├── .gitignore ├── .gitmodules ├── COPYING.LIB ├── COPYING.MIT ├── README-original ├── README.md ├── gst-app ├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── configure.ac ├── meson.build └── src │ ├── Makefile.am │ ├── gst-app.h │ ├── main.cpp │ ├── play.cpp │ └── play.h ├── gst-plugin ├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── configure.ac ├── meson.build ├── src │ ├── Makefile.am │ ├── gstaudiofilter.c │ ├── gstmyfilter.cpp │ ├── gstmyfilter.h │ ├── gstplugin.c │ ├── gstplugin.h │ ├── gsttransform.c │ └── gsttransform.h └── tools │ └── make_element └── meson.build /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.bak 3 | *.orig 4 | *.diff 5 | *.patch 6 | *.so 7 | *.a 8 | *.la 9 | *.lo 10 | *.pyc 11 | *.page 12 | *.swp 13 | build* 14 | compile 15 | *~ 16 | core.* 17 | 18 | Makefile 19 | Makefile.in 20 | core 21 | log 22 | .deps 23 | .libs 24 | .dirstamp 25 | 26 | /INSTALL 27 | 28 | /aclocal.m4 29 | /autom4te.cache 30 | /autoregen.sh 31 | /compile 32 | /config.guess 33 | /config.h 34 | /config.h.in 35 | /config.log 36 | /config.status 37 | /config.sub 38 | /configure 39 | /depcomp 40 | /install-sh 41 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "common"] 2 | path = common 3 | url = https://gitlab.freedesktop.org/gstreamer/common 4 | -------------------------------------------------------------------------------- /COPYING.LIB: -------------------------------------------------------------------------------- 1 | GNU LIBRARY GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1991 Free Software Foundation, Inc. 5 | 675 Mass Ave, Cambridge, MA 02139, USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the library GPL. It is 10 | numbered 2 because it goes with version 2 of the ordinary GPL.] 11 | 12 | Preamble 13 | 14 | The licenses for most software are designed to take away your 15 | freedom to share and change it. By contrast, the GNU General Public 16 | Licenses are intended to guarantee your freedom to share and change 17 | free software--to make sure the software is free for all its users. 18 | 19 | This license, the Library General Public License, applies to some 20 | specially designated Free Software Foundation software, and to any 21 | other libraries whose authors decide to use it. You can use it for 22 | your libraries, too. 23 | 24 | When we speak of free software, we are referring to freedom, not 25 | price. Our General Public Licenses are designed to make sure that you 26 | have the freedom to distribute copies of free software (and charge for 27 | this service if you wish), that you receive source code or can get it 28 | if you want it, that you can change the software or use pieces of it 29 | in new free programs; and that you know you can do these things. 30 | 31 | To protect your rights, we need to make restrictions that forbid 32 | anyone to deny you these rights or to ask you to surrender the rights. 33 | These restrictions translate to certain responsibilities for you if 34 | you distribute copies of the library, or if you modify it. 35 | 36 | For example, if you distribute copies of the library, whether gratis 37 | or for a fee, you must give the recipients all the rights that we gave 38 | you. You must make sure that they, too, receive or can get the source 39 | code. If you link a program with the library, you must provide 40 | complete object files to the recipients so that they can relink them 41 | with the library, after making changes to the library and recompiling 42 | it. And you must show them these terms so they know their rights. 43 | 44 | Our method of protecting your rights has two steps: (1) copyright 45 | the library, and (2) offer you this license which gives you legal 46 | permission to copy, distribute and/or modify the library. 47 | 48 | Also, for each distributor's protection, we want to make certain 49 | that everyone understands that there is no warranty for this free 50 | library. If the library is modified by someone else and passed on, we 51 | want its recipients to know that what they have is not the original 52 | version, so that any problems introduced by others will not reflect on 53 | the original authors' reputations. 54 | 55 | Finally, any free program is threatened constantly by software 56 | patents. We wish to avoid the danger that companies distributing free 57 | software will individually obtain patent licenses, thus in effect 58 | transforming the program into proprietary software. To prevent this, 59 | we have made it clear that any patent must be licensed for everyone's 60 | free use or not licensed at all. 61 | 62 | Most GNU software, including some libraries, is covered by the ordinary 63 | GNU General Public License, which was designed for utility programs. This 64 | license, the GNU Library General Public License, applies to certain 65 | designated libraries. This license is quite different from the ordinary 66 | one; be sure to read it in full, and don't assume that anything in it is 67 | the same as in the ordinary license. 68 | 69 | The reason we have a separate public license for some libraries is that 70 | they blur the distinction we usually make between modifying or adding to a 71 | program and simply using it. Linking a program with a library, without 72 | changing the library, is in some sense simply using the library, and is 73 | analogous to running a utility program or application program. However, in 74 | a textual and legal sense, the linked executable is a combined work, a 75 | derivative of the original library, and the ordinary General Public License 76 | treats it as such. 77 | 78 | Because of this blurred distinction, using the ordinary General 79 | Public License for libraries did not effectively promote software 80 | sharing, because most developers did not use the libraries. We 81 | concluded that weaker conditions might promote sharing better. 82 | 83 | However, unrestricted linking of non-free programs would deprive the 84 | users of those programs of all benefit from the free status of the 85 | libraries themselves. This Library General Public License is intended to 86 | permit developers of non-free programs to use free libraries, while 87 | preserving your freedom as a user of such programs to change the free 88 | libraries that are incorporated in them. (We have not seen how to achieve 89 | this as regards changes in header files, but we have achieved it as regards 90 | changes in the actual functions of the Library.) The hope is that this 91 | will lead to faster development of free libraries. 92 | 93 | The precise terms and conditions for copying, distribution and 94 | modification follow. Pay close attention to the difference between a 95 | "work based on the library" and a "work that uses the library". The 96 | former contains code derived from the library, while the latter only 97 | works together with the library. 98 | 99 | Note that it is possible for a library to be covered by the ordinary 100 | General Public License rather than by this special one. 101 | 102 | GNU LIBRARY GENERAL PUBLIC LICENSE 103 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 104 | 105 | 0. This License Agreement applies to any software library which 106 | contains a notice placed by the copyright holder or other authorized 107 | party saying it may be distributed under the terms of this Library 108 | General Public License (also called "this License"). Each licensee is 109 | addressed as "you". 110 | 111 | A "library" means a collection of software functions and/or data 112 | prepared so as to be conveniently linked with application programs 113 | (which use some of those functions and data) to form executables. 114 | 115 | The "Library", below, refers to any such software library or work 116 | which has been distributed under these terms. A "work based on the 117 | Library" means either the Library or any derivative work under 118 | copyright law: that is to say, a work containing the Library or a 119 | portion of it, either verbatim or with modifications and/or translated 120 | straightforwardly into another language. (Hereinafter, translation is 121 | included without limitation in the term "modification".) 122 | 123 | "Source code" for a work means the preferred form of the work for 124 | making modifications to it. For a library, complete source code means 125 | all the source code for all modules it contains, plus any associated 126 | interface definition files, plus the scripts used to control compilation 127 | and installation of the library. 128 | 129 | Activities other than copying, distribution and modification are not 130 | covered by this License; they are outside its scope. The act of 131 | running a program using the Library is not restricted, and output from 132 | such a program is covered only if its contents constitute a work based 133 | on the Library (independent of the use of the Library in a tool for 134 | writing it). Whether that is true depends on what the Library does 135 | and what the program that uses the Library does. 136 | 137 | 1. You may copy and distribute verbatim copies of the Library's 138 | complete source code as you receive it, in any medium, provided that 139 | you conspicuously and appropriately publish on each copy an 140 | appropriate copyright notice and disclaimer of warranty; keep intact 141 | all the notices that refer to this License and to the absence of any 142 | warranty; and distribute a copy of this License along with the 143 | Library. 144 | 145 | You may charge a fee for the physical act of transferring a copy, 146 | and you may at your option offer warranty protection in exchange for a 147 | fee. 148 | 149 | 2. You may modify your copy or copies of the Library or any portion 150 | of it, thus forming a work based on the Library, and copy and 151 | distribute such modifications or work under the terms of Section 1 152 | above, provided that you also meet all of these conditions: 153 | 154 | a) The modified work must itself be a software library. 155 | 156 | b) You must cause the files modified to carry prominent notices 157 | stating that you changed the files and the date of any change. 158 | 159 | c) You must cause the whole of the work to be licensed at no 160 | charge to all third parties under the terms of this License. 161 | 162 | d) If a facility in the modified Library refers to a function or a 163 | table of data to be supplied by an application program that uses 164 | the facility, other than as an argument passed when the facility 165 | is invoked, then you must make a good faith effort to ensure that, 166 | in the event an application does not supply such function or 167 | table, the facility still operates, and performs whatever part of 168 | its purpose remains meaningful. 169 | 170 | (For example, a function in a library to compute square roots has 171 | a purpose that is entirely well-defined independent of the 172 | application. Therefore, Subsection 2d requires that any 173 | application-supplied function or table used by this function must 174 | be optional: if the application does not supply it, the square 175 | root function must still compute square roots.) 176 | 177 | These requirements apply to the modified work as a whole. If 178 | identifiable sections of that work are not derived from the Library, 179 | and can be reasonably considered independent and separate works in 180 | themselves, then this License, and its terms, do not apply to those 181 | sections when you distribute them as separate works. But when you 182 | distribute the same sections as part of a whole which is a work based 183 | on the Library, the distribution of the whole must be on the terms of 184 | this License, whose permissions for other licensees extend to the 185 | entire whole, and thus to each and every part regardless of who wrote 186 | it. 187 | 188 | Thus, it is not the intent of this section to claim rights or contest 189 | your rights to work written entirely by you; rather, the intent is to 190 | exercise the right to control the distribution of derivative or 191 | collective works based on the Library. 192 | 193 | In addition, mere aggregation of another work not based on the Library 194 | with the Library (or with a work based on the Library) on a volume of 195 | a storage or distribution medium does not bring the other work under 196 | the scope of this License. 197 | 198 | 3. You may opt to apply the terms of the ordinary GNU General Public 199 | License instead of this License to a given copy of the Library. To do 200 | this, you must alter all the notices that refer to this License, so 201 | that they refer to the ordinary GNU General Public License, version 2, 202 | instead of to this License. (If a newer version than version 2 of the 203 | ordinary GNU General Public License has appeared, then you can specify 204 | that version instead if you wish.) Do not make any other change in 205 | these notices. 206 | 207 | Once this change is made in a given copy, it is irreversible for 208 | that copy, so the ordinary GNU General Public License applies to all 209 | subsequent copies and derivative works made from that copy. 210 | 211 | This option is useful when you wish to copy part of the code of 212 | the Library into a program that is not a library. 213 | 214 | 4. You may copy and distribute the Library (or a portion or 215 | derivative of it, under Section 2) in object code or executable form 216 | under the terms of Sections 1 and 2 above provided that you accompany 217 | it with the complete corresponding machine-readable source code, which 218 | must be distributed under the terms of Sections 1 and 2 above on a 219 | medium customarily used for software interchange. 220 | 221 | If distribution of object code is made by offering access to copy 222 | from a designated place, then offering equivalent access to copy the 223 | source code from the same place satisfies the requirement to 224 | distribute the source code, even though third parties are not 225 | compelled to copy the source along with the object code. 226 | 227 | 5. A program that contains no derivative of any portion of the 228 | Library, but is designed to work with the Library by being compiled or 229 | linked with it, is called a "work that uses the Library". Such a 230 | work, in isolation, is not a derivative work of the Library, and 231 | therefore falls outside the scope of this License. 232 | 233 | However, linking a "work that uses the Library" with the Library 234 | creates an executable that is a derivative of the Library (because it 235 | contains portions of the Library), rather than a "work that uses the 236 | library". The executable is therefore covered by this License. 237 | Section 6 states terms for distribution of such executables. 238 | 239 | When a "work that uses the Library" uses material from a header file 240 | that is part of the Library, the object code for the work may be a 241 | derivative work of the Library even though the source code is not. 242 | Whether this is true is especially significant if the work can be 243 | linked without the Library, or if the work is itself a library. The 244 | threshold for this to be true is not precisely defined by law. 245 | 246 | If such an object file uses only numerical parameters, data 247 | structure layouts and accessors, and small macros and small inline 248 | functions (ten lines or less in length), then the use of the object 249 | file is unrestricted, regardless of whether it is legally a derivative 250 | work. (Executables containing this object code plus portions of the 251 | Library will still fall under Section 6.) 252 | 253 | Otherwise, if the work is a derivative of the Library, you may 254 | distribute the object code for the work under the terms of Section 6. 255 | Any executables containing that work also fall under Section 6, 256 | whether or not they are linked directly with the Library itself. 257 | 258 | 6. As an exception to the Sections above, you may also compile or 259 | link a "work that uses the Library" with the Library to produce a 260 | work containing portions of the Library, and distribute that work 261 | under terms of your choice, provided that the terms permit 262 | modification of the work for the customer's own use and reverse 263 | engineering for debugging such modifications. 264 | 265 | You must give prominent notice with each copy of the work that the 266 | Library is used in it and that the Library and its use are covered by 267 | this License. You must supply a copy of this License. If the work 268 | during execution displays copyright notices, you must include the 269 | copyright notice for the Library among them, as well as a reference 270 | directing the user to the copy of this License. Also, you must do one 271 | of these things: 272 | 273 | a) Accompany the work with the complete corresponding 274 | machine-readable source code for the Library including whatever 275 | changes were used in the work (which must be distributed under 276 | Sections 1 and 2 above); and, if the work is an executable linked 277 | with the Library, with the complete machine-readable "work that 278 | uses the Library", as object code and/or source code, so that the 279 | user can modify the Library and then relink to produce a modified 280 | executable containing the modified Library. (It is understood 281 | that the user who changes the contents of definitions files in the 282 | Library will not necessarily be able to recompile the application 283 | to use the modified definitions.) 284 | 285 | b) Accompany the work with a written offer, valid for at 286 | least three years, to give the same user the materials 287 | specified in Subsection 6a, above, for a charge no more 288 | than the cost of performing this distribution. 289 | 290 | c) If distribution of the work is made by offering access to copy 291 | from a designated place, offer equivalent access to copy the above 292 | specified materials from the same place. 293 | 294 | d) Verify that the user has already received a copy of these 295 | materials or that you have already sent this user a copy. 296 | 297 | For an executable, the required form of the "work that uses the 298 | Library" must include any data and utility programs needed for 299 | reproducing the executable from it. However, as a special exception, 300 | the source code distributed need not include anything that is normally 301 | distributed (in either source or binary form) with the major 302 | components (compiler, kernel, and so on) of the operating system on 303 | which the executable runs, unless that component itself accompanies 304 | the executable. 305 | 306 | It may happen that this requirement contradicts the license 307 | restrictions of other proprietary libraries that do not normally 308 | accompany the operating system. Such a contradiction means you cannot 309 | use both them and the Library together in an executable that you 310 | distribute. 311 | 312 | 7. You may place library facilities that are a work based on the 313 | Library side-by-side in a single library together with other library 314 | facilities not covered by this License, and distribute such a combined 315 | library, provided that the separate distribution of the work based on 316 | the Library and of the other library facilities is otherwise 317 | permitted, and provided that you do these two things: 318 | 319 | a) Accompany the combined library with a copy of the same work 320 | based on the Library, uncombined with any other library 321 | facilities. This must be distributed under the terms of the 322 | Sections above. 323 | 324 | b) Give prominent notice with the combined library of the fact 325 | that part of it is a work based on the Library, and explaining 326 | where to find the accompanying uncombined form of the same work. 327 | 328 | 8. You may not copy, modify, sublicense, link with, or distribute 329 | the Library except as expressly provided under this License. Any 330 | attempt otherwise to copy, modify, sublicense, link with, or 331 | distribute the Library is void, and will automatically terminate your 332 | rights under this License. However, parties who have received copies, 333 | or rights, from you under this License will not have their licenses 334 | terminated so long as such parties remain in full compliance. 335 | 336 | 9. You are not required to accept this License, since you have not 337 | signed it. However, nothing else grants you permission to modify or 338 | distribute the Library or its derivative works. These actions are 339 | prohibited by law if you do not accept this License. Therefore, by 340 | modifying or distributing the Library (or any work based on the 341 | Library), you indicate your acceptance of this License to do so, and 342 | all its terms and conditions for copying, distributing or modifying 343 | the Library or works based on it. 344 | 345 | 10. Each time you redistribute the Library (or any work based on the 346 | Library), the recipient automatically receives a license from the 347 | original licensor to copy, distribute, link with or modify the Library 348 | subject to these terms and conditions. You may not impose any further 349 | restrictions on the recipients' exercise of the rights granted herein. 350 | You are not responsible for enforcing compliance by third parties to 351 | this License. 352 | 353 | 11. If, as a consequence of a court judgment or allegation of patent 354 | infringement or for any other reason (not limited to patent issues), 355 | conditions are imposed on you (whether by court order, agreement or 356 | otherwise) that contradict the conditions of this License, they do not 357 | excuse you from the conditions of this License. If you cannot 358 | distribute so as to satisfy simultaneously your obligations under this 359 | License and any other pertinent obligations, then as a consequence you 360 | may not distribute the Library at all. For example, if a patent 361 | license would not permit royalty-free redistribution of the Library by 362 | all those who receive copies directly or indirectly through you, then 363 | the only way you could satisfy both it and this License would be to 364 | refrain entirely from distribution of the Library. 365 | 366 | If any portion of this section is held invalid or unenforceable under any 367 | particular circumstance, the balance of the section is intended to apply, 368 | and the section as a whole is intended to apply in other circumstances. 369 | 370 | It is not the purpose of this section to induce you to infringe any 371 | patents or other property right claims or to contest validity of any 372 | such claims; this section has the sole purpose of protecting the 373 | integrity of the free software distribution system which is 374 | implemented by public license practices. Many people have made 375 | generous contributions to the wide range of software distributed 376 | through that system in reliance on consistent application of that 377 | system; it is up to the author/donor to decide if he or she is willing 378 | to distribute software through any other system and a licensee cannot 379 | impose that choice. 380 | 381 | This section is intended to make thoroughly clear what is believed to 382 | be a consequence of the rest of this License. 383 | 384 | 12. If the distribution and/or use of the Library is restricted in 385 | certain countries either by patents or by copyrighted interfaces, the 386 | original copyright holder who places the Library under this License may add 387 | an explicit geographical distribution limitation excluding those countries, 388 | so that distribution is permitted only in or among countries not thus 389 | excluded. In such case, this License incorporates the limitation as if 390 | written in the body of this License. 391 | 392 | 13. The Free Software Foundation may publish revised and/or new 393 | versions of the Library General Public License from time to time. 394 | Such new versions will be similar in spirit to the present version, 395 | but may differ in detail to address new problems or concerns. 396 | 397 | Each version is given a distinguishing version number. If the Library 398 | specifies a version number of this License which applies to it and 399 | "any later version", you have the option of following the terms and 400 | conditions either of that version or of any later version published by 401 | the Free Software Foundation. If the Library does not specify a 402 | license version number, you may choose any version ever published by 403 | the Free Software Foundation. 404 | 405 | 14. If you wish to incorporate parts of the Library into other free 406 | programs whose distribution conditions are incompatible with these, 407 | write to the author to ask for permission. For software which is 408 | copyrighted by the Free Software Foundation, write to the Free 409 | Software Foundation; we sometimes make exceptions for this. Our 410 | decision will be guided by the two goals of preserving the free status 411 | of all derivatives of our free software and of promoting the sharing 412 | and reuse of software generally. 413 | 414 | NO WARRANTY 415 | 416 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 417 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 418 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 419 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 420 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 421 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 422 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 423 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 424 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 425 | 426 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 427 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 428 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 429 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 430 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 431 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 432 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 433 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 434 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 435 | DAMAGES. 436 | 437 | END OF TERMS AND CONDITIONS 438 | 439 | Appendix: How to Apply These Terms to Your New Libraries 440 | 441 | If you develop a new library, and you want it to be of the greatest 442 | possible use to the public, we recommend making it free software that 443 | everyone can redistribute and change. You can do so by permitting 444 | redistribution under these terms (or, alternatively, under the terms of the 445 | ordinary General Public License). 446 | 447 | To apply these terms, attach the following notices to the library. It is 448 | safest to attach them to the start of each source file to most effectively 449 | convey the exclusion of warranty; and each file should have at least the 450 | "copyright" line and a pointer to where the full notice is found. 451 | 452 | 453 | Copyright (C) 454 | 455 | This library is free software; you can redistribute it and/or 456 | modify it under the terms of the GNU Library General Public 457 | License as published by the Free Software Foundation; either 458 | version 2 of the License, or (at your option) any later version. 459 | 460 | This library is distributed in the hope that it will be useful, 461 | but WITHOUT ANY WARRANTY; without even the implied warranty of 462 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 463 | Library General Public License for more details. 464 | 465 | You should have received a copy of the GNU Library General Public 466 | License along with this library; if not, write to the Free 467 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 468 | 469 | Also add information on how to contact you by electronic and paper mail. 470 | 471 | You should also get your employer (if you work as a programmer) or your 472 | school, if any, to sign a "copyright disclaimer" for the library, if 473 | necessary. Here is a sample; alter the names: 474 | 475 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 476 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 477 | 478 | , 1 April 1990 479 | Ty Coon, President of Vice 480 | 481 | That's all there is to it! 482 | -------------------------------------------------------------------------------- /COPYING.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a 2 | copy of this software and associated documentation files (the "Software"), 3 | to deal in the Software without restriction, including without limitation 4 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | and/or sell copies of the Software, and to permit persons to whom the 6 | Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 16 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | DEALINGS IN THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /README-original: -------------------------------------------------------------------------------- 1 | This git module contains template code for possible GStreamer projects. 2 | 3 | gst-app 4 | basic autotools layout for writing a GStreamer-based application. 5 | 6 | gst-plugin 7 | basic autotools layout and basic filter code for writing a 8 | GStreamer plug-in. 9 | 10 | This code is provided under a MIT license [1], which basically means "do 11 | with it as you wish, but don't blame us if it doesn't work". You can use 12 | this code for any project as you wish, under any license as you wish. We 13 | recommend the use of the LGPL [2] license for applications and plugins, 14 | given the minefield of patents the multimedia is nowadays. See our website 15 | for details [3]. 16 | 17 | Build each module like this: 18 | 19 | cd gst-plugin 20 | ./autogen.sh 21 | make 22 | 23 | Modify gst-plugin/src/Makefile.am to add or remove source files to build or 24 | add additional dependencies or compiler flags or change the name of the 25 | plugin file to be installed. Run ./autoregen.sh if changes don't take effect 26 | automatically on 'make'. 27 | 28 | Modify gst-plugin/configure.ac to check for additional library dependencies 29 | or other features needed by your plugin. Run ./autoregen.sh if changes don't 30 | take effect automatically on 'make'. 31 | 32 | Once the plugin is built you can either install it with 'sudo make install' 33 | (however, this will by default go into the /usr/local prefix where it won't 34 | be picked up by a GStreamer installed from packages, so you would need to 35 | set the GST_PLUGIN_PATH environment variable to include or point to 36 | /usr/local/lib/gstreamer-1.0/ for your plugin to be found by a from-package 37 | GStreamer). Alternatively, you will find your plugin binary in 38 | gst-plugins/src/.libs/ as libgstplugin.so or similar (the extension may vary), 39 | so you can also set the GST_PLUGIN_PATH environmen variable to the 40 | gst-plugins/src/.libs/ directory (best to specify an absolute path though). 41 | 42 | You can also check if it has been built correctly with: 43 | 44 | gst-inspect-1.0 gst-plugins/src/.libs/libgstplugin.so 45 | 46 | 47 | [1] http://www.opensource.org/licenses/mit-license.php or COPYING.MIT 48 | [2] http://www.opensource.org/licenses/lgpl-license.php or COPYING.LIB 49 | [3] http://gstreamer.freedesktop.org/documentation/licensing.html 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GStreamer C++ Plugin Boilerplate 2 | 3 | This git module contains template code for possible GStreamer plugin projects 4 | with C++. 5 | 6 | gst-plugin 7 | basic autotools layout and basic filter code for writing a 8 | GStreamer plug-in. 9 | 10 | This code is provided under a MIT license [1], which basically means "do 11 | with it as you wish, but don't blame us if it doesn't work". You can use 12 | this code for any project as you wish, under any license as you wish. We 13 | recommend the use of the LGPL [2] license for applications and plugins, 14 | given the minefield of patents the multimedia is nowadays. See our website 15 | for details [3]. 16 | 17 | Build "myfilter" like this: 18 | 19 | cd gst-plugin 20 | ./autogen.sh 21 | 22 | Modify gst-plugin/src/Makefile.am to add or remove source files to build or 23 | add additional dependencies or compiler flags or change the name of the 24 | plugin file to be installed. Run ./autoregen.sh if changes don't take effect 25 | automatically on 'make'. 26 | 27 | Modify gst-plugin/configure.ac to check for additional library dependencies 28 | or other features needed by your plugin. Run ./autoregen.sh if changes don't 29 | take effect automatically on 'make'. 30 | 31 | Once the plugin is built you can either install it with 'sudo make install' 32 | (however, this will by default go into the /usr/local prefix where it won't 33 | be picked up by a GStreamer installed from packages, so you would need to 34 | set the GST_PLUGIN_PATH environment variable to include or point to 35 | /usr/local/lib/gstreamer-1.0/ for your plugin to be found by a from-package 36 | GStreamer). Alternatively, you will find your plugin binary in 37 | gst-plugins/src/.libs/ as libgstplugin.so or similar (the extension may vary), 38 | so you can also set the GST_PLUGIN_PATH environmen variable to the 39 | gst-plugins/src/.libs/ directory (best to specify an absolute path though). 40 | To enable plugins, add it to your bashrc or run the line below in your 41 | terminal: 42 | 43 | export GST_PLUGIN_PATH='/usr/local/lib/gstreamer-1.0' 44 | 45 | You can also check if it has been built correctly with: 46 | 47 | gst-inspect-1.0 /usr/local/lib/gstreamer-1.0/libgstmyfilter.so 48 | 49 | 50 | [1] http://www.opensource.org/licenses/mit-license.php or COPYING.MIT 51 | 52 | [2] http://www.opensource.org/licenses/lgpl-license.php or COPYING.LIB 53 | 54 | [3] http://gstreamer.freedesktop.org/documentation/licensing.html 55 | -------------------------------------------------------------------------------- /gst-app/.gitignore: -------------------------------------------------------------------------------- 1 | aclocal.m4 2 | autom4te.cache 3 | autoregen.sh 4 | config.* 5 | configure 6 | libtool 7 | INSTALL 8 | Makefile.in 9 | depcomp 10 | install-sh 11 | ltmain.sh 12 | missing 13 | stamp-* 14 | compile 15 | my-app-*.tar.* 16 | *~ 17 | 18 | src/gst-app 19 | 20 | -------------------------------------------------------------------------------- /gst-app/AUTHORS: -------------------------------------------------------------------------------- 1 | Thomas Vander Stichele 2 | -------------------------------------------------------------------------------- /gst-app/COPYING: -------------------------------------------------------------------------------- 1 | Put your license in here! 2 | 3 | -------------------------------------------------------------------------------- /gst-app/ChangeLog: -------------------------------------------------------------------------------- 1 | 2008-03-28 Tim-Philipp Müller 2 | 3 | * src/main.c: (main): 4 | Call g_thread_init() before calling any other GLib function, 5 | such as g_option_context_new(). 6 | 7 | 2006-07-04 Tim-Philipp Müller 8 | 9 | * autogen.sh: 10 | * configure.ac: 11 | Run autoheader to create config.h.in; add 12 | AM_CONFIG_HEADER to configure.ac. 13 | 14 | 2006-07-03 Tim-Philipp Müller 15 | 16 | * Makefile.am: 17 | * autogen.sh: 18 | * gst-autogen.sh: 19 | Throw an error if autotools versions are too old. We require 20 | automake 1.7 or newer (#346054). Add gst-autogen.sh to check 21 | for this. 22 | 23 | * COPYING: 24 | Add placeholder COPYING file so it doesn't get overwritten 25 | by a GPL one by automake. 26 | 27 | 2006-05-15 Tim-Philipp Müller 28 | 29 | * configure.ac: 30 | * src/Makefile.am: 31 | * src/gst-app.h: 32 | * src/load.c: 33 | * src/load.h: 34 | * src/main.c: (handle_file_or_directory), (main): 35 | * src/play.c: (play_uri): 36 | * src/play.h: 37 | Update for 0.10. Turn into a super-simple command line player. 38 | 39 | 2004-04-03 Benjamin Otte 40 | 41 | * configure.ac: 42 | updated for 0.8 43 | 44 | 2003-02-06 Thomas Vander Stichele 45 | 46 | * updated for GStreamer 0.6.0 47 | 48 | 2002-07-17 Thomas Vander Stichele 49 | 50 | * initial creation on a flight to New York 51 | -------------------------------------------------------------------------------- /gst-app/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS=src 2 | 3 | EXTRA_DIST=autogen.sh 4 | -------------------------------------------------------------------------------- /gst-app/NEWS: -------------------------------------------------------------------------------- 1 | Nothing much yet. 2 | -------------------------------------------------------------------------------- /gst-app/README: -------------------------------------------------------------------------------- 1 | gst-app is a template for writing your own GStreamer-based app. 2 | 3 | The code is deliberately kept simple so that you quickly understand the basics 4 | of how to set up autotools and your source tree. 5 | 6 | This template demonstrates : 7 | - what to do in autogen.sh 8 | - how to setup configure.ac (your package name and version, GStreamer flags) 9 | - how to setup your source dir 10 | - main () and main header 11 | - supporting source code 12 | - Makefile.am 13 | 14 | The template performs one simple function : loading a pipeline from xml and 15 | start to iterate it. Try saving a pipeline from gst-editor, it will play 16 | with this sample program. 17 | 18 | More features might get added to this template later on. 19 | -------------------------------------------------------------------------------- /gst-app/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # you can either set the environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, 3 | # ACLOCAL, AUTOPOINT and/or LIBTOOLIZE to the right versions, or leave them 4 | # unset and get the defaults 5 | 6 | autoreconf --verbose --force --install --make || { 7 | echo 'autogen.sh failed'; 8 | exit 1; 9 | } 10 | 11 | ./configure || { 12 | echo 'configure failed'; 13 | exit 1; 14 | } 15 | 16 | echo 17 | echo "Now type 'make' to compile this module." 18 | echo 19 | -------------------------------------------------------------------------------- /gst-app/configure.ac: -------------------------------------------------------------------------------- 1 | dnl required version of autoconf 2 | AC_PREREQ([2.53]) 3 | 4 | dnl TODO: fill in your package name and package version here 5 | AC_INIT([my-app],[1.0.0]) 6 | 7 | dnl required version of gstreamer and gst-plugins-base 8 | GST_REQUIRED=1.0.0 9 | 10 | AC_CONFIG_SRCDIR([src/main.cpp]) 11 | AC_CONFIG_HEADERS([config.h]) 12 | 13 | dnl required version of automake 14 | AM_INIT_AUTOMAKE([1.10]) 15 | 16 | dnl enable mainainer mode by default 17 | AM_MAINTAINER_MODE([enable]) 18 | 19 | dnl check for tools (compiler etc.) 20 | AC_PROG_CXX 21 | AC_LANG([C++]) 22 | 23 | dnl required version of libtool 24 | LT_PREREQ([2.2.6]) 25 | LT_INIT 26 | 27 | dnl error out if we can't find pkg-config 28 | AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, [ ], [ 29 | AC_MSG_ERROR([You need to have pkg-config installed or set the PATH.]) 30 | ]) 31 | 32 | dnl ======================================================================= 33 | dnl Check for the required version of GStreamer core (and gst-plugins-base) 34 | dnl 35 | dnl This will export GST_CXXFLAGS and GST_LIBS variables for use in Makefile.am 36 | dnl 37 | dnl If you need libraries from gst-plugins-base here, also add: 38 | dnl for libgstaudio-1.0: gstreamer-audio-1.0 >= $GST_REQUIRED 39 | dnl for libgstvideo-1.0: gstreamer-video-1.0 >= $GST_REQUIRED 40 | dnl for libgsttag-1.0: gstreamer-tag-1.0 >= $GST_REQUIRED 41 | dnl for libgstpbutils-1.0: gstreamer-pbutils-1.0 >= $GST_REQUIRED 42 | dnl for libgstfft-1.0: gstreamer-fft-1.0 >= $GST_REQUIRED 43 | dnl for libgstinterfaces-1.0: gstreamer-interfaces-1.0 >= $GST_REQUIRED 44 | dnl for libgstrtp-1.0: gstreamer-rtp-1.0 >= $GST_REQUIRED 45 | dnl for libgstrtsp-1.0: gstreamer-rtsp-1.0 >= $GST_REQUIRED 46 | dnl etc. 47 | dnl ======================================================================= 48 | 49 | PKG_CHECK_MODULES(GST, [ 50 | gstreamer-1.0 >= $GST_REQUIRED 51 | gstreamer-base-1.0 >= $GST_REQUIRED 52 | gstreamer-controller-1.0 >= $GST_REQUIRED 53 | ], [ 54 | AC_SUBST(GST_CXXFLAGS) 55 | AC_SUBST(GST_LIBS) 56 | ], [ 57 | AC_MSG_ERROR([ 58 | Can't find the following GStreamer development packages: 59 | 60 | gstreamer-1.0 >= $GST_REQUIRED 61 | gstreamer-base-1.0 >= $GST_REQUIRED 62 | gstreamer-controller-1.0 >= $GST_REQUIRED 63 | 64 | Please make sure you have the necessary GStreamer-1.0 65 | development headers installed. 66 | 67 | On debian/Ubuntu systems you will probably need to install the 68 | 'libgstreamer1.0-dev' and 'libgstreamer-plugins-base1.0-dev' packages. 69 | 70 | On RPM-based systems you will probably need to install the 71 | 'gstreamer-devel-1.0' package. 72 | ]) 73 | ]) 74 | 75 | dnl check if compiler understands -Wall (if yes, add -Wall to GST_CXXFLAGS) 76 | AC_MSG_CHECKING([to see if compiler understands -Wall]) 77 | save_CXXFLAGS="$CXXFLAGS" 78 | CXXFLAGS="$CXXFLAGS -Wall" 79 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ], [ ])], [ 80 | GST_CXXFLAGS="$GST_CXXFLAGS -Wall" 81 | AC_MSG_RESULT([yes]) 82 | ], [ 83 | AC_MSG_RESULT([no]) 84 | ]) 85 | 86 | dnl ======================================================================= 87 | dnl Finally, create Makefiles in all directories 88 | dnl ======================================================================= 89 | 90 | AC_CONFIG_FILES([ 91 | Makefile 92 | src/Makefile 93 | ]) 94 | AC_OUTPUT 95 | 96 | -------------------------------------------------------------------------------- /gst-app/meson.build: -------------------------------------------------------------------------------- 1 | app_sources = [ 2 | 'src/main.cpp', 3 | 'src/play.cpp' 4 | ] 5 | 6 | executable('gst-app', app_sources, dependencies : [gst_dep]) 7 | -------------------------------------------------------------------------------- /gst-app/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # name of your binary 2 | bin_PROGRAMS = gst-app 3 | 4 | # list of source files 5 | # the prefix is the name of the binary 6 | gst_app_SOURCES = main.cpp play.cpp 7 | 8 | # list of headers we're not going to install 9 | noinst_HEADERS = gst-app.h play.h 10 | 11 | # our CXXFLAGS and LDFLAGS used for compiling and linking 12 | # make sure you prefix these with the name of your binary 13 | gst_app_CXXFLAGS = $(GST_CXXFLAGS) 14 | gst_app_LDFLAGS = $(GST_LIBS) 15 | -------------------------------------------------------------------------------- /gst-app/src/gst-app.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2005 Thomas Vander Stichele 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a 4 | * copy of this software and associated documentation files (the "Software"), 5 | * to deal in the Software without restriction, including without limitation 6 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the 8 | * Software is furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | * Alternatively, the contents of this file may be used under the 22 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 23 | * which case the following provisions apply instead of the ones 24 | * mentioned above: 25 | * 26 | * This library is free software; you can redistribute it and/or 27 | * modify it under the terms of the GNU Library General Public 28 | * License as published by the Free Software Foundation; either 29 | * version 2 of the License, or (at your option) any later version. 30 | * 31 | * This library is distributed in the hope that it will be useful, 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | * Library General Public License for more details. 35 | * 36 | * You should have received a copy of the GNU Library General Public 37 | * License along with this library; if not, write to the 38 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 39 | * Boston, MA 02111-1307, USA. 40 | */ 41 | 42 | #include "play.h" 43 | -------------------------------------------------------------------------------- /gst-app/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 Tim-Philipp Müller 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a 4 | * copy of this software and associated documentation files (the "Software"), 5 | * to deal in the Software without restriction, including without limitation 6 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the 8 | * Software is furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | * Alternatively, the contents of this file may be used under the 22 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 23 | * which case the following provisions apply instead of the ones 24 | * mentioned above: 25 | * 26 | * This library is free software; you can redistribute it and/or 27 | * modify it under the terms of the GNU Library General Public 28 | * License as published by the Free Software Foundation; either 29 | * version 2 of the License, or (at your option) any later version. 30 | * 31 | * This library is distributed in the hope that it will be useful, 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | * Library General Public License for more details. 35 | * 36 | * You should have received a copy of the GNU Library General Public 37 | * License along with this library; if not, write to the 38 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 39 | * Boston, MA 02111-1307, USA. 40 | */ 41 | 42 | #ifdef HAVE_CONFIG_H 43 | #include "config.h" 44 | #endif 45 | 46 | #include "gst-app.h" 47 | 48 | static void 49 | handle_file_or_directory (const gchar * filename) 50 | { 51 | GError *err = NULL; 52 | GDir *dir; 53 | gchar *uri; 54 | 55 | if ((dir = g_dir_open (filename, 0, NULL))) { 56 | const gchar *entry; 57 | 58 | while ((entry = g_dir_read_name (dir))) { 59 | gchar *path; 60 | 61 | path = g_strconcat (filename, G_DIR_SEPARATOR_S, entry, NULL); 62 | handle_file_or_directory (path); 63 | g_free (path); 64 | } 65 | 66 | g_dir_close (dir); 67 | return; 68 | } 69 | 70 | if (g_path_is_absolute (filename)) { 71 | uri = g_filename_to_uri (filename, NULL, &err); 72 | } else { 73 | gchar *curdir, *absolute_path; 74 | 75 | curdir = g_get_current_dir (); 76 | absolute_path = g_strconcat ( curdir, G_DIR_SEPARATOR_S, filename, NULL); 77 | uri = g_filename_to_uri (absolute_path, NULL, &err); 78 | g_free (absolute_path); 79 | g_free (curdir); 80 | } 81 | 82 | if (uri) { 83 | /* great, we have a proper file:// URI, let's play it! */ 84 | play_uri (uri); 85 | } else { 86 | g_warning ("Failed to convert filename '%s' to URI: %s", filename, 87 | err->message); 88 | g_error_free (err); 89 | } 90 | 91 | g_free (uri); 92 | } 93 | 94 | int 95 | main (int argc, char *argv[]) 96 | { 97 | gchar **filenames = NULL; 98 | const GOptionEntry entries[] = { 99 | /* you can add your won command line options here */ 100 | { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, 101 | "Special option that collects any remaining arguments for us" }, 102 | { NULL, } 103 | }; 104 | GOptionContext *ctx; 105 | GError *err = NULL; 106 | gint i, num; 107 | 108 | /* Before calling any GLib or GStreamer function, we must initialise 109 | * the GLib threading system */ 110 | if (!g_thread_supported()) 111 | g_thread_init (NULL); 112 | 113 | ctx = g_option_context_new ("[FILE1] [FILE2] ..."); 114 | g_option_context_add_group (ctx, gst_init_get_option_group ()); 115 | g_option_context_add_main_entries (ctx, entries, NULL); 116 | 117 | if (!g_option_context_parse (ctx, &argc, &argv, &err)) { 118 | g_print ("Error initializing: %s\n", GST_STR_NULL (err->message)); 119 | return -1; 120 | } 121 | g_option_context_free (ctx); 122 | 123 | if (filenames == NULL || *filenames == NULL) { 124 | g_print ("Please specify a file to play\n\n"); 125 | return -1; 126 | } 127 | 128 | 129 | 130 | num = g_strv_length (filenames); 131 | 132 | for (i = 0; i < num; ++i) { 133 | handle_file_or_directory (filenames[i]); 134 | } 135 | 136 | g_strfreev (filenames); 137 | 138 | return 0; 139 | } 140 | -------------------------------------------------------------------------------- /gst-app/src/play.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 Tim-Philipp Müller 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a 4 | * copy of this software and associated documentation files (the "Software"), 5 | * to deal in the Software without restriction, including without limitation 6 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the 8 | * Software is furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | * Alternatively, the contents of this file may be used under the 22 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 23 | * which case the following provisions apply instead of the ones 24 | * mentioned above: 25 | * 26 | * This library is free software; you can redistribute it and/or 27 | * modify it under the terms of the GNU Library General Public 28 | * License as published by the Free Software Foundation; either 29 | * version 2 of the License, or (at your option) any later version. 30 | * 31 | * This library is distributed in the hope that it will be useful, 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | * Library General Public License for more details. 35 | * 36 | * You should have received a copy of the GNU Library General Public 37 | * License along with this library; if not, write to the 38 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 39 | * Boston, MA 02111-1307, USA. 40 | */ 41 | 42 | #include "play.h" 43 | 44 | void 45 | play_uri (const gchar * uri) 46 | { 47 | GstStateChangeReturn sret; 48 | GstElement *playbin; 49 | GstElement *audiosink; 50 | GstElement *videosink; 51 | GstMessage *msg = NULL; 52 | GstBus *bus; 53 | 54 | g_print ("Trying to play %s ...\n", uri); 55 | 56 | playbin = gst_element_factory_make ("playbin", "playbin"); 57 | if (playbin == NULL) 58 | goto no_playbin; 59 | 60 | /* get playbin's bus - we'll watch it for messages */ 61 | bus = gst_pipeline_get_bus (GST_PIPELINE (playbin)); 62 | 63 | /* set audio sink */ 64 | audiosink = gst_element_factory_make ("autoaudiosink", "audiosink"); 65 | if (audiosink == NULL) 66 | goto no_autoaudiosink; 67 | g_object_set (playbin, "audio-sink", audiosink, NULL); 68 | 69 | /* set video sink */ 70 | videosink = gst_element_factory_make ("autovideosink", "videosink"); 71 | if (videosink == NULL) 72 | goto no_autovideosink; 73 | g_object_set (playbin, "video-sink", videosink, NULL); 74 | 75 | /* set URI to play back */ 76 | g_object_set (playbin, "uri", uri, NULL); 77 | 78 | /* and GO GO GO! */ 79 | gst_element_set_state (GST_ELEMENT (playbin), GST_STATE_PLAYING); 80 | 81 | /* wait (blocks!) until state change either completes or fails */ 82 | sret = gst_element_get_state (GST_ELEMENT (playbin), NULL, NULL, -1); 83 | 84 | switch (sret) { 85 | case GST_STATE_CHANGE_FAILURE:{ 86 | msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0); 87 | goto got_error_message; 88 | } 89 | case GST_STATE_CHANGE_SUCCESS:{ 90 | GstMessage *msg; 91 | 92 | g_print ("Playing ...\n"); 93 | 94 | while (1) { 95 | gint64 dur, pos; 96 | 97 | if (gst_element_query_duration (playbin, GST_FORMAT_TIME, &dur) && 98 | gst_element_query_position (playbin, GST_FORMAT_TIME, &pos)) { 99 | g_print (" %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\n", 100 | GST_TIME_ARGS (pos), GST_TIME_ARGS (dur)); 101 | } 102 | 103 | /* check if we finished or if there was an error, 104 | * but don't wait/block if neither is the case */ 105 | msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, 0); 106 | 107 | if (msg && GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) 108 | goto got_error_message; 109 | 110 | if (msg && GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS) { 111 | g_print ("Finished.\n"); 112 | break; 113 | } 114 | 115 | /* sleep for one second */ 116 | g_usleep (G_USEC_PER_SEC * 1); 117 | } 118 | break; 119 | } 120 | default: 121 | g_assert_not_reached (); 122 | } 123 | 124 | /* shut down and free everything */ 125 | gst_element_set_state (playbin, GST_STATE_NULL); 126 | gst_object_unref (playbin); 127 | gst_object_unref (bus); 128 | return; 129 | 130 | /* ERRORS */ 131 | got_error_message: 132 | { 133 | if (msg) { 134 | GError *err = NULL; 135 | gchar *dbg_str = NULL; 136 | 137 | gst_message_parse_error (msg, &err, &dbg_str); 138 | g_printerr ("FAILED to play %s: %s\n%s\n", uri, err->message, 139 | (dbg_str) ? dbg_str : "(no debugging information)"); 140 | g_error_free (err); 141 | g_free (dbg_str); 142 | gst_message_unref (msg); 143 | } else { 144 | g_printerr ("FAILED to play %s: unknown error\n", uri); 145 | } 146 | 147 | /* shut down and free everything */ 148 | gst_element_set_state (playbin, GST_STATE_NULL); 149 | gst_object_unref (playbin); 150 | gst_object_unref (bus); 151 | return; 152 | } 153 | 154 | no_playbin: 155 | { 156 | g_error ("Could not create GStreamer 'playbin' element. " 157 | "Please install it"); 158 | /* not reached, g_error aborts */ 159 | return; 160 | } 161 | 162 | no_autoaudiosink: 163 | { 164 | g_error ("Could not create GStreamer 'autoaudiosink' element. " 165 | "Please install it"); 166 | /* not reached, g_error aborts */ 167 | return; 168 | } 169 | 170 | no_autovideosink: 171 | { 172 | g_error ("Could not create GStreamer 'autovideosink' element. " 173 | "Please install it"); 174 | /* not reached, g_error aborts */ 175 | return; 176 | } 177 | } 178 | 179 | 180 | -------------------------------------------------------------------------------- /gst-app/src/play.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 Tim-Philipp Müller 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a 4 | * copy of this software and associated documentation files (the "Software"), 5 | * to deal in the Software without restriction, including without limitation 6 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the 8 | * Software is furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | * Alternatively, the contents of this file may be used under the 22 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 23 | * which case the following provisions apply instead of the ones 24 | * mentioned above: 25 | * 26 | * This library is free software; you can redistribute it and/or 27 | * modify it under the terms of the GNU Library General Public 28 | * License as published by the Free Software Foundation; either 29 | * version 2 of the License, or (at your option) any later version. 30 | * 31 | * This library is distributed in the hope that it will be useful, 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | * Library General Public License for more details. 35 | * 36 | * You should have received a copy of the GNU Library General Public 37 | * License along with this library; if not, write to the 38 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 39 | * Boston, MA 02111-1307, USA. 40 | */ 41 | 42 | #ifndef _MY_APP_PLAY_H_INCLUDED_ 43 | #define _MY_APP_PLAY_H_INCLUDED_ 44 | 45 | #include 46 | 47 | void play_uri (const gchar * uri); 48 | 49 | #endif /* _MY_APP_PLAY_H_INCLUDED_ */ 50 | 51 | -------------------------------------------------------------------------------- /gst-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | aclocal.m4 2 | autom4te.cache 3 | autoregen.sh 4 | config.* 5 | configure 6 | libtool 7 | INSTALL 8 | Makefile.in 9 | depcomp 10 | install-sh 11 | ltmain.sh 12 | missing 13 | stamp-* 14 | my-plugin-*.tar.* 15 | *~ 16 | 17 | -------------------------------------------------------------------------------- /gst-plugin/AUTHORS: -------------------------------------------------------------------------------- 1 | Thomas Vander Stichele 2 | -------------------------------------------------------------------------------- /gst-plugin/COPYING: -------------------------------------------------------------------------------- 1 | Put your license in here! 2 | 3 | -------------------------------------------------------------------------------- /gst-plugin/ChangeLog: -------------------------------------------------------------------------------- 1 | 2008-11-04 Stefan Kost 2 | 3 | * src/Makefile.am: 4 | Don't install static libs for plugins. Fixes #550851 for the template. 5 | 6 | 2008-10-30 Stefan Kost 7 | 8 | * tools/make_element: 9 | Don't replace GstPlugin. 10 | 11 | 2008-08-11 Stefan Kost 12 | 13 | * README: 14 | * src/gstaudiofilter.c: 15 | * src/gstplugin.c: 16 | * src/gsttransform.c: 17 | * tools/make_element: 18 | Integrate new template and improve search'n'replace ops. Update 19 | templates to use current API. 20 | 21 | 2008-07-26 Stefan Kost 22 | 23 | * tools/make_element: 24 | Fix username detection. tries getent first and falls back to grep 25 | passwd. Spotted by Karoly Segesdi. 26 | 27 | 2008-06-09 Jan Schmidt 28 | 29 | * src/gstplugin.c: 30 | Fix some memory leaks, and make the setcaps function actually 31 | sets the caps on the other pad. 32 | 33 | 2008-05-08 Stefan Kost 34 | 35 | * README: 36 | Add simple usage explanation and make it look like the other READMEs. 37 | 38 | * src/gstplugin.c: 39 | * src/gstplugin.h: 40 | * src/gsttransform.c: 41 | * src/gsttransform.h: 42 | * tools/make_element: 43 | Add year, username and email fields. Update the templates here and 44 | there a bit. Add more comments. 45 | 46 | 2007-08-01 Tim-Philipp Müller 47 | 48 | * src/gsttransform.c: 49 | Include right header to avoid structure size mismatches etc. 50 | 51 | 2007-07-25 Tim-Philipp Müller 52 | 53 | Patch by: Steve Fink 54 | 55 | * src/gstplugin.c: 56 | Use GST_DEBUG_FUNCPTR() macros where it makes sense. 57 | 58 | 2007-07-19 Stefan Kost 59 | 60 | * configure.ac: 61 | Fix CVS-build detection. 62 | 63 | 2007-01-23 Tim-Philipp Müller 64 | 65 | * src/Makefile.am: 66 | Make clearer which Makefile variables need renaming if the plugin 67 | name is changes (#399746) (pretty it is not, but it's the content 68 | that counts, right?) 69 | 70 | 2007-01-22 Tim-Philipp Müller 71 | 72 | Patch by: Philip Jägenstedt 73 | 74 | * tools/make_element: 75 | Translate FOO_IS_MY_PLUGIN macro as well according to the template 76 | (#399323). 77 | 78 | 2006-07-04 Tim-Philipp Müller 79 | 80 | * autogen.sh: 81 | Run autoheader to create config.h.in and fix the build.` 82 | 83 | 2006-07-03 Tim-Philipp Müller 84 | 85 | * Makefile.am: 86 | * autogen.sh: 87 | * gst-autogen.sh: 88 | Throw an error if autotools versions are too old. We require 89 | automake 1.7 or newer (#346054). Add gst-autogen.sh to check 90 | for this. 91 | 92 | * COPYING: 93 | Add placeholder COPYING file so it doesn't get overwritten 94 | by a GPL one by automake. 95 | 96 | 2006-06-22 Tim-Philipp Müller 97 | 98 | Patch by: Philip Jägenstedt 99 | 100 | * src/gstplugin.c: (gst_plugin_template_base_init), 101 | (gst_plugin_template_class_init), (gst_plugin_template_init), 102 | (plugin_init): 103 | Use GST_BOILERPLATE, add debug category (#345601). 104 | 105 | 2006-04-20 Stefan Kost 106 | 107 | Patch by: Johan Rydberg 108 | 109 | * src/gstplugin.c: (gst_plugin_template_get_type), 110 | (gst_plugin_template_base_init), (gst_plugin_template_class_init), 111 | (gst_plugin_template_set_property), 112 | (gst_plugin_template_get_property): 113 | * src/gstplugin.h: 114 | * src/gsttransform.c: (gst_plugin_template_base_init), 115 | (gst_plugin_template_set_property), 116 | (gst_plugin_template_get_property): 117 | * tools/make_element: 118 | remove double gst_get_, fix '_' in names 119 | 120 | 121 | 2006-02-26 Tim-Philipp Müller 122 | 123 | * src/gstplugin.c: (gst_plugin_template_init), 124 | (gst_plugin_template_chain): 125 | Fix function declaration of _init() function. 126 | Remove unnecessary assertion clutter in chain function 127 | (that also failed to return a flow value, causing 128 | compiler warnings). 129 | 130 | 2006-02-07 Stefan Kost 131 | 132 | * src/gstplugin.c: (gst_plugin_template_set_caps), 133 | (gst_plugin_template_chain): 134 | * src/gsttransform.c: (gst_plugin_template_transform_ip): 135 | more code cleanups, more comments 136 | 137 | 2006-02-07 Stefan Kost 138 | 139 | * configure.ac: 140 | allow installing to $HOME 141 | * src/gstplugin.c: (gst_plugin_template_base_init), 142 | (gst_plugin_template_init): 143 | * src/gstplugin.h: 144 | * src/gsttransform.c: (gst_plugin_template_base_init), 145 | (gst_plugin_template_class_init), (gst_plugin_template_init), 146 | (gst_plugin_template_transform_ip), 147 | (gst_plugin_template_set_property), 148 | (gst_plugin_template_get_property), (plugin_init): 149 | * src/gsttransform.h: 150 | add another template 151 | * tools/make_element: 152 | fix generator, when template (arg2) is given 153 | 154 | 2006-01-23 Tim-Philipp Müller 155 | 156 | * src/gstplugin.h: 157 | FOO_BAR_CLASS(klass) should cast to FooBarClass*, 158 | not FooBar*. 159 | 160 | 2006-01-13 Thomas Vander Stichele 161 | 162 | * autogen.sh: 163 | * configure.ac: 164 | * src/Makefile.am: 165 | * src/gstplugin.c: 166 | bring into the 0.10 world 167 | Fix #315582 168 | 169 | 2005-12-16 Jan Schmidt 170 | 171 | * src/gstplugin.c: (gst_plugin_template_class_init): 172 | Need to have the set_property and get_property methods 173 | before installing properties 174 | 175 | 2005-12-14 Tim-Philipp Müller 176 | 177 | * src/gstplugin.h: 178 | Fix GST_IS_FOO_BAR_CLASS macro. 179 | 180 | 2005-06-30 Ronald S. Bultje 181 | 182 | * configure.ac: 183 | * src/gstplugin.c: (gst_plugin_template_set_caps), 184 | (gst_plugin_template_init), (gst_plugin_template_chain): 185 | Fix for GStreamer 0.9. 186 | 187 | 2004-04-22 Thomas Vander Stichele 188 | 189 | * Makefile.am: 190 | * autogen.sh: 191 | * configure.ac: 192 | * src/Makefile.am: 193 | use proper LDFLAGS for plugins 194 | run in maintainer mode by default 195 | 196 | 2004-04-22 Thomas Vander Stichele 197 | 198 | * configure.ac: ... and fix comments too 199 | 200 | 2004-04-03 Benjamin Otte 201 | 202 | * configure.ac: 203 | update for GStreamer 0.8 204 | 205 | 2004-01-25 Ronald Bultje 206 | 207 | * src/gstplugin.c: (gst_plugin_template_link), 208 | (gst_plugin_template_base_init), (gst_plugin_template_init): 209 | Fix for GStreamer 0.7.x. 210 | 211 | 2003-02-06 Thomas Vander Stichele 212 | 213 | * updated for GStreamer 0.6.0 214 | 215 | 2002-07-17 Thomas Vander Stichele 216 | 217 | * initial creation on a flight to New York 218 | -------------------------------------------------------------------------------- /gst-plugin/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | 3 | EXTRA_DIST = autogen.sh 4 | -------------------------------------------------------------------------------- /gst-plugin/NEWS: -------------------------------------------------------------------------------- 1 | Nothing much yet. 2 | -------------------------------------------------------------------------------- /gst-plugin/README: -------------------------------------------------------------------------------- 1 | WHAT IT IS 2 | ---------- 3 | 4 | gst-plugin is a template for writing your own GStreamer plug-in. 5 | 6 | The code is deliberately kept simple so that you quickly understand the basics 7 | of how to set up autotools and your source tree. 8 | 9 | This template demonstrates : 10 | - what to do in autogen.sh 11 | - how to setup configure.ac (your package name and version, GStreamer flags) 12 | - how to setup your source dir 13 | - what to put in Makefile.am 14 | 15 | More features and templates might get added later on. 16 | 17 | HOW TO USE IT 18 | ------------- 19 | 20 | To use it, either make a copy for yourself and rename the parts or use the 21 | make_element script in tools. To create sources for "myfilter" based on the 22 | "gsttransform" template run: 23 | 24 | cd src; 25 | ../tools/make_element myfilter gsttransform 26 | 27 | This will create gstmyfilter.c and gstmyfilter.h. Open them in an editor and 28 | start editing. There are several occurances of the string "template", update 29 | those with real values. The plugin will be called 'myfilter' and it will have 30 | one element called 'myfilter' too. Also look for "FIXME:" markers that point you 31 | to places where you need to edit the code. 32 | 33 | You still need to adjust the Makefile.am. 34 | 35 | -------------------------------------------------------------------------------- /gst-plugin/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # you can either set the environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, 3 | # ACLOCAL, AUTOPOINT and/or LIBTOOLIZE to the right versions, or leave them 4 | # unset and get the defaults 5 | 6 | git clean -fx 7 | rm -rf ./src/.deps/ 8 | rm -rf ./src/.libs/ 9 | 10 | autoreconf --verbose --force --install --make || { 11 | echo 'autogen.sh failed'; 12 | exit 1; 13 | } 14 | 15 | ./configure || { 16 | echo 'configure failed'; 17 | exit 1; 18 | } 19 | 20 | echo 21 | echo "Now type 'make' to compile this module." 22 | echo 23 | 24 | make 25 | sudo make install 26 | -------------------------------------------------------------------------------- /gst-plugin/configure.ac: -------------------------------------------------------------------------------- 1 | dnl required version of autoconf 2 | AC_PREREQ([2.53]) 3 | 4 | dnl TODO: fill in your package name and package version here 5 | AC_INIT([my-filter],[1.0.0]) 6 | 7 | dnl required versions of gstreamer and plugins-base 8 | GST_REQUIRED=1.0.0 9 | GSTPB_REQUIRED=1.0.0 10 | 11 | AC_CONFIG_SRCDIR([src/gstplugin.c]) 12 | AC_CONFIG_HEADERS([config.h]) 13 | 14 | dnl required version of automake 15 | AM_INIT_AUTOMAKE([1.10]) 16 | 17 | dnl enable mainainer mode by default 18 | AM_MAINTAINER_MODE([enable]) 19 | 20 | dnl check for tools (compiler etc.) 21 | AC_PROG_CXX 22 | AC_LANG([C++]) 23 | 24 | dnl required version of libtool 25 | LT_PREREQ([2.2.6]) 26 | LT_INIT 27 | 28 | dnl give error and exit if we don't have pkgconfig 29 | AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, [ ], [ 30 | AC_MSG_ERROR([You need to have pkg-config installed!]) 31 | ]) 32 | 33 | dnl Check for the required version of GStreamer core (and gst-plugins-base) 34 | dnl This will export GST_CFLAGS and GST_LIBS variables for use in Makefile.am 35 | dnl 36 | dnl If you need libraries from gst-plugins-base here, also add: 37 | dnl for libgstaudio-1.0: gstreamer-audio-1.0 >= $GST_REQUIRED 38 | dnl for libgstvideo-1.0: gstreamer-video-1.0 >= $GST_REQUIRED 39 | dnl for libgsttag-1.0: gstreamer-tag-1.0 >= $GST_REQUIRED 40 | dnl for libgstpbutils-1.0: gstreamer-pbutils-1.0 >= $GST_REQUIRED 41 | dnl for libgstfft-1.0: gstreamer-fft-1.0 >= $GST_REQUIRED 42 | dnl for libgstinterfaces-1.0: gstreamer-interfaces-1.0 >= $GST_REQUIRED 43 | dnl for libgstrtp-1.0: gstreamer-rtp-1.0 >= $GST_REQUIRED 44 | dnl for libgstrtsp-1.0: gstreamer-rtsp-1.0 >= $GST_REQUIRED 45 | dnl etc. 46 | PKG_CHECK_MODULES(GST, [ 47 | gstreamer-1.0 >= $GST_REQUIRED 48 | gstreamer-base-1.0 >= $GST_REQUIRED 49 | gstreamer-controller-1.0 >= $GST_REQUIRED 50 | gstreamer-audio-1.0 >= $GST_REQUIRED 51 | ], [ 52 | AC_SUBST(GST_CFLAGS) 53 | AC_SUBST(GST_LIBS) 54 | ], [ 55 | AC_MSG_ERROR([ 56 | You need to install or upgrade the GStreamer development 57 | packages on your system. On debian-based systems these are 58 | libgstreamer1.0-dev and libgstreamer-plugins-base1.0-dev. 59 | on RPM-based systems gstreamer1.0-devel, libgstreamer1.0-devel 60 | or similar. The minimum version required is $GST_REQUIRED. 61 | ]) 62 | ]) 63 | 64 | dnl check if compiler understands -Wall (if yes, add -Wall to GST_CFLAGS) 65 | AC_MSG_CHECKING([to see if compiler understands -Wall]) 66 | save_CFLAGS="$CFLAGS" 67 | CFLAGS="$CFLAGS -Wall" 68 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ], [ ])], [ 69 | GST_CFLAGS="$GST_CFLAGS -Wall" 70 | AC_MSG_RESULT([yes]) 71 | ], [ 72 | AC_MSG_RESULT([no]) 73 | ]) 74 | 75 | dnl set the plugindir where plugins should be installed (for src/Makefile.am) 76 | if test "x${prefix}" = "x$HOME"; then 77 | plugindir="$HOME/.gstreamer-1.0/plugins" 78 | else 79 | plugindir="\$(libdir)/gstreamer-1.0" 80 | fi 81 | AC_SUBST(plugindir) 82 | 83 | dnl set proper LDFLAGS for plugins 84 | GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*' 85 | AC_SUBST(GST_PLUGIN_LDFLAGS) 86 | 87 | AC_CONFIG_FILES([Makefile src/Makefile]) 88 | AC_OUTPUT 89 | 90 | -------------------------------------------------------------------------------- /gst-plugin/meson.build: -------------------------------------------------------------------------------- 1 | plugin_c_args = ['-DHAVE_CONFIG_H'] 2 | 3 | cdata = configuration_data() 4 | cdata.set_quoted('PACKAGE_VERSION', gst_version) 5 | cdata.set_quoted('PACKAGE', 'gst-template-plugin') 6 | cdata.set_quoted('GST_LICENSE', 'LGPL') 7 | cdata.set_quoted('GST_API_VERSION', api_version) 8 | cdata.set_quoted('GST_PACKAGE_NAME', 'GStreamer template Plug-ins') 9 | cdata.set_quoted('GST_PACKAGE_ORIGIN', 'https://gstreamer.freedesktop.org') 10 | configure_file(output : 'config.h', configuration : cdata) 11 | 12 | gstaudio_dep = dependency('gstreamer-audio-1.0', 13 | fallback: ['gst-plugins-base', 'audio_dep']) 14 | 15 | # Plugin 1 16 | plugin_sources = [ 17 | 'src/gstmyfilter.c' 18 | ] 19 | 20 | gstmyfilterexample = library('gstmyfilter', 21 | plugin_sources, 22 | c_args: plugin_c_args, 23 | dependencies : [gst_dep], 24 | install : true, 25 | install_dir : plugins_install_dir, 26 | ) -------------------------------------------------------------------------------- /gst-plugin/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Note: plugindir is set in configure 2 | 3 | ############################################################################## 4 | # TODO: change libgstmyfilter.la to something else, e.g. libmysomething.la # 5 | ############################################################################## 6 | plugin_LTLIBRARIES = libgstmyfilter.la 7 | 8 | ############################################################################## 9 | # TODO: for the next set of variables, name the prefix if you named the .la, # 10 | # e.g. libmysomething.la => libmysomething_la_SOURCES # 11 | # libmysomething_la_CFLAGS # 12 | # libmysomething_la_LIBADD # 13 | # libmysomething_la_LDFLAGS # 14 | ############################################################################## 15 | 16 | ## Plugin 1 17 | 18 | # sources used to compile this plug-in 19 | libgstmyfilter_la_SOURCES = gstmyfilter.cpp gstmyfilter.h 20 | 21 | # compiler and linker flags used to compile this plugin, set in configure.ac 22 | libgstmyfilter_la_CXXFLAGS = $(GST_CFLAGS) 23 | libgstmyfilter_la_LIBADD = $(GST_LIBS) 24 | libgstmyfilter_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) 25 | libgstmyfilter_la_LIBTOOLFLAGS = --tag=disable-static -------------------------------------------------------------------------------- /gst-plugin/src/gstaudiofilter.c: -------------------------------------------------------------------------------- 1 | /* GStreamer audio filter example class 2 | * Copyright (C) <1999> Erik Walthinsen 3 | * Copyright (C) <2003> David Schleef 4 | * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | * DEALINGS IN THE SOFTWARE. 23 | * 24 | * Alternatively, the contents of this file may be used under the 25 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 26 | * which case the following provisions apply instead of the ones 27 | * mentioned above: 28 | * 29 | * This library is free software; you can redistribute it and/or 30 | * modify it under the terms of the GNU Library General Public 31 | * License as published by the Free Software Foundation; either 32 | * version 2 of the License, or (at your option) any later version. 33 | * 34 | * This library is distributed in the hope that it will be useful, 35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 37 | * Library General Public License for more details. 38 | * 39 | * You should have received a copy of the GNU Library General Public 40 | * License along with this library; if not, write to the 41 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 42 | * Boston, MA 02111-1307, USA. 43 | */ 44 | 45 | /** 46 | * SECTION:element-plugin 47 | * 48 | * FIXME:Describe plugin here. 49 | * 50 | * 51 | * Example launch line 52 | * |[ 53 | * gst-launch -v -m audiotestsrc ! plugin ! autoaudiosink 54 | * ]| 55 | * 56 | */ 57 | 58 | #ifdef HAVE_CONFIG_H 59 | #include "config.h" 60 | #endif 61 | 62 | #include 63 | #include 64 | #include 65 | #include 66 | 67 | GST_DEBUG_CATEGORY_STATIC (audiofiltertemplate_debug); 68 | #define GST_CAT_DEFAULT audiofiltertemplate_debug 69 | 70 | typedef struct _GstAudioFilterTemplate GstAudioFilterTemplate; 71 | typedef struct _GstAudioFilterTemplateClass GstAudioFilterTemplateClass; 72 | 73 | /* These are boilerplate cast macros and type check macros */ 74 | #define GST_TYPE_AUDIO_FILTER_TEMPLATE \ 75 | (gst_audio_filter_template_get_type()) 76 | #define GST_AUDIO_FILTER_TEMPLATE(obj) \ 77 | (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_FILTER_TEMPLATE,GstAudioFilterTemplate)) 78 | #define GST_AUDIO_FILTER_TEMPLATE_CLASS(klass) \ 79 | (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_FILTER_TEMPLATE,GstAudioFilterTemplateClass)) 80 | #define GST_IS_AUDIO_FILTER_TEMPLATE(obj) \ 81 | (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_FILTER_TEMPLATE)) 82 | #define GST_IS_AUDIO_FILTER_TEMPLATE_CLASS(klass) \ 83 | (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_FILTER_TEMPLATE)) 84 | 85 | struct _GstAudioFilterTemplate 86 | { 87 | GstAudioFilter audiofilter; 88 | 89 | /* here you can add additional per-instance 90 | * data such as properties */ 91 | }; 92 | 93 | struct _GstAudioFilterTemplateClass 94 | { 95 | GstAudioFilterClass audiofilter_class; 96 | }; 97 | 98 | 99 | enum 100 | { 101 | /* FILL ME */ 102 | LAST_SIGNAL 103 | }; 104 | 105 | enum 106 | { 107 | ARG_0 108 | /* FILL ME */ 109 | }; 110 | 111 | G_DEFINE_TYPE (GstAudioFilterTemplate, gst_audio_filter_template, 112 | GST_TYPE_AUDIO_FILTER); 113 | 114 | static void gst_audio_filter_template_set_property (GObject * object, 115 | guint prop_id, const GValue * value, GParamSpec * pspec); 116 | static void gst_audio_filter_template_get_property (GObject * object, 117 | guint prop_id, GValue * value, GParamSpec * pspec); 118 | 119 | static gboolean gst_audio_filter_template_setup (GstAudioFilter * filter, 120 | const GstAudioInfo * info); 121 | static GstFlowReturn gst_audio_filter_template_filter (GstBaseTransform * bt, 122 | GstBuffer * outbuf, GstBuffer * inbuf); 123 | static GstFlowReturn 124 | gst_audio_filter_template_filter_inplace (GstBaseTransform * base_transform, 125 | GstBuffer * buf); 126 | 127 | #if 0 128 | /* This means we support signed 16-bit pcm and signed 32-bit pcm in native 129 | * endianness */ 130 | #define SUPPORTED_CAPS_STRING \ 131 | GST_AUDIO_CAPS_MAKE("{ " GST_AUDIO_NE(S16) ", " GST_AUDIO_NE(S32) " }") 132 | #endif 133 | 134 | /* For simplicity only support 16-bit pcm in native endianness for starters */ 135 | #define SUPPORTED_CAPS_STRING \ 136 | GST_AUDIO_CAPS_MAKE(GST_AUDIO_NE(S16)) 137 | 138 | /* GObject vmethod implementations */ 139 | static void 140 | gst_audio_filter_template_class_init (GstAudioFilterTemplateClass * klass) 141 | { 142 | GObjectClass *gobject_class; 143 | GstElementClass *element_class; 144 | GstBaseTransformClass *btrans_class; 145 | GstAudioFilterClass *audio_filter_class; 146 | GstCaps *caps; 147 | 148 | gobject_class = (GObjectClass *) klass; 149 | element_class = (GstElementClass *) klass; 150 | btrans_class = (GstBaseTransformClass *) klass; 151 | audio_filter_class = (GstAudioFilterClass *) klass; 152 | 153 | #if 0 154 | g_object_class_install_property (gobject_class, ARG_METHOD, 155 | g_param_spec_enum ("method", "method", "method", 156 | GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1, 157 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 158 | #endif 159 | 160 | gobject_class->set_property = gst_audio_filter_template_set_property; 161 | gobject_class->get_property = gst_audio_filter_template_get_property; 162 | 163 | /* this function will be called when the format is set before the 164 | * first buffer comes in, and whenever the format changes */ 165 | audio_filter_class->setup = gst_audio_filter_template_setup; 166 | 167 | /* here you set up functions to process data (either in place, or from 168 | * one input buffer to another output buffer); only one is required */ 169 | btrans_class->transform = gst_audio_filter_template_filter; 170 | btrans_class->transform_ip = gst_audio_filter_template_filter_inplace; 171 | /* Set some basic metadata about your new element */ 172 | gst_element_class_set_details_simple (element_class, 173 | "Audio Filter Template", /* FIXME: short name */ 174 | "Filter/Effect/Audio", 175 | "Filters audio", /* FIXME: short description*/ 176 | "Name "); /* FIXME: author */ 177 | 178 | caps = gst_caps_from_string (SUPPORTED_CAPS_STRING); 179 | gst_audio_filter_class_add_pad_templates (audio_filter_class, caps); 180 | gst_caps_unref (caps); 181 | } 182 | 183 | static void 184 | gst_audio_filter_template_init (GstAudioFilterTemplate * filter) 185 | { 186 | /* This function is called when a new filter object is created. You 187 | * would typically do things like initialise properties to their 188 | * default values here if needed. */ 189 | } 190 | 191 | static void 192 | gst_audio_filter_template_set_property (GObject * object, guint prop_id, 193 | const GValue * value, GParamSpec * pspec) 194 | { 195 | GstAudioFilterTemplate *filter = GST_AUDIO_FILTER_TEMPLATE (object); 196 | 197 | GST_OBJECT_LOCK (filter); 198 | switch (prop_id) { 199 | default: 200 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 201 | break; 202 | } 203 | GST_OBJECT_UNLOCK (filter); 204 | } 205 | 206 | static void 207 | gst_audio_filter_template_get_property (GObject * object, guint prop_id, 208 | GValue * value, GParamSpec * pspec) 209 | { 210 | GstAudioFilterTemplate *filter = GST_AUDIO_FILTER_TEMPLATE (object); 211 | 212 | GST_OBJECT_LOCK (filter); 213 | switch (prop_id) { 214 | default: 215 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 216 | break; 217 | } 218 | GST_OBJECT_UNLOCK (filter); 219 | } 220 | 221 | static gboolean 222 | gst_audio_filter_template_setup (GstAudioFilter * filter, 223 | const GstAudioInfo * info) 224 | { 225 | GstAudioFilterTemplate *filter_template; 226 | GstAudioFormat fmt; 227 | gint chans, rate; 228 | 229 | filter_template = GST_AUDIO_FILTER_TEMPLATE (filter); 230 | 231 | rate = GST_AUDIO_INFO_RATE (info); 232 | chans = GST_AUDIO_INFO_CHANNELS (info); 233 | fmt = GST_AUDIO_INFO_FORMAT (info); 234 | 235 | GST_INFO_OBJECT (filter_template, "format %d (%s), rate %d, %d channels", 236 | fmt, GST_AUDIO_INFO_NAME (info), rate, chans); 237 | 238 | /* if any setup needs to be done (like memory allocated), do it here */ 239 | 240 | /* The audio filter base class also saves the audio info in 241 | * GST_AUDIO_FILTER_INFO(filter) so it's automatically available 242 | * later from there as well */ 243 | 244 | return TRUE; 245 | } 246 | 247 | /* You may choose to implement either a copying filter or an 248 | * in-place filter (or both). Implementing only one will give 249 | * full functionality, however, implementing both will cause 250 | * audiofilter to use the optimal function in every situation, 251 | * with a minimum of memory copies. */ 252 | 253 | static GstFlowReturn 254 | gst_audio_filter_template_filter (GstBaseTransform * base_transform, 255 | GstBuffer * inbuf, GstBuffer * outbuf) 256 | { 257 | GstAudioFilterTemplate *filter = GST_AUDIO_FILTER_TEMPLATE (base_transform); 258 | GstMapInfo map_in; 259 | GstMapInfo map_out; 260 | 261 | GST_LOG_OBJECT (filter, "transform buffer"); 262 | 263 | /* FIXME: do something interesting here. We simply copy the input data 264 | * to the output buffer for now. */ 265 | if (gst_buffer_map (inbuf, &map_in, GST_MAP_READ)) { 266 | if (gst_buffer_map (outbuf, &map_out, GST_MAP_WRITE)) { 267 | g_assert (map_out.size == map_in.size); 268 | memcpy (map_out.data, map_in.data, map_out.size); 269 | gst_buffer_unmap (outbuf, &map_out); 270 | } 271 | gst_buffer_unmap (inbuf, &map_in); 272 | } 273 | 274 | return GST_FLOW_OK; 275 | } 276 | 277 | static GstFlowReturn 278 | gst_audio_filter_template_filter_inplace (GstBaseTransform * base_transform, 279 | GstBuffer * buf) 280 | { 281 | GstAudioFilterTemplate *filter = GST_AUDIO_FILTER_TEMPLATE (base_transform); 282 | GstFlowReturn flow = GST_FLOW_OK; 283 | GstMapInfo map; 284 | 285 | GST_LOG_OBJECT (filter, "transform buffer in place"); 286 | 287 | /* FIXME: do something interesting here. Doing nothing means the input 288 | * buffer is simply pushed out as is without any modification */ 289 | if (gst_buffer_map (buf, &map, GST_MAP_READWRITE)) { 290 | #if 0 291 | switch (GST_AUDIO_FILTER_FORMAT (filter)) { 292 | case GST_AUDIO_FORMAT_S16LE: 293 | case GST_AUDIO_FORMAT_S16BE: { 294 | gint16 *samples = map.data; 295 | guint n_samples = map.size / sizeof (gint16); 296 | guint i; 297 | 298 | for (i = 0; i < n; ++n) { 299 | samples[i] = samples[i]; 300 | } 301 | break; 302 | } 303 | default: 304 | g_warning ("Unexpected audio format %s!", 305 | GST_AUDIO_INFO_NAME (GST_AUDIO_FILTER_INFO(filter))); 306 | flow = GST_FLOW_ERROR; 307 | break; 308 | } 309 | #endif 310 | gst_buffer_unmap (buf, &map); 311 | } 312 | 313 | return flow; 314 | } 315 | 316 | static gboolean 317 | plugin_init (GstPlugin * plugin) 318 | { 319 | /* Register debug category for filtering log messages 320 | * FIXME:exchange the string 'Template plugin' with your description */ 321 | GST_DEBUG_CATEGORY_INIT (audiofiltertemplate_debug, "audiofiltertemplate", 0, 322 | "Audio filter template example"); 323 | 324 | /* This is the name used in gst-launch-1.0 and gst_element_factory_make() */ 325 | return gst_element_register (plugin, "audiofiltertemplate", GST_RANK_NONE, 326 | GST_TYPE_AUDIO_FILTER_TEMPLATE); 327 | } 328 | 329 | /* gstreamer looks for this structure to register plugins 330 | * 331 | * FIXME:exchange the string 'Template plugin' with you plugin description 332 | */ 333 | GST_PLUGIN_DEFINE ( 334 | GST_VERSION_MAJOR, 335 | GST_VERSION_MINOR, 336 | audiofilterexample, 337 | "Audio filter example plugin", 338 | plugin_init, 339 | PACKAGE_VERSION, 340 | GST_LICENSE, 341 | GST_PACKAGE_NAME, 342 | GST_PACKAGE_ORIGIN 343 | ); 344 | -------------------------------------------------------------------------------- /gst-plugin/src/gstmyfilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * GStreamer 3 | * Copyright (C) 2005 Thomas Vander Stichele 4 | * Copyright (C) 2005 Ronald S. Bultje 5 | * Copyright (C) 2019 Ozan Karaali <> 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | * 25 | * Alternatively, the contents of this file may be used under the 26 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 27 | * which case the following provisions apply instead of the ones 28 | * mentioned above: 29 | * 30 | * This library is free software; you can redistribute it and/or 31 | * modify it under the terms of the GNU Library General Public 32 | * License as published by the Free Software Foundation; either 33 | * version 2 of the License, or (at your option) any later version. 34 | * 35 | * This library is distributed in the hope that it will be useful, 36 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 37 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 38 | * Library General Public License for more details. 39 | * 40 | * You should have received a copy of the GNU Library General Public 41 | * License along with this library; if not, write to the 42 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 43 | * Boston, MA 02111-1307, USA. 44 | */ 45 | 46 | /** 47 | * SECTION:element-myfilter 48 | * 49 | * FIXME:Describe myfilter here. 50 | * 51 | * 52 | * Example launch line 53 | * |[ 54 | * gst-launch -v -m fakesrc ! myfilter ! fakesink silent=TRUE 55 | * ]| 56 | * 57 | */ 58 | 59 | #ifdef HAVE_CONFIG_H 60 | # include 61 | #endif 62 | 63 | #include 64 | #include 65 | #include "gstmyfilter.h" 66 | 67 | GST_DEBUG_CATEGORY_STATIC (gst_my_filter_debug); 68 | #define GST_CAT_DEFAULT gst_my_filter_debug 69 | 70 | /* Filter signals and args */ 71 | enum 72 | { 73 | /* FILL ME */ 74 | LAST_SIGNAL 75 | }; 76 | 77 | enum 78 | { 79 | PROP_0, 80 | PROP_SILENT 81 | }; 82 | 83 | /* the capabilities of the inputs and outputs. 84 | * 85 | * describe the real formats here. 86 | */ 87 | static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", 88 | GST_PAD_SINK, 89 | GST_PAD_ALWAYS, 90 | GST_STATIC_CAPS ("ANY") 91 | ); 92 | 93 | static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", 94 | GST_PAD_SRC, 95 | GST_PAD_ALWAYS, 96 | GST_STATIC_CAPS ("ANY") 97 | ); 98 | 99 | #define gst_my_filter_parent_class parent_class 100 | G_DEFINE_TYPE (GstMyFilter, gst_my_filter, GST_TYPE_ELEMENT); 101 | 102 | static void gst_my_filter_set_property (GObject * object, guint prop_id, 103 | const GValue * value, GParamSpec * pspec); 104 | static void gst_my_filter_get_property (GObject * object, guint prop_id, 105 | GValue * value, GParamSpec * pspec); 106 | 107 | static gboolean gst_my_filter_sink_event (GstPad * pad, GstObject * parent, GstEvent * event); 108 | static GstFlowReturn gst_my_filter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf); 109 | 110 | /* GObject vmethod implementations */ 111 | 112 | /* initialize the myfilter's class */ 113 | static void 114 | gst_my_filter_class_init (GstMyFilterClass * klass) 115 | { 116 | GObjectClass *gobject_class; 117 | GstElementClass *gstelement_class; 118 | 119 | gobject_class = (GObjectClass *) klass; 120 | gstelement_class = (GstElementClass *) klass; 121 | 122 | gobject_class->set_property = gst_my_filter_set_property; 123 | gobject_class->get_property = gst_my_filter_get_property; 124 | 125 | g_object_class_install_property (gobject_class, PROP_SILENT, 126 | g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", 127 | FALSE, G_PARAM_READWRITE)); 128 | 129 | gst_element_class_set_details_simple(gstelement_class, 130 | "MyFilter", 131 | "FIXME:Generic", 132 | "FIXME:Generic Template Element", 133 | "Ozan Karaali <>"); 134 | 135 | gst_element_class_add_pad_template (gstelement_class, 136 | gst_static_pad_template_get (&src_factory)); 137 | gst_element_class_add_pad_template (gstelement_class, 138 | gst_static_pad_template_get (&sink_factory)); 139 | } 140 | 141 | /* initialize the new element 142 | * instantiate pads and add them to element 143 | * set pad calback functions 144 | * initialize instance structure 145 | */ 146 | static void 147 | gst_my_filter_init (GstMyFilter * filter) 148 | { 149 | filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink"); 150 | gst_pad_set_event_function (filter->sinkpad, 151 | GST_DEBUG_FUNCPTR(gst_my_filter_sink_event)); 152 | gst_pad_set_chain_function (filter->sinkpad, 153 | GST_DEBUG_FUNCPTR(gst_my_filter_chain)); 154 | GST_PAD_SET_PROXY_CAPS (filter->sinkpad); 155 | gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); 156 | 157 | filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); 158 | GST_PAD_SET_PROXY_CAPS (filter->srcpad); 159 | gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); 160 | 161 | filter->silent = FALSE; 162 | } 163 | 164 | static void 165 | gst_my_filter_set_property (GObject * object, guint prop_id, 166 | const GValue * value, GParamSpec * pspec) 167 | { 168 | GstMyFilter *filter = GST_MYFILTER (object); 169 | 170 | switch (prop_id) { 171 | case PROP_SILENT: 172 | filter->silent = g_value_get_boolean (value); 173 | break; 174 | default: 175 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 176 | break; 177 | } 178 | } 179 | 180 | static void 181 | gst_my_filter_get_property (GObject * object, guint prop_id, 182 | GValue * value, GParamSpec * pspec) 183 | { 184 | GstMyFilter *filter = GST_MYFILTER (object); 185 | 186 | switch (prop_id) { 187 | case PROP_SILENT: 188 | g_value_set_boolean (value, filter->silent); 189 | break; 190 | default: 191 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 192 | break; 193 | } 194 | } 195 | 196 | /* GstElement vmethod implementations */ 197 | 198 | /* this function handles sink events */ 199 | static gboolean 200 | gst_my_filter_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) 201 | { 202 | GstMyFilter *filter; 203 | gboolean ret; 204 | 205 | filter = GST_MYFILTER (parent); 206 | 207 | GST_LOG_OBJECT (filter, "Received %s event: %" GST_PTR_FORMAT, 208 | GST_EVENT_TYPE_NAME (event), event); 209 | 210 | switch (GST_EVENT_TYPE (event)) { 211 | case GST_EVENT_CAPS: 212 | { 213 | GstCaps * caps; 214 | 215 | gst_event_parse_caps (event, &caps); 216 | /* do something with the caps */ 217 | 218 | /* and forward */ 219 | ret = gst_pad_event_default (pad, parent, event); 220 | break; 221 | } 222 | default: 223 | ret = gst_pad_event_default (pad, parent, event); 224 | break; 225 | } 226 | return ret; 227 | } 228 | 229 | /* chain function 230 | * this function does the actual processing 231 | */ 232 | static GstFlowReturn 233 | gst_my_filter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) 234 | { 235 | GstMyFilter *filter; 236 | 237 | filter = GST_MYFILTER (parent); 238 | 239 | if (filter->silent == FALSE){ 240 | g_print ("Loaded!"); 241 | // Now we can use iostream C++: 242 | std::cout<< "Test" <srcpad, buf); 247 | } 248 | 249 | 250 | /* entry point to initialize the plug-in 251 | * initialize the plug-in itself 252 | * register the element factories and other features 253 | */ 254 | static gboolean 255 | myfilter_init (GstPlugin * myfilter) 256 | { 257 | /* debug category for fltering log messages 258 | * 259 | * exchange the string 'Template myfilter' with your description 260 | */ 261 | GST_DEBUG_CATEGORY_INIT (gst_my_filter_debug, "myfilter", 262 | 0, "Template myfilter"); 263 | 264 | return gst_element_register (myfilter, "myfilter", GST_RANK_NONE, 265 | GST_TYPE_MYFILTER); 266 | } 267 | 268 | /* PACKAGE: this is usually set by autotools depending on some _INIT macro 269 | * in configure.ac and then written into and defined in config.h, but we can 270 | * just set it ourselves here in case someone doesn't use autotools to 271 | * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined. 272 | */ 273 | #ifndef PACKAGE 274 | #define PACKAGE "myfirstmyfilter" 275 | #endif 276 | 277 | /* gstreamer looks for this structure to register myfilters 278 | * 279 | * exchange the string 'Template myfilter' with your myfilter description 280 | */ 281 | GST_PLUGIN_DEFINE ( 282 | GST_VERSION_MAJOR, 283 | GST_VERSION_MINOR, 284 | myfilter, 285 | "Template myfilter", 286 | myfilter_init, 287 | PACKAGE_VERSION, 288 | "LGPL", 289 | "GStreamer", 290 | "http://gstreamer.net/" 291 | ) 292 | -------------------------------------------------------------------------------- /gst-plugin/src/gstmyfilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GStreamer 3 | * Copyright (C) 2005 Thomas Vander Stichele 4 | * Copyright (C) 2005 Ronald S. Bultje 5 | * Copyright (C) 2019 Ozan Karaali <> 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | * 25 | * Alternatively, the contents of this file may be used under the 26 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 27 | * which case the following provisions apply instead of the ones 28 | * mentioned above: 29 | * 30 | * This library is free software; you can redistribute it and/or 31 | * modify it under the terms of the GNU Library General Public 32 | * License as published by the Free Software Foundation; either 33 | * version 2 of the License, or (at your option) any later version. 34 | * 35 | * This library is distributed in the hope that it will be useful, 36 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 37 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 38 | * Library General Public License for more details. 39 | * 40 | * You should have received a copy of the GNU Library General Public 41 | * License along with this library; if not, write to the 42 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 43 | * Boston, MA 02111-1307, USA. 44 | */ 45 | 46 | #ifndef __GST_MYFILTER_H__ 47 | #define __GST_MYFILTER_H__ 48 | 49 | #include 50 | 51 | G_BEGIN_DECLS 52 | 53 | /* #defines don't like whitespacey bits */ 54 | #define GST_TYPE_MYFILTER \ 55 | (gst_my_filter_get_type()) 56 | #define GST_MYFILTER(obj) \ 57 | (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MYFILTER,GstMyFilter)) 58 | #define GST_MYFILTER_CLASS(klass) \ 59 | (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MYFILTER,GstMyFilterClass)) 60 | #define GST_IS_MYFILTER(obj) \ 61 | (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MYFILTER)) 62 | #define GST_IS_MYFILTER_CLASS(klass) \ 63 | (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MYFILTER)) 64 | 65 | typedef struct _GstMyFilter GstMyFilter; 66 | typedef struct _GstMyFilterClass GstMyFilterClass; 67 | 68 | struct _GstMyFilter 69 | { 70 | GstElement element; 71 | 72 | GstPad *sinkpad, *srcpad; 73 | 74 | gboolean silent; 75 | }; 76 | 77 | struct _GstMyFilterClass 78 | { 79 | GstElementClass parent_class; 80 | }; 81 | 82 | GType gst_my_filter_get_type (void); 83 | 84 | G_END_DECLS 85 | 86 | #endif /* __GST_MYFILTER_H__ */ 87 | -------------------------------------------------------------------------------- /gst-plugin/src/gstplugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * GStreamer 3 | * Copyright (C) 2005 Thomas Vander Stichele 4 | * Copyright (C) 2005 Ronald S. Bultje 5 | * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | * 25 | * Alternatively, the contents of this file may be used under the 26 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 27 | * which case the following provisions apply instead of the ones 28 | * mentioned above: 29 | * 30 | * This library is free software; you can redistribute it and/or 31 | * modify it under the terms of the GNU Library General Public 32 | * License as published by the Free Software Foundation; either 33 | * version 2 of the License, or (at your option) any later version. 34 | * 35 | * This library is distributed in the hope that it will be useful, 36 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 37 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 38 | * Library General Public License for more details. 39 | * 40 | * You should have received a copy of the GNU Library General Public 41 | * License along with this library; if not, write to the 42 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 43 | * Boston, MA 02111-1307, USA. 44 | */ 45 | 46 | /** 47 | * SECTION:element-plugin 48 | * 49 | * FIXME:Describe plugin here. 50 | * 51 | * 52 | * Example launch line 53 | * |[ 54 | * gst-launch -v -m fakesrc ! plugin ! fakesink silent=TRUE 55 | * ]| 56 | * 57 | */ 58 | 59 | #ifdef HAVE_CONFIG_H 60 | # include 61 | #endif 62 | 63 | #include 64 | 65 | #include "gstplugin.h" 66 | 67 | GST_DEBUG_CATEGORY_STATIC (gst_plugin_template_debug); 68 | #define GST_CAT_DEFAULT gst_plugin_template_debug 69 | 70 | /* Filter signals and args */ 71 | enum 72 | { 73 | /* FILL ME */ 74 | LAST_SIGNAL 75 | }; 76 | 77 | enum 78 | { 79 | PROP_0, 80 | PROP_SILENT 81 | }; 82 | 83 | /* the capabilities of the inputs and outputs. 84 | * 85 | * describe the real formats here. 86 | */ 87 | static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", 88 | GST_PAD_SINK, 89 | GST_PAD_ALWAYS, 90 | GST_STATIC_CAPS ("ANY") 91 | ); 92 | 93 | static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", 94 | GST_PAD_SRC, 95 | GST_PAD_ALWAYS, 96 | GST_STATIC_CAPS ("ANY") 97 | ); 98 | 99 | #define gst_plugin_template_parent_class parent_class 100 | G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_ELEMENT); 101 | 102 | static void gst_plugin_template_set_property (GObject * object, guint prop_id, 103 | const GValue * value, GParamSpec * pspec); 104 | static void gst_plugin_template_get_property (GObject * object, guint prop_id, 105 | GValue * value, GParamSpec * pspec); 106 | 107 | static gboolean gst_plugin_template_sink_event (GstPad * pad, GstObject * parent, GstEvent * event); 108 | static GstFlowReturn gst_plugin_template_chain (GstPad * pad, GstObject * parent, GstBuffer * buf); 109 | 110 | /* GObject vmethod implementations */ 111 | 112 | /* initialize the plugin's class */ 113 | static void 114 | gst_plugin_template_class_init (GstPluginTemplateClass * klass) 115 | { 116 | GObjectClass *gobject_class; 117 | GstElementClass *gstelement_class; 118 | 119 | gobject_class = (GObjectClass *) klass; 120 | gstelement_class = (GstElementClass *) klass; 121 | 122 | gobject_class->set_property = gst_plugin_template_set_property; 123 | gobject_class->get_property = gst_plugin_template_get_property; 124 | 125 | g_object_class_install_property (gobject_class, PROP_SILENT, 126 | g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", 127 | FALSE, G_PARAM_READWRITE)); 128 | 129 | gst_element_class_set_details_simple(gstelement_class, 130 | "Plugin", 131 | "FIXME:Generic", 132 | "FIXME:Generic Template Element", 133 | "AUTHOR_NAME AUTHOR_EMAIL"); 134 | 135 | gst_element_class_add_pad_template (gstelement_class, 136 | gst_static_pad_template_get (&src_factory)); 137 | gst_element_class_add_pad_template (gstelement_class, 138 | gst_static_pad_template_get (&sink_factory)); 139 | } 140 | 141 | /* initialize the new element 142 | * instantiate pads and add them to element 143 | * set pad calback functions 144 | * initialize instance structure 145 | */ 146 | static void 147 | gst_plugin_template_init (GstPluginTemplate * filter) 148 | { 149 | filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink"); 150 | gst_pad_set_event_function (filter->sinkpad, 151 | GST_DEBUG_FUNCPTR(gst_plugin_template_sink_event)); 152 | gst_pad_set_chain_function (filter->sinkpad, 153 | GST_DEBUG_FUNCPTR(gst_plugin_template_chain)); 154 | GST_PAD_SET_PROXY_CAPS (filter->sinkpad); 155 | gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); 156 | 157 | filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); 158 | GST_PAD_SET_PROXY_CAPS (filter->srcpad); 159 | gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); 160 | 161 | filter->silent = FALSE; 162 | } 163 | 164 | static void 165 | gst_plugin_template_set_property (GObject * object, guint prop_id, 166 | const GValue * value, GParamSpec * pspec) 167 | { 168 | GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object); 169 | 170 | switch (prop_id) { 171 | case PROP_SILENT: 172 | filter->silent = g_value_get_boolean (value); 173 | break; 174 | default: 175 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 176 | break; 177 | } 178 | } 179 | 180 | static void 181 | gst_plugin_template_get_property (GObject * object, guint prop_id, 182 | GValue * value, GParamSpec * pspec) 183 | { 184 | GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object); 185 | 186 | switch (prop_id) { 187 | case PROP_SILENT: 188 | g_value_set_boolean (value, filter->silent); 189 | break; 190 | default: 191 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 192 | break; 193 | } 194 | } 195 | 196 | /* GstElement vmethod implementations */ 197 | 198 | /* this function handles sink events */ 199 | static gboolean 200 | gst_plugin_template_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) 201 | { 202 | GstPluginTemplate *filter; 203 | gboolean ret; 204 | 205 | filter = GST_PLUGIN_TEMPLATE (parent); 206 | 207 | GST_LOG_OBJECT (filter, "Received %s event: %" GST_PTR_FORMAT, 208 | GST_EVENT_TYPE_NAME (event), event); 209 | 210 | switch (GST_EVENT_TYPE (event)) { 211 | case GST_EVENT_CAPS: 212 | { 213 | GstCaps * caps; 214 | 215 | gst_event_parse_caps (event, &caps); 216 | /* do something with the caps */ 217 | 218 | /* and forward */ 219 | ret = gst_pad_event_default (pad, parent, event); 220 | break; 221 | } 222 | default: 223 | ret = gst_pad_event_default (pad, parent, event); 224 | break; 225 | } 226 | return ret; 227 | } 228 | 229 | /* chain function 230 | * this function does the actual processing 231 | */ 232 | static GstFlowReturn 233 | gst_plugin_template_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) 234 | { 235 | GstPluginTemplate *filter; 236 | 237 | filter = GST_PLUGIN_TEMPLATE (parent); 238 | 239 | if (filter->silent == FALSE) 240 | g_print ("I'm plugged, therefore I'm in.\n"); 241 | 242 | /* just push out the incoming buffer without touching it */ 243 | return gst_pad_push (filter->srcpad, buf); 244 | } 245 | 246 | 247 | /* entry point to initialize the plug-in 248 | * initialize the plug-in itself 249 | * register the element factories and other features 250 | */ 251 | static gboolean 252 | plugin_init (GstPlugin * plugin) 253 | { 254 | /* debug category for fltering log messages 255 | * 256 | * exchange the string 'Template plugin' with your description 257 | */ 258 | GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin", 259 | 0, "Template plugin"); 260 | 261 | return gst_element_register (plugin, "plugin", GST_RANK_NONE, 262 | GST_TYPE_PLUGIN_TEMPLATE); 263 | } 264 | 265 | /* PACKAGE: this is usually set by autotools depending on some _INIT macro 266 | * in configure.ac and then written into and defined in config.h, but we can 267 | * just set it ourselves here in case someone doesn't use autotools to 268 | * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined. 269 | */ 270 | #ifndef PACKAGE 271 | #define PACKAGE "myfirstplugin" 272 | #endif 273 | 274 | /* gstreamer looks for this structure to register plugins 275 | * 276 | * exchange the string 'Template plugin' with your plugin description 277 | */ 278 | GST_PLUGIN_DEFINE ( 279 | GST_VERSION_MAJOR, 280 | GST_VERSION_MINOR, 281 | plugin, 282 | "Template plugin", 283 | plugin_init, 284 | PACKAGE_VERSION, 285 | GST_LICENSE, 286 | GST_PACKAGE_NAME, 287 | GST_PACKAGE_ORIGIN 288 | ) 289 | -------------------------------------------------------------------------------- /gst-plugin/src/gstplugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GStreamer 3 | * Copyright (C) 2005 Thomas Vander Stichele 4 | * Copyright (C) 2005 Ronald S. Bultje 5 | * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | * 25 | * Alternatively, the contents of this file may be used under the 26 | * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 27 | * which case the following provisions apply instead of the ones 28 | * mentioned above: 29 | * 30 | * This library is free software; you can redistribute it and/or 31 | * modify it under the terms of the GNU Library General Public 32 | * License as published by the Free Software Foundation; either 33 | * version 2 of the License, or (at your option) any later version. 34 | * 35 | * This library is distributed in the hope that it will be useful, 36 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 37 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 38 | * Library General Public License for more details. 39 | * 40 | * You should have received a copy of the GNU Library General Public 41 | * License along with this library; if not, write to the 42 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 43 | * Boston, MA 02111-1307, USA. 44 | */ 45 | 46 | #ifndef __GST_PLUGIN_TEMPLATE_H__ 47 | #define __GST_PLUGIN_TEMPLATE_H__ 48 | 49 | #include 50 | 51 | G_BEGIN_DECLS 52 | 53 | /* #defines don't like whitespacey bits */ 54 | #define GST_TYPE_PLUGIN_TEMPLATE \ 55 | (gst_plugin_template_get_type()) 56 | #define GST_PLUGIN_TEMPLATE(obj) \ 57 | (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplate)) 58 | #define GST_PLUGIN_TEMPLATE_CLASS(klass) \ 59 | (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplateClass)) 60 | #define GST_IS_PLUGIN_TEMPLATE(obj) \ 61 | (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLUGIN_TEMPLATE)) 62 | #define GST_IS_PLUGIN_TEMPLATE_CLASS(klass) \ 63 | (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLUGIN_TEMPLATE)) 64 | 65 | typedef struct _GstPluginTemplate GstPluginTemplate; 66 | typedef struct _GstPluginTemplateClass GstPluginTemplateClass; 67 | 68 | struct _GstPluginTemplate 69 | { 70 | GstElement element; 71 | 72 | GstPad *sinkpad, *srcpad; 73 | 74 | gboolean silent; 75 | }; 76 | 77 | struct _GstPluginTemplateClass 78 | { 79 | GstElementClass parent_class; 80 | }; 81 | 82 | GType gst_plugin_template_get_type (void); 83 | 84 | G_END_DECLS 85 | 86 | #endif /* __GST_PLUGIN_TEMPLATE_H__ */ 87 | -------------------------------------------------------------------------------- /gst-plugin/src/gsttransform.c: -------------------------------------------------------------------------------- 1 | /* 2 | * GStreamer 3 | * Copyright (C) 2006 Stefan Kost 4 | * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | /** 23 | * SECTION:element-plugin 24 | * 25 | * FIXME:Describe plugin here. 26 | * 27 | * 28 | * Example launch line 29 | * |[ 30 | * gst-launch -v -m fakesrc ! plugin ! fakesink silent=TRUE 31 | * ]| 32 | * 33 | */ 34 | 35 | #ifdef HAVE_CONFIG_H 36 | #include "config.h" 37 | #endif 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #include "gsttransform.h" 44 | 45 | GST_DEBUG_CATEGORY_STATIC (gst_plugin_template_debug); 46 | #define GST_CAT_DEFAULT gst_plugin_template_debug 47 | 48 | /* Filter signals and args */ 49 | enum 50 | { 51 | /* FILL ME */ 52 | LAST_SIGNAL 53 | }; 54 | 55 | enum 56 | { 57 | PROP_0, 58 | PROP_SILENT, 59 | }; 60 | 61 | /* the capabilities of the inputs and outputs. 62 | * 63 | * FIXME:describe the real formats here. 64 | */ 65 | static GstStaticPadTemplate sink_template = 66 | GST_STATIC_PAD_TEMPLATE ( 67 | "sink", 68 | GST_PAD_SINK, 69 | GST_PAD_ALWAYS, 70 | GST_STATIC_CAPS ("ANY") 71 | ); 72 | 73 | static GstStaticPadTemplate src_template = 74 | GST_STATIC_PAD_TEMPLATE ( 75 | "src", 76 | GST_PAD_SRC, 77 | GST_PAD_ALWAYS, 78 | GST_STATIC_CAPS ("ANY") 79 | ); 80 | 81 | #define gst_plugin_template_parent_class parent_class 82 | G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_BASE_TRANSFORM); 83 | 84 | static void gst_plugin_template_set_property (GObject * object, guint prop_id, 85 | const GValue * value, GParamSpec * pspec); 86 | static void gst_plugin_template_get_property (GObject * object, guint prop_id, 87 | GValue * value, GParamSpec * pspec); 88 | 89 | static GstFlowReturn gst_plugin_template_transform_ip (GstBaseTransform * base, 90 | GstBuffer * outbuf); 91 | 92 | /* GObject vmethod implementations */ 93 | 94 | /* initialize the plugin's class */ 95 | static void 96 | gst_plugin_template_class_init (GstPluginTemplateClass * klass) 97 | { 98 | GObjectClass *gobject_class; 99 | GstElementClass *gstelement_class; 100 | 101 | gobject_class = (GObjectClass *) klass; 102 | gstelement_class = (GstElementClass *) klass; 103 | 104 | gobject_class->set_property = gst_plugin_template_set_property; 105 | gobject_class->get_property = gst_plugin_template_get_property; 106 | 107 | g_object_class_install_property (gobject_class, PROP_SILENT, 108 | g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", 109 | FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); 110 | 111 | gst_element_class_set_details_simple (gstelement_class, 112 | "Plugin", 113 | "Generic/Filter", 114 | "FIXME:Generic Template Filter", 115 | "AUTHOR_NAME AUTHOR_EMAIL"); 116 | 117 | gst_element_class_add_pad_template (gstelement_class, 118 | gst_static_pad_template_get (&src_template)); 119 | gst_element_class_add_pad_template (gstelement_class, 120 | gst_static_pad_template_get (&sink_template)); 121 | 122 | GST_BASE_TRANSFORM_CLASS (klass)->transform_ip = 123 | GST_DEBUG_FUNCPTR (gst_plugin_template_transform_ip); 124 | 125 | /* debug category for fltering log messages 126 | * 127 | * FIXME:exchange the string 'Template plugin' with your description 128 | */ 129 | GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin", 0, "Template plugin"); 130 | } 131 | 132 | /* initialize the new element 133 | * initialize instance structure 134 | */ 135 | static void 136 | gst_plugin_template_init (GstPluginTemplate *filter) 137 | { 138 | filter->silent = FALSE; 139 | } 140 | 141 | static void 142 | gst_plugin_template_set_property (GObject * object, guint prop_id, 143 | const GValue * value, GParamSpec * pspec) 144 | { 145 | GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object); 146 | 147 | switch (prop_id) { 148 | case PROP_SILENT: 149 | filter->silent = g_value_get_boolean (value); 150 | break; 151 | default: 152 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 153 | break; 154 | } 155 | } 156 | 157 | static void 158 | gst_plugin_template_get_property (GObject * object, guint prop_id, 159 | GValue * value, GParamSpec * pspec) 160 | { 161 | GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object); 162 | 163 | switch (prop_id) { 164 | case PROP_SILENT: 165 | g_value_set_boolean (value, filter->silent); 166 | break; 167 | default: 168 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 169 | break; 170 | } 171 | } 172 | 173 | /* GstBaseTransform vmethod implementations */ 174 | 175 | /* this function does the actual processing 176 | */ 177 | static GstFlowReturn 178 | gst_plugin_template_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) 179 | { 180 | GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (base); 181 | 182 | if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (outbuf))) 183 | gst_object_sync_values (GST_OBJECT (filter), GST_BUFFER_TIMESTAMP (outbuf)); 184 | 185 | if (filter->silent == FALSE) 186 | g_print ("I'm plugged, therefore I'm in.\n"); 187 | 188 | /* FIXME: do something interesting here. This simply copies the source 189 | * to the destination. */ 190 | 191 | return GST_FLOW_OK; 192 | } 193 | 194 | 195 | /* entry point to initialize the plug-in 196 | * initialize the plug-in itself 197 | * register the element factories and other features 198 | */ 199 | static gboolean 200 | plugin_init (GstPlugin * plugin) 201 | { 202 | return gst_element_register (plugin, "plugin", GST_RANK_NONE, 203 | GST_TYPE_PLUGIN_TEMPLATE); 204 | } 205 | 206 | /* gstreamer looks for this structure to register plugins 207 | * 208 | * FIXME:exchange the string 'Template plugin' with you plugin description 209 | */ 210 | GST_PLUGIN_DEFINE ( 211 | GST_VERSION_MAJOR, 212 | GST_VERSION_MINOR, 213 | plugin, 214 | "Template plugin", 215 | plugin_init, 216 | PACKAGE_VERSION, 217 | GST_LICENSE, 218 | GST_PACKAGE_NAME, 219 | GST_PACKAGE_ORIGIN 220 | ) 221 | -------------------------------------------------------------------------------- /gst-plugin/src/gsttransform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GStreamer 3 | * Copyright (C) 2006 Stefan Kost 4 | * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 | * Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | #ifndef __GST_PLUGIN_TEMPLATE_H__ 23 | #define __GST_PLUGIN_TEMPLATE_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GST_TYPE_PLUGIN_TEMPLATE \ 31 | (gst_plugin_template_get_type()) 32 | #define GST_PLUGIN_TEMPLATE(obj) \ 33 | (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplate)) 34 | #define GST_PLUGIN_TEMPLATE_CLASS(klass) \ 35 | (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplateClass)) 36 | #define GST_IS_PLUGIN_TEMPLATE(obj) \ 37 | (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLUGIN_TEMPLATE)) 38 | #define GST_IS_PLUGIN_TEMPLATE_CLASS(klass) \ 39 | (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLUGIN_TEMPLATE)) 40 | 41 | typedef struct _GstPluginTemplate GstPluginTemplate; 42 | typedef struct _GstPluginTemplateClass GstPluginTemplateClass; 43 | 44 | struct _GstPluginTemplate { 45 | GstBaseTransform element; 46 | 47 | gboolean silent; 48 | }; 49 | 50 | struct _GstPluginTemplateClass { 51 | GstBaseTransformClass parent_class; 52 | }; 53 | 54 | GType gst_plugin_template_get_type (void); 55 | 56 | G_END_DECLS 57 | 58 | #endif /* __GST_PLUGIN_TEMPLATE_H__ */ 59 | -------------------------------------------------------------------------------- /gst-plugin/tools/make_element: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | Template=$1; 4 | srcfile=$2.c; 5 | srcfile_h=$2.h; 6 | 7 | if test x"$1" = x ; then 8 | echo "$0 Objectname [srcfile]\n"; 9 | echo " creates gstobjectname.{c,h} implementing GstObjectname\n"; 10 | exit 1; 11 | fi 12 | 13 | if test x"$2" = x ; then 14 | srcfile="gstplugin.c" 15 | srcfile_h="gstplugin.h" 16 | fi 17 | 18 | id=$(echo '$Id$' | sed \ 19 | -e 's/\$I[d]: \([^$]*\)\$/\1/g' \ 20 | ) 21 | 22 | TEMPLATE=$(echo $Template | tr a-z A-Z) 23 | template=$(echo $Template | tr A-Z a-z) 24 | filename=$(echo $template | tr -d _) 25 | Template=$(echo $Template | tr -d _) 26 | template_=$(echo $Template | sed "s/\([a-z]\)\([A-Z]\)/\1_\2/g" | tr A-Z a-z) 27 | 28 | YEAR=`date "+%Y"` 29 | if [ -z "$REAL_NAME" ]; then 30 | user=`id -u` 31 | if [ `which 2>/dev/null getent` ]; then 32 | entry=`getent passwd $user` 33 | else 34 | entry=`grep $user /etc/passwd` 35 | fi 36 | REAL_NAME=`echo $entry | awk -F":" '{ print $5 }' | awk -F"," '{ print $1 }'` 37 | fi 38 | if [ -z "$EMAIL_ADDRESS" ]; then 39 | EMAIL_ADDRESS="" 40 | fi 41 | 42 | # remember to break up the Id: in the line below 43 | sed \ 44 | -e 's/gstplugin\.c/SOURCEFILE/g' \ 45 | -e "s/gstplugin\.h/gst$filename.h/g" \ 46 | -e "s/gsttransform\.h/gst$filename.h/g" \ 47 | -e "s/GstPluginTemplate/Gst$Template/g" \ 48 | -e "s/gst_plugin_template/gst_$template_/g" \ 49 | -e "s/gst_type_plugin_template/gst_$template_/g" \ 50 | -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \ 51 | -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \ 52 | -e 's/\$I[d]: \([^$]*\)\$/\1/g' \ 53 | -e 's/SOURCEFILE/gstobject\.c/g' \ 54 | -e "s%MAKEFILTERVERSION%$id%g" \ 55 | -e "s/plugin/$template/g" \ 56 | -e "s/\([^G][^s][^t]\)Plugin/\1$Template/g" \ 57 | -e "s/YEAR/$YEAR/g" \ 58 | -e "s/AUTHOR_NAME/$REAL_NAME/g" \ 59 | -e "s/AUTHOR_EMAIL/<$EMAIL_ADDRESS>/g" \ 60 | $srcfile >gst$filename.c.tmp && mv gst$filename.c.tmp gst$filename.c 61 | 62 | if [ -e $srcfile_h ]; then 63 | sed \ 64 | -e 's/gstplugin\.c/SOURCEFILE/g' \ 65 | -e "s/GstPluginTemplate/Gst$Template/g" \ 66 | -e "s/gst_plugin_template/gst_$template_/g" \ 67 | -e "s/gst_type_plugin_template/gst_$template_/g" \ 68 | -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \ 69 | -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \ 70 | -e "s/GST_IS_PLUGIN_TEMPLATE/GST_IS_$TEMPLATE/g" \ 71 | -e 's/\$I[d]: \([^$]*\)\$/\1/g' \ 72 | -e 's/SOURCEFILE/gstobject\.c/g' \ 73 | -e "s%MAKEFILTERVERSION%$id%g" \ 74 | -e "s/plugin/$template/g" \ 75 | -e "s/\([^G][^s][^t]\)Plugin/\1$Template/g" \ 76 | -e "s/YEAR/$YEAR/g" \ 77 | -e "s/AUTHOR_NAME/$REAL_NAME/g" \ 78 | -e "s/AUTHOR_EMAIL/<$EMAIL_ADDRESS>/g" \ 79 | $srcfile_h >gst$filename.h.tmp && mv gst$filename.h.tmp gst$filename.h 80 | fi 81 | 82 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('gst-template', 'cpp', version : '1.17.0.1', license : 'LGPL') 2 | 3 | plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0') 4 | 5 | cc = meson.get_compiler('cpp') 6 | 7 | gst_version = meson.project_version() 8 | 9 | api_version = '1.0' 10 | 11 | gst_dep = dependency('gstreamer-1.0', 12 | fallback : ['gstreamer', 'gst_dep']) 13 | 14 | subdir('gst-app') 15 | subdir('gst-plugin') 16 | --------------------------------------------------------------------------------