[svn r618] moved to gst-gmyth trunk
authorrenatofilho
Tue May 01 17:22:20 2007 +0100 (2007-05-01)
branchtrunk
changeset 61281f031485b52
parent 611 aa1f309ec686
child 613 289e2d11d16c
[svn r618] moved to gst-gmyth
gst-plugins-nuvdemux/AUTHORS
gst-plugins-nuvdemux/COPYING
gst-plugins-nuvdemux/ChangeLog
gst-plugins-nuvdemux/INSTALL
gst-plugins-nuvdemux/Makefile.am
gst-plugins-nuvdemux/NEWS
gst-plugins-nuvdemux/README
gst-plugins-nuvdemux/autogen.sh
gst-plugins-nuvdemux/config.h.in
gst-plugins-nuvdemux/configure.ac
gst-plugins-nuvdemux/debian/changelog
gst-plugins-nuvdemux/debian/compat
gst-plugins-nuvdemux/debian/control
gst-plugins-nuvdemux/debian/copyright
gst-plugins-nuvdemux/debian/files
gst-plugins-nuvdemux/debian/gstreamer0.10-indt-nuvdemux.install
gst-plugins-nuvdemux/debian/maemo-nuvdemux.install
gst-plugins-nuvdemux/debian/maemo-nuvdemux.postinst
gst-plugins-nuvdemux/debian/nuv.xml
gst-plugins-nuvdemux/debian/osso_media_server_nuv.schemas
gst-plugins-nuvdemux/debian/rules
gst-plugins-nuvdemux/m4/Makefile.am
gst-plugins-nuvdemux/m4/as-compiler-flag.m4
gst-plugins-nuvdemux/m4/as-version.m4
gst-plugins-nuvdemux/m4/gst-feature.m4
gst-plugins-nuvdemux/nuvdemux/Makefile.am
gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.h
gst-plugins-nuvdemux/typefind/Makefile.am
gst-plugins-nuvdemux/typefind/gsttypefindfunctions.c
     1.1 --- a/gst-plugins-nuvdemux/COPYING	Tue May 01 17:03:38 2007 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,340 +0,0 @@
     1.4 -		    GNU GENERAL PUBLIC LICENSE
     1.5 -		       Version 2, June 1991
     1.6 -
     1.7 - Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     1.8 -     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     1.9 - Everyone is permitted to copy and distribute verbatim copies
    1.10 - of this license document, but changing it is not allowed.
    1.11 -
    1.12 -			    Preamble
    1.13 -
    1.14 -  The licenses for most software are designed to take away your
    1.15 -freedom to share and change it.  By contrast, the GNU General Public
    1.16 -License is intended to guarantee your freedom to share and change free
    1.17 -software--to make sure the software is free for all its users.  This
    1.18 -General Public License applies to most of the Free Software
    1.19 -Foundation's software and to any other program whose authors commit to
    1.20 -using it.  (Some other Free Software Foundation software is covered by
    1.21 -the GNU Library General Public License instead.)  You can apply it to
    1.22 -your programs, too.
    1.23 -
    1.24 -  When we speak of free software, we are referring to freedom, not
    1.25 -price.  Our General Public Licenses are designed to make sure that you
    1.26 -have the freedom to distribute copies of free software (and charge for
    1.27 -this service if you wish), that you receive source code or can get it
    1.28 -if you want it, that you can change the software or use pieces of it
    1.29 -in new free programs; and that you know you can do these things.
    1.30 -
    1.31 -  To protect your rights, we need to make restrictions that forbid
    1.32 -anyone to deny you these rights or to ask you to surrender the rights.
    1.33 -These restrictions translate to certain responsibilities for you if you
    1.34 -distribute copies of the software, or if you modify it.
    1.35 -
    1.36 -  For example, if you distribute copies of such a program, whether
    1.37 -gratis or for a fee, you must give the recipients all the rights that
    1.38 -you have.  You must make sure that they, too, receive or can get the
    1.39 -source code.  And you must show them these terms so they know their
    1.40 -rights.
    1.41 -
    1.42 -  We protect your rights with two steps: (1) copyright the software, and
    1.43 -(2) offer you this license which gives you legal permission to copy,
    1.44 -distribute and/or modify the software.
    1.45 -
    1.46 -  Also, for each author's protection and ours, we want to make certain
    1.47 -that everyone understands that there is no warranty for this free
    1.48 -software.  If the software is modified by someone else and passed on, we
    1.49 -want its recipients to know that what they have is not the original, so
    1.50 -that any problems introduced by others will not reflect on the original
    1.51 -authors' reputations.
    1.52 -
    1.53 -  Finally, any free program is threatened constantly by software
    1.54 -patents.  We wish to avoid the danger that redistributors of a free
    1.55 -program will individually obtain patent licenses, in effect making the
    1.56 -program proprietary.  To prevent this, we have made it clear that any
    1.57 -patent must be licensed for everyone's free use or not licensed at all.
    1.58 -
    1.59 -  The precise terms and conditions for copying, distribution and
    1.60 -modification follow.
    1.61 -
    1.62 -		    GNU GENERAL PUBLIC LICENSE
    1.63 -   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    1.64 -
    1.65 -  0. This License applies to any program or other work which contains
    1.66 -a notice placed by the copyright holder saying it may be distributed
    1.67 -under the terms of this General Public License.  The "Program", below,
    1.68 -refers to any such program or work, and a "work based on the Program"
    1.69 -means either the Program or any derivative work under copyright law:
    1.70 -that is to say, a work containing the Program or a portion of it,
    1.71 -either verbatim or with modifications and/or translated into another
    1.72 -language.  (Hereinafter, translation is included without limitation in
    1.73 -the term "modification".)  Each licensee is addressed as "you".
    1.74 -
    1.75 -Activities other than copying, distribution and modification are not
    1.76 -covered by this License; they are outside its scope.  The act of
    1.77 -running the Program is not restricted, and the output from the Program
    1.78 -is covered only if its contents constitute a work based on the
    1.79 -Program (independent of having been made by running the Program).
    1.80 -Whether that is true depends on what the Program does.
    1.81 -
    1.82 -  1. You may copy and distribute verbatim copies of the Program's
    1.83 -source code as you receive it, in any medium, provided that you
    1.84 -conspicuously and appropriately publish on each copy an appropriate
    1.85 -copyright notice and disclaimer of warranty; keep intact all the
    1.86 -notices that refer to this License and to the absence of any warranty;
    1.87 -and give any other recipients of the Program a copy of this License
    1.88 -along with the Program.
    1.89 -
    1.90 -You may charge a fee for the physical act of transferring a copy, and
    1.91 -you may at your option offer warranty protection in exchange for a fee.
    1.92 -
    1.93 -  2. You may modify your copy or copies of the Program or any portion
    1.94 -of it, thus forming a work based on the Program, and copy and
    1.95 -distribute such modifications or work under the terms of Section 1
    1.96 -above, provided that you also meet all of these conditions:
    1.97 -
    1.98 -    a) You must cause the modified files to carry prominent notices
    1.99 -    stating that you changed the files and the date of any change.
   1.100 -
   1.101 -    b) You must cause any work that you distribute or publish, that in
   1.102 -    whole or in part contains or is derived from the Program or any
   1.103 -    part thereof, to be licensed as a whole at no charge to all third
   1.104 -    parties under the terms of this License.
   1.105 -
   1.106 -    c) If the modified program normally reads commands interactively
   1.107 -    when run, you must cause it, when started running for such
   1.108 -    interactive use in the most ordinary way, to print or display an
   1.109 -    announcement including an appropriate copyright notice and a
   1.110 -    notice that there is no warranty (or else, saying that you provide
   1.111 -    a warranty) and that users may redistribute the program under
   1.112 -    these conditions, and telling the user how to view a copy of this
   1.113 -    License.  (Exception: if the Program itself is interactive but
   1.114 -    does not normally print such an announcement, your work based on
   1.115 -    the Program is not required to print an announcement.)
   1.116 -
   1.117 -These requirements apply to the modified work as a whole.  If
   1.118 -identifiable sections of that work are not derived from the Program,
   1.119 -and can be reasonably considered independent and separate works in
   1.120 -themselves, then this License, and its terms, do not apply to those
   1.121 -sections when you distribute them as separate works.  But when you
   1.122 -distribute the same sections as part of a whole which is a work based
   1.123 -on the Program, the distribution of the whole must be on the terms of
   1.124 -this License, whose permissions for other licensees extend to the
   1.125 -entire whole, and thus to each and every part regardless of who wrote it.
   1.126 -
   1.127 -Thus, it is not the intent of this section to claim rights or contest
   1.128 -your rights to work written entirely by you; rather, the intent is to
   1.129 -exercise the right to control the distribution of derivative or
   1.130 -collective works based on the Program.
   1.131 -
   1.132 -In addition, mere aggregation of another work not based on the Program
   1.133 -with the Program (or with a work based on the Program) on a volume of
   1.134 -a storage or distribution medium does not bring the other work under
   1.135 -the scope of this License.
   1.136 -
   1.137 -  3. You may copy and distribute the Program (or a work based on it,
   1.138 -under Section 2) in object code or executable form under the terms of
   1.139 -Sections 1 and 2 above provided that you also do one of the following:
   1.140 -
   1.141 -    a) Accompany it with the complete corresponding machine-readable
   1.142 -    source code, which must be distributed under the terms of Sections
   1.143 -    1 and 2 above on a medium customarily used for software interchange; or,
   1.144 -
   1.145 -    b) Accompany it with a written offer, valid for at least three
   1.146 -    years, to give any third party, for a charge no more than your
   1.147 -    cost of physically performing source distribution, a complete
   1.148 -    machine-readable copy of the corresponding source code, to be
   1.149 -    distributed under the terms of Sections 1 and 2 above on a medium
   1.150 -    customarily used for software interchange; or,
   1.151 -
   1.152 -    c) Accompany it with the information you received as to the offer
   1.153 -    to distribute corresponding source code.  (This alternative is
   1.154 -    allowed only for noncommercial distribution and only if you
   1.155 -    received the program in object code or executable form with such
   1.156 -    an offer, in accord with Subsection b above.)
   1.157 -
   1.158 -The source code for a work means the preferred form of the work for
   1.159 -making modifications to it.  For an executable work, complete source
   1.160 -code means all the source code for all modules it contains, plus any
   1.161 -associated interface definition files, plus the scripts used to
   1.162 -control compilation and installation of the executable.  However, as a
   1.163 -special exception, the source code distributed need not include
   1.164 -anything that is normally distributed (in either source or binary
   1.165 -form) with the major components (compiler, kernel, and so on) of the
   1.166 -operating system on which the executable runs, unless that component
   1.167 -itself accompanies the executable.
   1.168 -
   1.169 -If distribution of executable or object code is made by offering
   1.170 -access to copy from a designated place, then offering equivalent
   1.171 -access to copy the source code from the same place counts as
   1.172 -distribution of the source code, even though third parties are not
   1.173 -compelled to copy the source along with the object code.
   1.174 -
   1.175 -  4. You may not copy, modify, sublicense, or distribute the Program
   1.176 -except as expressly provided under this License.  Any attempt
   1.177 -otherwise to copy, modify, sublicense or distribute the Program is
   1.178 -void, and will automatically terminate your rights under this License.
   1.179 -However, parties who have received copies, or rights, from you under
   1.180 -this License will not have their licenses terminated so long as such
   1.181 -parties remain in full compliance.
   1.182 -
   1.183 -  5. You are not required to accept this License, since you have not
   1.184 -signed it.  However, nothing else grants you permission to modify or
   1.185 -distribute the Program or its derivative works.  These actions are
   1.186 -prohibited by law if you do not accept this License.  Therefore, by
   1.187 -modifying or distributing the Program (or any work based on the
   1.188 -Program), you indicate your acceptance of this License to do so, and
   1.189 -all its terms and conditions for copying, distributing or modifying
   1.190 -the Program or works based on it.
   1.191 -
   1.192 -  6. Each time you redistribute the Program (or any work based on the
   1.193 -Program), the recipient automatically receives a license from the
   1.194 -original licensor to copy, distribute or modify the Program subject to
   1.195 -these terms and conditions.  You may not impose any further
   1.196 -restrictions on the recipients' exercise of the rights granted herein.
   1.197 -You are not responsible for enforcing compliance by third parties to
   1.198 -this License.
   1.199 -
   1.200 -  7. If, as a consequence of a court judgment or allegation of patent
   1.201 -infringement or for any other reason (not limited to patent issues),
   1.202 -conditions are imposed on you (whether by court order, agreement or
   1.203 -otherwise) that contradict the conditions of this License, they do not
   1.204 -excuse you from the conditions of this License.  If you cannot
   1.205 -distribute so as to satisfy simultaneously your obligations under this
   1.206 -License and any other pertinent obligations, then as a consequence you
   1.207 -may not distribute the Program at all.  For example, if a patent
   1.208 -license would not permit royalty-free redistribution of the Program by
   1.209 -all those who receive copies directly or indirectly through you, then
   1.210 -the only way you could satisfy both it and this License would be to
   1.211 -refrain entirely from distribution of the Program.
   1.212 -
   1.213 -If any portion of this section is held invalid or unenforceable under
   1.214 -any particular circumstance, the balance of the section is intended to
   1.215 -apply and the section as a whole is intended to apply in other
   1.216 -circumstances.
   1.217 -
   1.218 -It is not the purpose of this section to induce you to infringe any
   1.219 -patents or other property right claims or to contest validity of any
   1.220 -such claims; this section has the sole purpose of protecting the
   1.221 -integrity of the free software distribution system, which is
   1.222 -implemented by public license practices.  Many people have made
   1.223 -generous contributions to the wide range of software distributed
   1.224 -through that system in reliance on consistent application of that
   1.225 -system; it is up to the author/donor to decide if he or she is willing
   1.226 -to distribute software through any other system and a licensee cannot
   1.227 -impose that choice.
   1.228 -
   1.229 -This section is intended to make thoroughly clear what is believed to
   1.230 -be a consequence of the rest of this License.
   1.231 -
   1.232 -  8. If the distribution and/or use of the Program is restricted in
   1.233 -certain countries either by patents or by copyrighted interfaces, the
   1.234 -original copyright holder who places the Program under this License
   1.235 -may add an explicit geographical distribution limitation excluding
   1.236 -those countries, so that distribution is permitted only in or among
   1.237 -countries not thus excluded.  In such case, this License incorporates
   1.238 -the limitation as if written in the body of this License.
   1.239 -
   1.240 -  9. The Free Software Foundation may publish revised and/or new versions
   1.241 -of the General Public License from time to time.  Such new versions will
   1.242 -be similar in spirit to the present version, but may differ in detail to
   1.243 -address new problems or concerns.
   1.244 -
   1.245 -Each version is given a distinguishing version number.  If the Program
   1.246 -specifies a version number of this License which applies to it and "any
   1.247 -later version", you have the option of following the terms and conditions
   1.248 -either of that version or of any later version published by the Free
   1.249 -Software Foundation.  If the Program does not specify a version number of
   1.250 -this License, you may choose any version ever published by the Free Software
   1.251 -Foundation.
   1.252 -
   1.253 -  10. If you wish to incorporate parts of the Program into other free
   1.254 -programs whose distribution conditions are different, write to the author
   1.255 -to ask for permission.  For software which is copyrighted by the Free
   1.256 -Software Foundation, write to the Free Software Foundation; we sometimes
   1.257 -make exceptions for this.  Our decision will be guided by the two goals
   1.258 -of preserving the free status of all derivatives of our free software and
   1.259 -of promoting the sharing and reuse of software generally.
   1.260 -
   1.261 -			    NO WARRANTY
   1.262 -
   1.263 -  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
   1.264 -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
   1.265 -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
   1.266 -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
   1.267 -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   1.268 -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
   1.269 -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
   1.270 -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
   1.271 -REPAIR OR CORRECTION.
   1.272 -
   1.273 -  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
   1.274 -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
   1.275 -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
   1.276 -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
   1.277 -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
   1.278 -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
   1.279 -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
   1.280 -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
   1.281 -POSSIBILITY OF SUCH DAMAGES.
   1.282 -
   1.283 -		     END OF TERMS AND CONDITIONS
   1.284 -
   1.285 -	    How to Apply These Terms to Your New Programs
   1.286 -
   1.287 -  If you develop a new program, and you want it to be of the greatest
   1.288 -possible use to the public, the best way to achieve this is to make it
   1.289 -free software which everyone can redistribute and change under these terms.
   1.290 -
   1.291 -  To do so, attach the following notices to the program.  It is safest
   1.292 -to attach them to the start of each source file to most effectively
   1.293 -convey the exclusion of warranty; and each file should have at least
   1.294 -the "copyright" line and a pointer to where the full notice is found.
   1.295 -
   1.296 -    <one line to give the program's name and a brief idea of what it does.>
   1.297 -    Copyright (C) <year>  <name of author>
   1.298 -
   1.299 -    This program is free software; you can redistribute it and/or modify
   1.300 -    it under the terms of the GNU General Public License as published by
   1.301 -    the Free Software Foundation; either version 2 of the License, or
   1.302 -    (at your option) any later version.
   1.303 -
   1.304 -    This program is distributed in the hope that it will be useful,
   1.305 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.306 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.307 -    GNU General Public License for more details.
   1.308 -
   1.309 -    You should have received a copy of the GNU General Public License
   1.310 -    along with this program; if not, write to the Free Software
   1.311 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   1.312 -
   1.313 -
   1.314 -Also add information on how to contact you by electronic and paper mail.
   1.315 -
   1.316 -If the program is interactive, make it output a short notice like this
   1.317 -when it starts in an interactive mode:
   1.318 -
   1.319 -    Gnomovision version 69, Copyright (C) year  name of author
   1.320 -    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
   1.321 -    This is free software, and you are welcome to redistribute it
   1.322 -    under certain conditions; type `show c' for details.
   1.323 -
   1.324 -The hypothetical commands `show w' and `show c' should show the appropriate
   1.325 -parts of the General Public License.  Of course, the commands you use may
   1.326 -be called something other than `show w' and `show c'; they could even be
   1.327 -mouse-clicks or menu items--whatever suits your program.
   1.328 -
   1.329 -You should also get your employer (if you work as a programmer) or your
   1.330 -school, if any, to sign a "copyright disclaimer" for the program, if
   1.331 -necessary.  Here is a sample; alter the names:
   1.332 -
   1.333 -  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
   1.334 -  `Gnomovision' (which makes passes at compilers) written by James Hacker.
   1.335 -
   1.336 -  <signature of Ty Coon>, 1 April 1989
   1.337 -  Ty Coon, President of Vice
   1.338 -
   1.339 -This General Public License does not permit incorporating your program into
   1.340 -proprietary programs.  If your program is a subroutine library, you may
   1.341 -consider it more useful to permit linking proprietary applications with the
   1.342 -library.  If this is what you want to do, use the GNU Library General
   1.343 -Public License instead of this License.
     2.1 --- a/gst-plugins-nuvdemux/INSTALL	Tue May 01 17:03:38 2007 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,229 +0,0 @@
     2.4 -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
     2.5 -Foundation, Inc.
     2.6 -
     2.7 -   This file is free documentation; the Free Software Foundation gives
     2.8 -unlimited permission to copy, distribute and modify it.
     2.9 -
    2.10 -Basic Installation
    2.11 -==================
    2.12 -
    2.13 -   These are generic installation instructions.
    2.14 -
    2.15 -   The `configure' shell script attempts to guess correct values for
    2.16 -various system-dependent variables used during compilation.  It uses
    2.17 -those values to create a `Makefile' in each directory of the package.
    2.18 -It may also create one or more `.h' files containing system-dependent
    2.19 -definitions.  Finally, it creates a shell script `config.status' that
    2.20 -you can run in the future to recreate the current configuration, and a
    2.21 -file `config.log' containing compiler output (useful mainly for
    2.22 -debugging `configure').
    2.23 -
    2.24 -   It can also use an optional file (typically called `config.cache'
    2.25 -and enabled with `--cache-file=config.cache' or simply `-C') that saves
    2.26 -the results of its tests to speed up reconfiguring.  (Caching is
    2.27 -disabled by default to prevent problems with accidental use of stale
    2.28 -cache files.)
    2.29 -
    2.30 -   If you need to do unusual things to compile the package, please try
    2.31 -to figure out how `configure' could check whether to do them, and mail
    2.32 -diffs or instructions to the address given in the `README' so they can
    2.33 -be considered for the next release.  If you are using the cache, and at
    2.34 -some point `config.cache' contains results you don't want to keep, you
    2.35 -may remove or edit it.
    2.36 -
    2.37 -   The file `configure.ac' (or `configure.in') is used to create
    2.38 -`configure' by a program called `autoconf'.  You only need
    2.39 -`configure.ac' if you want to change it or regenerate `configure' using
    2.40 -a newer version of `autoconf'.
    2.41 -
    2.42 -The simplest way to compile this package is:
    2.43 -
    2.44 -  1. `cd' to the directory containing the package's source code and type
    2.45 -     `./configure' to configure the package for your system.  If you're
    2.46 -     using `csh' on an old version of System V, you might need to type
    2.47 -     `sh ./configure' instead to prevent `csh' from trying to execute
    2.48 -     `configure' itself.
    2.49 -
    2.50 -     Running `configure' takes awhile.  While running, it prints some
    2.51 -     messages telling which features it is checking for.
    2.52 -
    2.53 -  2. Type `make' to compile the package.
    2.54 -
    2.55 -  3. Optionally, type `make check' to run any self-tests that come with
    2.56 -     the package.
    2.57 -
    2.58 -  4. Type `make install' to install the programs and any data files and
    2.59 -     documentation.
    2.60 -
    2.61 -  5. You can remove the program binaries and object files from the
    2.62 -     source code directory by typing `make clean'.  To also remove the
    2.63 -     files that `configure' created (so you can compile the package for
    2.64 -     a different kind of computer), type `make distclean'.  There is
    2.65 -     also a `make maintainer-clean' target, but that is intended mainly
    2.66 -     for the package's developers.  If you use it, you may have to get
    2.67 -     all sorts of other programs in order to regenerate files that came
    2.68 -     with the distribution.
    2.69 -
    2.70 -Compilers and Options
    2.71 -=====================
    2.72 -
    2.73 -   Some systems require unusual options for compilation or linking that
    2.74 -the `configure' script does not know about.  Run `./configure --help'
    2.75 -for details on some of the pertinent environment variables.
    2.76 -
    2.77 -   You can give `configure' initial values for configuration parameters
    2.78 -by setting variables in the command line or in the environment.  Here
    2.79 -is an example:
    2.80 -
    2.81 -     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
    2.82 -
    2.83 -   *Note Defining Variables::, for more details.
    2.84 -
    2.85 -Compiling For Multiple Architectures
    2.86 -====================================
    2.87 -
    2.88 -   You can compile the package for more than one kind of computer at the
    2.89 -same time, by placing the object files for each architecture in their
    2.90 -own directory.  To do this, you must use a version of `make' that
    2.91 -supports the `VPATH' variable, such as GNU `make'.  `cd' to the
    2.92 -directory where you want the object files and executables to go and run
    2.93 -the `configure' script.  `configure' automatically checks for the
    2.94 -source code in the directory that `configure' is in and in `..'.
    2.95 -
    2.96 -   If you have to use a `make' that does not support the `VPATH'
    2.97 -variable, you have to compile the package for one architecture at a
    2.98 -time in the source code directory.  After you have installed the
    2.99 -package for one architecture, use `make distclean' before reconfiguring
   2.100 -for another architecture.
   2.101 -
   2.102 -Installation Names
   2.103 -==================
   2.104 -
   2.105 -   By default, `make install' will install the package's files in
   2.106 -`/usr/local/bin', `/usr/local/man', etc.  You can specify an
   2.107 -installation prefix other than `/usr/local' by giving `configure' the
   2.108 -option `--prefix=PATH'.
   2.109 -
   2.110 -   You can specify separate installation prefixes for
   2.111 -architecture-specific files and architecture-independent files.  If you
   2.112 -give `configure' the option `--exec-prefix=PATH', the package will use
   2.113 -PATH as the prefix for installing programs and libraries.
   2.114 -Documentation and other data files will still use the regular prefix.
   2.115 -
   2.116 -   In addition, if you use an unusual directory layout you can give
   2.117 -options like `--bindir=PATH' to specify different values for particular
   2.118 -kinds of files.  Run `configure --help' for a list of the directories
   2.119 -you can set and what kinds of files go in them.
   2.120 -
   2.121 -   If the package supports it, you can cause programs to be installed
   2.122 -with an extra prefix or suffix on their names by giving `configure' the
   2.123 -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
   2.124 -
   2.125 -Optional Features
   2.126 -=================
   2.127 -
   2.128 -   Some packages pay attention to `--enable-FEATURE' options to
   2.129 -`configure', where FEATURE indicates an optional part of the package.
   2.130 -They may also pay attention to `--with-PACKAGE' options, where PACKAGE
   2.131 -is something like `gnu-as' or `x' (for the X Window System).  The
   2.132 -`README' should mention any `--enable-' and `--with-' options that the
   2.133 -package recognizes.
   2.134 -
   2.135 -   For packages that use the X Window System, `configure' can usually
   2.136 -find the X include and library files automatically, but if it doesn't,
   2.137 -you can use the `configure' options `--x-includes=DIR' and
   2.138 -`--x-libraries=DIR' to specify their locations.
   2.139 -
   2.140 -Specifying the System Type
   2.141 -==========================
   2.142 -
   2.143 -   There may be some features `configure' cannot figure out
   2.144 -automatically, but needs to determine by the type of machine the package
   2.145 -will run on.  Usually, assuming the package is built to be run on the
   2.146 -_same_ architectures, `configure' can figure that out, but if it prints
   2.147 -a message saying it cannot guess the machine type, give it the
   2.148 -`--build=TYPE' option.  TYPE can either be a short name for the system
   2.149 -type, such as `sun4', or a canonical name which has the form:
   2.150 -
   2.151 -     CPU-COMPANY-SYSTEM
   2.152 -
   2.153 -where SYSTEM can have one of these forms:
   2.154 -
   2.155 -     OS KERNEL-OS
   2.156 -
   2.157 -   See the file `config.sub' for the possible values of each field.  If
   2.158 -`config.sub' isn't included in this package, then this package doesn't
   2.159 -need to know the machine type.
   2.160 -
   2.161 -   If you are _building_ compiler tools for cross-compiling, you should
   2.162 -use the `--target=TYPE' option to select the type of system they will
   2.163 -produce code for.
   2.164 -
   2.165 -   If you want to _use_ a cross compiler, that generates code for a
   2.166 -platform different from the build platform, you should specify the
   2.167 -"host" platform (i.e., that on which the generated programs will
   2.168 -eventually be run) with `--host=TYPE'.
   2.169 -
   2.170 -Sharing Defaults
   2.171 -================
   2.172 -
   2.173 -   If you want to set default values for `configure' scripts to share,
   2.174 -you can create a site shell script called `config.site' that gives
   2.175 -default values for variables like `CC', `cache_file', and `prefix'.
   2.176 -`configure' looks for `PREFIX/share/config.site' if it exists, then
   2.177 -`PREFIX/etc/config.site' if it exists.  Or, you can set the
   2.178 -`CONFIG_SITE' environment variable to the location of the site script.
   2.179 -A warning: not all `configure' scripts look for a site script.
   2.180 -
   2.181 -Defining Variables
   2.182 -==================
   2.183 -
   2.184 -   Variables not defined in a site shell script can be set in the
   2.185 -environment passed to `configure'.  However, some packages may run
   2.186 -configure again during the build, and the customized values of these
   2.187 -variables may be lost.  In order to avoid this problem, you should set
   2.188 -them in the `configure' command line, using `VAR=value'.  For example:
   2.189 -
   2.190 -     ./configure CC=/usr/local2/bin/gcc
   2.191 -
   2.192 -will cause the specified gcc to be used as the C compiler (unless it is
   2.193 -overridden in the site shell script).
   2.194 -
   2.195 -`configure' Invocation
   2.196 -======================
   2.197 -
   2.198 -   `configure' recognizes the following options to control how it
   2.199 -operates.
   2.200 -
   2.201 -`--help'
   2.202 -`-h'
   2.203 -     Print a summary of the options to `configure', and exit.
   2.204 -
   2.205 -`--version'
   2.206 -`-V'
   2.207 -     Print the version of Autoconf used to generate the `configure'
   2.208 -     script, and exit.
   2.209 -
   2.210 -`--cache-file=FILE'
   2.211 -     Enable the cache: use and save the results of the tests in FILE,
   2.212 -     traditionally `config.cache'.  FILE defaults to `/dev/null' to
   2.213 -     disable caching.
   2.214 -
   2.215 -`--config-cache'
   2.216 -`-C'
   2.217 -     Alias for `--cache-file=config.cache'.
   2.218 -
   2.219 -`--quiet'
   2.220 -`--silent'
   2.221 -`-q'
   2.222 -     Do not print messages saying which checks are being made.  To
   2.223 -     suppress all normal output, redirect it to `/dev/null' (any error
   2.224 -     messages will still be shown).
   2.225 -
   2.226 -`--srcdir=DIR'
   2.227 -     Look for the package's source code in directory DIR.  Usually
   2.228 -     `configure' can determine that directory automatically.
   2.229 -
   2.230 -`configure' also accepts some other, not widely useful, options.  Run
   2.231 -`configure --help' for more details.
   2.232 -
     3.1 --- a/gst-plugins-nuvdemux/Makefile.am	Tue May 01 17:03:38 2007 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,4 +0,0 @@
     3.4 -ACLOCAL_AMFLAGS = -I m4
     3.5 -
     3.6 -SUBDIRS = nuvdemux typefind
     3.7 -DIST_SUBDIRS = m4
     4.1 --- a/gst-plugins-nuvdemux/autogen.sh	Tue May 01 17:03:38 2007 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,115 +0,0 @@
     4.4 -#!/bin/sh
     4.5 -# Run this to generate all the initial makefiles, etc.
     4.6 -
     4.7 -# Not all echo versions allow -n, so we check what is possible. This test is
     4.8 -# based on the one in autoconf.
     4.9 -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
    4.10 -  *c*,-n*) ECHO_N= ;;
    4.11 -  *c*,*  ) ECHO_N=-n ;;
    4.12 -  *)       ECHO_N= ;;
    4.13 -esac
    4.14 -
    4.15 -
    4.16 -# some terminal codes ...
    4.17 -boldface="`tput bold 2>/dev/null`"
    4.18 -normal="`tput sgr0 2>/dev/null`"
    4.19 -printbold() {
    4.20 -    echo $ECHO_N "$boldface"
    4.21 -    echo "$@"
    4.22 -    echo $ECHO_N "$normal"
    4.23 -}    
    4.24 -printerr() {
    4.25 -    echo "$@" >&2
    4.26 -}
    4.27 -
    4.28 -# Usage:
    4.29 -#     compare_versions MIN_VERSION ACTUAL_VERSION
    4.30 -# returns true if ACTUAL_VERSION >= MIN_VERSION
    4.31 -compare_versions() {
    4.32 -    ch_min_version=$1
    4.33 -    ch_actual_version=$2
    4.34 -    ch_status=0
    4.35 -    IFS="${IFS=         }"; ch_save_IFS="$IFS"; IFS="."
    4.36 -    set $ch_actual_version
    4.37 -    for ch_min in $ch_min_version; do
    4.38 -        ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
    4.39 -        if [ -z "$ch_min" ]; then break; fi
    4.40 -        if [ -z "$ch_cur" ]; then ch_status=1; break; fi
    4.41 -        if [ $ch_cur -gt $ch_min ]; then break; fi
    4.42 -        if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
    4.43 -    done
    4.44 -    IFS="$ch_save_IFS"
    4.45 -    return $ch_status
    4.46 -}
    4.47 -
    4.48 -# Usage:
    4.49 -#     version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
    4.50 -# checks to see if the package is available
    4.51 -version_check() {
    4.52 -    vc_package=$1
    4.53 -    vc_variable=$2
    4.54 -    vc_checkprogs=$3
    4.55 -    vc_min_version=$4
    4.56 -    vc_source=$5
    4.57 -    vc_status=1
    4.58 -
    4.59 -    vc_checkprog=`eval echo "\\$$vc_variable"`
    4.60 -    if [ -n "$vc_checkprog" ]; then
    4.61 -	printbold "using $vc_checkprog for $vc_package"
    4.62 -	return 0
    4.63 -    fi
    4.64 -
    4.65 -    printbold "checking for $vc_package >= $vc_min_version..."
    4.66 -    for vc_checkprog in $vc_checkprogs; do
    4.67 -	echo $ECHO_N "  testing $vc_checkprog... "
    4.68 -	if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then
    4.69 -	    vc_actual_version=`$vc_checkprog --version | head -n 1 | \
    4.70 -                               sed 's/^.*[ 	]\([0-9.]*[a-z]*\).*$/\1/'`
    4.71 -	    if compare_versions $vc_min_version $vc_actual_version; then
    4.72 -		echo "found $vc_actual_version"
    4.73 -		# set variable
    4.74 -		eval "$vc_variable=$vc_checkprog"
    4.75 -		vc_status=0
    4.76 -		break
    4.77 -	    else
    4.78 -		echo "too old (found version $vc_actual_version)"
    4.79 -	    fi
    4.80 -	else
    4.81 -	    echo "not found."
    4.82 -	fi
    4.83 -    done
    4.84 -    if [ "$vc_status" != 0 ]; then
    4.85 -	printerr "***Error***: You must have $vc_package >= $vc_min_version installed"
    4.86 -	printerr "  to build $PKG_NAME.  Download the appropriate package for"
    4.87 -	printerr "  from your distribution or get the source tarball at"
    4.88 -        printerr "    $vc_source"
    4.89 -	printerr
    4.90 -    fi
    4.91 -    return $vc_status
    4.92 -}
    4.93 -
    4.94 -#tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13
    4.95 -WANT_AUTOCONF_2_5=1
    4.96 -export WANT_AUTOCONF_2_5
    4.97 -version_check autoreconf AUTORECONF 'autoreconf' 2.50 \
    4.98 -    "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.50.tar.gz" || DIE=1
    4.99 -
   4.100 -automake_progs="automake automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake-1.5"
   4.101 -
   4.102 -version_check automake AUTOMAKE "$automake_progs" 1.5 \
   4.103 -    "http://ftp.gnu.org/pub/gnu/automake/automake-1.5.tar.gz" || DIE=1
   4.104 -ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/`
   4.105 -
   4.106 -export AUTOMAKE ACLOCAL
   4.107 -# gtkdocize
   4.108 -autoreconf --install --force || exit 1
   4.109 -
   4.110 -#conf_flags="--enable-maintainer-mode"
   4.111 -
   4.112 -if test x$NOCONFIGURE = x; then
   4.113 -    printbold Running $srcdir/configure $conf_flags "$@" ...
   4.114 -    ./configure $conf_flags "$@" \
   4.115 -	&& echo Now type \`make\' to compile $PKG_NAME || exit 1
   4.116 -else
   4.117 -    echo Skipping configure process.
   4.118 -fi
     5.1 --- a/gst-plugins-nuvdemux/config.h.in	Tue May 01 17:03:38 2007 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,67 +0,0 @@
     5.4 -/* config.h.in.  Generated from configure.ac by autoheader.  */
     5.5 -
     5.6 -/* Define the version */
     5.7 -#undef GST_PLUGINS_VERSION
     5.8 -
     5.9 -/* Define the release version */
    5.10 -#undef GST_PLUGINS_VERSION_RELEASE
    5.11 -
    5.12 -/* Define to 1 if you have the <dlfcn.h> header file. */
    5.13 -#undef HAVE_DLFCN_H
    5.14 -
    5.15 -/* Define to 1 if you have the <inttypes.h> header file. */
    5.16 -#undef HAVE_INTTYPES_H
    5.17 -
    5.18 -/* Define to 1 if you have the <memory.h> header file. */
    5.19 -#undef HAVE_MEMORY_H
    5.20 -
    5.21 -/* Define to 1 if you have the <stdint.h> header file. */
    5.22 -#undef HAVE_STDINT_H
    5.23 -
    5.24 -/* Define to 1 if you have the <stdlib.h> header file. */
    5.25 -#undef HAVE_STDLIB_H
    5.26 -
    5.27 -/* Define to 1 if you have the <strings.h> header file. */
    5.28 -#undef HAVE_STRINGS_H
    5.29 -
    5.30 -/* Define to 1 if you have the <string.h> header file. */
    5.31 -#undef HAVE_STRING_H
    5.32 -
    5.33 -/* Define to 1 if you have the <sys/stat.h> header file. */
    5.34 -#undef HAVE_SYS_STAT_H
    5.35 -
    5.36 -/* Define to 1 if you have the <sys/types.h> header file. */
    5.37 -#undef HAVE_SYS_TYPES_H
    5.38 -
    5.39 -/* Define to 1 if you have the <unistd.h> header file. */
    5.40 -#undef HAVE_UNISTD_H
    5.41 -
    5.42 -/* Name of package */
    5.43 -#undef PACKAGE
    5.44 -
    5.45 -/* Define to the address where bug reports for this package should be sent. */
    5.46 -#undef PACKAGE_BUGREPORT
    5.47 -
    5.48 -/* Define to the full name of this package. */
    5.49 -#undef PACKAGE_NAME
    5.50 -
    5.51 -/* Define to the full name and version of this package. */
    5.52 -#undef PACKAGE_STRING
    5.53 -
    5.54 -/* Define to the one symbol short name of this package. */
    5.55 -#undef PACKAGE_TARNAME
    5.56 -
    5.57 -/* Define to the version of this package. */
    5.58 -#undef PACKAGE_VERSION
    5.59 -
    5.60 -/* Define to 1 if you have the ANSI C header files. */
    5.61 -#undef STDC_HEADERS
    5.62 -
    5.63 -/* Version number of package */
    5.64 -#undef VERSION
    5.65 -
    5.66 -/* Define to `__inline__' or `__inline' if that's what the C compiler
    5.67 -   calls it, or to nothing if 'inline' is not supported under any name.  */
    5.68 -#ifndef __cplusplus
    5.69 -#undef inline
    5.70 -#endif
     6.1 --- a/gst-plugins-nuvdemux/configure.ac	Tue May 01 17:03:38 2007 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,130 +0,0 @@
     6.4 -dnl fill in your package name and version here
     6.5 -dnl autoconf configuration files for gst-plugins-dspbin
     6.6 -AC_INIT
     6.7 -AC_CANONICAL_TARGET
     6.8 -
     6.9 -AC_CONFIG_MACRO_DIR([m4])
    6.10 -dnl We disable static building for development, for time savings
    6.11 -dnl this goes before AS_LIBTOOL to appease autoconf
    6.12 -dnl *NOTE*: dnl this line before release, so release does static too
    6.13 -AM_DISABLE_STATIC
    6.14 -
    6.15 -dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
    6.16 -AM_MAINTAINER_MODE
    6.17 -
    6.18 -dnl when going to/from release please set the nano (fourth number) right !
    6.19 -dnl releases only do Wall, cvs and prerelease does Werror too
    6.20 -AS_VERSION(gst-plugins-nuvdemux, GST_PLUGINS_VERSION, 0, 10, 0, 1, GST_CVS="no", GST_CVS="yes")
    6.21 -
    6.22 -AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
    6.23 -
    6.24 -AM_PROG_LIBTOOL
    6.25 -
    6.26 -AM_CONFIG_HEADER(config.h)
    6.27 -
    6.28 -dnl make aclocal work in maintainer mode
    6.29 -AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
    6.30 -
    6.31 -dnl check for tools
    6.32 -AC_PROG_CC
    6.33 -AC_PROG_CC_STDC
    6.34 -AM_PROG_AS
    6.35 -
    6.36 -dnl decide on error flags
    6.37 -AS_COMPILER_FLAG(-Wall, GST_WALL="yes", GST_WALL="no")
    6.38 -
    6.39 -if test "x$GST_WALL" = "xyes"; then
    6.40 -  ERROR_CFLAGS="$GST_ERROR -Wall"
    6.41 -
    6.42 -  if test "x$GST_CVS" = "xyes"; then
    6.43 -    AS_COMPILER_FLAG(-Werror,ERROR_CFLAGS="$ERROR_CFLAGS -Werror",ERROR_CFLAGS="$ERROR_CFLAGS")
    6.44 -  fi
    6.45 -fi
    6.46 -
    6.47 -AC_SUBST(ERROR_CFLAGS)
    6.48 -
    6.49 -dnl determine c++ compiler
    6.50 -AC_PROG_CXX
    6.51 -dnl determine if c++ is available on this system
    6.52 -AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
    6.53 -dnl determine c++ preprocessor
    6.54 -AC_PROG_CXXCPP
    6.55 -AC_ISC_POSIX
    6.56 -
    6.57 -AC_HEADER_STDC([])
    6.58 -AC_C_INLINE
    6.59 -
    6.60 -dnl Check for pkgconfig first
    6.61 -AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
    6.62 -
    6.63 -dnl Give error and exit if we don't have pkgconfig
    6.64 -if test "x$HAVE_PKGCONFIG" = "xno"; then
    6.65 -  AC_MSG_ERROR(you need to have pkgconfig installed !)
    6.66 -fi
    6.67 -
    6.68 -dnl Now we're ready to ask for gstreamer libs and cflags
    6.69 -dnl And we can also ask for the right version of gstreamer
    6.70 -
    6.71 -GST_REQUIRED=0.10.3
    6.72 -GST_MAJORMINOR=0.10
    6.73 -
    6.74 -PKG_CHECK_MODULES(GST, \
    6.75 -  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED,
    6.76 -  HAVE_GST=yes,HAVE_GST=no)
    6.77 -
    6.78 -dnl Give error and exit if we don't have gstreamer
    6.79 -if test "x$HAVE_GST" = "xno"; then
    6.80 -  AC_MSG_ERROR(you need gstreamer development packages installed !)
    6.81 -fi
    6.82 -
    6.83 -if test "x$USE_DEBUG" = xyes; then
    6.84 -  GST_CFLAGS="$GST_CFLAGS -g"
    6.85 -fi
    6.86 -
    6.87 -dnl added because of the i18n headers
    6.88 -GST_CFLAGS="-I\$(top_builddir)/gst-libs $GST_CFLAGS"
    6.89 -
    6.90 -dnl make GST_CFLAGS and GST_LIBS available
    6.91 -AC_SUBST(GST_CFLAGS)
    6.92 -AC_SUBST(GST_LIBS)
    6.93 -
    6.94 -dnl make GST_MAJORMINOR available in Makefile.am
    6.95 -AC_SUBST(GST_MAJORMINOR)
    6.96 -
    6.97 -dnl check for gstreamer-base; uninstalled is selected preferentially
    6.98 -PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED,
    6.99 -  HAVE_GST_BASE="yes", HAVE_GST_BASE="no")
   6.100 -
   6.101 -if test "x$HAVE_GST_BASE" = "xno"; then
   6.102 -  AC_MSG_ERROR(no GStreamer Base Libs found)
   6.103 -fi
   6.104 -
   6.105 -AC_SUBST(GST_BASE_LIBS)
   6.106 -AC_SUBST(GST_BASE_CFLAGS)
   6.107 -
   6.108 -dnl check for gstreamer-libs; uinstalled is selected preferentially
   6.109 -PKG_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQUIRED,
   6.110 -  HAVE_GST_PLUGINS="yes", HAVE_GST_PLUGINS="no")
   6.111 -
   6.112 -if test "x$HAVE_GST_PLUGINS" = "xno"; then
   6.113 -  AC_MSG_ERROR(no GStreamer Plugins Libs found)
   6.114 -fi
   6.115 -
   6.116 -AC_SUBST(GST_PLUGINS_BASE_LIBS)
   6.117 -AC_SUBST(GST_PLUGINS_BASE_CFLAGS)
   6.118 -
   6.119 -dnl set the plugindir where plugins should be installed
   6.120 -plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
   6.121 -AC_SUBST(plugindir)
   6.122 -
   6.123 -dnl set proper LDFLAGS for plugins
   6.124 -GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
   6.125 -AC_SUBST(GST_PLUGIN_LDFLAGS)
   6.126 -
   6.127 -AC_OUTPUT( \
   6.128 -    Makefile \
   6.129 -    nuvdemux/Makefile \
   6.130 -    typefind/Makefile \
   6.131 -    m4/Makefile
   6.132 -)
   6.133 -
     7.1 --- a/gst-plugins-nuvdemux/debian/changelog	Tue May 01 17:03:38 2007 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,6 +0,0 @@
     7.4 -gst-indt-nuvdemux (0.10.2.debian-1) unstable; urgency=low
     7.5 -
     7.6 -  * Initial packaged;
     7.7 -
     7.8 - -- Renato Araujo Oliveira Filho <renato.filho@indt.org.br>  Thu, 09 Nov 2006 15:58:00 -0300
     7.9 -
     8.1 --- a/gst-plugins-nuvdemux/debian/compat	Tue May 01 17:03:38 2007 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,1 +0,0 @@
     8.4 -4
     9.1 --- a/gst-plugins-nuvdemux/debian/control	Tue May 01 17:03:38 2007 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,20 +0,0 @@
     9.4 -Source: gst-indt-nuvdemux
     9.5 -Section: libs
     9.6 -Priority: optional
     9.7 -Maintainer: Renato Araujo Oliveira Filho  <renato.filho@indt.org.br>
     9.8 -Build-Depends: debhelper (>= 4.1.0), cdbs (>= 0.4.8), autotools-dev, pkg-config (>= 0.11.0), libgstreamer0.10-dev (>= 0.10.0)
     9.9 -Standards-Version: 3.6.2
    9.10 -
    9.11 -Package: gstreamer0.10-indt-nuvdemux
    9.12 -Architecture: any
    9.13 -Section: libs
    9.14 -Depends: ${misc:Depends}, ${shlibs:Depends}
    9.15 -Description: INdT nuv demux GStreamer plugin
    9.16 - This GStreamer plugin permits demux of Nuv streams.
    9.17 -
    9.18 -Package: maemo-nuvdemux
    9.19 -Architecture: all
    9.20 -Depends: gstreamer0.10-indt-nuvdemux
    9.21 -Description: enable support to nuvdemux on osso media server (meta-package)
    9.22 - This package is a meta-package that, when installed, guarantees that you
    9.23 - have support to nuv files on osso-media-server.
    10.1 --- a/gst-plugins-nuvdemux/debian/copyright	Tue May 01 17:03:38 2007 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,23 +0,0 @@
    10.4 -This package was debianized by Renato Araujo Oliveira Filho <renato.filho@indt.org.br> on
    10.5 -Thu, 09 Nov 2006 15:58:00 -0300.
    10.6 -
    10.7 -Copyright Holder: 2006 INdT
    10.8 -
    10.9 -License:
   10.10 -
   10.11 -   This package is free software; you can redistribute it and/or modify
   10.12 -   it under the terms of the GNU General Public License as published by
   10.13 -   the Free Software Foundation; version 2 dated June, 1991.
   10.14 -
   10.15 -   This package is distributed in the hope that it will be useful,
   10.16 -   but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.17 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10.18 -   GNU General Public License for more details.
   10.19 -
   10.20 -   You should have received a copy of the GNU General Public License
   10.21 -   along with this package; if not, write to the Free Software
   10.22 -   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
   10.23 -   MA 02110-1301, USA.
   10.24 -
   10.25 -On Debian systems, the complete text of the GNU General
   10.26 -Public License can be found in `/usr/share/common-licenses/GPL'.
    11.1 --- a/gst-plugins-nuvdemux/debian/files	Tue May 01 17:03:38 2007 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,2 +0,0 @@
    11.4 -maemo-nuvdemux_0.10.2.debian-1_all.deb libs optional
    11.5 -gstreamer0.10-indt-nuvdemux_0.10.2.debian-1_armel.deb libs optional
    12.1 --- a/gst-plugins-nuvdemux/debian/gstreamer0.10-indt-nuvdemux.install	Tue May 01 17:03:38 2007 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,1 +0,0 @@
    12.4 -debian/tmp/usr/lib/gstreamer-*/*.so
    13.1 --- a/gst-plugins-nuvdemux/debian/maemo-nuvdemux.install	Tue May 01 17:03:38 2007 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,2 +0,0 @@
    13.4 -debian/nuv.xml usr/share/mime/packages/
    13.5 -debian/osso_media_server_nuv.schemas usr/share/gconf/schemas
    14.1 --- a/gst-plugins-nuvdemux/debian/maemo-nuvdemux.postinst	Tue May 01 17:03:38 2007 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,24 +0,0 @@
    14.4 -#! /bin/sh
    14.5 -set -e
    14.6 -
    14.7 -#DEBHELPER#
    14.8 -
    14.9 -# Register our X Desktop Group Shared MIME-info Database info
   14.10 -if [ -x /usr/bin/update-mime-database ] ; then
   14.11 -        /usr/bin/update-mime-database /usr/share/mime
   14.12 -fi
   14.13 -
   14.14 -# Register a new type on Osso Media Server
   14.15 -if [ -x /usr/bin/gconftool-2 ] ; then
   14.16 -    /usr/bin/gconftool-2 --makefile-install-rule /usr/share/gconf/schemas/osso_media_server_nuv.schemas
   14.17 -fi
   14.18 -
   14.19 -#append nuv info on osso mediaplayer ui
   14.20 -data_file=/usr/share/applications/hildon/mp_ui.desktop
   14.21 -tmp_file=/tmp/mp_ui.desktop
   14.22 -cat $data_file | sed 's/X-Osso-URI-Actions=rtsp/X-Osso-URI-Actions=rtsp;myth/' | sed 's/MimeType=\(.*\)/MimeType=\1;video\/x-nuv/'  > $tmp_file
   14.23 -echo -e "\n\n[X-Osso-URI-Action Handler myth] \nMethod=mime_open\nName=medi_ap_mediaplayer_name\nTranslationDomain=mediaplayer" >> $tmp_file
   14.24 -cat $tmp_file > $data_file
   14.25 -echo "FILE DESKTOP UPDATED"
   14.26 -
   14.27 -exit 0
    15.1 --- a/gst-plugins-nuvdemux/debian/nuv.xml	Tue May 01 17:03:38 2007 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,11 +0,0 @@
    15.4 -<?xml version="1.0" encoding="UTF-8"?>
    15.5 -<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    15.6 - <mime-type type="video/x-nuv">
    15.7 -  <comment>Nuv File</comment>
    15.8 -  <comment xml:lang="en">Mythtv Nuv file container</comment>
    15.9 -  <magic priority="60">
   15.10 -   <match value="MythTVVideo" type="string" offset="0"/>
   15.11 -  </magic>
   15.12 -  <glob pattern="*.nuv"/>
   15.13 - </mime-type>
   15.14 -</mime-info>
    16.1 --- a/gst-plugins-nuvdemux/debian/osso_media_server_nuv.schemas	Tue May 01 17:03:38 2007 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,16 +0,0 @@
    16.4 -<?xml version="1.0"?>
    16.5 -<gconfschemafile>
    16.6 -  <schemalist>
    16.7 -    <schema>
    16.8 -      <key>/schemas/apps/osso/osso_media_server/demux_video/video_x-nuv</key>
    16.9 -      <applyto>/apps/osso/osso_media_server/demux_video/video_x-nuv</applyto>
   16.10 -      <owner>osso_media_server</owner>
   16.11 -      <type>list</type>
   16.12 -      <list_type>string</list_type>
   16.13 -      <default>[video/x-nuv,nuvdemux]</default>
   16.14 -      <locale name="C">
   16.15 -        <short>Play MYTHTV .nuv files.</short>
   16.16 -      </locale>
   16.17 -    </schema>
   16.18 -  </schemalist>
   16.19 -</gconfschemafile>
    17.1 --- a/gst-plugins-nuvdemux/debian/rules	Tue May 01 17:03:38 2007 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,19 +0,0 @@
    17.4 -#!/usr/bin/make -f
    17.5 -
    17.6 -include /usr/share/cdbs/1/rules/debhelper.mk
    17.7 -include /usr/share/cdbs/1/rules/simple-patchsys.mk
    17.8 -include /usr/share/cdbs/1/class/gnome.mk
    17.9 -include /usr/share/cdbs/1/rules/utils.mk
   17.10 -
   17.11 -# debian package version
   17.12 -version=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
   17.13 -
   17.14 -maint: debian/control
   17.15 -
   17.16 -binary-install/gstreamer0.10-indt-nuvdemux::
   17.17 -	rm -f debian/gstreamer0.10-indt-nuvdemux/usr/lib/gstreamer-0.10/libgstnuvdemux.la
   17.18 -	rm -f debian/gstreamer0.10-indt-nuvdemux/usr/lib/gstreamer-0.10/libgstnuvdemux.a
   17.19 -	rm -f debian/gstreamer0.10-indt-nuvdemux/usr/lib/gstreamer-0.10/libgsttypefindfunctions_indt.la
   17.20 -	rm -f debian/gstreamer0.10-indt-nuvdemux/usr/lib/gstreamer-0.10/libgsttypefindfunctions_indt.a
   17.21 -
   17.22 -.PHONY: maint
    18.1 --- a/gst-plugins-nuvdemux/m4/Makefile.am	Tue May 01 17:03:38 2007 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,5 +0,0 @@
    18.4 -EXTRA_DIST = \
    18.5 -as-compiler-flag.m4 \
    18.6 -as-version.m4 \
    18.7 -gst-feature.m4
    18.8 -
    19.1 --- a/gst-plugins-nuvdemux/m4/as-compiler-flag.m4	Tue May 01 17:03:38 2007 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,32 +0,0 @@
    19.4 -dnl as-compiler-flag.m4 0.1.0
    19.5 -
    19.6 -dnl autostars m4 macro for detection of compiler flags
    19.7 -
    19.8 -dnl David Schleef <ds@schleef.org>
    19.9 -
   19.10 -dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
   19.11 -
   19.12 -dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
   19.13 -dnl Tries to compile with the given CFLAGS.
   19.14 -dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
   19.15 -dnl and ACTION-IF-NOT-ACCEPTED otherwise.
   19.16 -
   19.17 -AC_DEFUN([AS_COMPILER_FLAG],
   19.18 -[
   19.19 -  AC_MSG_CHECKING([to see if compiler understands $1])
   19.20 -
   19.21 -  save_CFLAGS="$CFLAGS"
   19.22 -  CFLAGS="$CFLAGS $1"
   19.23 -
   19.24 -  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
   19.25 -  CFLAGS="$save_CFLAGS"
   19.26 -
   19.27 -  if test "X$flag_ok" = Xyes ; then
   19.28 -    $2
   19.29 -    true
   19.30 -  else
   19.31 -    $3
   19.32 -    true
   19.33 -  fi
   19.34 -  AC_MSG_RESULT([$flag_ok])
   19.35 -])
    20.1 --- a/gst-plugins-nuvdemux/m4/as-version.m4	Tue May 01 17:03:38 2007 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,67 +0,0 @@
    20.4 -dnl as-version.m4 0.1.0
    20.5 -
    20.6 -dnl autostars m4 macro for versioning
    20.7 -
    20.8 -dnl Thomas Vander Stichele <thomas at apestaart dot org>
    20.9 -
   20.10 -dnl $Id: as-version.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
   20.11 -
   20.12 -dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO,
   20.13 -dnl            ACTION-IF-NO-NANO, [ACTION-IF-NANO])
   20.14 -
   20.15 -dnl example
   20.16 -dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,)
   20.17 -dnl for a 0.3.2 release version
   20.18 -
   20.19 -dnl this macro
   20.20 -dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO
   20.21 -dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode
   20.22 -dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE
   20.23 -dnl - executes the relevant action
   20.24 -dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE
   20.25 -dnl   as well as the little ones
   20.26 -dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents
   20.27 -dnl   maintainer mode from running ok
   20.28 -dnl
   20.29 -dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h
   20.30 -dnl if you use acconfig.h
   20.31 -
   20.32 -AC_DEFUN([AS_VERSION],
   20.33 -[
   20.34 -  PACKAGE=[$1]
   20.35 -  [$2]_MAJOR=[$3]
   20.36 -  [$2]_MINOR=[$4]
   20.37 -  [$2]_MICRO=[$5]
   20.38 -  NANO=[$6]
   20.39 -  [$2]_NANO=$NANO
   20.40 -  if test "x$NANO" = "x" || test "x$NANO" = "x0";
   20.41 -  then
   20.42 -      AC_MSG_NOTICE(configuring [$1] for release)
   20.43 -      VERSION=[$3].[$4].[$5]
   20.44 -      [$2]_RELEASE=1
   20.45 -      dnl execute action
   20.46 -      ifelse([$7], , :, [$7])
   20.47 -  else
   20.48 -      AC_MSG_NOTICE(configuring [$1] for development with nano $NANO)
   20.49 -      VERSION=[$3].[$4].[$5].$NANO
   20.50 -      [$2]_RELEASE=0.`date +%Y%m%d.%H%M%S`
   20.51 -      dnl execute action
   20.52 -      ifelse([$8], , :, [$8])
   20.53 -  fi
   20.54 -
   20.55 -  [$2]=$VERSION
   20.56 -  AC_DEFINE_UNQUOTED([$2], "$[$2]", [Define the version])
   20.57 -  AC_SUBST([$2])
   20.58 -  AC_DEFINE_UNQUOTED([$2]_RELEASE, "$[$2]_RELEASE", [Define the release version])
   20.59 -  AC_SUBST([$2]_RELEASE)
   20.60 -
   20.61 -  AC_SUBST([$2]_MAJOR)
   20.62 -  AC_SUBST([$2]_MINOR)
   20.63 -  AC_SUBST([$2]_MICRO)
   20.64 -  AC_SUBST([$2]_NANO)
   20.65 -  AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name])
   20.66 -  AC_SUBST(PACKAGE)
   20.67 -  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version])
   20.68 -  AC_SUBST(VERSION)
   20.69 -])
   20.70 -
    21.1 --- a/gst-plugins-nuvdemux/m4/gst-feature.m4	Tue May 01 17:03:38 2007 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,211 +0,0 @@
    21.4 -dnl Perform a check for a feature for GStreamer
    21.5 -dnl Richard Boulton <richard-alsa@tartarus.org>
    21.6 -dnl Thomas Vander Stichele <thomas@apestaart.org> added useful stuff
    21.7 -dnl Last modification: 25/06/2001
    21.8 -dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
    21.9 -dnl                   DEPENDENT-PLUGINS, TEST-FOR-FEATURE,
   21.10 -dnl                   DISABLE-BY-DEFAULT, ACTION-IF-USE, ACTION-IF-NOTUSE)
   21.11 -dnl
   21.12 -dnl This macro adds a command line argument to enable the user to enable
   21.13 -dnl or disable a feature, and if the feature is enabled, performs a supplied
   21.14 -dnl test to check if the feature is available.
   21.15 -dnl
   21.16 -dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending
   21.17 -dnl on whether the feature is available.
   21.18 -dnl
   21.19 -dnl The macro will set USE_<FEATURE-NAME> to "yes" or "no" depending on
   21.20 -dnl whether the feature is to be used.
   21.21 -dnl Thomas changed this, so that when USE_<FEATURE-NAME> was already set
   21.22 -dnl to no, then it stays that way.
   21.23 -dnl
   21.24 -dnl The macro will call AM_CONDITIONAL(USE_<<FEATURE-NAME>, ...) to allow
   21.25 -dnl the feature to control what is built in Makefile.ams.  If you want
   21.26 -dnl additional actions resulting from the test, you can add them with the
   21.27 -dnl ACTION-IF-USE and ACTION-IF-NOTUSE parameters.
   21.28 -dnl 
   21.29 -dnl FEATURE-NAME        is the name of the feature, and should be in
   21.30 -dnl                     purely upper case characters.
   21.31 -dnl FEATURE-DESCRIPTION is used to describe the feature in help text for
   21.32 -dnl                     the command line argument.
   21.33 -dnl DEPENDENT-PLUGINS   lists any plugins which depend on this feature.
   21.34 -dnl TEST-FOR-FEATURE    is a test which sets HAVE_<FEATURE-NAME> to "yes"
   21.35 -dnl                     or "no" depending on whether the feature is
   21.36 -dnl                     available.
   21.37 -dnl DISABLE-BY-DEFAULT  if "disabled", the feature is disabled by default,
   21.38 -dnl                     if any other value, the feature is enabled by default.
   21.39 -dnl ACTION-IF-USE       any extra actions to perform if the feature is to be
   21.40 -dnl                     used.
   21.41 -dnl ACTION-IF-NOTUSE    any extra actions to perform if the feature is not to
   21.42 -dnl                     be used.
   21.43 -dnl
   21.44 -dnl
   21.45 -dnl thomas :
   21.46 -dnl we also added a history.  
   21.47 -dnl GST_PLUGINS_YES will contain all plugins to be built
   21.48 -dnl                 that were checked through GST_CHECK_FEATURE
   21.49 -dnl GST_PLUGINS_NO will contain those that won't be built
   21.50 -
   21.51 -AC_DEFUN([GST_CHECK_FEATURE],
   21.52 -AC_MSG_NOTICE(***)
   21.53 -AC_MSG_NOTICE(*** checking plugin: [$3] ***)
   21.54 -AC_MSG_NOTICE(***)
   21.55 -[dnl
   21.56 -builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
   21.57 -dnl if it is set to NO, then don't even consider it for building
   21.58 -NOUSE=
   21.59 -if test "x$USE_[$1]" = "xno"; then
   21.60 -  NOUSE="yes"
   21.61 -fi
   21.62 -AC_ARG_ENABLE(translit([$1], A-Z, a-z),
   21.63 -  [  ]builtin(format, --%-26s gst_endisable %s, gst_endisable-translit([$1], A-Z, a-z), [$2]ifelse([$3],,,: [$3])),
   21.64 -  [ case "${enableval}" in
   21.65 -      yes) USE_[$1]=yes;;
   21.66 -      no) USE_[$1]=no;;
   21.67 -      *) AC_MSG_ERROR(bad value ${enableval} for --enable-translit([$1], A-Z, a-z)) ;;
   21.68 -    esac],
   21.69 -  [ USE_$1=]ifelse($5, [disabled], [no], [yes]))           dnl DEFAULT
   21.70 -
   21.71 -dnl *** set it back to no if it was preset to no
   21.72 -if test "x$NOUSE" = "xyes"; then
   21.73 -  USE_[$1]="no"
   21.74 -  AC_MSG_WARN(*** $3 pre-configured not to be built)
   21.75 -fi
   21.76 -NOUSE=
   21.77 -
   21.78 -dnl *** If it's enabled
   21.79 -
   21.80 -if test x$USE_[$1] = xyes; then
   21.81 -  dnl save compile variables before the test
   21.82 -
   21.83 -  gst_check_save_LIBS=$LIBS
   21.84 -  gst_check_save_LDFLAGS=$LDFLAGS
   21.85 -  gst_check_save_CFLAGS=$CFLAGS
   21.86 -  gst_check_save_CPPFLAGS=$CPPFLAGS
   21.87 -  gst_check_save_CXXFLAGS=$CXXFLAGS
   21.88 -
   21.89 -  HAVE_[$1]=no
   21.90 -  dnl TEST_FOR_FEATURE
   21.91 -  $4
   21.92 -
   21.93 -  LIBS=$gst_check_save_LIBS
   21.94 -  LDFLAGS=$gst_check_save_LDFLAGS
   21.95 -  CFLAGS=$gst_check_save_CFLAGS
   21.96 -  CPPFLAGS=$gst_check_save_CPPFLAGS
   21.97 -  CXXFLAGS=$gst_check_save_CXXFLAGS
   21.98 -
   21.99 -  dnl If it isn't found, unset USE_[$1]
  21.100 -  if test x$HAVE_[$1] = xno; then
  21.101 -    USE_[$1]=no
  21.102 -  fi
  21.103 -fi
  21.104 -dnl *** Warn if it's disabled or not found
  21.105 -if test x$USE_[$1] = xyes; then
  21.106 -  ifelse([$6], , :, [$6])
  21.107 -  if test "x$3" != "x"; then
  21.108 -    GST_PLUGINS_YES="\t[$3]\n$GST_PLUGINS_YES"
  21.109 -  fi
  21.110 -  AC_DEFINE(HAVE_[$1], , [support for features: $3])
  21.111 -else
  21.112 -  ifelse([$3], , :, [AC_MSG_NOTICE(*** These plugins will not be built: [$3])])
  21.113 -  if test "x$3" != "x"; then
  21.114 -    GST_PLUGINS_NO="\t[$3]\n$GST_PLUGINS_NO"
  21.115 -  fi
  21.116 -  ifelse([$7], , :, [$7])
  21.117 -fi
  21.118 -dnl *** Define the conditional as appropriate
  21.119 -AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes)
  21.120 -])
  21.121 -
  21.122 -dnl Use a -config program which accepts --cflags and --libs parameters
  21.123 -dnl to set *_CFLAGS and *_LIBS and check existence of a feature.
  21.124 -dnl Richard Boulton <richard-alsa@tartarus.org>
  21.125 -dnl Last modification: 26/06/2001
  21.126 -dnl GST_CHECK_CONFIGPROG(FEATURE-NAME, CONFIG-PROG-FILENAME, MODULES)
  21.127 -dnl
  21.128 -dnl This check was written for GStreamer: it should be renamed and checked
  21.129 -dnl for portability if you decide to use it elsewhere.
  21.130 -dnl
  21.131 -AC_DEFUN([GST_CHECK_CONFIGPROG],
  21.132 -[
  21.133 -  AC_PATH_PROG([$1]_CONFIG, [$2], no)
  21.134 -  if test x$[$1]_CONFIG = xno; then
  21.135 -    [$1]_LIBS=
  21.136 -    [$1]_CFLAGS=
  21.137 -    HAVE_[$1]=no
  21.138 -  else
  21.139 -    if [$2] --plugin-libs [$3] &> /dev/null; then
  21.140 -      [$1]_LIBS=`[$2] --plugin-libs [$3]`
  21.141 -    else
  21.142 -      [$1]_LIBS=`[$2] --libs [$3]`
  21.143 -    fi
  21.144 -    [$1]_CFLAGS=`[$2] --cflags [$3]`
  21.145 -    HAVE_[$1]=yes
  21.146 -  fi
  21.147 -  AC_SUBST([$1]_LIBS)
  21.148 -  AC_SUBST([$1]_CFLAGS)
  21.149 -])
  21.150 -
  21.151 -dnl Use AC_CHECK_LIB and AC_CHECK_HEADER to do both tests at once
  21.152 -dnl sets HAVE_module if we have it
  21.153 -dnl Richard Boulton <richard-alsa@tartarus.org>
  21.154 -dnl Last modification: 26/06/2001
  21.155 -dnl GST_CHECK_LIBHEADER(FEATURE-NAME, LIB NAME, LIB FUNCTION, EXTRA LD FLAGS, 
  21.156 -dnl                     HEADER NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
  21.157 -dnl
  21.158 -dnl This check was written for GStreamer: it should be renamed and checked
  21.159 -dnl for portability if you decide to use it elsewhere.
  21.160 -dnl
  21.161 -AC_DEFUN([GST_CHECK_LIBHEADER],
  21.162 -[
  21.163 -  AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no,[$4])
  21.164 -  if test "x$HAVE_[$1]" = "xyes"; then
  21.165 -    AC_CHECK_HEADER([$5], :, HAVE_[$1]=no)
  21.166 -    if test "x$HAVE_[$1]" = "xyes"; then
  21.167 -      dnl execute what needs to be
  21.168 -      ifelse([$6], , :, [$6])
  21.169 -    else
  21.170 -      ifelse([$7], , :, [$7])
  21.171 -    fi
  21.172 -  else
  21.173 -    ifelse([$7], , :, [$7])
  21.174 -  fi
  21.175 -  AC_SUBST(HAVE_[$1])
  21.176 -]
  21.177 -)
  21.178 -
  21.179 -dnl 2004-02-14 Thomas - changed to get set properly and use proper output
  21.180 -dnl 2003-06-27 Benjamin Otte - changed to make this work with gstconfig.h
  21.181 -dnl
  21.182 -dnl Add a subsystem --disable flag and all the necessary symbols and substitions
  21.183 -dnl
  21.184 -dnl GST_CHECK_SUBSYSTEM_DISABLE(SYSNAME, [subsystem name])
  21.185 -dnl
  21.186 -AC_DEFUN([GST_CHECK_SUBSYSTEM_DISABLE],
  21.187 -[
  21.188 -  dnl this define will replace each literal subsys_def occurrence with
  21.189 -  dnl the lowercase hyphen-separated subsystem
  21.190 -  dnl e.g. if $1 is GST_DEBUG then subsys_def will be a macro with gst-debug
  21.191 -  define([subsys_def],translit([$1], _A-Z, -a-z))
  21.192 -
  21.193 -  AC_ARG_ENABLE(subsys_def, 
  21.194 -    AC_HELP_STRING(--disable-subsys_def, [disable $2]),
  21.195 -    [
  21.196 -      case "${enableval}" in
  21.197 -        yes) GST_DISABLE_[$1]=no ;;
  21.198 -        no) GST_DISABLE_[$1]=yes ;;
  21.199 -        *) AC_MSG_ERROR([bad value ${enableval} for --enable-subsys_def]) ;;
  21.200 -       esac
  21.201 -    ],
  21.202 -    [GST_DISABLE_[$1]=no]) dnl Default value
  21.203 -
  21.204 -  if test x$GST_DISABLE_[$1] = xyes; then
  21.205 -    AC_MSG_NOTICE([disabled subsystem [$2]])
  21.206 -    GST_DISABLE_[$1]_DEFINE="#define GST_DISABLE_$1 1" 
  21.207 -  else
  21.208 -    GST_DISABLE_[$1]_DEFINE="/* #undef GST_DISABLE_$1 */"
  21.209 -  fi
  21.210 -  AC_SUBST(GST_DISABLE_[$1]_DEFINE)
  21.211 -  undefine([subsys_def])
  21.212 -])
  21.213 -
  21.214 -
    22.1 --- a/gst-plugins-nuvdemux/nuvdemux/Makefile.am	Tue May 01 17:03:38 2007 +0100
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,22 +0,0 @@
    22.4 -plugin_LTLIBRARIES = libgstnuvdemux.la
    22.5 -
    22.6 -libgstnuvdemux_la_SOURCES =	\
    22.7 -	gstnuvdemux.c 
    22.8 -
    22.9 -libgstnuvdemux_la_CFLAGS = \
   22.10 -	$(GST_CFLAGS) \
   22.11 -	$(GST_BASE_CFLAGS) \
   22.12 -	$(GST_PLUGINS_BASE_CFLAGS)
   22.13 -
   22.14 -libgstnuvdemux_la_LIBADD = \
   22.15 -	$(GST_LIBS_LIBS)
   22.16 -
   22.17 -libgstnuvdemux_la_LDFLAGS = \
   22.18 -	$(GST_LIBS) \
   22.19 -	$(GST_PLUGIN_LDFLAGS) \
   22.20 -	$(GST_BASE_LIBS) \
   22.21 -	$(GST_PLUGINS_BASE_LIBS)
   22.22 -
   22.23 -noinst_HEADERS = \
   22.24 -	gstnuvdemux.h 
   22.25 -
    23.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Tue May 01 17:03:38 2007 +0100
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,1654 +0,0 @@
    23.4 -/* GStreamer
    23.5 - * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
    23.6 - *                      Rosfran Borges <rosfran.borges@indt.org.br>
    23.7 - *
    23.8 - * This library is free software; you can redistribute it and/or
    23.9 - * modify it under the terms of the GNU Library General Public
   23.10 - * License as published by the Free Software Foundation; either
   23.11 - * version 2 of the License, or (at your option) any later version.
   23.12 - *
   23.13 - * This library is distributed in the hope that it will be useful,
   23.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   23.16 - * Library General Public License for more details.
   23.17 - *
   23.18 - * You should have received a copy of the GNU Library General Public
   23.19 - * License along with this library; if not, write to the
   23.20 - * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   23.21 - * Boston, MA 02111-1307, USA.
   23.22 - */
   23.23 -/* Element-Checklist-Version: 5 */
   23.24 -
   23.25 -/**
   23.26 - * SECTION:element-nuvdemux
   23.27 - *
   23.28 - * <refsect2>
   23.29 - * <para>
   23.30 - * Demuxes an .nuv file into raw or compressed audio and/or video streams.
   23.31 - * </para>
   23.32 - * <para>
   23.33 - * This element currently only supports pull-based scheduling.
   23.34 - * </para>
   23.35 - * <title>Example launch line</title>
   23.36 - * <para>
   23.37 - * <programlisting>
   23.38 - * gst-launch filesrc test.nuv ! nuvdemux name=demux  demux.audio_00 ! decodebin ! audioconvert ! audioresample ! autoaudiosink   demux.video_00 ! queue ! decodebin ! ffmpegcolorspace ! videoscale ! autovideosink
   23.39 - * </programlisting>
   23.40 - * Play (parse and decode) an .nuv file and try to output it to
   23.41 - * an automatically detected soundcard and videosink. If the NUV file contains
   23.42 - * compressed audio or video data, this will only work if you have the
   23.43 - * right decoder elements/plugins installed.
   23.44 - * </para>
   23.45 - * </refsect2>
   23.46 - *
   23.47 - */
   23.48 -
   23.49 -#ifdef HAVE_CONFIG_H
   23.50 -#include "config.h"
   23.51 -#endif
   23.52 -
   23.53 -#include <gst/gst.h>
   23.54 -#include <gst/gsterror.h>
   23.55 -#include <gst/gstplugin.h>
   23.56 -#include <string.h>
   23.57 -#include <math.h>
   23.58 -
   23.59 -#include "glib/gi18n.h"
   23.60 -#include "gstnuvdemux.h"
   23.61 -
   23.62 -#define GST_NUV_DEMUX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemuxPrivate))
   23.63 -
   23.64 -GST_DEBUG_CATEGORY_STATIC (nuvdemux_debug);
   23.65 -#define GST_CAT_DEFAULT nuvdemux_debug
   23.66 -#define GST_FLOW_ERROR_NO_DATA  -101
   23.67 -#define GST_FLOW_ERROR_EOS	-102
   23.68 -
   23.69 -enum
   23.70 -{
   23.71 -   NUV_PUSH_MODE = 0,
   23.72 -   NUV_PULL_MODE
   23.73 -};
   23.74 -
   23.75 -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT);
   23.76 -
   23.77 -static const GstElementDetails gst_nuv_demux_details =
   23.78 -GST_ELEMENT_DETAILS ("Nuv demuxer",
   23.79 -    "Codec/Demuxer",
   23.80 -    "Demultiplex a .nuv file into audio and video",
   23.81 -    "Renato Araujo Oliveira Filho <renato.filho@indt.org.br>,"
   23.82 -    "Rosfran Borges <rosfran.borges@indt.org.br>");
   23.83 -
   23.84 -
   23.85 -/* file header */
   23.86 -typedef struct
   23.87 -{
   23.88 -    gchar id[12];       /* "NuppelVideo\0" or "MythTVVideo\0" */
   23.89 -    gchar version[5];    /* "x.xx\0" */
   23.90 -
   23.91 -    gint  i_width;
   23.92 -    gint  i_height;
   23.93 -    gint  i_width_desired;
   23.94 -    gint  i_height_desired;
   23.95 -
   23.96 -    gchar i_mode;            /* P progressive, I interlaced */
   23.97 -
   23.98 -    gdouble  d_aspect;       /* 1.0 squared pixel */
   23.99 -    gdouble  d_fps;
  23.100 -    //fps num/denom
  23.101 -    gint     i_fpsn;
  23.102 -    gint     i_fpsd;
  23.103 -
  23.104 -    gint     i_video_blocks; /* 0 no video, -1 unknown */
  23.105 -    gint     i_audio_blocks;
  23.106 -    gint     i_text_blocks;
  23.107 -
  23.108 -    gint     i_keyframe_distance;
  23.109 -
  23.110 -} nuv_header;
  23.111 -
  23.112 -/* frame header */
  23.113 -typedef struct
  23.114 -{
  23.115 -    gchar i_type;        /* A: audio, V: video, S: sync; T: test
  23.116 -                           R: Seekpoint (string:RTjjjjjjjj)
  23.117 -                           D: Extra data for codec */
  23.118 -    gchar i_compression; /* V: 0 uncompressed
  23.119 -                              1 RTJpeg
  23.120 -                              2 RTJpeg+lzo
  23.121 -                              N black frame
  23.122 -                              L copy last
  23.123 -                           A: 0 uncompressed (44100 1-bits, 2ch)
  23.124 -                              1 lzo
  23.125 -                              2 layer 2
  23.126 -                              3 layer 3
  23.127 -                              F flac
  23.128 -                              S shorten
  23.129 -                              N null frame loudless
  23.130 -                              L copy last
  23.131 -                            S: B audio and vdeo sync point
  23.132 -                               A audio sync info (timecode == effective
  23.133 -                                    dsp frequency*100)
  23.134 -                               V next video sync (timecode == next video
  23.135 -                                    frame num)
  23.136 -                               S audio,video,text correlation */
  23.137 -    gchar i_keyframe;    /* 0 keyframe, else no no key frame */
  23.138 -    guint8 i_filters;  /* 0x01: gauss 5 pixel (8,2,2,2,2)/16
  23.139 -                           0x02: gauss 5 pixel (8,1,1,1,1)/12
  23.140 -                           0x04: cartoon filter */
  23.141 -
  23.142 -    gint32 i_timecode;     /* ms */
  23.143 -
  23.144 -    gint i_length;       /* V,A,T: length of following data
  23.145 -                           S: length of packet correl */
  23.146 -} nuv_frame_header;
  23.147 -
  23.148 -
  23.149 -/* FIXME Not sure of this one */
  23.150 -typedef struct
  23.151 -{
  23.152 -    gint             i_version;
  23.153 -    guint32	     i_video_fcc;
  23.154 -
  23.155 -    guint32	     i_audio_fcc;
  23.156 -    gint             i_audio_sample_rate;
  23.157 -    gint             i_audio_bits_per_sample;
  23.158 -    gint             i_audio_channels;
  23.159 -    gint             i_audio_compression_ratio;
  23.160 -    gint             i_audio_quality;
  23.161 -    gint             i_rtjpeg_quality;
  23.162 -    gint             i_rtjpeg_luma_filter;
  23.163 -    gint             i_rtjpeg_chroma_filter;
  23.164 -    gint             i_lavc_bitrate;
  23.165 -    gint             i_lavc_qmin;
  23.166 -    gint             i_lavc_qmax;
  23.167 -    gint             i_lavc_maxqdiff;
  23.168 -    gint64           i_seekable_offset;
  23.169 -    gint64           i_keyframe_adjust_offset;
  23.170 -
  23.171 -} nuv_extended_header;
  23.172 -
  23.173 -typedef struct
  23.174 -{
  23.175 -  gint64 timecode;
  23.176 -  gint64 offset;
  23.177 -
  23.178 -} frame_index_data;
  23.179 -
  23.180 -typedef enum {
  23.181 -  GST_NUV_DEMUX_START,
  23.182 -  GST_NUV_DEMUX_HEADER_DATA,
  23.183 -  GST_NUV_DEMUX_EXTRA_DATA,
  23.184 -  GST_NUV_DEMUX_MPEG_DATA,
  23.185 -  GST_NUV_DEMUX_EXTEND_HEADER,
  23.186 -  GST_NUV_DEMUX_EXTEND_HEADER_DATA,
  23.187 -  GST_NUV_DEMUX_INDEX_CREATE,
  23.188 -  GST_NUV_DEMUX_FRAME_HEADER,
  23.189 -  GST_NUV_DEMUX_MOVI,
  23.190 -  GST_NUV_DEMUX_INVALID_DATA
  23.191 -} GstNuvDemuxState;
  23.192 -
  23.193 -struct _GstNuvDemuxPrivate {
  23.194 -  /* used for indicate the mode */
  23.195 -  guint         mode;
  23.196 -
  23.197 -  /* used on push mode */
  23.198 -  GstAdapter    *adapter;
  23.199 -
  23.200 -  /* pads */
  23.201 -  GstPad        *sinkpad;
  23.202 -  GstPad        *src_video_pad;
  23.203 -  GstPad        *src_audio_pad;
  23.204 -
  23.205 -  /* Flow control */
  23.206 -  GstFlowReturn     last_video_return;
  23.207 -  GstFlowReturn     last_audio_return;
  23.208 -  gboolean          more_data;
  23.209 -  gboolean	    eos;
  23.210 -
  23.211 -  /* NUV decoding state */
  23.212 -  GstNuvDemuxState  state;
  23.213 -  guint64           offset;
  23.214 -
  23.215 -  /* duration information */
  23.216 -  guint64            duration_bytes;
  23.217 -  guint64            duration_time;
  23.218 -  guint64            segment_stop;
  23.219 -  guint64            segment_start;
  23.220 -
  23.221 -  /* segment control info */
  23.222 -  gboolean          new_audio_segment;
  23.223 -  gboolean          new_video_segment;
  23.224 -
  23.225 -  /* Mpeg ExtraData */
  23.226 -  guint64           mpeg_data_size;
  23.227 -  GstBuffer         *mpeg_buffer;
  23.228 -
  23.229 -  /* Headers */
  23.230 -  nuv_header h;
  23.231 -  nuv_extended_header eh;
  23.232 -  nuv_frame_header fh;
  23.233 -
  23.234 -  /* anothers info */
  23.235 -  guint64           header_lengh;
  23.236 -  gint64            time_start;
  23.237 -  gint64            time_diff;
  23.238 -  gint64            time_qos;
  23.239 -  guint64           last_frame_time;
  23.240 -  GSList            *index;
  23.241 -};
  23.242 -
  23.243 -
  23.244 -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
  23.245 -    GST_PAD_SINK,
  23.246 -    GST_PAD_ALWAYS,
  23.247 -    GST_STATIC_CAPS ("video/x-nuv"));
  23.248 -
  23.249 -static GstStaticPadTemplate audio_src_template =
  23.250 -GST_STATIC_PAD_TEMPLATE ("audio_src",
  23.251 -    GST_PAD_SRC,
  23.252 -    GST_PAD_SOMETIMES,
  23.253 -    GST_STATIC_CAPS_ANY);
  23.254 -
  23.255 -static GstStaticPadTemplate video_src_template =
  23.256 -GST_STATIC_PAD_TEMPLATE ("video_src",
  23.257 -    GST_PAD_SRC,
  23.258 -    GST_PAD_SOMETIMES,
  23.259 -    GST_STATIC_CAPS_ANY);
  23.260 -
  23.261 -static void gst_nuv_demux_dispose (GObject * object);
  23.262 -static void gst_nuv_demux_finalize (GObject * object);
  23.263 -static GstStateChangeReturn gst_nuv_demux_change_state (GstElement * element,
  23.264 -    GstStateChange transition);
  23.265 -static void gst_nuv_demux_loop (GstPad * pad);
  23.266 -static GstFlowReturn gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf);
  23.267 -static GstFlowReturn gst_nuv_demux_play (GstPad * pad);
  23.268 -static gboolean gst_nuv_demux_sink_activate_pull (GstPad * sinkpad,
  23.269 -    gboolean active);
  23.270 -static gboolean gst_nuv_demux_sink_activate_push (GstPad * pad,
  23.271 -    gboolean active);
  23.272 -static gboolean gst_nuv_demux_sink_activate (GstPad * sinkpad);
  23.273 -//static gboolean gst_nuv_demux_sink_event    (GstPad *pad, GstEvent *event);
  23.274 -static gboolean gst_nuv_demux_srcpad_event  (GstPad * pad, GstEvent * event);
  23.275 -static frame_index_data * gst_nuv_demux_do_seek_index (GstNuvDemux *nuv, gint64 seek_pos, 
  23.276 -  gint64 segment_stop, GstFormat format);
  23.277 -
  23.278 -
  23.279 -
  23.280 -static GstFlowReturn gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size,
  23.281 -    gboolean move, GstBuffer ** buffer);
  23.282 -static void gst_nuv_demux_reset (GstNuvDemux * nuv);
  23.283 -static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv);
  23.284 -static void gst_nuv_demux_send_eos (GstNuvDemux * nuv);
  23.285 -static void gst_nuv_demux_create_seek_index (GstNuvDemux * nuv);
  23.286 -
  23.287 -
  23.288 -#if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6) 
  23.289 -GstBuffer * gst_adapter_take_buffer (GstAdapter * adapter, guint nbytes);
  23.290 -#endif
  23.291 -
  23.292 -
  23.293 -GST_BOILERPLATE (GstNuvDemux, gst_nuv_demux, GstElement, GST_TYPE_ELEMENT);
  23.294 -
  23.295 -/******************************************************************************
  23.296 - * Utils function
  23.297 - ******************************************************************************/
  23.298 -#if G_BYTE_ORDER == G_BIG_ENDIAN
  23.299 -static inline gdouble
  23.300 -_gdouble_swap_le_be (gdouble * d)
  23.301 -{
  23.302 -  union
  23.303 -  {
  23.304 -    guint64 i;
  23.305 -    gdouble d;
  23.306 -  } u;
  23.307 -
  23.308 -  u.d = *d;
  23.309 -  u.i = GUINT64_SWAP_LE_BE (u.i);
  23.310 -  return u.d;
  23.311 -}
  23.312 -
  23.313 -#define READ_DOUBLE_FROM_LE(d) (_gdouble_swap_le_be((gdouble* ) d))
  23.314 -#else /* G_BYTE_ORDER != G_BIG_ENDIAN */
  23.315 -#define READ_DOUBLE_FROM_LE(d) *((gdouble* ) (d))
  23.316 -#endif /* G_BYTE_ORDER != G_BIG_ENDIAN */
  23.317 -
  23.318 -static void
  23.319 -double2fraction (double in, int *num, int *denom)
  23.320 -{
  23.321 -    if (in == 29.97) {
  23.322 -        *num = 30000;
  23.323 -        *denom = 1001;
  23.324 -    } else if (in == 23.976) {
  23.325 -        *num = 24000;
  23.326 -        *denom = 1001;
  23.327 -    } else {
  23.328 -        *denom = 1;
  23.329 -        while (in - floor(in) >= 0.1) {
  23.330 -            *denom *= 10;
  23.331 -            in *= 10.0;
  23.332 -        }
  23.333 -        *num = (int)floor(in);
  23.334 -    }
  23.335 -}
  23.336 -
  23.337 -/* GObject Functions */
  23.338 -
  23.339 -static void
  23.340 -gst_nuv_demux_base_init (gpointer klass)
  23.341 -{
  23.342 -  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
  23.343 -
  23.344 -  gst_element_class_add_pad_template (element_class,
  23.345 -      gst_static_pad_template_get (&audio_src_template));
  23.346 -
  23.347 -  gst_element_class_add_pad_template (element_class,
  23.348 -      gst_static_pad_template_get (&video_src_template));
  23.349 -
  23.350 -  gst_element_class_add_pad_template (element_class,
  23.351 -      gst_static_pad_template_get (&sink_template));
  23.352 -  gst_element_class_set_details (element_class, &gst_nuv_demux_details);
  23.353 -}
  23.354 -
  23.355 -static void
  23.356 -gst_nuv_demux_class_init (GstNuvDemuxClass * klass)
  23.357 -{
  23.358 -  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
  23.359 -  GObjectClass *gobject_class = (GObjectClass *) klass;
  23.360 -
  23.361 -  GST_DEBUG_CATEGORY_INIT (nuvdemux_debug, "nuvdemux",
  23.362 -      0, "Demuxer for NUV streams");
  23.363 -
  23.364 -  parent_class = g_type_class_peek_parent (klass);
  23.365 -
  23.366 -  gobject_class->dispose = gst_nuv_demux_dispose;
  23.367 -  gobject_class->finalize = gst_nuv_demux_finalize;
  23.368 -  gstelement_class->change_state = gst_nuv_demux_change_state;
  23.369 -
  23.370 -  g_type_class_add_private (gobject_class, sizeof (GstNuvDemuxPrivate));
  23.371 -}
  23.372 -
  23.373 -static void
  23.374 -gst_nuv_demux_init (GstNuvDemux * nuv, GstNuvDemuxClass * nuv_class)
  23.375 -{
  23.376 -  nuv->priv = GST_NUV_DEMUX_GET_PRIVATE (nuv);
  23.377 -  nuv->priv->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
  23.378 -
  23.379 -  /* creating adapter */
  23.380 -  nuv->priv->mode = NUV_PUSH_MODE;
  23.381 -  nuv->priv->adapter = gst_adapter_new ();
  23.382 -
  23.383 -  nuv->priv->new_audio_segment = TRUE;
  23.384 -  nuv->priv->new_video_segment = TRUE;
  23.385 -
  23.386 -  gst_pad_set_activate_function (nuv->priv->sinkpad, gst_nuv_demux_sink_activate);
  23.387 -  gst_pad_set_activatepull_function (nuv->priv->sinkpad,
  23.388 -      gst_nuv_demux_sink_activate_pull);
  23.389 -  gst_pad_set_activatepush_function (nuv->priv->sinkpad,
  23.390 -      gst_nuv_demux_sink_activate_push);
  23.391 -  gst_pad_set_chain_function (nuv->priv->sinkpad,
  23.392 -      GST_DEBUG_FUNCPTR (gst_nuv_demux_chain));
  23.393 -/*
  23.394 -  gst_pad_set_event_function (nuv->priv->sinkpad,
  23.395 -      gst_nuv_demux_sink_event);
  23.396 -*/
  23.397 -
  23.398 -  gst_element_add_pad (GST_ELEMENT (nuv), nuv->priv->sinkpad);
  23.399 -
  23.400 -}
  23.401 -
  23.402 -static void
  23.403 -gst_nuv_demux_dispose (GObject * object)
  23.404 -{
  23.405 -  GstNuvDemux *nuv = GST_NUV_DEMUX (object);
  23.406 -
  23.407 -
  23.408 -  if (nuv->priv->mpeg_buffer != NULL) {
  23.409 -    gst_buffer_unref (nuv->priv->mpeg_buffer);
  23.410 -  }
  23.411 -
  23.412 -  gst_nuv_demux_reset (GST_NUV_DEMUX (object));
  23.413 -  gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (object));
  23.414 -
  23.415 -  if (nuv->priv->adapter != NULL) {
  23.416 -    gst_object_unref (nuv->priv->adapter);
  23.417 -  }
  23.418 -}
  23.419 -
  23.420 -static void
  23.421 -gst_nuv_demux_finalize (GObject * object)
  23.422 -{
  23.423 -  G_OBJECT_CLASS (parent_class)->finalize (object);
  23.424 -}
  23.425 -
  23.426 -
  23.427 -/* HeaderLoad:
  23.428 - */
  23.429 -static GstFlowReturn
  23.430 -gst_nuv_demux_header_load (GstNuvDemux * nuv, nuv_header *h)
  23.431 -{
  23.432 -  GstBuffer *buffer = NULL;
  23.433 -  GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 72, TRUE, &buffer);
  23.434 -
  23.435 -  if ((res != GST_FLOW_OK) || (buffer == NULL)) {
  23.436 -      goto done;
  23.437 -  }
  23.438 -
  23.439 -  memcpy (h->id, buffer->data, 12);
  23.440 -  memcpy (h->version, buffer->data + 12, 5);
  23.441 -  h->i_width = GST_READ_UINT32_LE (&buffer->data[20]);
  23.442 -  h->i_height = GST_READ_UINT32_LE (&buffer->data[24]);
  23.443 -  h->i_width_desired = GST_READ_UINT32_LE (&buffer->data[28]);
  23.444 -  h->i_height_desired = GST_READ_UINT32_LE (&buffer->data[32]);
  23.445 -  h->i_mode = GPOINTER_TO_INT (buffer->data[36]);
  23.446 -  h->d_aspect = READ_DOUBLE_FROM_LE (&buffer->data[40]);
  23.447 -  h->d_fps = READ_DOUBLE_FROM_LE (&buffer->data[48]);
  23.448 -  /* get the num and denom values from fps */
  23.449 -  double2fraction (h->d_fps, &h->i_fpsn, &h->i_fpsd);
  23.450 -  h->i_video_blocks = GST_READ_UINT32_LE (&buffer->data[56]);
  23.451 -  h->i_audio_blocks = GST_READ_UINT32_LE (&buffer->data[60]);
  23.452 -  h->i_text_blocks = GST_READ_UINT32_LE (&buffer->data[64]);
  23.453 -  h->i_keyframe_distance = GST_READ_UINT32_LE (&buffer->data[68]);
  23.454 -
  23.455 -  GST_DEBUG_OBJECT (nuv,
  23.456 -      "nuv: h=%s v=%s %dx%d a=%f fps=%f v=%d a=%d t=%d kfd=%d", h->id,
  23.457 -      h->version, h->i_width, h->i_height, h->d_aspect, h->d_fps,
  23.458 -      h->i_video_blocks, h->i_audio_blocks, h->i_text_blocks,
  23.459 -      h->i_keyframe_distance);
  23.460 -
  23.461 -done:
  23.462 -  if (buffer != NULL) {
  23.463 -     gst_buffer_unref (buffer);
  23.464 -     buffer = NULL;
  23.465 -  }
  23.466 -  return res;
  23.467 -}
  23.468 -
  23.469 -static GstFlowReturn
  23.470 -gst_nuv_demux_stream_header_data (GstNuvDemux * nuv)
  23.471 -{
  23.472 -  GstFlowReturn res;
  23.473 -
  23.474 -  res = gst_nuv_demux_header_load (nuv, &nuv->priv->h);
  23.475 -  if (res == GST_FLOW_OK)
  23.476 -    nuv->priv->state = GST_NUV_DEMUX_EXTRA_DATA;
  23.477 -  return res;
  23.478 -}
  23.479 -
  23.480 -/*
  23.481 - * Read NUV file tag
  23.482 - */
  23.483 -static GstFlowReturn
  23.484 -gst_nuv_demux_stream_file_header (GstNuvDemux * nuv)
  23.485 -{
  23.486 -  GstFlowReturn res = GST_FLOW_OK;
  23.487 -  GstBuffer *file_header = NULL;
  23.488 -
  23.489 -  res = gst_nuv_demux_read_bytes (nuv, 12, FALSE, &file_header);
  23.490 -  if (res == GST_FLOW_OK) {
  23.491 -    if (strncmp ((gchar *) file_header->data, "MythTVVideo", 11) ||
  23.492 -        strncmp ((gchar *) file_header->data, "NuppelVideo", 11)) {
  23.493 -      nuv->priv->state = GST_NUV_DEMUX_HEADER_DATA;
  23.494 -    } else {
  23.495 -      GST_DEBUG_OBJECT (nuv, "error parsing file header");
  23.496 -      nuv->priv->state = GST_NUV_DEMUX_INVALID_DATA;
  23.497 -      res = GST_FLOW_ERROR;
  23.498 -    }
  23.499 -  }
  23.500 -
  23.501 -  if (file_header != NULL) {
  23.502 -    gst_buffer_unref (file_header);
  23.503 -    file_header = NULL;
  23.504 -  }
  23.505 -  return res;
  23.506 -}
  23.507 -
  23.508 -/* FrameHeaderLoad:
  23.509 - */
  23.510 -static GstFlowReturn
  23.511 -gst_nuv_demux_frame_header_load (GstNuvDemux * nuv, nuv_frame_header *h)
  23.512 -{
  23.513 -  unsigned char *data;
  23.514 -  GstBuffer *buf = NULL;
  23.515 -
  23.516 -  GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 12, TRUE, &buf);
  23.517 -
  23.518 -  if ((res != GST_FLOW_OK) || (buf == NULL)) {
  23.519 -      goto done;
  23.520 -  }
  23.521 -
  23.522 -  data = buf->data;
  23.523 -
  23.524 -  h->i_type = GPOINTER_TO_INT (data[0]);
  23.525 -  h->i_compression = GPOINTER_TO_INT (data[1]);
  23.526 -  h->i_keyframe = GPOINTER_TO_INT (data[2]);
  23.527 -  h->i_filters = GPOINTER_TO_INT (data[3]);
  23.528 -  h->i_timecode = GST_READ_UINT32_LE (&data[4]);
  23.529 -  h->i_length = GST_READ_UINT32_LE (&data[8]);
  23.530 -
  23.531 -  GST_DEBUG_OBJECT (nuv, "frame hdr: t=%c c=%c k=%d f=0x%x timecode=%d l=%d",
  23.532 -      h->i_type,
  23.533 -      h->i_compression ? h->i_compression : ' ',
  23.534 -      h->i_keyframe ? h->i_keyframe : ' ',
  23.535 -      h->i_filters, h->i_timecode, h->i_length);
  23.536 -
  23.537 -done:  
  23.538 -  if (buf != NULL) {
  23.539 -      gst_buffer_unref (buf);
  23.540 -      buf = NULL;
  23.541 -  }
  23.542 -
  23.543 -  return res;
  23.544 -}
  23.545 -
  23.546 -static GstFlowReturn
  23.547 -gst_nuv_demux_extended_header_load (GstNuvDemux * nuv,
  23.548 -    nuv_extended_header * h)
  23.549 -{
  23.550 -  unsigned char *data;
  23.551 -  GstBuffer *buff = NULL;
  23.552 -
  23.553 -  GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 512, TRUE, &buff);
  23.554 -
  23.555 -  if ((res != GST_FLOW_OK) || (buff == NULL)) {
  23.556 -      goto done;
  23.557 -  }
  23.558 -
  23.559 -  data = buff->data;
  23.560 -  h->i_version = GST_READ_UINT32_LE (&data[0]);
  23.561 -  h->i_video_fcc = GST_MAKE_FOURCC (data[4], data[5], data[6], data[7]);
  23.562 -  h->i_audio_fcc = GST_MAKE_FOURCC (data[8], data[9], data[10], data[11]);
  23.563 -  h->i_audio_sample_rate = GST_READ_UINT32_LE (&data[12]);
  23.564 -  h->i_audio_bits_per_sample = GST_READ_UINT32_LE (&data[16]);
  23.565 -  h->i_audio_channels = GST_READ_UINT32_LE (&data[20]);
  23.566 -  h->i_audio_compression_ratio = GST_READ_UINT32_LE (&data[24]);
  23.567 -  h->i_audio_quality = GST_READ_UINT32_LE (&data[28]);
  23.568 -  h->i_rtjpeg_quality = GST_READ_UINT32_LE (&data[32]);
  23.569 -  h->i_rtjpeg_luma_filter = GST_READ_UINT32_LE (&data[36]);
  23.570 -  h->i_rtjpeg_chroma_filter = GST_READ_UINT32_LE (&data[40]);
  23.571 -  h->i_lavc_bitrate = GST_READ_UINT32_LE (&data[44]);
  23.572 -  h->i_lavc_qmin = GST_READ_UINT32_LE (&data[48]);
  23.573 -  h->i_lavc_qmin = GST_READ_UINT32_LE (&data[52]);
  23.574 -  h->i_lavc_maxqdiff = GST_READ_UINT32_LE (&data[56]);
  23.575 -  h->i_seekable_offset = GST_READ_UINT64_LE (&data[60]);
  23.576 -  h->i_keyframe_adjust_offset = GST_READ_UINT64_LE (&data[68]);
  23.577 -
  23.578 -  GST_DEBUG_OBJECT (nuv,
  23.579 -      "ex hdr: v=%d vffc=%4.4s afcc=%4.4s %dHz %dbits ach=%d acr=%d aq=%d"
  23.580 -      "rtjpeg q=%d lf=%d lc=%d lavc br=%d qmin=%d qmax=%d maxqdiff=%d seekableoff=%lld keyfao=%lld",
  23.581 -      h->i_version, (gchar *) & h->i_video_fcc, (gchar *) & h->i_audio_fcc,
  23.582 -      h->i_audio_sample_rate, h->i_audio_bits_per_sample, h->i_audio_channels,
  23.583 -      h->i_audio_compression_ratio, h->i_audio_quality, h->i_rtjpeg_quality,
  23.584 -      h->i_rtjpeg_luma_filter, h->i_rtjpeg_chroma_filter, h->i_lavc_bitrate,
  23.585 -      h->i_lavc_qmin, h->i_lavc_qmax, h->i_lavc_maxqdiff, h->i_seekable_offset,
  23.586 -      h->i_keyframe_adjust_offset);
  23.587 -
  23.588 -done:
  23.589 -  if (buff != NULL) {
  23.590 -    gst_buffer_unref (buff);
  23.591 -    buff = NULL;
  23.592 -  }
  23.593 -  return res;
  23.594 -}
  23.595 -
  23.596 -
  23.597 -/* Query Functions */
  23.598 -static const GstQueryType *
  23.599 -gst_nuv_demux_get_src_query_types (GstPad * pad)
  23.600 -{
  23.601 -  static const GstQueryType src_types[] = {
  23.602 -    GST_QUERY_POSITION,
  23.603 -    GST_QUERY_DURATION,
  23.604 -    0
  23.605 -  };
  23.606 -
  23.607 -  return src_types;
  23.608 -}
  23.609 -
  23.610 -static gboolean
  23.611 -gst_nuv_demux_handle_src_query (GstPad * pad, GstQuery * query)
  23.612 -{
  23.613 -  gboolean res = FALSE;
  23.614 -  GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
  23.615 -
  23.616 -  switch (GST_QUERY_TYPE (query)) {
  23.617 -    case GST_QUERY_POSITION:
  23.618 -      if (GST_CLOCK_TIME_IS_VALID (nuv->priv->last_frame_time)) {
  23.619 -        gst_query_set_position (query, GST_FORMAT_TIME, nuv->priv->last_frame_time);
  23.620 -        res = TRUE;
  23.621 -      }
  23.622 -      break;
  23.623 -    case GST_QUERY_DURATION:
  23.624 -      {
  23.625 -        if (nuv->priv->duration_time != GST_CLOCK_TIME_NONE) {
  23.626 -            gst_query_set_duration (query, GST_FORMAT_TIME, nuv->priv->duration_time);
  23.627 -	    res = TRUE;
  23.628 -        }
  23.629 -      }
  23.630 -      break;
  23.631 -    default:
  23.632 -      res = FALSE;
  23.633 -      break;
  23.634 -  }
  23.635 -
  23.636 -  gst_object_unref (nuv);
  23.637 -
  23.638 -  return res;
  23.639 -}
  23.640 -
  23.641 -static GstPad*
  23.642 -gst_nuv_demux_create_pad (GstNuvDemux *nuv, GstCaps *caps, GstStaticPadTemplate *template, const gchar* name)
  23.643 -{
  23.644 -    GstPad *pad = NULL;
  23.645 -    pad = gst_pad_new_from_static_template (template, name);
  23.646 -    gst_pad_set_caps (pad, caps);
  23.647 -    gst_pad_set_active (pad, TRUE);
  23.648 -    gst_pad_use_fixed_caps (pad);
  23.649 -    gst_element_add_pad (GST_ELEMENT (nuv), pad);
  23.650 -
  23.651 -    gst_pad_set_event_function (pad,
  23.652 -      GST_DEBUG_FUNCPTR (gst_nuv_demux_srcpad_event));
  23.653 -
  23.654 -    gst_pad_set_query_type_function (pad,
  23.655 -      GST_DEBUG_FUNCPTR (gst_nuv_demux_get_src_query_types));
  23.656 -
  23.657 -    gst_pad_set_query_function (pad,
  23.658 -      GST_DEBUG_FUNCPTR (gst_nuv_demux_handle_src_query));
  23.659 -      
  23.660 -
  23.661 -    return pad;
  23.662 -}
  23.663 -
  23.664 -static void
  23.665 -gst_nuv_demux_create_pads (GstNuvDemux * nuv)
  23.666 -{
  23.667 -  if (nuv->priv->h.i_video_blocks != 0) {
  23.668 -    GstCaps *video_caps = NULL;
  23.669 -
  23.670 -    video_caps = gst_caps_new_simple ("video/x-divx",
  23.671 -        "divxversion", G_TYPE_INT, 4,
  23.672 -        "width", G_TYPE_INT, nuv->priv->h.i_width,
  23.673 -        "height", G_TYPE_INT, nuv->priv->h.i_height,
  23.674 -        "framerate", GST_TYPE_FRACTION, nuv->priv->h.i_fpsn, nuv->priv->h.i_fpsd,
  23.675 -        "format", GST_TYPE_FOURCC, nuv->priv->eh.i_video_fcc,
  23.676 -        "pixel-aspect-ratio", GST_TYPE_FRACTION,
  23.677 -        (gint) (nuv->priv->h.d_aspect * 1000.0f), 1000, NULL);
  23.678 -
  23.679 -    nuv->priv->src_video_pad = gst_nuv_demux_create_pad (nuv, video_caps, &video_src_template, "video_src");
  23.680 -    gst_caps_unref (video_caps);
  23.681 -  }
  23.682 -
  23.683 -  if (nuv->priv->h.i_audio_blocks != 0) {
  23.684 -    GstCaps *audio_caps = NULL;
  23.685 -
  23.686 -    audio_caps = gst_caps_new_simple ("audio/mpeg",
  23.687 -        "rate", G_TYPE_INT, nuv->priv->eh.i_audio_sample_rate,
  23.688 -        "format", GST_TYPE_FOURCC, nuv->priv->eh.i_audio_fcc,
  23.689 -        "channels", G_TYPE_INT, nuv->priv->eh.i_audio_channels,
  23.690 -        "layer", G_TYPE_INT, 3, // fixme: magic number
  23.691 -        "mpegversion", G_TYPE_INT, nuv->priv->eh.i_version, NULL);
  23.692 -    
  23.693 -    nuv->priv->src_audio_pad = gst_nuv_demux_create_pad (nuv, audio_caps, &audio_src_template, "audio_src");
  23.694 -    gst_caps_unref (audio_caps);
  23.695 -  }
  23.696 -
  23.697 -  gst_element_no_more_pads (GST_ELEMENT (nuv));
  23.698 -}
  23.699 -
  23.700 -static gboolean
  23.701 -gst_nuv_demux_validate_header (nuv_frame_header *h)
  23.702 -{
  23.703 -  gboolean valid = FALSE;
  23.704 -  //g_usleep (1 * G_USEC_PER_SEC );
  23.705 -  switch  (h->i_type) {
  23.706 -/*
  23.707 -    case 'V':
  23.708 -      if (h->i_compression == 0 ||
  23.709 -          h->i_compression == 1 ||
  23.710 -          h->i_compression == 2 ||
  23.711 -          h->i_compression == 'N' ||
  23.712 -          h->i_compression == 'L') {
  23.713 -         valid = TRUE;
  23.714 -      }
  23.715 -      break;
  23.716 -    case 'A':
  23.717 -      if (h->i_compression == 0 ||
  23.718 -          h->i_compression == 1 ||
  23.719 -          h->i_compression == 2 ||
  23.720 -          h->i_compression == 3 ||
  23.721 -          h->i_compression == 'F' ||
  23.722 -          h->i_compression == 'S' ||
  23.723 -          h->i_compression == 'N' ||
  23.724 -          h->i_compression == 'L') {
  23.725 -         valid = TRUE;
  23.726 -      }
  23.727 -      break;
  23.728 -    case 'S':
  23.729 -      if (h->i_compression == 'B' ||
  23.730 -          h->i_compression == 'A' ||
  23.731 -          h->i_compression == 'V' ||
  23.732 -          h->i_compression == 'S') {
  23.733 -         valid = TRUE;
  23.734 -      }
  23.735 -      break;
  23.736 -*/
  23.737 -    case 'A':
  23.738 -    case 'V':
  23.739 -    case 'S':
  23.740 -    case 'R':
  23.741 -    case 'D':
  23.742 -    case 'Q':
  23.743 -      valid  = TRUE;
  23.744 -      break;
  23.745 -    default:
  23.746 -      valid = FALSE;
  23.747 -  }
  23.748 -
  23.749 -  return valid;
  23.750 -}
  23.751 -
  23.752 -static GstFlowReturn
  23.753 -gst_nuv_demux_read_head_frame (GstNuvDemux * nuv)
  23.754 -{
  23.755 -  GstFlowReturn ret = GST_FLOW_OK;
  23.756 -  gboolean valid = FALSE;
  23.757 -
  23.758 -  do {
  23.759 -    ret = gst_nuv_demux_frame_header_load (nuv, &nuv->priv->fh);
  23.760 -    if (ret != GST_FLOW_OK) {
  23.761 -      return ret;
  23.762 -    }
  23.763 -
  23.764 -    if (gst_nuv_demux_validate_header (&nuv->priv->fh) == TRUE)
  23.765 -      valid = TRUE;
  23.766 -
  23.767 -  } while (valid == FALSE);
  23.768 -
  23.769 -  nuv->priv->state = GST_NUV_DEMUX_MOVI;
  23.770 -  return ret;
  23.771 -}
  23.772 -
  23.773 -static gboolean
  23.774 -gst_nuv_combine_flow (GstNuvDemux *nuv)
  23.775 -{
  23.776 -    GstFlowReturn ret_video = nuv->priv->last_video_return;
  23.777 -    GstFlowReturn ret_audio = nuv->priv->last_audio_return;
  23.778 -
  23.779 -    if ((ret_video != GST_FLOW_OK) &&
  23.780 -        (ret_audio != GST_FLOW_OK))
  23.781 -        return FALSE;
  23.782 -
  23.783 -    if (GST_FLOW_IS_FATAL (ret_video))
  23.784 -        return FALSE;
  23.785 -
  23.786 -    if (GST_FLOW_IS_FATAL (ret_audio))
  23.787 -        return FALSE;
  23.788 -
  23.789 -    return TRUE;
  23.790 -}
  23.791 -
  23.792 -static GstFlowReturn
  23.793 -gst_nuv_demux_stream_data (GstNuvDemux * nuv)
  23.794 -{
  23.795 -  GstFlowReturn ret = GST_FLOW_OK;
  23.796 -  GstPad *pad = NULL;
  23.797 -  guint64 timestamp;
  23.798 -  GstBuffer *buf = NULL;
  23.799 -  nuv_frame_header h;
  23.800 -
  23.801 -  h = nuv->priv->fh;
  23.802 -
  23.803 -  if (h.i_type == 'R') {
  23.804 -    goto done;
  23.805 -  }
  23.806 -
  23.807 -  if (h.i_length > 0) {
  23.808 -    ret = gst_nuv_demux_read_bytes (nuv, h.i_length, TRUE, &buf);
  23.809 -    if ((ret != GST_FLOW_OK) || (buf == NULL)) {
  23.810 -      goto done;
  23.811 -    }
  23.812 -
  23.813 -    if ((h.i_timecode < 0)) {
  23.814 -      h.i_timecode = 0;
  23.815 -      //goto done;
  23.816 -    }
  23.817 -
  23.818 -    timestamp = h.i_timecode * GST_MSECOND;
  23.819 -    GST_BUFFER_TIMESTAMP (buf) = timestamp;
  23.820 -  }
  23.821 -  else {
  23.822 -    goto done;
  23.823 -  }
  23.824 -
  23.825 -
  23.826 -  switch (h.i_type) {
  23.827 -    case 'V':
  23.828 -    {
  23.829 -      pad = nuv->priv->src_video_pad;
  23.830 -
  23.831 -      if (nuv->priv->new_video_segment) {
  23.832 -
  23.833 -        /* send new segment event*/
  23.834 -        gst_pad_push_event (nuv->priv->src_video_pad,
  23.835 -          gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0,
  23.836 -                                     GST_CLOCK_TIME_NONE, 0));
  23.837 -
  23.838 -        if (nuv->priv->time_start == GST_CLOCK_TIME_NONE) {
  23.839 -            nuv->priv->time_start = timestamp;
  23.840 -        }
  23.841 -        nuv->priv->new_video_segment = FALSE;
  23.842 -      }
  23.843 -
  23.844 -      break;
  23.845 -    }
  23.846 -    case 'A':
  23.847 -    {
  23.848 -      pad = nuv->priv->src_audio_pad;
  23.849 -
  23.850 -      if (nuv->priv->new_audio_segment) {
  23.851 -        /* send new segment event*/
  23.852 -        gst_pad_push_event (nuv->priv->src_audio_pad,
  23.853 -          gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0,
  23.854 -                                     GST_CLOCK_TIME_NONE, 0));
  23.855 -
  23.856 -        if (nuv->priv->time_start == GST_CLOCK_TIME_NONE) {
  23.857 -            nuv->priv->time_start = timestamp;
  23.858 -        }
  23.859 -        nuv->priv->new_audio_segment = FALSE;
  23.860 -      }
  23.861 -
  23.862 -      break;
  23.863 -    }
  23.864 -    case 'S':
  23.865 -   {
  23.866 -      switch (h.i_compression) {
  23.867 -        case 'V':
  23.868 -          GST_DEBUG_OBJECT (nuv, "sending new video segment: %d", h.i_timecode);
  23.869 -          gst_pad_push_event (nuv->priv->src_video_pad,
  23.870 -              gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, h.i_timecode * GST_MSECOND,
  23.871 -              		GST_CLOCK_TIME_NONE, 0));
  23.872 -          break;
  23.873 -        case 'A':
  23.874 -          GST_DEBUG_OBJECT (nuv, "sending new audio segment: %d", h.i_timecode);
  23.875 -          gst_pad_push_event (nuv->priv->src_audio_pad,
  23.876 -              gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0,
  23.877 -              		GST_CLOCK_TIME_NONE, 0));
  23.878 -          break;
  23.879 -        default:
  23.880 -          break;
  23.881 -      }
  23.882 -      goto done;
  23.883 -    }
  23.884 -    default:
  23.885 -      break;
  23.886 -  }
  23.887 -
  23.888 -  if ((buf != NULL) && (pad != NULL)) {
  23.889 -      /* pushing the buffer */
  23.890 -      gst_buffer_set_caps (buf, GST_PAD_CAPS (pad));
  23.891 -      ret = gst_pad_push (pad, buf);
  23.892 -      buf = NULL;
  23.893 -
  23.894 -      if (ret != GST_FLOW_OK) {
  23.895 -        GST_WARNING_OBJECT (nuv, "error: %d pushing on srcpad %s", ret, gst_pad_get_name (pad));
  23.896 -
  23.897 -        if (pad == nuv->priv->src_video_pad) {
  23.898 -            nuv->priv->last_video_return = ret;
  23.899 -        }
  23.900 -        else if (pad == nuv->priv->src_audio_pad) {
  23.901 -            nuv->priv->last_audio_return = ret;
  23.902 -        }
  23.903 -
  23.904 -        /* verify anothers flow if is necessary stop task */
  23.905 -        if (gst_nuv_combine_flow (nuv) != FALSE) {
  23.906 -          ret = GST_FLOW_OK;
  23.907 -        } else {
  23.908 -	  GST_WARNING_OBJECT (nuv, "error: on push");
  23.909 -	}
  23.910 -
  23.911 -      }
  23.912 -  } 
  23.913 -
  23.914 -done:
  23.915 -  if (buf != NULL) {
  23.916 -      gst_buffer_unref (buf);
  23.917 -      buf = NULL;
  23.918 -  }
  23.919 -  if (ret == GST_FLOW_OK) {
  23.920 -     nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
  23.921 -     memset (&nuv->priv->fh, 0, sizeof (nuv->priv->fh));
  23.922 -  }
  23.923 -  return ret;
  23.924 -}
  23.925 -
  23.926 -static GstFlowReturn
  23.927 -gst_nuv_demux_stream_mpeg_data (GstNuvDemux * nuv)
  23.928 -{
  23.929 -  GstFlowReturn ret = GST_FLOW_OK;
  23.930 -
  23.931 -  /* ffmpeg extra data */
  23.932 -  ret = gst_nuv_demux_read_bytes (nuv, nuv->priv->mpeg_data_size, TRUE,
  23.933 -      &nuv->priv->mpeg_buffer);
  23.934 -  if ((ret != GST_FLOW_OK) || (nuv->priv->mpeg_buffer == NULL)) {
  23.935 -    return ret;
  23.936 -  }
  23.937 -
  23.938 -  GST_BUFFER_SIZE (nuv->priv->mpeg_buffer) = nuv->priv->mpeg_data_size;
  23.939 -  nuv->priv->state = GST_NUV_DEMUX_EXTEND_HEADER;
  23.940 -  return ret;
  23.941 -}
  23.942 -
  23.943 -static GstFlowReturn
  23.944 -gst_nuv_demux_stream_extra_data (GstNuvDemux * nuv)
  23.945 -{
  23.946 -  GstFlowReturn ret = GST_FLOW_OK;
  23.947 -
  23.948 -  /* Load 'D' */
  23.949 -  nuv_frame_header h;
  23.950 -
  23.951 -  ret = gst_nuv_demux_frame_header_load (nuv, &h);
  23.952 -  if (ret != GST_FLOW_OK)
  23.953 -    return ret;
  23.954 -
  23.955 -  if (h.i_type != 'D') {
  23.956 -    GST_WARNING_OBJECT (nuv, "Unsuported rtjpeg");
  23.957 -    return GST_FLOW_NOT_SUPPORTED;
  23.958 -  }
  23.959 -
  23.960 -  if (h.i_length > 0) {
  23.961 -    if (h.i_compression == 'F') {
  23.962 -      nuv->priv->state = GST_NUV_DEMUX_MPEG_DATA;
  23.963 -    } else {
  23.964 -      GST_WARNING_OBJECT (nuv, "only file with extended chunk are supported");
  23.965 -      return GST_FLOW_NOT_SUPPORTED;
  23.966 -    }
  23.967 -  } else {
  23.968 -    nuv->priv->state = GST_NUV_DEMUX_EXTEND_HEADER;
  23.969 -  }
  23.970 -
  23.971 -  return ret;
  23.972 -}
  23.973 -
  23.974 -static GstFlowReturn
  23.975 -gst_nuv_demux_stream_extend_header_data (GstNuvDemux * nuv)
  23.976 -{
  23.977 -  GstFlowReturn ret = GST_FLOW_OK;
  23.978 -
  23.979 -  ret = gst_nuv_demux_extended_header_load (nuv, &nuv->priv->eh);
  23.980 -  if (ret != GST_FLOW_OK)
  23.981 -    return ret;
  23.982 -
  23.983 -  gst_nuv_demux_create_pads (nuv);
  23.984 -  nuv->priv->state = GST_NUV_DEMUX_INDEX_CREATE;
  23.985 -  return ret;
  23.986 -}
  23.987 -
  23.988 -static GstFlowReturn
  23.989 -gst_nuv_demux_stream_extend_header (GstNuvDemux * nuv)
  23.990 -{
  23.991 -  GstBuffer *buf = NULL;
  23.992 -  GstFlowReturn res = GST_FLOW_OK;
  23.993 -
  23.994 -  res = gst_nuv_demux_read_bytes (nuv, 1, FALSE, &buf);
  23.995 -  if ((res != GST_FLOW_OK) || (buf == NULL)) {
  23.996 -    if (buf != NULL) {
  23.997 -      gst_buffer_unref (buf);
  23.998 -    }
  23.999 -    return res;
 23.1000 -  }
 23.1001 -
 23.1002 -  if (buf->data[0] == 'X') {
 23.1003 -    gst_buffer_unref (buf);
 23.1004 -    buf = NULL;
 23.1005 -    nuv_frame_header h;
 23.1006 -
 23.1007 -    res = gst_nuv_demux_frame_header_load (nuv, &h);
 23.1008 -    if (res != GST_FLOW_OK)
 23.1009 -      return res;
 23.1010 -
 23.1011 -    if (h.i_length != 512) {
 23.1012 -      return GST_FLOW_ERROR;
 23.1013 -    }
 23.1014 -    nuv->priv->state = GST_NUV_DEMUX_EXTEND_HEADER_DATA;
 23.1015 -  } else {
 23.1016 -    nuv->priv->state = GST_NUV_DEMUX_INVALID_DATA;
 23.1017 -    g_object_unref (buf);
 23.1018 -    GST_ELEMENT_WARNING (nuv, STREAM, FAILED,
 23.1019 -        (_("incomplete NUV support")), ("incomplete NUV support"));
 23.1020 -    return GST_FLOW_ERROR;
 23.1021 -  }
 23.1022 -  return res;
 23.1023 -}
 23.1024 -
 23.1025 -static void
 23.1026 -gst_nuv_demux_create_seek_index (GstNuvDemux * nuv)
 23.1027 -{
 23.1028 -  GstMessage *msg;
 23.1029 -  nuv_frame_header h;
 23.1030 -
 23.1031 -  while (gst_nuv_demux_frame_header_load (nuv, &h) == GST_FLOW_OK) {
 23.1032 -    if ((h.i_type == 'V') && (h.i_keyframe == 0)) {
 23.1033 -      frame_index_data *f = g_new0 (frame_index_data, 1);
 23.1034 -
 23.1035 -      f->offset = nuv->priv->offset - 12;
 23.1036 -      f->timecode = h.i_timecode * GST_MSECOND;
 23.1037 -
 23.1038 -      nuv->priv->index = g_slist_append (nuv->priv->index, f);
 23.1039 -    } 
 23.1040 -    if (h.i_type != 'R') {
 23.1041 -      nuv->priv->offset += h.i_length;
 23.1042 -		  if (h.i_type == 'A' || h.i_type == 'V')
 23.1043 -  		  nuv->priv->duration_time = h.i_timecode * GST_MSECOND;
 23.1044 -    }
 23.1045 -  }
 23.1046 -  GST_DEBUG_OBJECT  (nuv, "CREATING INDEX: DONE : DURATION Bytes/Sec: %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT, 
 23.1047 -    nuv->priv->offset, nuv->priv->duration_time);
 23.1048 -  
 23.1049 -  nuv->priv->duration_bytes = nuv->priv->offset;
 23.1050 -  nuv->priv->offset = nuv->priv->header_lengh;
 23.1051 -
 23.1052 -  msg = gst_message_new_duration (GST_OBJECT (nuv), GST_FORMAT_TIME, nuv->priv->duration_time);
 23.1053 -  gst_element_post_message (GST_ELEMENT (nuv), msg);
 23.1054 -}
 23.1055 -
 23.1056 -static GstFlowReturn
 23.1057 -gst_nuv_demux_play (GstPad * pad)
 23.1058 -{
 23.1059 -  GstFlowReturn res = GST_FLOW_OK;
 23.1060 -  GstNuvDemux *nuv = GST_NUV_DEMUX (GST_PAD_PARENT (pad));
 23.1061 -
 23.1062 -  switch (nuv->priv->state) {
 23.1063 -    case GST_NUV_DEMUX_START:
 23.1064 -      res = gst_nuv_demux_stream_file_header (nuv);
 23.1065 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1066 -        goto pause;
 23.1067 -      }
 23.1068 -      break;
 23.1069 -
 23.1070 -    case GST_NUV_DEMUX_HEADER_DATA:
 23.1071 -      res = gst_nuv_demux_stream_header_data (nuv);
 23.1072 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1073 -        goto pause;
 23.1074 -      }
 23.1075 -      break;
 23.1076 -
 23.1077 -    case GST_NUV_DEMUX_EXTRA_DATA:
 23.1078 -      res = gst_nuv_demux_stream_extra_data (nuv);
 23.1079 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1080 -        goto pause;
 23.1081 -      }
 23.1082 -      break;
 23.1083 -
 23.1084 -    case GST_NUV_DEMUX_MPEG_DATA:
 23.1085 -      res = gst_nuv_demux_stream_mpeg_data (nuv);
 23.1086 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1087 -        goto pause;
 23.1088 -      }
 23.1089 -      break;
 23.1090 -
 23.1091 -    case GST_NUV_DEMUX_EXTEND_HEADER:
 23.1092 -      res = gst_nuv_demux_stream_extend_header (nuv);
 23.1093 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1094 -        goto pause;
 23.1095 -      }
 23.1096 -      break;
 23.1097 -
 23.1098 -    case GST_NUV_DEMUX_EXTEND_HEADER_DATA:
 23.1099 -      res = gst_nuv_demux_stream_extend_header_data (nuv);
 23.1100 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1101 -        goto pause;
 23.1102 -      }
 23.1103 -      //store file header size
 23.1104 -      nuv->priv->header_lengh = nuv->priv->offset;
 23.1105 -      break;
 23.1106 -
 23.1107 -    case GST_NUV_DEMUX_INDEX_CREATE:
 23.1108 -      if (nuv->priv->mode == NUV_PULL_MODE) {
 23.1109 -        gst_nuv_demux_create_seek_index (nuv);
 23.1110 -      }
 23.1111 -
 23.1112 -    case GST_NUV_DEMUX_FRAME_HEADER:
 23.1113 -      res = gst_nuv_demux_read_head_frame (nuv);
 23.1114 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1115 -        goto pause;
 23.1116 -      }
 23.1117 -      break;
 23.1118 -
 23.1119 -    case GST_NUV_DEMUX_MOVI: 
 23.1120 -      res = gst_nuv_demux_stream_data (nuv);
 23.1121 -      if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
 23.1122 -        goto pause;
 23.1123 -      }
 23.1124 -      break;
 23.1125 -
 23.1126 -    case GST_NUV_DEMUX_INVALID_DATA:
 23.1127 -      goto pause;
 23.1128 -      break;
 23.1129 -    default:
 23.1130 -      g_assert_not_reached ();
 23.1131 -  }
 23.1132 -
 23.1133 -  return GST_FLOW_OK;
 23.1134 -
 23.1135 -pause:
 23.1136 -  GST_LOG_OBJECT (nuv, "pausing task, reason %s", gst_flow_get_name (res));
 23.1137 -  gst_pad_pause_task (nuv->priv->sinkpad);
 23.1138 -
 23.1139 -  if (res == GST_FLOW_ERROR_EOS) {
 23.1140 -    gst_nuv_demux_send_eos (nuv);
 23.1141 -    nuv->priv->eos = TRUE;
 23.1142 -    res = GST_FLOW_OK;
 23.1143 -  }
 23.1144 -
 23.1145 -  if (GST_FLOW_IS_FATAL (res)) {
 23.1146 -    GST_ELEMENT_ERROR (nuv, STREAM, FAILED,
 23.1147 -        (_("Internal data stream error.")),
 23.1148 -        ("streaming stopped, reason %s", gst_flow_get_name (res)));
 23.1149 -
 23.1150 -    gst_nuv_demux_send_eos (nuv);
 23.1151 -  }
 23.1152 -  return res;
 23.1153 -}
 23.1154 -
 23.1155 -static void
 23.1156 -gst_nuv_demux_send_eos (GstNuvDemux * nuv)
 23.1157 -{
 23.1158 -  gst_element_post_message (GST_ELEMENT (nuv),
 23.1159 -      gst_message_new_segment_done (GST_OBJECT (nuv), GST_FORMAT_TIME, -1));
 23.1160 -
 23.1161 -  if (nuv->priv->src_video_pad)
 23.1162 -    gst_pad_push_event (nuv->priv->src_video_pad, gst_event_new_eos ());
 23.1163 -  if (nuv->priv->src_audio_pad)
 23.1164 -    gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_new_eos ());
 23.1165 -}
 23.1166 -
 23.1167 -static GstFlowReturn
 23.1168 -gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size, gboolean move,
 23.1169 -    GstBuffer ** buffer)
 23.1170 -{
 23.1171 -  GstFlowReturn ret = GST_FLOW_OK;
 23.1172 -
 23.1173 -  if (size == 0) {
 23.1174 -    return ret;
 23.1175 -  }
 23.1176 -
 23.1177 -
 23.1178 -  if (nuv->priv->mode == NUV_PULL_MODE) {
 23.1179 -    ret = gst_pad_pull_range (nuv->priv->sinkpad, nuv->priv->offset, size, buffer);
 23.1180 -    if (ret == GST_FLOW_OK) {
 23.1181 -      if (move) {
 23.1182 -        nuv->priv->offset += size;
 23.1183 -      }
 23.1184 -      /* got eos */
 23.1185 -    } else if (ret == GST_FLOW_UNEXPECTED) {
 23.1186 -      return GST_FLOW_ERROR_EOS;
 23.1187 -    }
 23.1188 -  } else {
 23.1189 -    if (gst_adapter_available (nuv->priv->adapter) < size) {
 23.1190 -      nuv->priv->more_data = TRUE;
 23.1191 -      return GST_FLOW_ERROR_NO_DATA;
 23.1192 -    }
 23.1193 -    if (move) {
 23.1194 -      *buffer = gst_adapter_take_buffer (nuv->priv->adapter, size);
 23.1195 -    } else {
 23.1196 -      guint8 *data = NULL;
 23.1197 -      data = (guint8 *) gst_adapter_peek (nuv->priv->adapter, size);
 23.1198 -      *buffer = gst_buffer_new ();
 23.1199 -      gst_buffer_set_data (*buffer, data, size);
 23.1200 -    }
 23.1201 -  }
 23.1202 -  return ret;
 23.1203 -}
 23.1204 -
 23.1205 -static gboolean
 23.1206 -gst_nuv_demux_sink_activate (GstPad * sinkpad)
 23.1207 -{
 23.1208 -  gboolean res = TRUE;
 23.1209 -  GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
 23.1210 - 
 23.1211 -  if (gst_pad_check_pull_range (sinkpad)) {
 23.1212 -    gst_adapter_clear (nuv->priv->adapter);
 23.1213 -    res = gst_pad_activate_pull (sinkpad, TRUE);
 23.1214 -  } else {
 23.1215 -    gst_adapter_clear (nuv->priv->adapter);
 23.1216 -    res = gst_pad_activate_push (sinkpad, TRUE);
 23.1217 -  }
 23.1218 -  
 23.1219 -  g_object_unref (nuv);
 23.1220 -  return res;
 23.1221 -}
 23.1222 -
 23.1223 -static gboolean
 23.1224 -gst_nuv_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
 23.1225 -{
 23.1226 -  GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
 23.1227 -
 23.1228 -  if (active) {
 23.1229 -    GST_DEBUG_OBJECT (nuv, "activating pull function");
 23.1230 -    nuv->priv->mode = NUV_PULL_MODE;
 23.1231 -    gst_adapter_clear (nuv->priv->adapter);
 23.1232 -
 23.1233 -    gst_pad_start_task (sinkpad, (GstTaskFunction) gst_nuv_demux_loop, sinkpad);
 23.1234 -  } else {
 23.1235 -    GST_DEBUG_OBJECT (nuv, "deactivating pull function");
 23.1236 -    gst_pad_stop_task (sinkpad);
 23.1237 -  }
 23.1238 -  gst_object_unref (nuv);
 23.1239 -
 23.1240 -  return TRUE;
 23.1241 -}
 23.1242 -
 23.1243 -static gboolean
 23.1244 -gst_nuv_demux_sink_activate_push (GstPad * pad, gboolean active)
 23.1245 -{
 23.1246 -  GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
 23.1247 -
 23.1248 -  if (active) {
 23.1249 -    nuv->priv->mode = NUV_PUSH_MODE;
 23.1250 -    gst_adapter_clear (nuv->priv->adapter);
 23.1251 -
 23.1252 -    GST_DEBUG_OBJECT (nuv, "activating push/chain function");
 23.1253 -  } else {
 23.1254 -    GST_DEBUG_OBJECT (nuv, "deactivating push/chain function");
 23.1255 -  }
 23.1256 -
 23.1257 -  gst_object_unref (nuv);
 23.1258 -
 23.1259 -  return TRUE;
 23.1260 -}
 23.1261 -
 23.1262 -static frame_index_data *
 23.1263 -gst_nuv_demux_do_seek_index (GstNuvDemux *nuv, gint64 seek_pos, 
 23.1264 -  gint64 segment_stop, GstFormat format)
 23.1265 -{
 23.1266 -  GSList *l;
 23.1267 -  frame_index_data *ret = NULL;
 23.1268 -
 23.1269 -  if (nuv->priv->index == NULL) {
 23.1270 -    return NULL;
 23.1271 -  }
 23.1272 -
 23.1273 -  /* find keyframe closest to the requested position  */
 23.1274 -  for (l = nuv->priv->index; l != NULL; l = l->next) {
 23.1275 -    frame_index_data *f = (frame_index_data *) l->data;  
 23.1276 -    gint64 pos = 0;
 23.1277 -   
 23.1278 -    if (format == GST_FORMAT_BYTES) {     
 23.1279 -      pos = f->offset;
 23.1280 -    } else if (format == GST_FORMAT_TIME) {
 23.1281 -      pos = f->timecode;
 23.1282 -    } else {
 23.1283 -      return NULL;
 23.1284 -    }
 23.1285 -
 23.1286 -    if (pos >= seek_pos) {
 23.1287 -      ret = f;
 23.1288 -      break;
 23.1289 -    }
 23.1290 -
 23.1291 -    if ((segment_stop != -1) &&  (segment_stop != GST_CLOCK_TIME_NONE) && (pos > segment_stop)) {
 23.1292 -      break;
 23.1293 -    }
 23.1294 -  } 
 23.1295 -
 23.1296 -  return ret;
 23.1297 -}
 23.1298 -
 23.1299 -static gboolean
 23.1300 -gst_nuv_demux_do_seek (GstNuvDemux *nuv, GstEvent * event)
 23.1301 -{
 23.1302 -  gdouble rate;
 23.1303 -  GstFormat format;
 23.1304 -  GstSeekFlags flags;
 23.1305 -  GstSeekType cur_type;
 23.1306 -  gint64 cur;
 23.1307 -  GstSeekType stop_type;
 23.1308 -  gint64 stop;
 23.1309 -  gboolean flush;
 23.1310 -  frame_index_data *entry;
 23.1311 -  gint64 segment_start;
 23.1312 -  gint64 segment_stop;
 23.1313 -  GstEvent *newsegment_event;
 23.1314 -
 23.1315 -  if (nuv->priv->eos) {
 23.1316 -    return FALSE;
 23.1317 -  }
 23.1318 -
 23.1319 -  if (nuv->priv->mode == NUV_PUSH_MODE) {
 23.1320 -    return FALSE;
 23.1321 -  }
 23.1322 -
 23.1323 -
 23.1324 -  gst_event_parse_seek (event, &rate, &format, &flags,
 23.1325 -      &cur_type, &cur, &stop_type, &stop);
 23.1326 -
 23.1327 -
 23.1328 -
 23.1329 -/*
 23.1330 -  if (format == GST_FORMAT_TIME) {
 23.1331 -    GST_DEBUG_OBJECT (nuv, "Can only seek on BYTES");
 23.1332 -    return FALSE;
 23.1333 -  }
 23.1334 -*/
 23.1335 -
 23.1336 -  if (rate <= 0.0) {
 23.1337 -    GST_DEBUG_OBJECT (nuv, "Can only seek with positive rate");
 23.1338 -    return FALSE;
 23.1339 -  }
 23.1340 -  
 23.1341 -  if (cur_type == GST_SEEK_TYPE_SET) {
 23.1342 -    GST_OBJECT_LOCK (nuv);
 23.1343 -    if (gst_nuv_demux_do_seek_index (nuv, cur, -1, format) == NULL) {
 23.1344 -      GST_DEBUG_OBJECT (nuv, "No matching seek entry in index");
 23.1345 -      GST_OBJECT_UNLOCK (nuv);
 23.1346 -      return FALSE;
 23.1347 -    }
 23.1348 -    GST_OBJECT_UNLOCK (nuv);
 23.1349 -  }
 23.1350 -
 23.1351 -  flush = !!(flags & GST_SEEK_FLAG_FLUSH);
 23.1352 -  
 23.1353 -  if (flush) {
 23.1354 -    gst_pad_push_event (nuv->priv->sinkpad, gst_event_new_flush_start ());
 23.1355 -    if (nuv->priv->src_video_pad != NULL) {
 23.1356 -      gst_pad_push_event (nuv->priv->src_video_pad, gst_event_new_flush_start ());
 23.1357 -    }
 23.1358 -
 23.1359 -    if (nuv->priv->src_audio_pad != NULL) {
 23.1360 -      gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_new_flush_start ());
 23.1361 -    }
 23.1362 -  }
 23.1363 -  else {
 23.1364 -    gst_pad_pause_task (nuv->priv->sinkpad);
 23.1365 -  }
 23.1366 -
 23.1367 -  GST_PAD_STREAM_LOCK (nuv->priv->sinkpad);
 23.1368 -  GST_OBJECT_LOCK (nuv);
 23.1369 -
 23.1370 -
 23.1371 -  if (cur == GST_CLOCK_TIME_NONE)
 23.1372 -    cur = 0;
 23.1373 -  if (stop == GST_CLOCK_TIME_NONE)
 23.1374 -    stop = nuv->priv->duration_time;
 23.1375 -
 23.1376 -  if (cur_type == GST_SEEK_TYPE_SET)
 23.1377 -    segment_start = cur;
 23.1378 -  else if (cur_type == GST_SEEK_TYPE_CUR)
 23.1379 -    segment_start = nuv->priv->segment_start + cur;
 23.1380 -  else
 23.1381 -    segment_start = nuv->priv->segment_start;
 23.1382 -
 23.1383 -  if (stop_type == GST_SEEK_TYPE_SET)
 23.1384 -    segment_stop = stop;
 23.1385 -  else if (stop_type == GST_SEEK_TYPE_CUR)
 23.1386 -    segment_stop = nuv->priv->segment_stop + stop;
 23.1387 -  else
 23.1388 -    segment_stop = nuv->priv->segment_stop;
 23.1389 -
 23.1390 -  segment_start = CLAMP (segment_start, 0, nuv->priv->duration_time);
 23.1391 -  segment_stop = CLAMP (segment_stop, 0, nuv->priv->duration_time);
 23.1392 -
 23.1393 -  entry = gst_nuv_demux_do_seek_index (nuv, segment_start,
 23.1394 -      segment_stop, format);
 23.1395 -
 23.1396 -  if (entry == NULL) {
 23.1397 -    GST_DEBUG_OBJECT (nuv, "No matching seek entry in index");
 23.1398 -    goto seek_error;
 23.1399 -  }
 23.1400 -
 23.1401 -  segment_start = entry->timecode;
 23.1402 -
 23.1403 -  nuv->priv->segment_start = segment_start;
 23.1404 -  nuv->priv->segment_stop = segment_stop;
 23.1405 -
 23.1406 -  GST_OBJECT_UNLOCK (nuv);
 23.1407 -
 23.1408 -  if (!nuv->priv->eos) {
 23.1409 -    GstMessage *msg;
 23.1410 -    msg = gst_message_new_segment_start (GST_OBJECT (nuv), GST_FORMAT_TIME,
 23.1411 -      nuv->priv->segment_start);
 23.1412 -  
 23.1413 -    gst_element_post_message (GST_ELEMENT (nuv), msg);
 23.1414 -  }
 23.1415 -
 23.1416 -  GST_DEBUG_OBJECT (nuv, "NEW SEGMENT START %" G_GUINT64_FORMAT ", STOP %" G_GUINT64_FORMAT, 
 23.1417 -    segment_start, segment_stop);
 23.1418 -  newsegment_event = gst_event_new_new_segment (FALSE, rate,
 23.1419 -    GST_FORMAT_TIME, segment_start, segment_stop, segment_start);
 23.1420 -
 23.1421 -
 23.1422 -  if (flush) {
 23.1423 -    if (nuv->priv->src_video_pad != NULL) {
 23.1424 -      gst_pad_push_event (nuv->priv->src_video_pad, gst_event_new_flush_stop ());
 23.1425 -    }
 23.1426 -
 23.1427 -    if (nuv->priv->src_audio_pad != NULL) {
 23.1428 -      gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_new_flush_stop ());
 23.1429 -    }
 23.1430 -
 23.1431 -    gst_pad_push_event (nuv->priv->sinkpad, gst_event_new_flush_stop ());
 23.1432 -  }
 23.1433 -
 23.1434 -  
 23.1435 -  if (nuv->priv->src_video_pad != NULL) {
 23.1436 -    gst_pad_push_event (nuv->priv->src_video_pad, gst_event_ref (newsegment_event));
 23.1437 -  }
 23.1438 -  if (nuv->priv->src_audio_pad != NULL) {
 23.1439 -    gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_ref (newsegment_event));
 23.1440 -  } 
 23.1441 -
 23.1442 -  gst_event_unref (newsegment_event);
 23.1443 -
 23.1444 -  nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
 23.1445 -  nuv->priv->offset = entry->offset;
 23.1446 -
 23.1447 -  gst_pad_start_task (nuv->priv->sinkpad, (GstTaskFunction) gst_nuv_demux_loop,
 23.1448 -      nuv->priv->sinkpad);
 23.1449 -
 23.1450 -  GST_PAD_STREAM_UNLOCK (nuv->priv->sinkpad);
 23.1451 -  return TRUE;
 23.1452 -
 23.1453 -seek_error:
 23.1454 -  GST_DEBUG_OBJECT (nuv, "Got a seek error");
 23.1455 -  GST_OBJECT_UNLOCK (nuv);
 23.1456 -  GST_PAD_STREAM_UNLOCK (nuv->priv->sinkpad);
 23.1457 -  return FALSE;
 23.1458 -
 23.1459 -}
 23.1460 -
 23.1461 -static gboolean
 23.1462 -gst_nuv_demux_srcpad_event (GstPad * pad, GstEvent * event)
 23.1463 -{
 23.1464 -  gboolean res = FALSE;
 23.1465 -  GstNuvDemux *nuv;
 23.1466 -
 23.1467 -  nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
 23.1468 -  
 23.1469 -  switch (GST_EVENT_TYPE (event)) {
 23.1470 -    case GST_EVENT_SEEK:
 23.1471 -      res = gst_nuv_demux_do_seek (nuv, event);
 23.1472 -      break;
 23.1473 -    default:
 23.1474 -      res = FALSE;
 23.1475 -      break;
 23.1476 -  }
 23.1477 -  
 23.1478 -  gst_object_unref (nuv);
 23.1479 -  return res;
 23.1480 -}
 23.1481 -
 23.1482 -static GstFlowReturn
 23.1483 -gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf)
 23.1484 -{
 23.1485 -  GstFlowReturn ret = GST_FLOW_OK;
 23.1486 -  GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
 23.1487 -  
 23.1488 -  if (nuv->priv->mode != NUV_PUSH_MODE)
 23.1489 -    return ret;
 23.1490 -
 23.1491 -  gst_adapter_push (nuv->priv->adapter, buf);  
 23.1492 -  
 23.1493 -  while ((ret == GST_FLOW_OK) && (nuv->priv->more_data == FALSE)) {
 23.1494 -      ret = gst_nuv_demux_play (pad);
 23.1495 -  }
 23.1496 -
 23.1497 -  nuv->priv->more_data = FALSE;
 23.1498 -  gst_object_unref (nuv);
 23.1499 -
 23.1500 -  return ret;
 23.1501 -}
 23.1502 -
 23.1503 -static void
 23.1504 -gst_nuv_demux_loop (GstPad * pad)
 23.1505 -{
 23.1506 -  gst_nuv_demux_play (pad);
 23.1507 -}
 23.1508 -
 23.1509 -static void
 23.1510 -gst_nuv_demux_index_free (gpointer data, gpointer user_data)
 23.1511 -{
 23.1512 -  g_free (data);
 23.1513 -}
 23.1514 -
 23.1515 -static void
 23.1516 -gst_nuv_demux_reset (GstNuvDemux * nuv)
 23.1517 -{
 23.1518 -  nuv->priv->eos = FALSE;
 23.1519 -  nuv->priv->more_data = FALSE;
 23.1520 -  nuv->priv->state = GST_NUV_DEMUX_START;
 23.1521 -  nuv->priv->mode = NUV_PUSH_MODE;
 23.1522 -  nuv->priv->offset = 0;
 23.1523 -  nuv->priv->time_start = 0;
 23.1524 -  nuv->priv->time_qos = GST_CLOCK_TIME_NONE;
 23.1525 -  nuv->priv->duration_bytes = GST_CLOCK_TIME_NONE;
 23.1526 -  nuv->priv->duration_time = GST_CLOCK_TIME_NONE;
 23.1527 -  nuv->priv->last_video_return = GST_FLOW_OK;
 23.1528 -  nuv->priv->last_audio_return = GST_FLOW_OK;
 23.1529 -  nuv->priv->header_lengh = 0;
 23.1530 -  nuv->priv->segment_stop = GST_CLOCK_TIME_NONE;
 23.1531 -  nuv->priv->segment_start = GST_CLOCK_TIME_NONE;
 23.1532 -
 23.1533 -  //clear index list
 23.1534 -  g_slist_foreach (nuv->priv->index, gst_nuv_demux_index_free, NULL);
 23.1535 -  g_slist_free (nuv->priv->index);
 23.1536 -  nuv->priv->index = NULL;
 23.1537 -
 23.1538 -  gst_adapter_clear (nuv->priv->adapter);
 23.1539 -
 23.1540 -  if (nuv->priv->mpeg_buffer != NULL) {
 23.1541 -    gst_buffer_unref (nuv->priv->mpeg_buffer);
 23.1542 -    nuv->priv->mpeg_buffer = NULL;
 23.1543 -  }
 23.1544 -}
 23.1545 -
 23.1546 -static void
 23.1547 -gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv)
 23.1548 -{
 23.1549 -  if (nuv->priv->src_video_pad) {
 23.1550 -    gst_element_remove_pad (GST_ELEMENT (nuv), nuv->priv->src_video_pad);
 23.1551 -    nuv->priv->src_video_pad = NULL;
 23.1552 -  }
 23.1553 -
 23.1554 -  if (nuv->priv->src_audio_pad) {
 23.1555 -    gst_element_remove_pad (GST_ELEMENT (nuv), nuv->priv->src_audio_pad);
 23.1556 -    nuv->priv->src_audio_pad = NULL;
 23.1557 -  }
 23.1558 -}
 23.1559 -
 23.1560 -static GstStateChangeReturn
 23.1561 -gst_nuv_demux_change_state (GstElement * element, GstStateChange transition)
 23.1562 -{
 23.1563 -  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
 23.1564 -
 23.1565 -  switch (transition) {
 23.1566 -    case GST_STATE_CHANGE_NULL_TO_READY:
 23.1567 -      gst_nuv_demux_reset (GST_NUV_DEMUX (element));
 23.1568 -      gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
 23.1569 -      break;
 23.1570 -    default:
 23.1571 -      break;
 23.1572 -  }
 23.1573 -
 23.1574 -  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
 23.1575 -  if (ret == GST_STATE_CHANGE_FAILURE) {
 23.1576 -    goto done;
 23.1577 -  }
 23.1578 -
 23.1579 -  switch (transition) {
 23.1580 -    case GST_STATE_CHANGE_READY_TO_NULL:
 23.1581 -      gst_nuv_demux_reset (GST_NUV_DEMUX (element));
 23.1582 -      gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
 23.1583 -      break;
 23.1584 -    default:
 23.1585 -      break;
 23.1586 -  }
 23.1587 -
 23.1588 -done:
 23.1589 -  return ret;
 23.1590 -}
 23.1591 -
 23.1592 -#if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6) 
 23.1593 -GstBuffer *
 23.1594 -gst_adapter_take_buffer (GstAdapter * adapter, guint nbytes)
 23.1595 -{
 23.1596 -  GstBuffer *buffer;
 23.1597 -  GstBuffer *cur;
 23.1598 -  guint8 *data;
 23.1599 -
 23.1600 -  g_return_val_if_fail (GST_IS_ADAPTER (adapter), NULL);
 23.1601 -  g_return_val_if_fail (nbytes > 0, NULL);
 23.1602 -
 23.1603 -  GST_LOG_OBJECT (adapter, "taking buffer of %u bytes", nbytes);
 23.1604 -
 23.1605 -  /* we don't have enough data, return NULL. This is unlikely
 23.1606 -   * as one usually does an _available() first instead of peeking a
 23.1607 -   * random size. */
 23.1608 -  if (G_UNLIKELY (nbytes > adapter->size))
 23.1609 -    return NULL;
 23.1610 -
 23.1611 -  /* our head buffer has enough data left, return it */
 23.1612 -  cur = adapter->buflist->data;
 23.1613 -  if (GST_BUFFER_SIZE (cur) >= nbytes + adapter->skip) {
 23.1614 -    GST_LOG_OBJECT (adapter, "providing buffer of %d bytes via sub-buffer",
 23.1615 -        nbytes);
 23.1616 -    buffer = gst_buffer_create_sub (cur, adapter->skip, nbytes);
 23.1617 -
 23.1618 -    gst_adapter_flush (adapter, nbytes);
 23.1619 -
 23.1620 -    return buffer;
 23.1621 -  }
 23.1622 -
 23.1623 -  data = gst_adapter_take (adapter, nbytes);
 23.1624 -  if (data == NULL)
 23.1625 -    return NULL;
 23.1626 -
 23.1627 -  buffer = gst_buffer_new ();
 23.1628 -  GST_BUFFER_DATA (buffer) = data;
 23.1629 -  GST_BUFFER_MALLOCDATA (buffer) = data;
 23.1630 -  GST_BUFFER_SIZE (buffer) = nbytes;
 23.1631 -
 23.1632 -  return buffer;
 23.1633 -}
 23.1634 -#endif
 23.1635 -
 23.1636 -
 23.1637 -static gboolean
 23.1638 -plugin_init (GstPlugin * plugin)
 23.1639 -{
 23.1640 -#ifdef ENABLE_NLS
 23.1641 -  setlocale (LC_ALL, "");
 23.1642 -  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
 23.1643 -#endif /* ENABLE_NLS */
 23.1644 -
 23.1645 -  if (!gst_element_register (plugin, "nuvdemux", GST_RANK_SECONDARY,
 23.1646 -          GST_TYPE_NUV_DEMUX)) {
 23.1647 -    return FALSE;
 23.1648 -  }
 23.1649 -  return TRUE;
 23.1650 -}
 23.1651 -
 23.1652 -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
 23.1653 -    GST_VERSION_MINOR,
 23.1654 -    "nuvdemux",
 23.1655 -    "Demuxes and muxes audio and video",
 23.1656 -     plugin_init, VERSION, "LGPL", "NuvDemux", "")
 23.1657 -
    24.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.h	Tue May 01 17:03:38 2007 +0100
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,55 +0,0 @@
    24.4 -/* GStreamer
    24.5 - * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
    24.6 - *                      Rosfran Borges <rosfran.borges@indt.org.br>
    24.7 - *
    24.8 - * This library is free software; you can redistribute it and/or
    24.9 - * modify it under the terms of the GNU Library General Public
   24.10 - * License as published by the Free Software Foundation; either
   24.11 - * version 2 of the License, or (at your option) any later version.
   24.12 - *
   24.13 - * This library is distributed in the hope that it will be useful,
   24.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   24.16 - * Library General Public License for more details.
   24.17 - *
   24.18 - * You should have received a copy of the GNU Library General Public
   24.19 - * License along with this library; if not, write to the
   24.20 - * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   24.21 - * Boston, MA 02111-1307, USA.
   24.22 - */
   24.23 -
   24.24 -#ifndef __GST_NUV_DEMUX_H__
   24.25 -#define __GST_NUV_DEMUX_H__
   24.26 -
   24.27 -#include <gst/gst.h>
   24.28 -
   24.29 -#include <gst/base/gstadapter.h>
   24.30 -
   24.31 -G_BEGIN_DECLS
   24.32 -
   24.33 -#define GST_TYPE_NUV_DEMUX \
   24.34 -  (gst_nuv_demux_get_type ())
   24.35 -#define GST_NUV_DEMUX(obj) \
   24.36 -  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemux))
   24.37 -#define GST_NUV_DEMUX_CLASS(klass) \
   24.38 -  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NUV_DEMUX, GstNuvDemuxClass))
   24.39 -#define GST_IS_NUV_DEMUX(obj) \
   24.40 -  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NUV_DEMUX))
   24.41 -#define GST_IS_NUV_DEMUX_CLASS(klass) \
   24.42 -  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NUV_DEMUX))
   24.43 -
   24.44 -typedef struct _GstNuvDemuxPrivate GstNuvDemuxPrivate;
   24.45 -typedef struct _GstNuvDemux {
   24.46 -  GstElement          parent;
   24.47 -  GstNuvDemuxPrivate *priv;
   24.48 -} GstNuvDemux;
   24.49 -
   24.50 -typedef struct _GstNuvDemuxClass {
   24.51 -  GstElementClass parent_class;
   24.52 -} GstNuvDemuxClass;
   24.53 -
   24.54 -GType           gst_nuv_demux_get_type          (void);
   24.55 -
   24.56 -G_END_DECLS
   24.57 -
   24.58 -#endif /* __GST_NUV_DEMUX_H__ */
    25.1 --- a/gst-plugins-nuvdemux/typefind/Makefile.am	Tue May 01 17:03:38 2007 +0100
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,14 +0,0 @@
    25.4 -plugin_LTLIBRARIES = libgsttypefindfunctions_indt.la
    25.5 -
    25.6 -libgsttypefindfunctions_indt_la_SOURCES = \
    25.7 -	gsttypefindfunctions.c
    25.8 -
    25.9 -libgsttypefindfunctions_indt_la_CFLAGS = \
   25.10 -	$(GST_CFLAGS)
   25.11 -
   25.12 -libgsttypefindfunctions_indt_la_LDFLAGS = \
   25.13 -	$(GST_PLUGIN_LDFLAGS) \
   25.14 -	$(GST_BASE_LIBS)
   25.15 -
   25.16 -libgsttypefindfunctions_indt_la_LIBADD = \
   25.17 -	$(GST_LIBS)
    26.1 --- a/gst-plugins-nuvdemux/typefind/gsttypefindfunctions.c	Tue May 01 17:03:38 2007 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,2808 +0,0 @@
    26.4 -/* GStreamer
    26.5 - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
    26.6 - *
    26.7 - * gsttypefindfunctions.c: collection of various typefind functions
    26.8 - *
    26.9 - * This library is free software; you can redistribute it and/or
   26.10 - * modify it under the terms of the GNU Library General Public
   26.11 - * License as published by the Free Software Foundation; either
   26.12 - * version 2 of the License, or (at your option) any later version.
   26.13 - *
   26.14 - * This library is distributed in the hope that it will be useful,
   26.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   26.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   26.17 - * Library General Public License for more details.
   26.18 - *
   26.19 - * You should have received a copy of the GNU Library General Public
   26.20 - * License along with this library; if not, write to the
   26.21 - * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   26.22 - * Boston, MA 02111-1307, USA.
   26.23 - */
   26.24 -
   26.25 -#ifdef HAVE_CONFIG_H
   26.26 -#include "config.h"
   26.27 -#endif
   26.28 -
   26.29 -#include <glib/gstrfuncs.h>
   26.30 -
   26.31 -#include <gst/gsttypefind.h>
   26.32 -#include <gst/gstelement.h>
   26.33 -#include <gst/gstversion.h>
   26.34 -#include <gst/gstinfo.h>
   26.35 -#include <gst/gstutils.h>
   26.36 -
   26.37 -#include <string.h>
   26.38 -#include <ctype.h>
   26.39 -
   26.40 -GST_DEBUG_CATEGORY_STATIC (type_find_debug);
   26.41 -#define GST_CAT_DEFAULT type_find_debug
   26.42 -
   26.43 -/*** text/plain ***/
   26.44 -static gboolean xml_check_first_element (GstTypeFind * tf,
   26.45 -    const gchar * element, guint elen, gboolean strict);
   26.46 -
   26.47 -
   26.48 -static GstStaticCaps utf8_caps = GST_STATIC_CAPS ("text/plain");
   26.49 -
   26.50 -#define UTF8_CAPS gst_static_caps_get(&utf8_caps)
   26.51 -
   26.52 -static gboolean
   26.53 -utf8_type_find_have_valid_utf8_at_offset (GstTypeFind * tf, guint64 offset,
   26.54 -    GstTypeFindProbability * prob)
   26.55 -{
   26.56 -  guint8 *data;
   26.57 -
   26.58 -  /* randomly decided values */
   26.59 -  guint min_size = 16;          /* minimum size  */
   26.60 -  guint size = 32 * 1024;       /* starting size */
   26.61 -  guint probability = 95;       /* starting probability */
   26.62 -  guint step = 10;              /* how much we reduce probability in each
   26.63 -                                 * iteration */
   26.64 -
   26.65 -  while (probability > step && size > min_size) {
   26.66 -    data = gst_type_find_peek (tf, offset, size);
   26.67 -    if (data) {
   26.68 -      gchar *end;
   26.69 -      gchar *start = (gchar *) data;
   26.70 -
   26.71 -      if (g_utf8_validate (start, size, (const gchar **) &end) || (end - start + 4 > size)) {   /* allow last char to be cut off */
   26.72 -        *prob = probability;
   26.73 -        return TRUE;
   26.74 -      }
   26.75 -      *prob = 0;
   26.76 -      return FALSE;
   26.77 -    }
   26.78 -    size /= 2;
   26.79 -    probability -= step;
   26.80 -  }
   26.81 -  *prob = 0;
   26.82 -  return FALSE;
   26.83 -}
   26.84 -
   26.85 -static void
   26.86 -utf8_type_find (GstTypeFind * tf, gpointer unused)
   26.87 -{
   26.88 -  GstTypeFindProbability start_prob, mid_prob;
   26.89 -  guint64 length;
   26.90 -
   26.91 -  /* leave xml to the xml typefinders */
   26.92 -  if (xml_check_first_element (tf, "", 0, TRUE))
   26.93 -    return;
   26.94 -
   26.95 -  /* check beginning of stream */
   26.96 -  if (!utf8_type_find_have_valid_utf8_at_offset (tf, 0, &start_prob))
   26.97 -    return;
   26.98 -
   26.99 -  GST_LOG ("start is plain text with probability of %u", start_prob);
  26.100 -
  26.101 -  /* POSSIBLE is the highest probability we ever return if we can't
  26.102 -   * probe into the middle of the file and don't know its length */
  26.103 -
  26.104 -  length = gst_type_find_get_length (tf);
  26.105 -  if (length == 0 || length == (guint64) - 1) {
  26.106 -    gst_type_find_suggest (tf, MIN (start_prob, GST_TYPE_FIND_POSSIBLE),
  26.107 -        UTF8_CAPS);
  26.108 -    return;
  26.109 -  }
  26.110 -
  26.111 -  if (length < 64 * 1024) {
  26.112 -    gst_type_find_suggest (tf, start_prob, UTF8_CAPS);
  26.113 -    return;
  26.114 -  }
  26.115 -
  26.116 -  /* check middle of stream */
  26.117 -  if (!utf8_type_find_have_valid_utf8_at_offset (tf, length / 2, &mid_prob))
  26.118 -    return;
  26.119 -
  26.120 -  GST_LOG ("middle is plain text with probability of %u", mid_prob);
  26.121 -  gst_type_find_suggest (tf, (start_prob + mid_prob) / 2, UTF8_CAPS);
  26.122 -}
  26.123 -
  26.124 -/*** text/uri-list ***/
  26.125 -
  26.126 -static GstStaticCaps uri_caps = GST_STATIC_CAPS ("text/uri-list");
  26.127 -
  26.128 -#define URI_CAPS (gst_static_caps_get(&uri_caps))
  26.129 -#define BUFFER_SIZE 16          /* If the string is < 16 bytes we're screwed */
  26.130 -#define INC_BUFFER {                                                    \
  26.131 -  pos++;                                                                \
  26.132 -  if (pos == BUFFER_SIZE) {                                             \
  26.133 -    pos = 0;                                                            \
  26.134 -    offset += BUFFER_SIZE;                                              \
  26.135 -    data = gst_type_find_peek (tf, offset, BUFFER_SIZE);                \
  26.136 -    if (data == NULL) return;                                           \
  26.137 -  } else {                                                              \
  26.138 -    data++;                                                             \
  26.139 -  }                                                                     \
  26.140 -}
  26.141 -static void
  26.142 -uri_type_find (GstTypeFind * tf, gpointer unused)
  26.143 -{
  26.144 -  guint8 *data = gst_type_find_peek (tf, 0, BUFFER_SIZE);
  26.145 -  guint pos = 0;
  26.146 -  guint offset = 0;
  26.147 -
  26.148 -  if (data) {
  26.149 -    /* Search for # comment lines */
  26.150 -    while (*data == '#') {
  26.151 -      /* Goto end of line */
  26.152 -      while (*data != '\n') {
  26.153 -        INC_BUFFER;
  26.154 -      }
  26.155 -
  26.156 -      INC_BUFFER;
  26.157 -    }
  26.158 -
  26.159 -    if (!g_ascii_isalpha (*data)) {
  26.160 -      /* Had a non alpha char - can't be uri-list */
  26.161 -      return;
  26.162 -    }
  26.163 -
  26.164 -    INC_BUFFER;
  26.165 -
  26.166 -    while (g_ascii_isalnum (*data)) {
  26.167 -      INC_BUFFER;
  26.168 -    }
  26.169 -
  26.170 -    if (*data != ':') {
  26.171 -      /* First non alpha char is not a : */
  26.172 -      return;
  26.173 -    }
  26.174 -
  26.175 -    /* Get the next 2 bytes as well */
  26.176 -    data = gst_type_find_peek (tf, offset + pos, 3);
  26.177 -    if (data == NULL)
  26.178 -      return;
  26.179 -
  26.180 -    if (data[1] != '/' && data[2] != '/') {
  26.181 -      return;
  26.182 -    }
  26.183 -
  26.184 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, URI_CAPS);
  26.185 -  }
  26.186 -}
  26.187 -
  26.188 -
  26.189 -/*** application/xml **********************************************************/
  26.190 -
  26.191 -#define XML_BUFFER_SIZE 16
  26.192 -#define XML_INC_BUFFER {                                                \
  26.193 -  pos++;                                                                \
  26.194 -  if (pos == XML_BUFFER_SIZE) {                                         \
  26.195 -    pos = 0;                                                            \
  26.196 -    offset += XML_BUFFER_SIZE;                                          \
  26.197 -    data = gst_type_find_peek (tf, offset, XML_BUFFER_SIZE);            \
  26.198 -    if (data == NULL) return FALSE;                                     \
  26.199 -  } else {                                                              \
  26.200 -    data++;                                                             \
  26.201 -  }                                                                     \
  26.202 -}
  26.203 -
  26.204 -static gboolean
  26.205 -xml_check_first_element (GstTypeFind * tf, const gchar * element, guint elen,
  26.206 -    gboolean strict)
  26.207 -{
  26.208 -  gboolean got_xmldec;
  26.209 -  guint8 *data;
  26.210 -  guint offset = 0;
  26.211 -  guint pos = 0;
  26.212 -
  26.213 -  data = gst_type_find_peek (tf, 0, XML_BUFFER_SIZE);
  26.214 -  if (!data)
  26.215 -    return FALSE;
  26.216 -
  26.217 -  /* look for the XMLDec
  26.218 -   * see XML spec 2.8, Prolog and Document Type Declaration
  26.219 -   * http://www.w3.org/TR/2004/REC-xml-20040204/#sec-prolog-dtd */
  26.220 -  got_xmldec = (memcmp (data, "<?xml", 5) == 0);
  26.221 -
  26.222 -  if (strict && !got_xmldec)
  26.223 -    return FALSE;
  26.224 -
  26.225 -  /* skip XMLDec in any case if we've got one */
  26.226 -  if (got_xmldec) {
  26.227 -    pos += 5;
  26.228 -    data += 5;
  26.229 -  }
  26.230 -
  26.231 -  /* look for the first element, it has to be the requested element. Bail
  26.232 -   * out if it is not within the first 4kB. */
  26.233 -  while (data && (offset + pos) < 4096) {
  26.234 -    while (*data != '<' && (offset + pos) < 4096) {
  26.235 -      XML_INC_BUFFER;
  26.236 -    }
  26.237 -
  26.238 -    XML_INC_BUFFER;
  26.239 -    if (!g_ascii_isalpha (*data)) {
  26.240 -      /* if not alphabetic, it's a PI or an element / attribute declaration
  26.241 -       * like <?xxx or <!xxx */
  26.242 -      XML_INC_BUFFER;
  26.243 -      continue;
  26.244 -    }
  26.245 -
  26.246 -    /* the first normal element, check if it's the one asked for */
  26.247 -    data = gst_type_find_peek (tf, offset + pos, elen + 1);
  26.248 -    return (data && element && strncmp ((char *) data, element, elen) == 0);
  26.249 -  }
  26.250 -
  26.251 -  return FALSE;
  26.252 -}
  26.253 -
  26.254 -static GstStaticCaps generic_xml_caps = GST_STATIC_CAPS ("application/xml");
  26.255 -
  26.256 -#define GENERIC_XML_CAPS (gst_static_caps_get(&generic_xml_caps))
  26.257 -static void
  26.258 -xml_type_find (GstTypeFind * tf, gpointer unused)
  26.259 -{
  26.260 -  if (xml_check_first_element (tf, "", 0, TRUE)) {
  26.261 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MINIMUM, GENERIC_XML_CAPS);
  26.262 -  }
  26.263 -}
  26.264 -
  26.265 -/*** application/smil *********************************************************/
  26.266 -
  26.267 -static GstStaticCaps smil_caps = GST_STATIC_CAPS ("application/smil");
  26.268 -
  26.269 -#define SMIL_CAPS (gst_static_caps_get(&smil_caps))
  26.270 -static void
  26.271 -smil_type_find (GstTypeFind * tf, gpointer unused)
  26.272 -{
  26.273 -  if (xml_check_first_element (tf, "smil", 4, FALSE)) {
  26.274 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SMIL_CAPS);
  26.275 -  }
  26.276 -}
  26.277 -
  26.278 -/*** text/html ***/
  26.279 -
  26.280 -static GstStaticCaps html_caps = GST_STATIC_CAPS ("text/html");
  26.281 -
  26.282 -#define HTML_CAPS gst_static_caps_get (&html_caps)
  26.283 -
  26.284 -static void
  26.285 -html_type_find (GstTypeFind * tf, gpointer unused)
  26.286 -{
  26.287 -  gchar *d, *data;
  26.288 -
  26.289 -  data = (gchar *) gst_type_find_peek (tf, 0, 16);
  26.290 -  if (!data)
  26.291 -    return;
  26.292 -
  26.293 -  if (!g_ascii_strncasecmp (data, "<!DOCTYPE HTML", 14)) {
  26.294 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
  26.295 -  } else if (xml_check_first_element (tf, "html", 4, FALSE)) {
  26.296 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
  26.297 -  } else if ((d = memchr (data, '<', 16))) {
  26.298 -    data = (gchar *) gst_type_find_peek (tf, d - data, 6);
  26.299 -    if (data && g_ascii_strncasecmp (data, "<html>", 6) == 0) {
  26.300 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
  26.301 -    }
  26.302 -  }
  26.303 -}
  26.304 -
  26.305 -/*** video/x-fli ***/
  26.306 -
  26.307 -static GstStaticCaps flx_caps = GST_STATIC_CAPS ("video/x-fli");
  26.308 -
  26.309 -#define FLX_CAPS gst_static_caps_get(&flx_caps)
  26.310 -static void
  26.311 -flx_type_find (GstTypeFind * tf, gpointer unused)
  26.312 -{
  26.313 -  guint8 *data = gst_type_find_peek (tf, 0, 134);
  26.314 -
  26.315 -  if (data) {
  26.316 -    /* check magic and the frame type of the first frame */
  26.317 -    if ((data[4] == 0x11 || data[4] == 0x12 ||
  26.318 -            data[4] == 0x30 || data[4] == 0x44) &&
  26.319 -        data[5] == 0xaf &&
  26.320 -        ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1)) {
  26.321 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FLX_CAPS);
  26.322 -    }
  26.323 -    return;
  26.324 -  }
  26.325 -  data = gst_type_find_peek (tf, 0, 6);
  26.326 -  if (data) {
  26.327 -    /* check magic only */
  26.328 -    if ((data[4] == 0x11 || data[4] == 0x12 ||
  26.329 -            data[4] == 0x30 || data[4] == 0x44) && data[5] == 0xaf) {
  26.330 -      gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, FLX_CAPS);
  26.331 -    }
  26.332 -    return;
  26.333 -  }
  26.334 -}
  26.335 -
  26.336 -/*** application/x-id3 ***/
  26.337 -
  26.338 -static GstStaticCaps id3_caps = GST_STATIC_CAPS ("application/x-id3");
  26.339 -
  26.340 -#define ID3_CAPS gst_static_caps_get(&id3_caps)
  26.341 -static void
  26.342 -id3v2_type_find (GstTypeFind * tf, gpointer unused)
  26.343 -{
  26.344 -  guint8 *data = gst_type_find_peek (tf, 0, 10);
  26.345 -
  26.346 -  if (data && memcmp (data, "ID3", 3) == 0 &&
  26.347 -      data[3] != 0xFF && data[4] != 0xFF &&
  26.348 -      (data[6] & 0x80) == 0 && (data[7] & 0x80) == 0 &&
  26.349 -      (data[8] & 0x80) == 0 && (data[9] & 0x80) == 0) {
  26.350 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, ID3_CAPS);
  26.351 -  }
  26.352 -}
  26.353 -
  26.354 -static void
  26.355 -id3v1_type_find (GstTypeFind * tf, gpointer unused)
  26.356 -{
  26.357 -  guint8 *data = gst_type_find_peek (tf, -128, 3);
  26.358 -
  26.359 -  if (data && memcmp (data, "TAG", 3) == 0) {
  26.360 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, ID3_CAPS);
  26.361 -  }
  26.362 -}
  26.363 -
  26.364 -/*** application/x-ape ***/
  26.365 -
  26.366 -static GstStaticCaps apetag_caps = GST_STATIC_CAPS ("application/x-apetag");
  26.367 -
  26.368 -#define APETAG_CAPS gst_static_caps_get(&apetag_caps)
  26.369 -static void
  26.370 -apetag_type_find (GstTypeFind * tf, gpointer unused)
  26.371 -{
  26.372 -  guint8 *data;
  26.373 -
  26.374 -  /* APEv1/2 at start of file */
  26.375 -  data = gst_type_find_peek (tf, 0, 8);
  26.376 -  if (data && !memcmp (data, "APETAGEX", 8)) {
  26.377 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, APETAG_CAPS);
  26.378 -    return;
  26.379 -  }
  26.380 -
  26.381 -  /* APEv1/2 at end of file */
  26.382 -  data = gst_type_find_peek (tf, -32, 8);
  26.383 -  if (data && !memcmp (data, "APETAGEX", 8)) {
  26.384 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, APETAG_CAPS);
  26.385 -    return;
  26.386 -  }
  26.387 -}
  26.388 -
  26.389 -/*** audio/x-ttafile ***/
  26.390 -
  26.391 -static GstStaticCaps tta_caps = GST_STATIC_CAPS ("audio/x-ttafile");
  26.392 -
  26.393 -#define TTA_CAPS gst_static_caps_get(&tta_caps)
  26.394 -static void
  26.395 -tta_type_find (GstTypeFind * tf, gpointer unused)
  26.396 -{
  26.397 -  guint8 *data = gst_type_find_peek (tf, 0, 3);
  26.398 -
  26.399 -  if (data) {
  26.400 -    if (memcmp (data, "TTA", 3) == 0) {
  26.401 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, TTA_CAPS);
  26.402 -      return;
  26.403 -    }
  26.404 -  }
  26.405 -}
  26.406 -
  26.407 -/*** audio/mpeg version 2, 4 ***/
  26.408 -
  26.409 -static GstStaticCaps aac_caps = GST_STATIC_CAPS ("audio/mpeg, "
  26.410 -    "mpegversion = (int) { 2, 4 }, framed = (bool) false");
  26.411 -#define AAC_CAPS (gst_static_caps_get(&aac_caps))
  26.412 -#define AAC_AMOUNT (4096)
  26.413 -static void
  26.414 -aac_type_find (GstTypeFind * tf, gpointer unused)
  26.415 -{
  26.416 -  guint8 *data = gst_type_find_peek (tf, 0, AAC_AMOUNT);
  26.417 -  gint snc;
  26.418 -
  26.419 -  /* detect adts header or adif header.
  26.420 -   * The ADIF header is 4 bytes, that should be OK. The ADTS header, on
  26.421 -   * the other hand, is 14 bits only, so we require one valid frame with
  26.422 -   * again a valid syncpoint on the next one (28 bits) for certainty. We
  26.423 -   * require 4 kB, which is quite a lot, since frames are generally 200-400
  26.424 -   * bytes.
  26.425 -   */
  26.426 -  if (data) {
  26.427 -    gint n;
  26.428 -
  26.429 -    for (n = 0; n < AAC_AMOUNT - 3; n++) {
  26.430 -      snc = GST_READ_UINT16_BE (&data[n]);
  26.431 -      if ((snc & 0xfff6) == 0xfff0) {
  26.432 -        /* ADTS header - find frame length */
  26.433 -        gint len;
  26.434 -
  26.435 -        GST_DEBUG ("Found one ADTS syncpoint at offset 0x%x, tracing next...",
  26.436 -            n);
  26.437 -        if (AAC_AMOUNT - n < 5) {
  26.438 -          GST_DEBUG ("Not enough data to parse ADTS header");
  26.439 -          break;
  26.440 -        }
  26.441 -        len = ((data[n + 3] & 0x03) << 11) |
  26.442 -            (data[n + 4] << 3) | ((data[n + 5] & 0xe0) >> 5);
  26.443 -        if (n + len + 2 >= AAC_AMOUNT) {
  26.444 -          GST_DEBUG ("Next frame is not within reach");
  26.445 -          break;
  26.446 -        } else if (len == 0) {
  26.447 -          continue;
  26.448 -        }
  26.449 -
  26.450 -        snc = GST_READ_UINT16_BE (&data[n + len]);
  26.451 -        if ((snc & 0xfff6) == 0xfff0) {
  26.452 -          gint mpegversion = (data[n + 1] & 0x08) ? 2 : 4;
  26.453 -          GstCaps *caps = gst_caps_new_simple ("audio/mpeg",
  26.454 -              "framed", G_TYPE_BOOLEAN, FALSE,
  26.455 -              "mpegversion", G_TYPE_INT, mpegversion,
  26.456 -              NULL);
  26.457 -
  26.458 -          gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, caps);
  26.459 -          gst_caps_unref (caps);
  26.460 -
  26.461 -          GST_DEBUG ("Found ADTS-%d syncpoint at offset 0x%x (framelen %u)",
  26.462 -              mpegversion, n, len);
  26.463 -          break;
  26.464 -        }
  26.465 -
  26.466 -        GST_DEBUG ("No next frame found... (should be at 0x%x)", n + len);
  26.467 -      } else if (!memcmp (&data[n], "ADIF", 4)) {
  26.468 -        /* ADIF header */
  26.469 -        GstCaps *caps = gst_caps_new_simple ("audio/mpeg",
  26.470 -            "framed", G_TYPE_BOOLEAN, FALSE,
  26.471 -            "mpegversion", G_TYPE_INT, 4,
  26.472 -            NULL);
  26.473 -
  26.474 -        gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, caps);
  26.475 -        gst_caps_unref (caps);
  26.476 -      }
  26.477 -    }
  26.478 -  }
  26.479 -}
  26.480 -
  26.481 -/*** audio/mpeg version 1 ***/
  26.482 -
  26.483 -/*
  26.484 - * The chance that random data is identified as a valid mp3 header is 63 / 2^18
  26.485 - * (0.024%) per try. This makes the function for calculating false positives
  26.486 - *   1 - (1 - ((63 / 2 ^18) ^ GST_MP3_TYPEFIND_MIN_HEADERS)) ^ buffersize)
  26.487 - * This has the following probabilities of false positives:
  26.488 - * datasize               MIN_HEADERS
  26.489 - * (bytes)      1       2       3       4
  26.490 - * 4096         62.6%    0.02%   0%      0%
  26.491 - * 16384        98%      0.09%   0%      0%
  26.492 - * 1 MiB       100%      5.88%   0%      0%
  26.493 - * 1 GiB       100%    100%      1.44%   0%
  26.494 - * 1 TiB       100%    100%    100%      0.35%
  26.495 - * This means that the current choice (3 headers by most of the time 4096 byte
  26.496 - * buffers is pretty safe for now.
  26.497 - *
  26.498 - * The max. size of each frame is 1440 bytes, which means that for N frames to
  26.499 - * be detected, we need 1440 * GST_MP3_TYPEFIND_MIN_HEADERS + 3 bytes of data.
  26.500 - * Assuming we step into the stream right after the frame header, this
  26.501 - * means we need 1440 * (GST_MP3_TYPEFIND_MIN_HEADERS + 1) - 1 + 3 bytes
  26.502 - * of data (5762) to always detect any mp3.
  26.503 - */
  26.504 -
  26.505 -static const guint mp3types_bitrates[2][3][16] =
  26.506 -    { {{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,},
  26.507 -    {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,},
  26.508 -    {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,}},
  26.509 -{{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,},
  26.510 -    {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,},
  26.511 -    {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}},
  26.512 -};
  26.513 -
  26.514 -static const guint mp3types_freqs[3][3] = { {11025, 12000, 8000},
  26.515 -{22050, 24000, 16000},
  26.516 -{44100, 48000, 32000}
  26.517 -};
  26.518 -
  26.519 -static inline guint
  26.520 -mp3_type_frame_length_from_header (guint32 header, guint * put_layer,
  26.521 -    guint * put_channels, guint * put_bitrate, guint * put_samplerate,
  26.522 -    gboolean * may_be_free_format, gint possible_free_framelen)
  26.523 -{
  26.524 -  guint bitrate, layer, length, mode, samplerate, version, channels;
  26.525 -
  26.526 -  if ((header & 0xffe00000) != 0xffe00000)
  26.527 -    return 0;
  26.528 -
  26.529 -  /* we don't need extension, copyright, original or
  26.530 -   * emphasis for the frame length */
  26.531 -  header >>= 6;
  26.532 -
  26.533 -  /* mode */
  26.534 -  mode = header & 0x3;
  26.535 -  header >>= 3;
  26.536 -
  26.537 -  /* padding */
  26.538 -  length = header & 0x1;
  26.539 -  header >>= 1;
  26.540 -
  26.541 -  /* sampling frequency */
  26.542 -  samplerate = header & 0x3;
  26.543 -  if (samplerate == 3)
  26.544 -    return 0;
  26.545 -  header >>= 2;
  26.546 -
  26.547 -  /* bitrate index */
  26.548 -  bitrate = header & 0xF;
  26.549 -  if (bitrate == 0 && possible_free_framelen == -1) {
  26.550 -    GST_LOG ("Possibly a free format mp3 - signalling");
  26.551 -    *may_be_free_format = TRUE;
  26.552 -  }
  26.553 -  if (bitrate == 15 || (bitrate == 0 && possible_free_framelen == -1))
  26.554 -    return 0;
  26.555 -
  26.556 -  /* ignore error correction, too */
  26.557 -  header >>= 5;
  26.558 -
  26.559 -  /* layer */
  26.560 -  layer = 4 - (header & 0x3);
  26.561 -  if (layer == 4)
  26.562 -    return 0;
  26.563 -  header >>= 2;
  26.564 -
  26.565 -  /* version 0=MPEG2.5; 2=MPEG2; 3=MPEG1 */
  26.566 -  version = header & 0x3;
  26.567 -  if (version == 1)
  26.568 -    return 0;
  26.569 -
  26.570 -  /* lookup */
  26.571 -  channels = (mode == 3) ? 1 : 2;
  26.572 -  samplerate = mp3types_freqs[version > 0 ? version - 1 : 0][samplerate];
  26.573 -  if (bitrate == 0) {
  26.574 -    if (layer == 1) {
  26.575 -      length *= 4;
  26.576 -      length += possible_free_framelen;
  26.577 -      bitrate = length * samplerate / 48000;
  26.578 -    } else {
  26.579 -      length += possible_free_framelen;
  26.580 -      bitrate = length * samplerate /
  26.581 -          ((layer == 3 && version != 3) ? 72000 : 144000);
  26.582 -    }
  26.583 -  } else {
  26.584 -    /* calculating */
  26.585 -    bitrate = mp3types_bitrates[version == 3 ? 0 : 1][layer - 1][bitrate];
  26.586 -    if (layer == 1) {
  26.587 -      length = ((12000 * bitrate / samplerate) + length) * 4;
  26.588 -    } else {
  26.589 -      length += ((layer == 3
  26.590 -              && version != 3) ? 72000 : 144000) * bitrate / samplerate;
  26.591 -    }
  26.592 -  }
  26.593 -
  26.594 -  GST_LOG ("mp3typefind: calculated mp3 frame length of %u bytes", length);
  26.595 -  GST_LOG
  26.596 -      ("mp3typefind: samplerate = %u - bitrate = %u - layer = %u - version = %u"
  26.597 -      " - channels = %u", samplerate, bitrate, layer, version, channels);
  26.598 -
  26.599 -  if (put_layer)
  26.600 -    *put_layer = layer;
  26.601 -  if (put_channels)
  26.602 -    *put_channels = channels;
  26.603 -  if (put_bitrate)
  26.604 -    *put_bitrate = bitrate;
  26.605 -  if (put_samplerate)
  26.606 -    *put_samplerate = samplerate;
  26.607 -
  26.608 -  return length;
  26.609 -}
  26.610 -
  26.611 -
  26.612 -static GstStaticCaps mp3_caps = GST_STATIC_CAPS ("audio/mpeg, "
  26.613 -    "mpegversion = (int) 1, layer = (int) [ 1, 3 ]");
  26.614 -#define MP3_CAPS (gst_static_caps_get(&mp3_caps))
  26.615 -/*
  26.616 - * random values for typefinding
  26.617 - * if no more data is available, we will return a probability of
  26.618 - * (found_headers/TRY_HEADERS) * (MAXIMUM * (TRY_SYNC - bytes_skipped)
  26.619 - *        / TRY_SYNC)
  26.620 - * if found_headers >= MIN_HEADERS
  26.621 - */
  26.622 -#define GST_MP3_TYPEFIND_MIN_HEADERS (2)
  26.623 -#define GST_MP3_TYPEFIND_TRY_HEADERS (5)
  26.624 -#define GST_MP3_TYPEFIND_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 100) /* 10kB */
  26.625 -#define GST_MP3_TYPEFIND_SYNC_SIZE (2048)
  26.626 -#define GST_MP3_WRONG_HEADER (10)
  26.627 -
  26.628 -static void
  26.629 -mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
  26.630 -    guint * found_layer, GstTypeFindProbability * found_prob)
  26.631 -{
  26.632 -  guint8 *data = NULL;
  26.633 -  guint8 *data_end = NULL;
  26.634 -  guint size;
  26.635 -  guint64 skipped;
  26.636 -  gint last_free_offset = -1;
  26.637 -  gint last_free_framelen = -1;
  26.638 -  gboolean headerstart = TRUE;
  26.639 -
  26.640 -  *found_layer = 0;
  26.641 -  *found_prob = 0;
  26.642 -
  26.643 -  size = 0;
  26.644 -  skipped = 0;
  26.645 -  while (skipped < GST_MP3_TYPEFIND_TRY_SYNC) {
  26.646 -    if (size <= 0) {
  26.647 -      size = GST_MP3_TYPEFIND_SYNC_SIZE * 2;
  26.648 -      do {
  26.649 -        size /= 2;
  26.650 -        data = gst_type_find_peek (tf, skipped + start_off, size);
  26.651 -      } while (size > 10 && !data);
  26.652 -      if (!data)
  26.653 -        break;
  26.654 -      data_end = data + size;
  26.655 -    }
  26.656 -    if (*data == 0xFF) {
  26.657 -      guint8 *head_data = NULL;
  26.658 -      guint layer = 0, bitrate, samplerate, channels;
  26.659 -      guint found = 0;          /* number of valid headers found */
  26.660 -      guint64 offset = skipped;
  26.661 -
  26.662 -      while (found < GST_MP3_TYPEFIND_TRY_HEADERS) {
  26.663 -        guint32 head;
  26.664 -        guint length;
  26.665 -        guint prev_layer = 0, prev_bitrate = 0;
  26.666 -        guint prev_channels = 0, prev_samplerate = 0;
  26.667 -        gboolean free = FALSE;
  26.668 -
  26.669 -        if ((gint64) (offset - skipped + 4) >= 0 &&
  26.670 -            data + offset - skipped + 4 < data_end) {
  26.671 -          head_data = data + offset - skipped;
  26.672 -        } else {
  26.673 -          head_data = gst_type_find_peek (tf, offset + start_off, 4);
  26.674 -        }
  26.675 -        if (!head_data)
  26.676 -          break;
  26.677 -        head = GST_READ_UINT32_BE (head_data);
  26.678 -        if (!(length = mp3_type_frame_length_from_header (head, &layer,
  26.679 -                    &channels, &bitrate, &samplerate, &free,
  26.680 -                    last_free_framelen))) {
  26.681 -          if (free) {
  26.682 -            if (last_free_offset == -1)
  26.683 -              last_free_offset = offset;
  26.684 -            else {
  26.685 -              last_free_framelen = offset - last_free_offset;
  26.686 -              offset = last_free_offset;
  26.687 -              continue;
  26.688 -            }
  26.689 -          } else {
  26.690 -            last_free_framelen = -1;
  26.691 -          }
  26.692 -
  26.693 -          /* Mark the fact that we didn't find a valid header at the beginning */
  26.694 -          if (found == 0)
  26.695 -            headerstart = FALSE;
  26.696 -
  26.697 -          GST_LOG ("%d. header at offset %" G_GUINT64_FORMAT
  26.698 -              " (0x%" G_GINT64_MODIFIER "x) was not an mp3 header "
  26.699 -              "(possibly-free: %s)", found + 1, start_off + offset,
  26.700 -              start_off + offset, free ? "yes" : "no");
  26.701 -          break;
  26.702 -        }
  26.703 -        if ((prev_layer && prev_layer != layer) ||
  26.704 -            /* (prev_bitrate && prev_bitrate != bitrate) || <-- VBR */
  26.705 -            (prev_samplerate && prev_samplerate != samplerate) ||
  26.706 -            (prev_channels && prev_channels != channels)) {
  26.707 -          /* this means an invalid property, or a change, which might mean
  26.708 -           * that this is not a mp3 but just a random bytestream. It could
  26.709 -           * be a freaking funky encoded mp3 though. We'll just not count
  26.710 -           * this header*/
  26.711 -          prev_layer = layer;
  26.712 -          prev_bitrate = bitrate;
  26.713 -          prev_channels = channels;
  26.714 -          prev_samplerate = samplerate;
  26.715 -        } else {
  26.716 -          found++;
  26.717 -          GST_LOG ("found %d. header at offset %" G_GUINT64_FORMAT " (0x%"
  26.718 -              G_GINT64_MODIFIER "X)", found, start_off + offset,
  26.719 -              start_off + offset);
  26.720 -        }
  26.721 -        offset += length;
  26.722 -      }
  26.723 -      g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS);
  26.724 -      if (found == GST_MP3_TYPEFIND_TRY_HEADERS ||
  26.725 -          (found >= GST_MP3_TYPEFIND_MIN_HEADERS && head_data == NULL)) {
  26.726 -        /* we can make a valid guess */
  26.727 -        guint probability = found * GST_TYPE_FIND_MAXIMUM *
  26.728 -            (GST_MP3_TYPEFIND_TRY_SYNC - skipped) /
  26.729 -            GST_MP3_TYPEFIND_TRY_HEADERS / GST_MP3_TYPEFIND_TRY_SYNC;
  26.730 -
  26.731 -        if (!headerstart
  26.732 -            && ((probability - GST_MP3_WRONG_HEADER) > GST_TYPE_FIND_MINIMUM))
  26.733 -          probability -= GST_MP3_WRONG_HEADER;
  26.734 -        if (probability < GST_TYPE_FIND_MINIMUM)
  26.735 -          probability = GST_TYPE_FIND_MINIMUM;
  26.736 -        if (start_off > 0)
  26.737 -          probability /= 2;
  26.738 -
  26.739 -        GST_INFO
  26.740 -            ("audio/mpeg calculated %u  =  %u  *  %u / %u  *  (%u - %"
  26.741 -            G_GUINT64_FORMAT ") / %u", probability, GST_TYPE_FIND_MAXIMUM,
  26.742 -            found, GST_MP3_TYPEFIND_TRY_HEADERS, GST_MP3_TYPEFIND_TRY_SYNC,
  26.743 -            (guint64) skipped, GST_MP3_TYPEFIND_TRY_SYNC);
  26.744 -        /* make sure we're not id3 tagged */
  26.745 -        head_data = gst_type_find_peek (tf, -128, 3);
  26.746 -        if (head_data && (memcmp (head_data, "TAG", 3) == 0)) {
  26.747 -          probability = 0;
  26.748 -        }
  26.749 -        g_assert (probability <= GST_TYPE_FIND_MAXIMUM);
  26.750 -
  26.751 -        *found_prob = probability;
  26.752 -        if (probability > 0)
  26.753 -          *found_layer = layer;
  26.754 -        return;
  26.755 -      }
  26.756 -    }
  26.757 -    data++;
  26.758 -    skipped++;
  26.759 -    size--;
  26.760 -  }
  26.761 -}
  26.762 -
  26.763 -static void
  26.764 -mp3_type_find (GstTypeFind * tf, gpointer unused)
  26.765 -{
  26.766 -  GstTypeFindProbability prob, mid_prob;
  26.767 -  guint8 *data;
  26.768 -  guint layer, mid_layer;
  26.769 -  guint64 length;
  26.770 -
  26.771 -  mp3_type_find_at_offset (tf, 0, &layer, &prob);
  26.772 -  length = gst_type_find_get_length (tf);
  26.773 -
  26.774 -  if (length == 0 || length == (guint64) - 1) {
  26.775 -    if (prob != 0)
  26.776 -      goto suggest;
  26.777 -    return;
  26.778 -  }
  26.779 -
  26.780 -  /* if we're pretty certain already, skip the additional check */
  26.781 -  if (prob >= GST_TYPE_FIND_LIKELY)
  26.782 -    goto suggest;
  26.783 -
  26.784 -  mp3_type_find_at_offset (tf, length / 2, &mid_layer, &mid_prob);
  26.785 -
  26.786 -  if (mid_prob > 0) {
  26.787 -    if (prob == 0) {
  26.788 -      GST_LOG ("detected audio/mpeg only in the middle (p=%u)", mid_prob);
  26.789 -      layer = mid_layer;
  26.790 -      prob = mid_prob;
  26.791 -      goto suggest;
  26.792 -    }
  26.793 -
  26.794 -    if (layer != mid_layer) {
  26.795 -      GST_WARNING ("audio/mpeg layer discrepancy: %u vs. %u", layer, mid_layer);
  26.796 -      return;                   /* FIXME: or should we just go with the one in the middle? */
  26.797 -    }
  26.798 -
  26.799 -    /* detected mpeg audio both in middle of the file and at the start */
  26.800 -    prob = (prob + mid_prob) / 2;
  26.801 -    goto suggest;
  26.802 -  }
  26.803 -
  26.804 -  /* let's see if there's a valid header right at the start */
  26.805 -  data = gst_type_find_peek (tf, 0, 4); /* use min. frame size? */
  26.806 -  if (data && mp3_type_frame_length_from_header (GST_READ_UINT32_BE (data),
  26.807 -          &layer, NULL, NULL, NULL, NULL, 0) != 0) {
  26.808 -    if (prob == 0)
  26.809 -      prob = GST_TYPE_FIND_POSSIBLE - 10;
  26.810 -    else
  26.811 -      prob = MAX (GST_TYPE_FIND_POSSIBLE - 10, prob + 10);
  26.812 -  }
  26.813 -
  26.814 -  if (prob > 0)
  26.815 -    goto suggest;
  26.816 -
  26.817 -  return;
  26.818 -
  26.819 -suggest:
  26.820 -  {
  26.821 -    GstCaps *caps;
  26.822 -
  26.823 -    g_assert (layer > 0);
  26.824 -
  26.825 -    caps = gst_caps_make_writable (MP3_CAPS);
  26.826 -    gst_structure_set (gst_caps_get_structure (caps, 0), "layer",
  26.827 -        G_TYPE_INT, layer, NULL);
  26.828 -    gst_type_find_suggest (tf, prob, caps);
  26.829 -    gst_caps_unref (caps);
  26.830 -    return;
  26.831 -  }
  26.832 -}
  26.833 -
  26.834 -/*** audio/x-musepack ***/
  26.835 -
  26.836 -static GstStaticCaps musepack_caps = GST_STATIC_CAPS ("audio/x-musepack");
  26.837 -
  26.838 -#define MUSEPACK_CAPS (gst_static_caps_get(&musepack_caps))
  26.839 -static void
  26.840 -musepack_type_find (GstTypeFind * tf, gpointer unused)
  26.841 -{
  26.842 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
  26.843 -
  26.844 -  if (data && memcmp (data, "MP+", 3) == 0) {
  26.845 -    if ((data[3] & 0x7f) == 7) {
  26.846 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MUSEPACK_CAPS);
  26.847 -    } else {
  26.848 -      gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 10, MUSEPACK_CAPS);
  26.849 -    }
  26.850 -  }
  26.851 -}
  26.852 -
  26.853 -/*** audio/x-ac3 ***/
  26.854 -static GstStaticCaps ac3_caps = GST_STATIC_CAPS ("audio/x-ac3");
  26.855 -
  26.856 -#define AC3_CAPS (gst_static_caps_get(&ac3_caps))
  26.857 -
  26.858 -static void
  26.859 -ac3_type_find (GstTypeFind * tf, gpointer unused)
  26.860 -{
  26.861 -  guint8 *data = gst_type_find_peek (tf, 0, 2);
  26.862 -
  26.863 -  if (data) {
  26.864 -    /* pretty lame method... */
  26.865 -    if (data[0] == 0x0b && data[1] == 0x77) {
  26.866 -      gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, AC3_CAPS);
  26.867 -      return;
  26.868 -    }
  26.869 -  }
  26.870 -}
  26.871 -
  26.872 -/*** wavpack ***/
  26.873 -
  26.874 -static GstStaticCaps wavpack_caps =
  26.875 -GST_STATIC_CAPS ("audio/x-wavpack, framed = (boolean) false");
  26.876 -
  26.877 -#define WAVPACK_CAPS (gst_static_caps_get(&wavpack_caps))
  26.878 -
  26.879 -static GstStaticCaps wavpack_correction_caps =
  26.880 -GST_STATIC_CAPS ("audio/x-wavpack-correction, framed = (boolean) false");
  26.881 -
  26.882 -#define WAVPACK_CORRECTION_CAPS (gst_static_caps_get(&wavpack_correction_caps))
  26.883 -
  26.884 -static void
  26.885 -wavpack_type_find (GstTypeFind * tf, gpointer unused)
  26.886 -{
  26.887 -  guint64 offset;
  26.888 -  guint32 blocksize;
  26.889 -  guint8 *data;
  26.890 -
  26.891 -  data = gst_type_find_peek (tf, 0, 32);
  26.892 -  if (!data)
  26.893 -    return;
  26.894 -
  26.895 -  if (data[0] != 'w' || data[1] != 'v' || data[2] != 'p' || data[3] != 'k')
  26.896 -    return;
  26.897 -
  26.898 -  /* Note: wavpack blocks can be fairly large (easily 60-110k), possibly
  26.899 -   * larger than the max. limits imposed by certain typefinding elements
  26.900 -   * like id3demux or apedemux, so typefinding is most likely only going to
  26.901 -   * work in pull-mode */
  26.902 -  blocksize = GST_READ_UINT32_LE (data + 4);
  26.903 -  GST_LOG ("wavpack header, blocksize=0x%04x", blocksize);
  26.904 -  offset = 32;
  26.905 -  while (offset < 32 + blocksize) {
  26.906 -    guint32 sublen;
  26.907 -
  26.908 -    /* get chunk header */
  26.909 -    GST_LOG ("peeking at chunk at offset 0x%04x", (guint) offset);
  26.910 -    data = gst_type_find_peek (tf, offset, 4);
  26.911 -    if (data == NULL)
  26.912 -      break;
  26.913 -    sublen = ((guint32) data[1]) << 1;
  26.914 -    if (data[0] & 0x80) {
  26.915 -      sublen |= (((guint32) data[2]) << 9) | (((guint32) data[3]) << 17);
  26.916 -      sublen += 1 + 3;          /* id + length */
  26.917 -    } else {
  26.918 -      sublen += 1 + 1;          /* id + length */
  26.919 -    }
  26.920 -    if (sublen > blocksize - offset + 32) {
  26.921 -      GST_LOG ("chunk length too big (%u > %" G_GUINT64_FORMAT ")", sublen,
  26.922 -          blocksize - offset);
  26.923 -      break;
  26.924 -    }
  26.925 -    if ((data[0] & 0x20) == 0) {
  26.926 -      switch (data[0] & 0x0f) {
  26.927 -        case 0xa:              /* ID_WV_BITSTREAM  */
  26.928 -        case 0xc:              /* ID_WVX_BITSTREAM */
  26.929 -          gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, WAVPACK_CAPS);
  26.930 -          return;
  26.931 -        case 0xb:              /* ID_WVC_BITSTREAM */
  26.932 -          gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY,
  26.933 -              WAVPACK_CORRECTION_CAPS);
  26.934 -          return;
  26.935 -        default:
  26.936 -          break;
  26.937 -      }
  26.938 -    }
  26.939 -    offset += sublen;
  26.940 -  }
  26.941 -}
  26.942 -
  26.943 -/*** multipart/x-mixed-replace mimestream ***/
  26.944 -
  26.945 -static GstStaticCaps multipart_caps =
  26.946 -GST_STATIC_CAPS ("multipart/x-mixed-replace");
  26.947 -#define MULTIPART_CAPS gst_static_caps_get(&multipart_caps)
  26.948 -
  26.949 -/* multipart/x-mixed replace is: 
  26.950 - *   <maybe some whitespace>--<some ascii chars>[\r]\n
  26.951 - *   <more ascii chars>[\r]\nContent-type:<more ascii>[\r]\n */
  26.952 -static void
  26.953 -multipart_type_find (GstTypeFind * tf, gpointer unused)
  26.954 -{
  26.955 -  guint8 *data;
  26.956 -  guint8 *x;
  26.957 -
  26.958 -#define MULTIPART_MAX_BOUNDARY_OFFSET 16
  26.959 -  data = gst_type_find_peek (tf, 0, MULTIPART_MAX_BOUNDARY_OFFSET);
  26.960 -  if (!data)
  26.961 -    return;
  26.962 -
  26.963 -  for (x = data;
  26.964 -      x - data < MULTIPART_MAX_BOUNDARY_OFFSET - 2 && g_ascii_isspace (*x);
  26.965 -      x++);
  26.966 -  if (x[0] != '-' || x[1] != '-')
  26.967 -    return;
  26.968 -
  26.969 -  /* Could be okay, peek what should be enough for a complete header */
  26.970 -#define MULTIPART_MAX_HEADER_SIZE 256
  26.971 -  data = gst_type_find_peek (tf, 0, MULTIPART_MAX_HEADER_SIZE);
  26.972 -  if (!data)
  26.973 -    return;
  26.974 -
  26.975 -  for (x = data; x - data < MULTIPART_MAX_HEADER_SIZE - 14; x++) {
  26.976 -    if (!isascii (*x)) {
  26.977 -      return;
  26.978 -    }
  26.979 -    if (*x == '\n' &&
  26.980 -        !g_ascii_strncasecmp ("content-type:", (gchar *) x + 1, 13)) {
  26.981 -      GstCaps *caps = gst_caps_copy (MULTIPART_CAPS);
  26.982 -
  26.983 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps);
  26.984 -      gst_caps_unref (caps);
  26.985 -      return;
  26.986 -    }
  26.987 -  }
  26.988 -}
  26.989 -
  26.990 -/*** video/mpeg systemstream ***/
  26.991 -static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, "
  26.992 -    "systemstream = (boolean) true, mpegversion = (int) [ 1, 2 ]");
  26.993 -
  26.994 -#define MPEG_SYS_CAPS gst_static_caps_get(&mpeg_sys_caps)
  26.995 -#define IS_MPEG_HEADER(data)            ((((guint8 *)(data))[0] == 0x00) &&  \
  26.996 -                                         (((guint8 *)(data))[1] == 0x00) &&  \
  26.997 -                                         (((guint8 *)(data))[2] == 0x01))
  26.998 -
  26.999 -#define IS_MPEG_PACK_HEADER(data)       (IS_MPEG_HEADER (data) &&            \
 26.1000 -                                         (((guint8 *)(data))[3] == 0xBA))
 26.1001 -
 26.1002 -#define IS_MPEG_SYSTEM_HEADER(data)     (IS_MPEG_HEADER (data) &&            \
 26.1003 -                                         (((guint8 *)(data))[3] == 0xBB))
 26.1004 -#define IS_MPEG_PACKET_HEADER(data)     (IS_MPEG_HEADER (data) &&            \
 26.1005 -                                         ((((guint8 *)(data))[3] & 0x80) == 0x80))
 26.1006 -
 26.1007 -#define IS_MPEG_PES_HEADER(data)        (IS_MPEG_HEADER (data) &&            \
 26.1008 -                                         ((((guint8 *)(data))[3] == 0xE0) || \
 26.1009 -                                          (((guint8 *)(data))[3] == 0xC0) || \
 26.1010 -                                          (((guint8 *)(data))[3] == 0xBD)))
 26.1011 -
 26.1012 -static void
 26.1013 -mpeg2_sys_type_find (GstTypeFind * tf, gpointer unused)
 26.1014 -{
 26.1015 -  guint8 *data = gst_type_find_peek (tf, 0, 5);
 26.1016 -  gint mpegversion;
 26.1017 -
 26.1018 -  if (data && IS_MPEG_PACK_HEADER (data)) {
 26.1019 -    if ((data[4] & 0xC0) == 0x40) {
 26.1020 -      /* type 2 */
 26.1021 -      mpegversion = 2;
 26.1022 -      goto suggest;
 26.1023 -    } else if ((data[4] & 0xF0) == 0x20) {
 26.1024 -      mpegversion = 1;
 26.1025 -      goto suggest;
 26.1026 -    }
 26.1027 -  } else if (data && IS_MPEG_PES_HEADER (data)) {
 26.1028 -    /* PES stream */
 26.1029 -    mpegversion = 2;
 26.1030 -    goto suggest;
 26.1031 -  }
 26.1032 -
 26.1033 -  return;
 26.1034 -suggest:
 26.1035 -  {
 26.1036 -    GstCaps *caps = gst_caps_copy (MPEG_SYS_CAPS);
 26.1037 -
 26.1038 -    gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion",
 26.1039 -        G_TYPE_INT, mpegversion, NULL);
 26.1040 -    gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, caps);
 26.1041 -    gst_caps_unref (caps);
 26.1042 -  }
 26.1043 -};
 26.1044 -
 26.1045 -/* ATTENTION: ugly return value:
 26.1046 - * 0 -  invalid data
 26.1047 - * 1 - not enough data
 26.1048 - * anything else - size until next package
 26.1049 - */
 26.1050 -static guint
 26.1051 -mpeg1_parse_header (GstTypeFind * tf, guint64 offset)
 26.1052 -{
 26.1053 -  guint8 *data = gst_type_find_peek (tf, offset, 4);
 26.1054 -  guint size;
 26.1055 -
 26.1056 -  if (!data) {
 26.1057 -    GST_LOG ("couldn't get MPEG header bytes");
 26.1058 -    return 1;
 26.1059 -  }
 26.1060 -
 26.1061 -  if (data[0] != 0 || data[1] != 0 || data[2] != 1) {
 26.1062 -    GST_LOG ("no sync");
 26.1063 -    return 0;
 26.1064 -  }
 26.1065 -  offset += 4;
 26.1066 -
 26.1067 -  GST_LOG ("sync %02x", data[3]);
 26.1068 -
 26.1069 -  switch (data[3]) {
 26.1070 -    case 0xBA:                 /* pack header */
 26.1071 -      data = gst_type_find_peek (tf, offset, 8);
 26.1072 -      if (!data) {
 26.1073 -        GST_LOG ("couldn't get MPEG pack header bytes");
 26.1074 -        return 1;
 26.1075 -      }
 26.1076 -      size = 12;
 26.1077 -      /* check marker bits */
 26.1078 -      if ((data[0] & 0xF1) != 0x21 ||
 26.1079 -          (data[2] & 0x01) != 0x01 ||
 26.1080 -          (data[4] & 0x01) != 0x01 ||
 26.1081 -          (data[5] & 0x80) != 0x80 || (data[7] & 0x01) != 0x01) {
 26.1082 -        GST_LOG ("wrong marker bits");
 26.1083 -        return 0;
 26.1084 -      }
 26.1085 -      break;
 26.1086 -
 26.1087 -    case 0xB9:                 /* ISO end code */
 26.1088 -      size = 4;
 26.1089 -      break;
 26.1090 -
 26.1091 -    case 0xBB:                 /* system header */
 26.1092 -      data = gst_type_find_peek (tf, offset, 2);
 26.1093 -      if (!data) {
 26.1094 -        GST_LOG ("couldn't get MPEG pack header bytes");
 26.1095 -        return 1;
 26.1096 -      }
 26.1097 -      size = GST_READ_UINT16_BE (data) + 6;
 26.1098 -      offset += 2;
 26.1099 -      data = gst_type_find_peek (tf, offset, size - 6);
 26.1100 -      if (!data) {
 26.1101 -        GST_LOG ("couldn't get MPEG pack header bytes");
 26.1102 -        return 1;
 26.1103 -      }
 26.1104 -      /* check marker bits */
 26.1105 -      if ((data[0] & 0x80) != 0x80 ||
 26.1106 -          (data[2] & 0x01) != 0x01 || (data[4] & 0x20) != 0x20) {
 26.1107 -        GST_LOG ("wrong marker bits");
 26.1108 -        return 0;
 26.1109 -      }
 26.1110 -      /* check stream marker bits */
 26.1111 -      for (offset = 6; offset < (size - 6); offset += 3) {
 26.1112 -        if (data[offset] <= 0xBB || (data[offset + 1] & 0xC0) != 0xC0) {
 26.1113 -          GST_LOG ("wrong marker bits");
 26.1114 -          return 0;
 26.1115 -        }
 26.1116 -      }
 26.1117 -      break;
 26.1118 -
 26.1119 -    default:
 26.1120 -      if (data[3] < 0xB9)
 26.1121 -        return 0;
 26.1122 -      data = gst_type_find_peek (tf, offset, 2);
 26.1123 -      if (!data) {
 26.1124 -        GST_LOG ("couldn't get MPEG pack header bytes");
 26.1125 -        return 1;
 26.1126 -      }
 26.1127 -      size = GST_READ_UINT16_BE (data) + 6;
 26.1128 -      /* FIXME: we could check PTS/DTS marker bits here... (bit overkill) */
 26.1129 -      break;
 26.1130 -  }
 26.1131 -
 26.1132 -  return size;
 26.1133 -}
 26.1134 -
 26.1135 -/* calculation of possibility to identify random data as mpeg systemstream:
 26.1136 - * bits that must match in header detection:            32 (or more)
 26.1137 - * chance that random data is identifed:                1/2^32
 26.1138 - * chance that GST_MPEG_TYPEFIND_TRY_HEADERS headers are identified:
 26.1139 - *                                      1/2^(32*GST_MPEG_TYPEFIND_TRY_HEADERS)
 26.1140 - * chance that this happens in GST_MPEG_TYPEFIND_TRY_SYNC bytes:
 26.1141 - *                                      1-(1+1/2^(32*GST_MPEG_TYPEFIND_TRY_HEADERS)^GST_MPEG_TYPEFIND_TRY_SYNC)
 26.1142 - * for current values:
 26.1143 - *                                      1-(1+1/2^(32*4)^101024)
 26.1144 - *                                    = <some_number>
 26.1145 - */
 26.1146 -#define GST_MPEG_TYPEFIND_TRY_HEADERS 4
 26.1147 -#define GST_MPEG_TYPEFIND_TRY_SYNC (100 * 1024) /* 100kB */
 26.1148 -#define GST_MPEG_TYPEFIND_SYNC_SIZE 2048
 26.1149 -static void
 26.1150 -mpeg1_sys_type_find (GstTypeFind * tf, gpointer unused)
 26.1151 -{
 26.1152 -  guint8 *data = NULL;
 26.1153 -  guint size = 0;
 26.1154 -  guint64 skipped = 0;
 26.1155 -  GstCaps *caps;
 26.1156 -
 26.1157 -  while (skipped < GST_MPEG_TYPEFIND_TRY_SYNC) {
 26.1158 -    if (size < 4) {
 26.1159 -      data = gst_type_find_peek (tf, skipped, GST_MPEG_TYPEFIND_SYNC_SIZE);
 26.1160 -      if (!data)
 26.1161 -        break;
 26.1162 -      size = GST_MPEG_TYPEFIND_SYNC_SIZE;
 26.1163 -    }
 26.1164 -    if (IS_MPEG_PACK_HEADER (data)) {
 26.1165 -      /* found packet start code */
 26.1166 -      guint found = 0;
 26.1167 -      guint packet_size = 0;
 26.1168 -      guint64 offset = skipped;
 26.1169 -
 26.1170 -      while (found < GST_MPEG_TYPEFIND_TRY_HEADERS) {
 26.1171 -        packet_size = mpeg1_parse_header (tf, offset);
 26.1172 -        if (packet_size <= 1)
 26.1173 -          break;
 26.1174 -        offset += packet_size;
 26.1175 -        found++;
 26.1176 -      }
 26.1177 -      g_assert (found <= GST_MPEG_TYPEFIND_TRY_HEADERS);
 26.1178 -      if (found == GST_MPEG_TYPEFIND_TRY_HEADERS || packet_size == 1) {
 26.1179 -        GST_LOG ("suggesting mpeg1 system steeam");
 26.1180 -        caps = gst_caps_copy (MPEG_SYS_CAPS);
 26.1181 -        gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion",
 26.1182 -            G_TYPE_INT, 1, NULL);
 26.1183 -        gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 1, caps);
 26.1184 -        gst_caps_unref (caps);
 26.1185 -        return;
 26.1186 -      }
 26.1187 -    }
 26.1188 -    data++;
 26.1189 -    skipped++;
 26.1190 -    size--;
 26.1191 -  }
 26.1192 -}
 26.1193 -
 26.1194 -/** video/mpegts Transport Stream **/
 26.1195 -static GstStaticCaps mpegts_caps = GST_STATIC_CAPS ("video/mpegts, "
 26.1196 -    "systemstream = (boolean) true, packetsize = (int) [ 188, 208 ]");
 26.1197 -#define MPEGTS_CAPS gst_static_caps_get(&mpegts_caps)
 26.1198 -
 26.1199 -#define GST_MPEGTS_TYPEFIND_MIN_HEADERS 4
 26.1200 -#define GST_MPEGTS_TYPEFIND_MAX_HEADERS 10
 26.1201 -#define GST_MPEGTS_MAX_PACKET_SIZE 204
 26.1202 -#define GST_MPEGTS_TYPEFIND_SYNC_SIZE \
 26.1203 -            (GST_MPEGTS_TYPEFIND_MIN_HEADERS * GST_MPEGTS_MAX_PACKET_SIZE)
 26.1204 -#define GST_MPEGTS_TYPEFIND_MAX_SYNC \
 26.1205 -            (GST_MPEGTS_TYPEFIND_MAX_HEADERS * GST_MPEGTS_MAX_PACKET_SIZE)
 26.1206 -
 26.1207 -#define MPEGTS_HDR_SIZE 4
 26.1208 -#define IS_MPEGTS_HEADER(data) (((data)[0] == 0x47) && \
 26.1209 -                                (((data)[1] & 0x80) == 0x00) && \
 26.1210 -                                (((data)[3] & 0x10) == 0x10))
 26.1211 -
 26.1212 -/* Helper function to search ahead at intervals of packet_size for mpegts
 26.1213 - * headers */
 26.1214 -gint
 26.1215 -mpeg_ts_probe_headers (GstTypeFind * tf, guint64 offset, gint packet_size)
 26.1216 -{
 26.1217 -  /* We always enter this function having found at least one header already */
 26.1218 -  gint found = 1;
 26.1219 -  guint8 *data = NULL;
 26.1220 -
 26.1221 -  while (found < GST_MPEGTS_TYPEFIND_MAX_HEADERS) {
 26.1222 -    offset += packet_size;
 26.1223 -
 26.1224 -    data = gst_type_find_peek (tf, offset, MPEGTS_HDR_SIZE);
 26.1225 -    if (data == NULL || !IS_MPEGTS_HEADER (data))
 26.1226 -      return found;
 26.1227 -
 26.1228 -    found++;
 26.1229 -  }
 26.1230 -
 26.1231 -  return found;
 26.1232 -}
 26.1233 -
 26.1234 -/* Try and detect at least 4 packets in at most 10 packets worth of
 26.1235 - * data. Need to try several possible packet sizes */
 26.1236 -static void
 26.1237 -mpeg_ts_type_find (GstTypeFind * tf, gpointer unused)
 26.1238 -{
 26.1239 -  /* TS packet sizes to test: normal, DVHS packet size and 
 26.1240 -   * FEC with 16 or 20 byte codes packet size. */
 26.1241 -  const gint pack_sizes[] = { 188, 192, 204, 208 };
 26.1242 -  const gint n_pack_sizes = sizeof (pack_sizes) / sizeof (gint);
 26.1243 -
 26.1244 -  guint8 *data = NULL;
 26.1245 -  guint size = 0;
 26.1246 -  guint64 skipped = 0;
 26.1247 -
 26.1248 -  while (skipped < GST_MPEGTS_TYPEFIND_MAX_SYNC) {
 26.1249 -    if (size < MPEGTS_HDR_SIZE) {
 26.1250 -      data = gst_type_find_peek (tf, skipped, GST_MPEGTS_TYPEFIND_SYNC_SIZE);
 26.1251 -      if (!data)
 26.1252 -        break;
 26.1253 -      size = GST_MPEGTS_TYPEFIND_SYNC_SIZE;
 26.1254 -    }
 26.1255 -
 26.1256 -    /* Have at least MPEGTS_HDR_SIZE bytes at this point */
 26.1257 -    if (IS_MPEGTS_HEADER (data)) {
 26.1258 -      gint p;
 26.1259 -
 26.1260 -      for (p = 0; p < n_pack_sizes; p++) {
 26.1261 -        gint found;
 26.1262 -
 26.1263 -        /* Probe ahead at size pack_sizes[p] */
 26.1264 -        found = mpeg_ts_probe_headers (tf, skipped, pack_sizes[p]);
 26.1265 -        if (found >= GST_MPEGTS_TYPEFIND_MIN_HEADERS) {
 26.1266 -          gint probability;
 26.1267 -          GstCaps *caps = gst_caps_copy (MPEGTS_CAPS);
 26.1268 -
 26.1269 -          gst_structure_set (gst_caps_get_structure (caps, 0), "packetsize",
 26.1270 -              G_TYPE_INT, pack_sizes[p], NULL);
 26.1271 -
 26.1272 -          /* found at least 4 headers. 10 headers = MAXIMUM probability. 
 26.1273 -           * Arbitrarily, I assigned 10% probability for each header we
 26.1274 -           * found, 40% -> 100% */
 26.1275 -
 26.1276 -          probability = 10 * MIN (found, 10);
 26.1277 -
 26.1278 -          gst_type_find_suggest (tf, probability, caps);
 26.1279 -          gst_caps_unref (caps);
 26.1280 -          return;
 26.1281 -        }
 26.1282 -      }
 26.1283 -    }
 26.1284 -    data++;
 26.1285 -    skipped++;
 26.1286 -    size--;
 26.1287 -  }
 26.1288 -}
 26.1289 -
 26.1290 -/*** video/mpeg MPEG-4 elementary video stream ***/
 26.1291 -
 26.1292 -static GstStaticCaps mpeg4_video_caps = GST_STATIC_CAPS ("video/mpeg, "
 26.1293 -    "systemstream = (boolean) false, mpegversion = 4");
 26.1294 -#define MPEG4_VIDEO_CAPS gst_static_caps_get(&mpeg4_video_caps)
 26.1295 -static void
 26.1296 -mpeg4_video_type_find (GstTypeFind * tf, gpointer unused)
 26.1297 -{
 26.1298 -  /* Header consists of: a series of start codes (00 00 01 xx), some with 
 26.1299 -   * associated data.
 26.1300 -   * Optionally, we start with a visual_object_sequence_start_code, followed by
 26.1301 -   * (optionally) visual_object_start_code), then the mandatory 
 26.1302 -   * video_object_start_code and video_object_layer_start_code)
 26.1303 -   */
 26.1304 -  guint8 *data = NULL;
 26.1305 -  int offset = 0;
 26.1306 -  gboolean seen_vos = FALSE;
 26.1307 -
 26.1308 -  while (TRUE) {
 26.1309 -    data = gst_type_find_peek (tf, offset, 4);
 26.1310 -    if (data && data[0] == 0 && data[1] == 0 && data[2] == 1) {
 26.1311 -      int sc = data[3];
 26.1312 -
 26.1313 -      if (sc == 0xB0)           /* visual_object_sequence_start_code */
 26.1314 -        offset += 5;
 26.1315 -      else if (sc == 0xB5)      /* visual_object_start_code */
 26.1316 -        offset += 5;
 26.1317 -      else if (sc >= 0x00 && sc <= 0x1F) {      /* video_object_start_code */
 26.1318 -        offset += 4;
 26.1319 -        seen_vos = TRUE;
 26.1320 -      } else if (sc >= 0x20 && sc <= 0x2F) {    /* video_object_layer_start_code */
 26.1321 -        if (seen_vos) {
 26.1322 -          GstCaps *caps = gst_caps_copy (MPEG4_VIDEO_CAPS);
 26.1323 -
 26.1324 -          gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 1, caps);
 26.1325 -          gst_caps_unref (caps);
 26.1326 -          return;
 26.1327 -        }
 26.1328 -      } else
 26.1329 -        return;
 26.1330 -    } else
 26.1331 -      return;
 26.1332 -  }
 26.1333 -}
 26.1334 -
 26.1335 -/*** video/mpeg video stream ***/
 26.1336 -
 26.1337 -static GstStaticCaps mpeg_video_caps = GST_STATIC_CAPS ("video/mpeg, "
 26.1338 -    "systemstream = (boolean) false");
 26.1339 -#define MPEG_VIDEO_CAPS gst_static_caps_get(&mpeg_video_caps)
 26.1340 -static void
 26.1341 -mpeg_video_type_find (GstTypeFind * tf, gpointer unused)
 26.1342 -{
 26.1343 -  static const guint8 sequence_header[] = { 0x00, 0x00, 0x01, 0xb3 };
 26.1344 -  guint8 *data = NULL;
 26.1345 -
 26.1346 -  data = gst_type_find_peek (tf, 0, 8);
 26.1347 -
 26.1348 -  if (data && memcmp (data, sequence_header, 4) == 0) {
 26.1349 -    GstCaps *caps = gst_caps_copy (MPEG_VIDEO_CAPS);
 26.1350 -
 26.1351 -    gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion",
 26.1352 -        G_TYPE_INT, 1, NULL);
 26.1353 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 1, caps);
 26.1354 -    gst_caps_unref (caps);
 26.1355 -  }
 26.1356 -}
 26.1357 -
 26.1358 -/*
 26.1359 - * Idea is the same as MPEG system stream typefinding: We check each
 26.1360 - * byte of the stream to see if - from that point on - the stream
 26.1361 - * matches a predefined set of marker bits as defined in the MPEG
 26.1362 - * video specs.
 26.1363 - *
 26.1364 - * I'm sure someone will do a chance calculation here too.
 26.1365 - */
 26.1366 -
 26.1367 -#define GST_MPEGVID_TYPEFIND_TRY_PICTURES 6
 26.1368 -#define GST_MPEGVID_TYPEFIND_TRY_SYNC (100 * 1024)      /* 100 kB */
 26.1369 -#define GST_MPEGVID_TYPEFIND_SYNC_SIZE 2048
 26.1370 -
 26.1371 -static void
 26.1372 -mpeg_video_stream_type_find (GstTypeFind * tf, gpointer unused)
 26.1373 -{
 26.1374 -  gint size = 0, found = 0;
 26.1375 -  guint64 skipped = 0;
 26.1376 -  guint8 *data = NULL;
 26.1377 -
 26.1378 -  while (1) {
 26.1379 -    if (found >= GST_MPEGVID_TYPEFIND_TRY_PICTURES) {
 26.1380 -      GstCaps *caps = gst_caps_copy (MPEG_VIDEO_CAPS);
 26.1381 -
 26.1382 -      gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion",
 26.1383 -          G_TYPE_INT, 1, NULL);
 26.1384 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 2, caps);
 26.1385 -      gst_caps_unref (caps);
 26.1386 -      return;
 26.1387 -    }
 26.1388 -
 26.1389 -    if (skipped > GST_MPEGVID_TYPEFIND_TRY_SYNC)
 26.1390 -      break;
 26.1391 -
 26.1392 -    if (size < 5) {
 26.1393 -      data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE);
 26.1394 -      if (!data)
 26.1395 -        break;
 26.1396 -      size = GST_MPEGVID_TYPEFIND_SYNC_SIZE;
 26.1397 -    }
 26.1398 -
 26.1399 -    /* are we a sequence (0xB3) or GOP (0xB8) header? */
 26.1400 -    if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x1 &&
 26.1401 -        (data[3] == 0xB3 || data[3] == 0xB8)) {
 26.1402 -      size -= 8;
 26.1403 -      data += 8;
 26.1404 -      skipped += 8;
 26.1405 -      if (data[3] == 0xB3)
 26.1406 -        continue;
 26.1407 -      else if (size < 4) {
 26.1408 -        data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE);
 26.1409 -        size = GST_MPEGVID_TYPEFIND_SYNC_SIZE;
 26.1410 -        if (!data)
 26.1411 -          break;
 26.1412 -      }
 26.1413 -      /* else, we should now see an image */
 26.1414 -    }
 26.1415 -
 26.1416 -    /* image header (and, when found, slice header) */
 26.1417 -    if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x1 && data[4] == 0x0) {
 26.1418 -      size -= 8;
 26.1419 -      data += 8;
 26.1420 -      skipped += 8;
 26.1421 -      if (size < 5) {
 26.1422 -        data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE);
 26.1423 -        size = GST_MPEGVID_TYPEFIND_SYNC_SIZE;
 26.1424 -        if (!data)
 26.1425 -          break;
 26.1426 -      }
 26.1427 -      if ((data[0] == 0x0 && data[1] == 0x0 &&
 26.1428 -              data[2] == 0x1 && data[3] == 0x1) ||
 26.1429 -          (data[1] == 0x0 && data[2] == 0x0 &&
 26.1430 -              data[3] == 0x1 && data[4] == 0x1)) {
 26.1431 -        size -= 4;
 26.1432 -        data += 4;
 26.1433 -        skipped += 4;
 26.1434 -        found += 1;
 26.1435 -        continue;
 26.1436 -      }
 26.1437 -    }
 26.1438 -
 26.1439 -    size--;
 26.1440 -    data++;
 26.1441 -    skipped++;
 26.1442 -  }
 26.1443 -}
 26.1444 -
 26.1445 -/*** audio/x-aiff ***/
 26.1446 -
 26.1447 -static GstStaticCaps aiff_caps = GST_STATIC_CAPS ("audio/x-aiff");
 26.1448 -
 26.1449 -#define AIFF_CAPS gst_static_caps_get(&aiff_caps)
 26.1450 -static void
 26.1451 -aiff_type_find (GstTypeFind * tf, gpointer unused)
 26.1452 -{
 26.1453 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.1454 -
 26.1455 -  if (data && memcmp (data, "FORM", 4) == 0) {
 26.1456 -    data += 8;
 26.1457 -    if (memcmp (data, "AIFF", 4) == 0 || memcmp (data, "AIFC", 4) == 0)
 26.1458 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, AIFF_CAPS);
 26.1459 -  }
 26.1460 -}
 26.1461 -
 26.1462 -/*** audio/x-aiff ***/
 26.1463 -
 26.1464 -static GstStaticCaps svx_caps = GST_STATIC_CAPS ("audio/x-svx");
 26.1465 -
 26.1466 -#define SVX_CAPS gst_static_caps_get(&svx_caps)
 26.1467 -static void
 26.1468 -svx_type_find (GstTypeFind * tf, gpointer unused)
 26.1469 -{
 26.1470 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.1471 -
 26.1472 -  if (data && memcmp (data, "FORM", 4) == 0) {
 26.1473 -    data += 8;
 26.1474 -    if (memcmp (data, "8SVX", 4) == 0 || memcmp (data, "16SV", 4) == 0)
 26.1475 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SVX_CAPS);
 26.1476 -  }
 26.1477 -}
 26.1478 -
 26.1479 -/*** audio/x-shorten ***/
 26.1480 -
 26.1481 -static GstStaticCaps shn_caps = GST_STATIC_CAPS ("audio/x-shorten");
 26.1482 -
 26.1483 -#define SHN_CAPS gst_static_caps_get(&shn_caps)
 26.1484 -static void
 26.1485 -shn_type_find (GstTypeFind * tf, gpointer unused)
 26.1486 -{
 26.1487 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.1488 -
 26.1489 -  if (data && memcmp (data, "ajkg", 4) == 0) {
 26.1490 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SHN_CAPS);
 26.1491 -  }
 26.1492 -  data = gst_type_find_peek (tf, -8, 8);
 26.1493 -  if (data && memcmp (data, "SHNAMPSK", 8) == 0) {
 26.1494 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SHN_CAPS);
 26.1495 -  }
 26.1496 -}
 26.1497 -
 26.1498 -/*** application/x-ape ***/
 26.1499 -
 26.1500 -static GstStaticCaps ape_caps = GST_STATIC_CAPS ("application/x-ape");
 26.1501 -
 26.1502 -#define APE_CAPS gst_static_caps_get(&ape_caps)
 26.1503 -static void
 26.1504 -ape_type_find (GstTypeFind * tf, gpointer unused)
 26.1505 -{
 26.1506 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.1507 -
 26.1508 -  if (data && memcmp (data, "MAC ", 4) == 0) {
 26.1509 -    gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 10, APE_CAPS);
 26.1510 -  }
 26.1511 -}
 26.1512 -
 26.1513 -/*** ISO FORMATS ***/
 26.1514 -
 26.1515 -/*** audio/x-m4a ***/
 26.1516 -
 26.1517 -static GstStaticCaps m4a_caps = GST_STATIC_CAPS ("audio/x-m4a");
 26.1518 -
 26.1519 -#define M4A_CAPS (gst_static_caps_get(&m4a_caps))
 26.1520 -static void
 26.1521 -m4a_type_find (GstTypeFind * tf, gpointer unused)
 26.1522 -{
 26.1523 -  guint8 *data = gst_type_find_peek (tf, 4, 8);
 26.1524 -
 26.1525 -  if (data &&
 26.1526 -      (memcmp (data, "ftypM4A ", 8) == 0 ||
 26.1527 -          memcmp (data, "ftypmp42", 8) == 0)) {
 26.1528 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, M4A_CAPS);
 26.1529 -  }
 26.1530 -}
 26.1531 -
 26.1532 -/*** application/x-3gp ***/
 26.1533 -
 26.1534 -/* The Q is there because variables can't start with a number. */
 26.1535 -
 26.1536 -
 26.1537 -static GstStaticCaps q3gp_caps = GST_STATIC_CAPS ("application/x-3gp");
 26.1538 -
 26.1539 -#define Q3GP_CAPS (gst_static_caps_get(&q3gp_caps))
 26.1540 -static void
 26.1541 -q3gp_type_find (GstTypeFind * tf, gpointer unused)
 26.1542 -{
 26.1543 -
 26.1544 -  guint32 ftyp_size = 0;
 26.1545 -  gint offset = 0;
 26.1546 -  guint8 *data = NULL;
 26.1547 -
 26.1548 -  if ((data = gst_type_find_peek (tf, 0, 12)) == NULL) {
 26.1549 -    return;
 26.1550 -  }
 26.1551 -
 26.1552 -  data += 4;
 26.1553 -  if (memcmp (data, "ftyp", 4) != 0) {
 26.1554 -    return;
 26.1555 -  }
 26.1556 -
 26.1557 -  /* check major brand */
 26.1558 -  data += 4;
 26.1559 -  if (memcmp (data, "3gp", 3) == 0 ||
 26.1560 -      memcmp (data, "3gr", 3) == 0 ||
 26.1561 -      memcmp (data, "3gs", 3) == 0 || memcmp (data, "3gg", 3) == 0) {
 26.1562 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, Q3GP_CAPS);
 26.1563 -    return;
 26.1564 -  }
 26.1565 -
 26.1566 -  /* check compatible brands */
 26.1567 -  if ((data = gst_type_find_peek (tf, 0, 4)) != NULL) {
 26.1568 -    ftyp_size = GST_READ_UINT32_BE (data);
 26.1569 -  }
 26.1570 -  for (offset = 16; offset < ftyp_size; offset += 4) {
 26.1571 -    if ((data = gst_type_find_peek (tf, offset, 3)) == NULL) {
 26.1572 -      break;
 26.1573 -    }
 26.1574 -    if (memcmp (data, "3gp", 3) == 0 ||
 26.1575 -        memcmp (data, "3gr", 3) == 0 ||
 26.1576 -        memcmp (data, "3gs", 3) == 0 || memcmp (data, "3gg", 3) == 0) {
 26.1577 -      gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, Q3GP_CAPS);
 26.1578 -      break;
 26.1579 -    }
 26.1580 -  }
 26.1581 -
 26.1582 -  return;
 26.1583 -
 26.1584 -}
 26.1585 -
 26.1586 -/*** video/quicktime ***/
 26.1587 -
 26.1588 -static GstStaticCaps qt_caps = GST_STATIC_CAPS ("video/quicktime");
 26.1589 -
 26.1590 -#define QT_CAPS gst_static_caps_get(&qt_caps)
 26.1591 -#define STRNCMP(x,y,z) (strncmp ((char*)(x), (char*)(y), z))
 26.1592 -
 26.1593 -static void
 26.1594 -qt_type_find (GstTypeFind * tf, gpointer unused)
 26.1595 -{
 26.1596 -  guint8 *data;
 26.1597 -  guint tip = 0;
 26.1598 -  guint64 offset = 0;
 26.1599 -  guint64 size;
 26.1600 -
 26.1601 -  while ((data = gst_type_find_peek (tf, offset, 8)) != NULL) {
 26.1602 -    /* box/atom types that are in common with ISO base media file format */
 26.1603 -    if (STRNCMP (&data[4], "moov", 4) == 0 ||
 26.1604 -        STRNCMP (&data[4], "mdat", 4) == 0 ||
 26.1605 -        STRNCMP (&data[4], "ftyp", 4) == 0 ||
 26.1606 -        STRNCMP (&data[4], "free", 4) == 0 ||
 26.1607 -        STRNCMP (&data[4], "uuid", 4) == 0 ||
 26.1608 -        STRNCMP (&data[4], "skip", 4) == 0) {
 26.1609 -      if (tip == 0) {
 26.1610 -        tip = GST_TYPE_FIND_LIKELY;
 26.1611 -      } else {
 26.1612 -        tip = GST_TYPE_FIND_NEARLY_CERTAIN;
 26.1613 -      }
 26.1614 -    }
 26.1615 -    /* other box/atom types, apparently quicktime specific */
 26.1616 -    else if (STRNCMP (&data[4], "pnot", 4) == 0 ||
 26.1617 -        STRNCMP (&data[4], "PICT", 4) == 0 ||
 26.1618 -        STRNCMP (&data[4], "wide", 4) == 0 ||
 26.1619 -        STRNCMP (&data[4], "prfl", 4) == 0) {
 26.1620 -      tip = GST_TYPE_FIND_MAXIMUM;
 26.1621 -      break;
 26.1622 -    } else {
 26.1623 -      tip = 0;
 26.1624 -      break;
 26.1625 -    }
 26.1626 -    size = GST_READ_UINT32_BE (data);
 26.1627 -    if (size == 1) {
 26.1628 -      guint8 *sizedata;
 26.1629 -
 26.1630 -      sizedata = gst_type_find_peek (tf, offset + 8, 8);
 26.1631 -      if (sizedata == NULL)
 26.1632 -        break;
 26.1633 -
 26.1634 -      size = GST_READ_UINT64_BE (sizedata);
 26.1635 -    } else {
 26.1636 -      if (size < 8)
 26.1637 -        break;
 26.1638 -    }
 26.1639 -    offset += size;
 26.1640 -  }
 26.1641 -  if (tip > 0) {
 26.1642 -    gst_type_find_suggest (tf, tip, QT_CAPS);
 26.1643 -  }
 26.1644 -};
 26.1645 -
 26.1646 -
 26.1647 -/*** image/x-quicktime ***/
 26.1648 -
 26.1649 -static GstStaticCaps qtif_caps = GST_STATIC_CAPS ("image/x-quicktime");
 26.1650 -
 26.1651 -#define QTIF_CAPS gst_static_caps_get(&qtif_caps)
 26.1652 -
 26.1653 -/* how many atoms we check before we give up */
 26.1654 -#define QTIF_MAXROUNDS 25
 26.1655 -
 26.1656 -static void
 26.1657 -qtif_type_find (GstTypeFind * tf, gpointer unused)
 26.1658 -{
 26.1659 -  const guint8 *data;
 26.1660 -  gboolean found_idsc = FALSE;
 26.1661 -  gboolean found_idat = FALSE;
 26.1662 -  guint64 offset = 0;
 26.1663 -  guint rounds = 0;
 26.1664 -
 26.1665 -  while ((data = gst_type_find_peek (tf, offset, 8)) != NULL) {
 26.1666 -    guint64 size;
 26.1667 -
 26.1668 -    size = GST_READ_UINT32_BE (data);
 26.1669 -    if (size == 1) {
 26.1670 -      const guint8 *sizedata;
 26.1671 -
 26.1672 -      sizedata = gst_type_find_peek (tf, offset + 8, 8);
 26.1673 -      if (sizedata == NULL)
 26.1674 -        break;
 26.1675 -
 26.1676 -      size = GST_READ_UINT64_BE (sizedata);
 26.1677 -    }
 26.1678 -    if (size < 8)
 26.1679 -      break;
 26.1680 -
 26.1681 -    if (STRNCMP (data + 4, "idsc", 4) == 0)
 26.1682 -      found_idsc = TRUE;
 26.1683 -    if (STRNCMP (data + 4, "idat", 4) == 0)
 26.1684 -      found_idat = TRUE;
 26.1685 -
 26.1686 -    if (found_idsc && found_idat) {
 26.1687 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, QTIF_CAPS);
 26.1688 -      return;
 26.1689 -    }
 26.1690 -
 26.1691 -    offset += size;
 26.1692 -    if (++rounds > QTIF_MAXROUNDS)
 26.1693 -      break;
 26.1694 -  }
 26.1695 -
 26.1696 -  if (found_idsc || found_idat) {
 26.1697 -    gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, QTIF_CAPS);
 26.1698 -    return;
 26.1699 -  }
 26.1700 -};
 26.1701 -
 26.1702 -/*** audio/x-mod ***/
 26.1703 -
 26.1704 -static GstStaticCaps mod_caps = GST_STATIC_CAPS ("audio/x-mod");
 26.1705 -
 26.1706 -#define MOD_CAPS gst_static_caps_get(&mod_caps)
 26.1707 -/* FIXME: M15 CheckType to do */
 26.1708 -static void
 26.1709 -mod_type_find (GstTypeFind * tf, gpointer unused)
 26.1710 -{
 26.1711 -  guint8 *data;
 26.1712 -
 26.1713 -  /* MOD */
 26.1714 -  if ((data = gst_type_find_peek (tf, 1080, 4)) != NULL) {
 26.1715 -    /* Protracker and variants */
 26.1716 -    if ((memcmp (data, "M.K.", 4) == 0) || (memcmp (data, "M!K!", 4) == 0) ||
 26.1717 -        /* Star Tracker */
 26.1718 -        (memcmp (data, "FLT", 3) == 0 && isdigit (data[3])) ||
 26.1719 -        (memcmp (data, "EXO", 3) == 0 && isdigit (data[3])) ||
 26.1720 -        /* Oktalyzer (Amiga) */
 26.1721 -        (memcmp (data, "OKTA", 4) == 0) ||
 26.1722 -        /* Oktalyser (Atari) */
 26.1723 -        (memcmp (data, "CD81", 4) == 0) ||
 26.1724 -        /* Fasttracker */
 26.1725 -        (memcmp (data + 1, "CHN", 3) == 0 && isdigit (data[0])) ||
 26.1726 -        /* Fasttracker or Taketracker */
 26.1727 -        (memcmp (data + 2, "CH", 2) == 0 && isdigit (data[0])
 26.1728 -            && isdigit (data[1])) || (memcmp (data + 2, "CN", 2) == 0
 26.1729 -            && isdigit (data[0]) && isdigit (data[1]))) {
 26.1730 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1731 -      return;
 26.1732 -    }
 26.1733 -  }
 26.1734 -  /* XM */
 26.1735 -  if ((data = gst_type_find_peek (tf, 0, 38)) != NULL) {
 26.1736 -    if (memcmp (data, "Extended Module: ", 17) == 0 && data[37] == 0x1A) {
 26.1737 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1738 -      return;
 26.1739 -    }
 26.1740 -  }
 26.1741 -  /* OKT */
 26.1742 -  if (data || (data = gst_type_find_peek (tf, 0, 8)) != NULL) {
 26.1743 -    if (memcmp (data, "OKTASONG", 8) == 0) {
 26.1744 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1745 -      return;
 26.1746 -    }
 26.1747 -  }
 26.1748 -  if (data || (data = gst_type_find_peek (tf, 0, 4)) != NULL) {
 26.1749 -    /* 669 */
 26.1750 -    if ((memcmp (data, "if", 2) == 0) || (memcmp (data, "JN", 2) == 0)) {
 26.1751 -      gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS);
 26.1752 -      return;
 26.1753 -    }
 26.1754 -    /* AMF */
 26.1755 -    if ((memcmp (data, "AMF", 3) == 0 && data[3] > 10 && data[3] < 14) ||
 26.1756 -        /* IT */
 26.1757 -        (memcmp (data, "IMPM", 4) == 0) ||
 26.1758 -        /* MED */
 26.1759 -        (memcmp (data, "MMD0", 4) == 0) || (memcmp (data, "MMD1", 4) == 0) ||
 26.1760 -        /* MTM */
 26.1761 -        (memcmp (data, "MTM", 3) == 0)) {
 26.1762 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1763 -      return;
 26.1764 -    }
 26.1765 -    /* DSM */
 26.1766 -    if (memcmp (data, "RIFF", 4) == 0) {
 26.1767 -      guint8 *data2 = gst_type_find_peek (tf, 8, 4);
 26.1768 -
 26.1769 -      if (data2) {
 26.1770 -        if (memcmp (data2, "DSMF", 4) == 0) {
 26.1771 -          gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1772 -          return;
 26.1773 -        }
 26.1774 -      }
 26.1775 -    }
 26.1776 -    /* FAM */
 26.1777 -    if (memcmp (data, "FAM\xFE", 4) == 0) {
 26.1778 -      guint8 *data2 = gst_type_find_peek (tf, 44, 3);
 26.1779 -
 26.1780 -      if (data2) {
 26.1781 -        if (memcmp (data2, "compare", 3) == 0) {
 26.1782 -          gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1783 -          return;
 26.1784 -        }
 26.1785 -      } else {
 26.1786 -        gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS);
 26.1787 -        return;
 26.1788 -      }
 26.1789 -    }
 26.1790 -    /* GDM */
 26.1791 -    if (memcmp (data, "GDM\xFE", 4) == 0) {
 26.1792 -      guint8 *data2 = gst_type_find_peek (tf, 71, 4);
 26.1793 -
 26.1794 -      if (data2) {
 26.1795 -        if (memcmp (data2, "GMFS", 4) == 0) {
 26.1796 -          gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1797 -          return;
 26.1798 -        }
 26.1799 -      } else {
 26.1800 -        gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS);
 26.1801 -        return;
 26.1802 -      }
 26.1803 -    }
 26.1804 -  }
 26.1805 -  /* IMF */
 26.1806 -  if ((data = gst_type_find_peek (tf, 60, 4)) != NULL) {
 26.1807 -    if (memcmp (data, "IM10", 4) == 0) {
 26.1808 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1809 -      return;
 26.1810 -    }
 26.1811 -  }
 26.1812 -  /* S3M */
 26.1813 -  if ((data = gst_type_find_peek (tf, 44, 4)) != NULL) {
 26.1814 -    if (memcmp (data, "SCRM", 4) == 0) {
 26.1815 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
 26.1816 -      return;
 26.1817 -    }
 26.1818 -  }
 26.1819 -}
 26.1820 -
 26.1821 -/*** application/x-shockwave-flash ***/
 26.1822 -
 26.1823 -static GstStaticCaps swf_caps =
 26.1824 -GST_STATIC_CAPS ("application/x-shockwave-flash");
 26.1825 -#define SWF_CAPS (gst_static_caps_get(&swf_caps))
 26.1826 -static void
 26.1827 -swf_type_find (GstTypeFind * tf, gpointer unused)
 26.1828 -{
 26.1829 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.1830 -
 26.1831 -  if (data && (data[0] == 'F' || data[0] == 'C') &&
 26.1832 -      data[1] == 'W' && data[2] == 'S') {
 26.1833 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SWF_CAPS);
 26.1834 -  }
 26.1835 -}
 26.1836 -
 26.1837 -/*** image/jpeg ***/
 26.1838 -
 26.1839 -static GstStaticCaps jpeg_caps = GST_STATIC_CAPS ("image/jpeg");
 26.1840 -
 26.1841 -#define JPEG_CAPS (gst_static_caps_get(&jpeg_caps))
 26.1842 -static void
 26.1843 -jpeg_type_find (GstTypeFind * tf, gpointer unused)
 26.1844 -{
 26.1845 -  guint8 *data = gst_type_find_peek (tf, 0, 10);
 26.1846 -  guint8 header[2] = { 0xFF, 0xD8 };
 26.1847 -
 26.1848 -  if (data && memcmp (data, header, 2) == 0) {
 26.1849 -    if (memcmp (data + 6, "JFIF", 4) == 0) {
 26.1850 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, JPEG_CAPS);
 26.1851 -    } else if (memcmp (data + 6, "Exif", 4) == 0) {
 26.1852 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, JPEG_CAPS);
 26.1853 -    } else {
 26.1854 -      gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, JPEG_CAPS);
 26.1855 -    }
 26.1856 -  }
 26.1857 -}
 26.1858 -
 26.1859 -/*** image/bmp ***/
 26.1860 -
 26.1861 -static GstStaticCaps bmp_caps = GST_STATIC_CAPS ("image/bmp");
 26.1862 -
 26.1863 -#define BMP_CAPS (gst_static_caps_get(&bmp_caps))
 26.1864 -static void
 26.1865 -bmp_type_find (GstTypeFind * tf, gpointer unused)
 26.1866 -{
 26.1867 -  guint8 *data = gst_type_find_peek (tf, 0, 18);
 26.1868 -
 26.1869 -  if (data && memcmp (data, "BM", 2) == 0) {
 26.1870 -    if ((data[14] == 0x0C ||
 26.1871 -            data[14] == 0x28 ||
 26.1872 -            data[14] == 0xF0) &&
 26.1873 -        data[15] == 0 && data[16] == 0 && data[17] == 0) {
 26.1874 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, BMP_CAPS);
 26.1875 -    }
 26.1876 -  }
 26.1877 -}
 26.1878 -
 26.1879 -/*** image/tiff ***/
 26.1880 -static GstStaticCaps tiff_caps = GST_STATIC_CAPS ("image/tiff, "
 26.1881 -    "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }");
 26.1882 -#define TIFF_CAPS (gst_static_caps_get(&tiff_caps))
 26.1883 -static GstStaticCaps tiff_be_caps = GST_STATIC_CAPS ("image/tiff, "
 26.1884 -    "endianness = (int) BIG_ENDIAN");
 26.1885 -#define TIFF_BE_CAPS (gst_static_caps_get(&tiff_be_caps))
 26.1886 -static GstStaticCaps tiff_le_caps = GST_STATIC_CAPS ("image/tiff, "
 26.1887 -    "endianness = (int) LITTLE_ENDIAN");
 26.1888 -#define TIFF_LE_CAPS (gst_static_caps_get(&tiff_le_caps))
 26.1889 -static void
 26.1890 -tiff_type_find (GstTypeFind * tf, gpointer ununsed)
 26.1891 -{
 26.1892 -  guint8 *data = gst_type_find_peek (tf, 0, 8);
 26.1893 -  guint8 le_header[4] = { 0x49, 0x49, 0x2A, 0x00 };
 26.1894 -  guint8 be_header[4] = { 0x4D, 0x4D, 0x00, 0x2A };
 26.1895 -
 26.1896 -  if (data) {
 26.1897 -    if (memcmp (data, le_header, 4) == 0) {
 26.1898 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, TIFF_LE_CAPS);
 26.1899 -    } else if (memcmp (data, be_header, 4) == 0) {
 26.1900 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, TIFF_BE_CAPS);
 26.1901 -    }
 26.1902 -  }
 26.1903 -}
 26.1904 -
 26.1905 -static GstStaticCaps sds_caps = GST_STATIC_CAPS ("audio/x-sds");
 26.1906 -
 26.1907 -#define SDS_CAPS (gst_static_caps_get(&sds_caps))
 26.1908 -static void
 26.1909 -sds_type_find (GstTypeFind * tf, gpointer ununsed)
 26.1910 -{
 26.1911 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.1912 -  guint8 mask[4] = { 0xFF, 0xFF, 0x80, 0xFF };
 26.1913 -  guint8 match[4] = { 0xF0, 0x7E, 0, 0x01 };
 26.1914 -  gint x;
 26.1915 -
 26.1916 -  if (data) {
 26.1917 -    for (x = 0; x < 4; x++) {
 26.1918 -      if ((data[x] & mask[x]) != match[x]) {
 26.1919 -        return;
 26.1920 -      }
 26.1921 -    }
 26.1922 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SDS_CAPS);
 26.1923 -  }
 26.1924 -}
 26.1925 -
 26.1926 -static GstStaticCaps ircam_caps = GST_STATIC_CAPS ("audio/x-ircam");
 26.1927 -
 26.1928 -#define IRCAM_CAPS (gst_static_caps_get(&ircam_caps))
 26.1929 -static void
 26.1930 -ircam_type_find (GstTypeFind * tf, gpointer ununsed)
 26.1931 -{
 26.1932 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.1933 -  guint8 mask[4] = { 0xFF, 0xFF, 0xF8, 0xFF };
 26.1934 -  guint8 match[4] = { 0x64, 0xA3, 0x00, 0x00 };
 26.1935 -  gint x;
 26.1936 -  gboolean matched = TRUE;
 26.1937 -
 26.1938 -  if (!data) {
 26.1939 -    return;
 26.1940 -  }
 26.1941 -  for (x = 0; x < 4; x++) {
 26.1942 -    if ((data[x] & mask[x]) != match[x]) {
 26.1943 -      matched = FALSE;
 26.1944 -    }
 26.1945 -  }
 26.1946 -  if (matched) {
 26.1947 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, IRCAM_CAPS);
 26.1948 -    return;
 26.1949 -  }
 26.1950 -  /* now try the reverse version */
 26.1951 -  matched = TRUE;
 26.1952 -  for (x = 0; x < 4; x++) {
 26.1953 -    if ((data[x] & mask[3 - x]) != match[3 - x]) {
 26.1954 -      matched = FALSE;
 26.1955 -    }
 26.1956 -  }
 26.1957 -}
 26.1958 -
 26.1959 -
 26.1960 -/*** video/x-matroska ***/
 26.1961 -static GstStaticCaps matroska_caps = GST_STATIC_CAPS ("video/x-matroska");
 26.1962 -
 26.1963 -#define MATROSKA_CAPS (gst_static_caps_get(&matroska_caps))
 26.1964 -static void
 26.1965 -matroska_type_find (GstTypeFind * tf, gpointer ununsed)
 26.1966 -{
 26.1967 -  /* 4 bytes for EBML ID, 1 byte for header length identifier */
 26.1968 -  guint8 *data = gst_type_find_peek (tf, 0, 4 + 1);
 26.1969 -  gint len_mask = 0x80, size = 1, n = 1, total;
 26.1970 -  guint8 probe_data[] = { 'm', 'a', 't', 'r', 'o', 's', 'k', 'a' };
 26.1971 -
 26.1972 -  if (!data)
 26.1973 -    return;
 26.1974 -
 26.1975 -  /* ebml header? */
 26.1976 -  if (data[0] != 0x1A || data[1] != 0x45 || data[2] != 0xDF || data[3] != 0xA3)
 26.1977 -    return;
 26.1978 -
 26.1979 -  /* length of header */
 26.1980 -  total = data[4];
 26.1981 -  while (size <= 8 && !(total & len_mask)) {
 26.1982 -    size++;
 26.1983 -    len_mask >>= 1;
 26.1984 -  }
 26.1985 -  if (size > 8)
 26.1986 -    return;
 26.1987 -  total &= (len_mask - 1);
 26.1988 -  while (n < size)
 26.1989 -    total = (total << 8) | data[4 + n++];
 26.1990 -
 26.1991 -  /* get new data for full header, 4 bytes for EBML ID,
 26.1992 -   * EBML length tag and the actual header */
 26.1993 -  data = gst_type_find_peek (tf, 0, 4 + size + total);
 26.1994 -  if (!data)
 26.1995 -    return;
 26.1996 -
 26.1997 -  /* the header must contain the document type 'matroska'. For now,
 26.1998 -   * we don't parse the whole header but simply check for the
 26.1999 -   * availability of that array of characters inside the header.
 26.2000 -   * Not fully fool-proof, but good enough. */
 26.2001 -  for (n = 4 + size; n <= 4 + size + total - sizeof (probe_data); n++)
 26.2002 -    if (!memcmp (&data[n], probe_data, sizeof (probe_data))) {
 26.2003 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MATROSKA_CAPS);
 26.2004 -      break;
 26.2005 -    }
 26.2006 -}
 26.2007 -
 26.2008 -/*** video/x-dv ***/
 26.2009 -
 26.2010 -static GstStaticCaps dv_caps = GST_STATIC_CAPS ("video/x-dv, "
 26.2011 -    "systemstream = (boolean) true");
 26.2012 -#define DV_CAPS (gst_static_caps_get(&dv_caps))
 26.2013 -static void
 26.2014 -dv_type_find (GstTypeFind * tf, gpointer private)
 26.2015 -{
 26.2016 -  guint8 *data;
 26.2017 -
 26.2018 -  data = gst_type_find_peek (tf, 0, 5);
 26.2019 -
 26.2020 -  /* check for DIF  and DV flag */
 26.2021 -  if (data && (data[0] == 0x1f) && (data[1] == 0x07) && (data[2] == 0x00) &&
 26.2022 -      ((data[4] & 0x01) == 0)) {
 26.2023 -    gchar *format;
 26.2024 -    GstCaps *caps = gst_caps_copy (DV_CAPS);
 26.2025 -
 26.2026 -    if (data[3] & 0x80) {
 26.2027 -      format = "PAL";
 26.2028 -    } else {
 26.2029 -      format = "NTSC";
 26.2030 -    }
 26.2031 -    gst_structure_set (gst_caps_get_structure (caps, 0), "format",
 26.2032 -        G_TYPE_STRING, format, NULL);
 26.2033 -
 26.2034 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps);
 26.2035 -    gst_caps_unref (caps);
 26.2036 -  }
 26.2037 -}
 26.2038 -
 26.2039 -
 26.2040 -/*** application/ogg and application/x-annodex ***/
 26.2041 -static GstStaticCaps ogg_caps = GST_STATIC_CAPS ("application/ogg");
 26.2042 -static GstStaticCaps annodex_caps = GST_STATIC_CAPS ("application/x-annodex");
 26.2043 -
 26.2044 -#define OGGANX_CAPS (gst_static_caps_get(&annodex_caps))
 26.2045 -
 26.2046 -static void
 26.2047 -ogganx_type_find (GstTypeFind * tf, gpointer private)
 26.2048 -{
 26.2049 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.2050 -
 26.2051 -  if ((data != NULL) && (memcmp (data, "OggS", 4) == 0)) {
 26.2052 -
 26.2053 -    /* Check for an annodex fishbone header */
 26.2054 -    data = gst_type_find_peek (tf, 28, 8);
 26.2055 -    if (data && memcmp (data, "fishead\0", 8) == 0)
 26.2056 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGGANX_CAPS);
 26.2057 -
 26.2058 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM,
 26.2059 -        gst_static_caps_get (&ogg_caps));
 26.2060 -  }
 26.2061 -}
 26.2062 -
 26.2063 -/*** audio/x-vorbis ***/
 26.2064 -static GstStaticCaps vorbis_caps = GST_STATIC_CAPS ("audio/x-vorbis");
 26.2065 -
 26.2066 -#define VORBIS_CAPS (gst_static_caps_get(&vorbis_caps))
 26.2067 -static void
 26.2068 -vorbis_type_find (GstTypeFind * tf, gpointer private)
 26.2069 -{
 26.2070 -  guint8 *data = gst_type_find_peek (tf, 0, 30);
 26.2071 -
 26.2072 -  if (data) {
 26.2073 -    guint blocksize_0;
 26.2074 -    guint blocksize_1;
 26.2075 -
 26.2076 -    /* 1 byte packet type (identification=0x01)
 26.2077 -       6 byte string "vorbis"
 26.2078 -       4 byte vorbis version */
 26.2079 -    if (memcmp (data, "\001vorbis\000\000\000\000", 11) != 0)
 26.2080 -      return;
 26.2081 -    data += 11;
 26.2082 -    /* 1 byte channels must be != 0 */
 26.2083 -    if (data[0] == 0)
 26.2084 -      return;
 26.2085 -    data++;
 26.2086 -    /* 4 byte samplerate must be != 0 */
 26.2087 -    if (*((guint32 *) data) == 0)
 26.2088 -      return;
 26.2089 -    data += 16;
 26.2090 -    /* blocksize checks */
 26.2091 -    blocksize_0 = data[0] & 0x0F;
 26.2092 -    blocksize_1 = (data[0] & 0xF0) >> 4;
 26.2093 -    if (blocksize_0 > blocksize_1)
 26.2094 -      return;
 26.2095 -    if (blocksize_0 < 6 || blocksize_0 > 13)
 26.2096 -      return;
 26.2097 -    if (blocksize_1 < 6 || blocksize_1 > 13)
 26.2098 -      return;
 26.2099 -    data++;
 26.2100 -    /* framing bit */
 26.2101 -    if ((data[0] & 0x01) != 1)
 26.2102 -      return;
 26.2103 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, VORBIS_CAPS);
 26.2104 -  }
 26.2105 -}
 26.2106 -
 26.2107 -/*** video/x-theora ***/
 26.2108 -
 26.2109 -static GstStaticCaps theora_caps = GST_STATIC_CAPS ("video/x-theora");
 26.2110 -
 26.2111 -#define THEORA_CAPS (gst_static_caps_get(&theora_caps))
 26.2112 -static void
 26.2113 -theora_type_find (GstTypeFind * tf, gpointer private)
 26.2114 -{
 26.2115 -  guint8 *data = gst_type_find_peek (tf, 0, 7); //42);
 26.2116 -
 26.2117 -  if (data) {
 26.2118 -    if (data[0] != 0x80)
 26.2119 -      return;
 26.2120 -    if (memcmp (&data[1], "theora", 6) != 0)
 26.2121 -      return;
 26.2122 -    /* FIXME: make this more reliable when specs are out */
 26.2123 -
 26.2124 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, THEORA_CAPS);
 26.2125 -  }
 26.2126 -}
 26.2127 -
 26.2128 -/*** application/x-ogm-video or audio***/
 26.2129 -
 26.2130 -static GstStaticCaps ogmvideo_caps =
 26.2131 -GST_STATIC_CAPS ("application/x-ogm-video");
 26.2132 -#define OGMVIDEO_CAPS (gst_static_caps_get(&ogmvideo_caps))
 26.2133 -static void
 26.2134 -ogmvideo_type_find (GstTypeFind * tf, gpointer private)
 26.2135 -{
 26.2136 -  guint8 *data = gst_type_find_peek (tf, 0, 9);
 26.2137 -
 26.2138 -  if (data) {
 26.2139 -    if (memcmp (data, "\001video\000\000\000", 9) != 0)
 26.2140 -      return;
 26.2141 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGMVIDEO_CAPS);
 26.2142 -  }
 26.2143 -}
 26.2144 -
 26.2145 -static GstStaticCaps ogmaudio_caps =
 26.2146 -GST_STATIC_CAPS ("application/x-ogm-audio");
 26.2147 -#define OGMAUDIO_CAPS (gst_static_caps_get(&ogmaudio_caps))
 26.2148 -static void
 26.2149 -ogmaudio_type_find (GstTypeFind * tf, gpointer private)
 26.2150 -{
 26.2151 -  guint8 *data = gst_type_find_peek (tf, 0, 9);
 26.2152 -
 26.2153 -  if (data) {
 26.2154 -    if (memcmp (data, "\001audio\000\000\000", 9) != 0)
 26.2155 -      return;
 26.2156 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGMAUDIO_CAPS);
 26.2157 -  }
 26.2158 -}
 26.2159 -
 26.2160 -static GstStaticCaps ogmtext_caps = GST_STATIC_CAPS ("application/x-ogm-text");
 26.2161 -
 26.2162 -#define OGMTEXT_CAPS (gst_static_caps_get(&ogmtext_caps))
 26.2163 -static void
 26.2164 -ogmtext_type_find (GstTypeFind * tf, gpointer private)
 26.2165 -{
 26.2166 -  guint8 *data = gst_type_find_peek (tf, 0, 9);
 26.2167 -
 26.2168 -  if (data) {
 26.2169 -    if (memcmp (data, "\001text\000\000\000\000", 9) != 0)
 26.2170 -      return;
 26.2171 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGMTEXT_CAPS);
 26.2172 -  }
 26.2173 -}
 26.2174 -
 26.2175 -/*** audio/x-speex ***/
 26.2176 -
 26.2177 -static GstStaticCaps speex_caps = GST_STATIC_CAPS ("audio/x-speex");
 26.2178 -
 26.2179 -#define SPEEX_CAPS (gst_static_caps_get(&speex_caps))
 26.2180 -static void
 26.2181 -speex_type_find (GstTypeFind * tf, gpointer private)
 26.2182 -{
 26.2183 -  guint8 *data = gst_type_find_peek (tf, 0, 80);
 26.2184 -
 26.2185 -  if (data) {
 26.2186 -    /* 8 byte string "Speex   "
 26.2187 -       24 byte speex version string + int */
 26.2188 -    if (memcmp (data, "Speex   ", 8) != 0)
 26.2189 -      return;
 26.2190 -    data += 32;
 26.2191 -
 26.2192 -    /* 4 byte header size >= 80 */
 26.2193 -    if (GST_READ_UINT32_LE (data) < 80)
 26.2194 -      return;
 26.2195 -    data += 4;
 26.2196 -
 26.2197 -    /* 4 byte sample rate <= 48000 */
 26.2198 -    if (GST_READ_UINT32_LE (data) > 48000)
 26.2199 -      return;
 26.2200 -    data += 4;
 26.2201 -
 26.2202 -    /* currently there are only 3 speex modes. */
 26.2203 -    if (GST_READ_UINT32_LE (data) > 3)
 26.2204 -      return;
 26.2205 -    data += 12;
 26.2206 -
 26.2207 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SPEEX_CAPS);
 26.2208 -  }
 26.2209 -}
 26.2210 -
 26.2211 -/*** application/x-ogg-skeleton ***/
 26.2212 -static GstStaticCaps ogg_skeleton_caps =
 26.2213 -GST_STATIC_CAPS ("application/x-ogg-skeleton, parsed=(boolean)FALSE");
 26.2214 -#define OGG_SKELETON_CAPS (gst_static_caps_get(&ogg_skeleton_caps))
 26.2215 -static void
 26.2216 -oggskel_type_find (GstTypeFind * tf, gpointer private)
 26.2217 -{
 26.2218 -  guint8 *data = gst_type_find_peek (tf, 0, 12);
 26.2219 -
 26.2220 -  if (data) {
 26.2221 -    /* 8 byte string "fishead\0" for the ogg skeleton stream */
 26.2222 -    if (memcmp (data, "fishead\0", 8) != 0)
 26.2223 -      return;
 26.2224 -    data += 8;
 26.2225 -
 26.2226 -    /* Require that the header contains version 3.0 */
 26.2227 -    if (GST_READ_UINT16_LE (data) != 3)
 26.2228 -      return;
 26.2229 -    data += 2;
 26.2230 -    if (GST_READ_UINT16_LE (data) != 0)
 26.2231 -      return;
 26.2232 -
 26.2233 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGG_SKELETON_CAPS);
 26.2234 -  }
 26.2235 -}
 26.2236 -
 26.2237 -static GstStaticCaps cmml_caps = GST_STATIC_CAPS ("text/x-cmml");
 26.2238 -
 26.2239 -#define CMML_CAPS (gst_static_caps_get(&cmml_caps))
 26.2240 -static void
 26.2241 -cmml_type_find (GstTypeFind * tf, gpointer private)
 26.2242 -{
 26.2243 -  /* Header is 12 bytes minimum (though we don't check the minor version */
 26.2244 -  guint8 *data = gst_type_find_peek (tf, 0, 12);
 26.2245 -
 26.2246 -  if (data) {
 26.2247 -
 26.2248 -    /* 8 byte string "CMML\0\0\0\0" for the magic number */
 26.2249 -    if (memcmp (data, "CMML\0\0\0\0", 8) != 0)
 26.2250 -      return;
 26.2251 -    data += 8;
 26.2252 -
 26.2253 -    /* Require that the header contains at least version 2.0 */
 26.2254 -    if (GST_READ_UINT16_LE (data) < 2)
 26.2255 -      return;
 26.2256 -
 26.2257 -    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, CMML_CAPS);
 26.2258 -  }
 26.2259 -}
 26.2260 -
 26.2261 -/*** application/x-tar ***/
 26.2262 -
 26.2263 -static GstStaticCaps tar_caps = GST_STATIC_CAPS ("application/x-tar");
 26.2264 -
 26.2265 -#define TAR_CAPS (gst_static_caps_get(&tar_caps))
 26.2266 -#define OLDGNU_MAGIC "ustar  "  /* 7 chars and a NUL */
 26.2267 -#define NEWGNU_MAGIC "ustar"    /* 5 chars and a NUL */
 26.2268 -static void
 26.2269 -tar_type_find (GstTypeFind * tf, gpointer unused)
 26.2270 -{
 26.2271 -  guint8 *data = gst_type_find_peek (tf, 257, 8);
 26.2272 -
 26.2273 -  /* of course we are not certain, but we don't want other typefind funcs
 26.2274 -   * to detect formats of files within the tar archive, e.g. mp3s */
 26.2275 -  if (data) {
 26.2276 -    if (memcmp (data, OLDGNU_MAGIC, 8) == 0) {  /* sic */
 26.2277 -      gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, TAR_CAPS);
 26.2278 -    } else if (memcmp (data, NEWGNU_MAGIC, 6) == 0 &&   /* sic */
 26.2279 -        g_ascii_isdigit (data[6]) && g_ascii_isdigit (data[7])) {
 26.2280 -      gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, TAR_CAPS);
 26.2281 -    }
 26.2282 -  }
 26.2283 -}
 26.2284 -
 26.2285 -/*** application/x-ar ***/
 26.2286 -
 26.2287 -static GstStaticCaps ar_caps = GST_STATIC_CAPS ("application/x-ar");
 26.2288 -
 26.2289 -#define AR_CAPS (gst_static_caps_get(&ar_caps))
 26.2290 -static void
 26.2291 -ar_type_find (GstTypeFind * tf, gpointer unused)
 26.2292 -{
 26.2293 -  guint8 *data = gst_type_find_peek (tf, 0, 24);
 26.2294 -
 26.2295 -  if (data && memcmp (data, "!<arch>", 7) == 0) {
 26.2296 -    gint i;
 26.2297 -
 26.2298 -    for (i = 7; i < 24; ++i) {
 26.2299 -      if (!g_ascii_isprint (data[i]) && data[i] != '\n') {
 26.2300 -        gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, AR_CAPS);
 26.2301 -      }
 26.2302 -    }
 26.2303 -
 26.2304 -    gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, AR_CAPS);
 26.2305 -  }
 26.2306 -}
 26.2307 -
 26.2308 -/*** audio/x-au ***/
 26.2309 -
 26.2310 -/* NOTE: we cannot replace this function with TYPE_FIND_REGISTER_START_WITH,
 26.2311 - * as it is only possible to register one typefind factory per 'name'
 26.2312 - * (which is in this case the caps), and the first one would be replaced by
 26.2313 - * the second one. */
 26.2314 -static GstStaticCaps au_caps = GST_STATIC_CAPS ("audio/x-au");
 26.2315 -
 26.2316 -#define AU_CAPS (gst_static_caps_get(&au_caps))
 26.2317 -static void
 26.2318 -au_type_find (GstTypeFind * tf, gpointer unused)
 26.2319 -{
 26.2320 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.2321 -
 26.2322 -  if (data) {
 26.2323 -    if (memcmp (data, ".snd", 4) == 0 || memcmp (data, "dns.", 4) == 0) {
 26.2324 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, AU_CAPS);
 26.2325 -    }
 26.2326 -  }
 26.2327 -}
 26.2328 -
 26.2329 -
 26.2330 -/*** video/x-nuv ***/
 26.2331 -
 26.2332 -/* NOTE: we cannot replace this function with TYPE_FIND_REGISTER_START_WITH,
 26.2333 - * as it is only possible to register one typefind factory per 'name'
 26.2334 - * (which is in this case the caps), and the first one would be replaced by
 26.2335 - * the second one. */
 26.2336 -static GstStaticCaps nuv_caps = GST_STATIC_CAPS ("video/x-nuv");
 26.2337 -
 26.2338 -#define NUV_CAPS (gst_static_caps_get(&nuv_caps))
 26.2339 -static void
 26.2340 -nuv_type_find (GstTypeFind * tf, gpointer unused)
 26.2341 -{
 26.2342 -  guint8 *data = gst_type_find_peek (tf, 0, 11);
 26.2343 -
 26.2344 -  if (data) {
 26.2345 -    if (memcmp (data, "MythTVVideo", 11) == 0
 26.2346 -        || memcmp (data, "NuppelVideo", 11) == 0) {
 26.2347 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, NUV_CAPS);
 26.2348 -    }
 26.2349 -  }
 26.2350 -}
 26.2351 -
 26.2352 -/*** audio/x-paris ***/
 26.2353 -/* NOTE: do not replace this function with two TYPE_FIND_REGISTER_START_WITH */
 26.2354 -static GstStaticCaps paris_caps = GST_STATIC_CAPS ("audio/x-paris");
 26.2355 -
 26.2356 -#define PARIS_CAPS (gst_static_caps_get(&paris_caps))
 26.2357 -static void
 26.2358 -paris_type_find (GstTypeFind * tf, gpointer unused)
 26.2359 -{
 26.2360 -  guint8 *data = gst_type_find_peek (tf, 0, 4);
 26.2361 -
 26.2362 -  if (data) {
 26.2363 -    if (memcmp (data, " paf", 4) == 0 || memcmp (data, "fap ", 4) == 0) {
 26.2364 -      gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, PARIS_CAPS);
 26.2365 -    }
 26.2366 -  }
 26.2367 -}
 26.2368 -
 26.2369 -/*** audio/iLBC-sh ***/
 26.2370 -/* NOTE: do not replace this function with two TYPE_FIND_REGISTER_START_WITH */
 26.2371 -static GstStaticCaps ilbc_caps = GST_STATIC_CAPS ("audio/iLBC-sh");
 26.2372 -
 26.2373 -#define ILBC_CAPS (gst_static_caps_get(&ilbc_caps))
 26.2374 -static void
 26.2375 -ilbc_type_find (GstTypeFind * tf, gpointer unused)
 26.2376 -{
 26.2377 -  guint8 *data = gst_type_find_peek (tf, 0, 8);
 26.2378 -
 26.2379 -  if (data) {
 26.2380 -    if (memcmp (data, "#!iLBC30", 8) == 0 || memcmp (data, "#!iLBC20", 8) == 0) {
 26.2381 -      gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, ILBC_CAPS);
 26.2382 -    }
 26.2383 -  }
 26.2384 -}
 26.2385 -
 26.2386 -/*** application/x-ms-dos-executable ***/
 26.2387 -
 26.2388 -static GstStaticCaps msdos_caps =
 26.2389 -GST_STATIC_CAPS ("application/x-ms-dos-executable");
 26.2390 -#define MSDOS_CAPS (gst_static_caps_get(&msdos_caps))
 26.2391 -/* see http://www.madchat.org/vxdevl/papers/winsys/pefile/pefile.htm */
 26.2392 -static void
 26.2393 -msdos_type_find (GstTypeFind * tf, gpointer unused)
 26.2394 -{
 26.2395 -  guint8 *data = gst_type_find_peek (tf, 0, 64);
 26.2396 -
 26.2397 -  if (data && data[0] == 'M' && data[1] == 'Z' &&
 26.2398 -      GST_READ_UINT16_LE (data + 8) == 4) {
 26.2399 -    guint32 pe_offset = GST_READ_UINT32_LE (data + 60);
 26.2400 -
 26.2401 -    data = gst_type_find_peek (tf, pe_offset, 2);
 26.2402 -    if (data && data[0] == 'P' && data[1] == 'E') {
 26.2403 -      gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, MSDOS_CAPS);
 26.2404 -    }
 26.2405 -  }
 26.2406 -}
 26.2407 -
 26.2408 -/*** application/x-mmsh ***/
 26.2409 -
 26.2410 -static GstStaticCaps mmsh_caps = GST_STATIC_CAPS ("application/x-mmsh");
 26.2411 -
 26.2412 -#define MMSH_CAPS gst_static_caps_get(&mmsh_caps)
 26.2413 -
 26.2414 -/* This is to recognise mssh-over-http */
 26.2415 -static void
 26.2416 -mmsh_type_find (GstTypeFind * tf, gpointer unused)
 26.2417 -{
 26.2418 -  static const guint8 asf_marker[16] = { 0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66,
 26.2419 -    0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
 26.2420 -  };
 26.2421 -
 26.2422 -  guint8 *data;
 26.2423 -
 26.2424 -  data = gst_type_find_peek (tf, 0, 2 + 2 + 4 + 2 + 2 + 16);
 26.2425 -  if (data && data[0] == 0x24 && data[1] == 0x48 &&
 26.2426 -      GST_READ_UINT16_LE (data + 2) > 2 + 2 + 4 + 2 + 2 + 16 &&
 26.2427 -      memcmp (data + 2 + 2 + 4 + 2 + 2, asf_marker, 16) == 0) {
 26.2428 -    GstCaps *caps = gst_caps_copy (MMSH_CAPS);
 26.2429 -
 26.2430 -    gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, caps);
 26.2431 -    gst_caps_unref (caps);
 26.2432 -    return;
 26.2433 -  }
 26.2434 -}
 26.2435 -
 26.2436 -/*** generic typefind for streams that have some data at a specific position***/
 26.2437 -typedef struct
 26.2438 -{
 26.2439 -  const guint8 *data;
 26.2440 -  guint size;
 26.2441 -  guint probability;
 26.2442 -  GstCaps *caps;
 26.2443 -}
 26.2444 -GstTypeFindData;
 26.2445 -
 26.2446 -static void
 26.2447 -start_with_type_find (GstTypeFind * tf, gpointer private)
 26.2448 -{
 26.2449 -  GstTypeFindData *start_with = (GstTypeFindData *) private;
 26.2450 -  guint8 *data;
 26.2451 -
 26.2452 -  GST_LOG ("trying to find mime type %s with the first %u bytes of data",
 26.2453 -      gst_structure_get_name (gst_caps_get_structure (start_with->caps, 0)),
 26.2454 -      start_with->size);
 26.2455 -  data = gst_type_find_peek (tf, 0, start_with->size);
 26.2456 -  if (data && memcmp (data, start_with->data, start_with->size) == 0) {
 26.2457 -    gst_type_find_suggest (tf, start_with->probability, start_with->caps);
 26.2458 -  }
 26.2459 -}
 26.2460 -
 26.2461 -static void
 26.2462 -sw_data_destroy (GstTypeFindData * sw_data)
 26.2463 -{
 26.2464 -  if (G_LIKELY (sw_data->caps != NULL))
 26.2465 -    gst_caps_unref (sw_data->caps);
 26.2466 -  g_free (sw_data);
 26.2467 -}
 26.2468 -
 26.2469 -#define TYPE_FIND_REGISTER_START_WITH(plugin,name,rank,ext,_data,_size,_probability)\
 26.2470 -G_BEGIN_DECLS{                                                          \
 26.2471 -  GstTypeFindData *sw_data = g_new (GstTypeFindData, 1);                \
 26.2472 -  sw_data->data = (const guint8 *)_data;                                \
 26.2473 -  sw_data->size = _size;                                                \
 26.2474 -  sw_data->probability = _probability;                                  \
 26.2475 -  sw_data->caps = gst_caps_new_simple (name, NULL);                     \
 26.2476 -  if (!gst_type_find_register (plugin, name, rank, start_with_type_find,\
 26.2477 -                      ext, sw_data->caps, sw_data,                      \
 26.2478 -                     (GDestroyNotify) (sw_data_destroy))) {             \
 26.2479 -    gst_caps_unref (sw_data->caps);                                     \
 26.2480 -    g_free (sw_data);                                                   \
 26.2481 -  }                                                                     \
 26.2482 -}G_END_DECLS
 26.2483 -
 26.2484 -/*** same for riff types ***/
 26.2485 -
 26.2486 -static void
 26.2487 -riff_type_find (GstTypeFind * tf, gpointer private)
 26.2488 -{
 26.2489 -  GstTypeFindData *riff_data = (GstTypeFindData *) private;
 26.2490 -  guint8 *data = gst_type_find_peek (tf, 0, 12);
 26.2491 -
 26.2492 -  if (data && memcmp (data, "RIFF", 4) == 0) {
 26.2493 -    data += 8;
 26.2494 -    if (memcmp (data, riff_data->data, 4) == 0)
 26.2495 -      gst_type_find_suggest (tf, riff_data->probability, riff_data->caps);
 26.2496 -  }
 26.2497 -}
 26.2498 -
 26.2499 -#define TYPE_FIND_REGISTER_RIFF(plugin,name,rank,ext,_data)             \
 26.2500 -G_BEGIN_DECLS{                                                          \
 26.2501 -  GstTypeFindData *sw_data = g_new (GstTypeFindData, 1);                \
 26.2502 -  sw_data->data = (gpointer)_data;                                      \
 26.2503 -  sw_data->size = 4;                                                    \
 26.2504 -  sw_data->probability = GST_TYPE_FIND_MAXIMUM;                         \
 26.2505 -  sw_data->caps = gst_caps_new_simple (name, NULL);                     \
 26.2506 -  if (!gst_type_find_register (plugin, name, rank, riff_type_find,      \
 26.2507 -                      ext, sw_data->caps, sw_data,                      \
 26.2508 -                      (GDestroyNotify) (sw_data_destroy))) {            \
 26.2509 -    gst_caps_unref (sw_data->caps);                                     \
 26.2510 -    g_free (sw_data);                                                   \
 26.2511 -  }                                                                     \
 26.2512 -}G_END_DECLS
 26.2513 -
 26.2514 -
 26.2515 -
 26.2516 -/*** plugin initialization ***/
 26.2517 -
 26.2518 -#define TYPE_FIND_REGISTER(plugin,name,rank,func,ext,caps,priv,notify) \
 26.2519 -G_BEGIN_DECLS{\
 26.2520 -  if (!gst_type_find_register (plugin, name, rank, func, ext, caps, priv, notify))\
 26.2521 -    return FALSE; \
 26.2522 -}G_END_DECLS
 26.2523 -static gboolean
 26.2524 -plugin_init (GstPlugin * plugin)
 26.2525 -{
 26.2526 -  /* can't initialize this via a struct as caps can't be statically initialized */
 26.2527 -
 26.2528 -  /* note: asx/wax/wmx are XML files, asf doesn't handle them */
 26.2529 -  /* FIXME-0.11: these should be const,
 26.2530 -     this requires gstreamer/gst/gsttypefind::gst_type_find_register()
 26.2531 -     to have define the parameter as const
 26.2532 -   */
 26.2533 -  static gchar *asf_exts[] = { "asf", "wm", "wma", "wmv", NULL };
 26.2534 -  static gchar *au_exts[] = { "au", "snd", NULL };
 26.2535 -  static gchar *avi_exts[] = { "avi", NULL };
 26.2536 -  static gchar *cdxa_exts[] = { "dat", NULL };
 26.2537 -  static gchar *flac_exts[] = { "flac", NULL };
 26.2538 -  static gchar *flx_exts[] = { "flc", "fli", NULL };
 26.2539 -  static gchar *id3_exts[] =
 26.2540 -      { "mp3", "mp2", "mp1", "mpga", "ogg", "flac", "tta", NULL };
 26.2541 -  static gchar *apetag_exts[] = { "ape", "mpc", "wv", NULL };   /* and mp3 and wav? */
 26.2542 -  static gchar *tta_exts[] = { "tta", NULL };
 26.2543 -  static gchar *mod_exts[] = { "669", "amf", "dsm", "gdm", "far", "imf",
 26.2544 -    "it", "med", "mod", "mtm", "okt", "sam",
 26.2545 -    "s3m", "stm", "stx", "ult", "xm", NULL
 26.2546 -  };
 26.2547 -  static gchar *mp3_exts[] = { "mp3", "mp2", "mp1", "mpga", NULL };
 26.2548 -  static gchar *ac3_exts[] = { "ac3", NULL };
 26.2549 -  static gchar *musepack_exts[] = { "mpc", NULL };
 26.2550 -  static gchar *mpeg_sys_exts[] = { "mpe", "mpeg", "mpg", NULL };
 26.2551 -  static gchar *mpeg_video_exts[] = { "mpv", "mpeg", "mpg", NULL };
 26.2552 -  static gchar *mpeg_ts_exts[] = { "ts", NULL };
 26.2553 -  static gchar *ogg_exts[] = { "anx", "ogg", "ogm", NULL };
 26.2554 -  static gchar *qt_exts[] = { "mov", NULL };
 26.2555 -  static gchar *qtif_exts[] = { "qif", "qtif", "qti", NULL };
 26.2556 -  static gchar *rm_exts[] = { "ra", "ram", "rm", "rmvb", NULL };
 26.2557 -  static gchar *swf_exts[] = { "swf", "swfl", NULL };
 26.2558 -  static gchar *utf8_exts[] = { "txt", NULL };
 26.2559 -  static gchar *wav_exts[] = { "wav", NULL };
 26.2560 -  static gchar *aiff_exts[] = { "aiff", "aif", "aifc", NULL };
 26.2561 -  static gchar *svx_exts[] = { "iff", "svx", NULL };
 26.2562 -  static gchar *paris_exts[] = { "paf", NULL };
 26.2563 -  static gchar *nist_exts[] = { "nist", NULL };
 26.2564 -  static gchar *voc_exts[] = { "voc", NULL };
 26.2565 -  static gchar *sds_exts[] = { "sds", NULL };
 26.2566 -  static gchar *ircam_exts[] = { "sf", NULL };
 26.2567 -  static gchar *w64_exts[] = { "w64", NULL };
 26.2568 -  static gchar *shn_exts[] = { "shn", NULL };
 26.2569 -  static gchar *ape_exts[] = { "ape", NULL };
 26.2570 -  static gchar *uri_exts[] = { "ram", NULL };
 26.2571 -  static gchar *smil_exts[] = { "smil", NULL };
 26.2572 -  static gchar *html_exts[] = { "htm", "html", NULL };
 26.2573 -  static gchar *xml_exts[] = { "xml", NULL };
 26.2574 -  static gchar *jpeg_exts[] = { "jpg", "jpe", "jpeg", NULL };
 26.2575 -  static gchar *gif_exts[] = { "gif", NULL };
 26.2576 -  static gchar *png_exts[] = { "png", NULL };
 26.2577 -  static gchar *bmp_exts[] = { "bmp", NULL };
 26.2578 -  static gchar *tiff_exts[] = { "tif", "tiff", NULL };
 26.2579 -  static gchar *matroska_exts[] = { "mkv", "mka", NULL };
 26.2580 -  static gchar *mve_exts[] = { "mve", NULL };
 26.2581 -  static gchar *dv_exts[] = { "dv", "dif", NULL };
 26.2582 -  static gchar *amr_exts[] = { "amr", NULL };
 26.2583 -  static gchar *ilbc_exts[] = { "ilbc", NULL };
 26.2584 -  static gchar *sid_exts[] = { "sid", NULL };
 26.2585 -  static gchar *xcf_exts[] = { "xcf", NULL };
 26.2586 -  static gchar *mng_exts[] = { "mng", NULL };
 26.2587 -  static gchar *jng_exts[] = { "jng", NULL };
 26.2588 -  static gchar *xpm_exts[] = { "xpm", NULL };
 26.2589 -  static gchar *ras_exts[] = { "ras", NULL };
 26.2590 -  static gchar *bz2_exts[] = { "bz2", NULL };
 26.2591 -  static gchar *gz_exts[] = { "gz", NULL };
 26.2592 -  static gchar *zip_exts[] = { "zip", NULL };
 26.2593 -  static gchar *compress_exts[] = { "Z", NULL };
 26.2594 -  static gchar *m4a_exts[] = { "m4a", NULL };
 26.2595 -  static gchar *q3gp_exts[] = { "3gp", NULL };
 26.2596 -  static gchar *aac_exts[] = { "aac", NULL };
 26.2597 -  static gchar *spc_exts[] = { "spc", NULL };
 26.2598 -  static gchar *wavpack_exts[] = { "wv", "wvp", NULL };
 26.2599 -  static gchar *wavpack_correction_exts[] = { "wvc", NULL };
 26.2600 -  static gchar *rar_exts[] = { "rar", NULL };
 26.2601 -  static gchar *tar_exts[] = { "tar", NULL };
 26.2602 -  static gchar *ar_exts[] = { "a", NULL };
 26.2603 -  static gchar *msdos_exts[] = { "dll", "exe", "ocx", "sys", "scr",
 26.2604 -    "msstyles", "cpl", NULL
 26.2605 -  };
 26.2606 -  static gchar *flv_exts[] = { "flv", NULL };
 26.2607 -  static gchar *m4v_exts[] = { "m4v", NULL };
 26.2608 -  static gchar *nuv_exts[] = { "nuv", NULL };
 26.2609 -
 26.2610 -  GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions",
 26.2611 -      GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions");
 26.2612 -
 26.2613 -  /* must use strings, macros don't accept initializers */
 26.2614 -  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-ms-asf", GST_RANK_SECONDARY,
 26.2615 -      asf_exts,
 26.2616 -      "\060\046\262\165\216\146\317\021\246\331\000\252\000\142\316\154", 16,
 26.2617 -      GST_TYPE_FIND_MAXIMUM);
 26.2618 -  TYPE_FIND_REGISTER (plugin, "audio/x-musepack", GST_RANK_PRIMARY,
 26.2619 -      musepack_type_find, musepack_exts, MUSEPACK_CAPS, NULL, NULL);
 26.2620 -  TYPE_FIND_REGISTER (plugin, "audio/x-au", GST_RANK_MARGINAL,
 26.2621 -      au_type_find, au_exts, AU_CAPS, NULL, NULL);
 26.2622 -  TYPE_FIND_REGISTER_RIFF (plugin, "video/x-msvideo", GST_RANK_PRIMARY,
 26.2623 -      avi_exts, "AVI ");
 26.2624 -  TYPE_FIND_REGISTER_RIFF (plugin, "video/x-cdxa", GST_RANK_PRIMARY,
 26.2625 -      cdxa_exts, "CDXA");
 26.2626 -  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-vcd", GST_RANK_PRIMARY,
 26.2627 -      cdxa_exts, "\000\377\377\377\377\377\377\377\377\377\377\000", 12,
 26.2628 -      GST_TYPE_FIND_MAXIMUM);
 26.2629 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-flac", GST_RANK_PRIMARY,
 26.2630 -      flac_exts, "fLaC", 4, GST_TYPE_FIND_MAXIMUM);
 26.2631 -  TYPE_FIND_REGISTER (plugin, "video/x-fli", GST_RANK_MARGINAL, flx_type_find,
 26.2632 -      flx_exts, FLX_CAPS, NULL, NULL);
 26.2633 -  TYPE_FIND_REGISTER (plugin, "application/x-id3v2", GST_RANK_PRIMARY + 3,
 26.2634 -      id3v2_type_find, id3_exts, ID3_CAPS, NULL, NULL);
 26.2635 -  TYPE_FIND_REGISTER (plugin, "application/x-id3v1", GST_RANK_PRIMARY + 1,
 26.2636 -      id3v1_type_find, id3_exts, ID3_CAPS, NULL, NULL);
 26.2637 -  TYPE_FIND_REGISTER (plugin, "application/x-apetag", GST_RANK_PRIMARY + 2,
 26.2638 -      apetag_type_find, apetag_exts, APETAG_CAPS, NULL, NULL);
 26.2639 -  TYPE_FIND_REGISTER (plugin, "audio/x-ttafile", GST_RANK_PRIMARY,
 26.2640 -      tta_type_find, tta_exts, TTA_CAPS, NULL, NULL);
 26.2641 -  TYPE_FIND_REGISTER (plugin, "audio/x-mod", GST_RANK_SECONDARY, mod_type_find,
 26.2642 -      mod_exts, MOD_CAPS, NULL, NULL);
 26.2643 -  TYPE_FIND_REGISTER (plugin, "audio/mpeg", GST_RANK_PRIMARY, mp3_type_find,
 26.2644 -      mp3_exts, MP3_CAPS, NULL, NULL);
 26.2645 -  TYPE_FIND_REGISTER (plugin, "audio/x-ac3", GST_RANK_PRIMARY, ac3_type_find,
 26.2646 -      ac3_exts, AC3_CAPS, NULL, NULL);
 26.2647 -  TYPE_FIND_REGISTER (plugin, "video/mpeg1", GST_RANK_PRIMARY,
 26.2648 -      mpeg1_sys_type_find, mpeg_sys_exts, MPEG_SYS_CAPS, NULL, NULL);
 26.2649 -  TYPE_FIND_REGISTER (plugin, "video/mpeg2", GST_RANK_SECONDARY,
 26.2650 -      mpeg2_sys_type_find, mpeg_sys_exts, MPEG_SYS_CAPS, NULL, NULL);
 26.2651 -  TYPE_FIND_REGISTER (plugin, "video/mpegts", GST_RANK_PRIMARY,
 26.2652 -      mpeg_ts_type_find, mpeg_ts_exts, MPEGTS_CAPS, NULL, NULL);
 26.2653 -  TYPE_FIND_REGISTER (plugin, "application/ogg", GST_RANK_PRIMARY,
 26.2654 -      ogganx_type_find, ogg_exts, OGGANX_CAPS, NULL, NULL);
 26.2655 -  TYPE_FIND_REGISTER (plugin, "video/mpeg", GST_RANK_SECONDARY,
 26.2656 -      mpeg_video_type_find, mpeg_video_exts, MPEG_VIDEO_CAPS, NULL, NULL);
 26.2657 -  TYPE_FIND_REGISTER (plugin, "video/mpeg-stream", GST_RANK_MARGINAL,
 26.2658 -      mpeg_video_stream_type_find, mpeg_video_exts, MPEG_VIDEO_CAPS, NULL,
 26.2659 -      NULL);
 26.2660 -  TYPE_FIND_REGISTER (plugin, "video/mpeg4", GST_RANK_PRIMARY,
 26.2661 -      mpeg4_video_type_find, m4v_exts, MPEG_VIDEO_CAPS, NULL, NULL);
 26.2662 -  TYPE_FIND_REGISTER (plugin, "video/x-nuv", GST_RANK_SECONDARY,
 26.2663 -      nuv_type_find, nuv_exts, NUV_CAPS, NULL, NULL);
 26.2664 -
 26.2665 -  /* ISO formats */
 26.2666 -  TYPE_FIND_REGISTER (plugin, "audio/x-m4a", GST_RANK_PRIMARY, m4a_type_find,
 26.2667 -      m4a_exts, M4A_CAPS, NULL, NULL);
 26.2668 -  TYPE_FIND_REGISTER (plugin, "application/x-3gp", GST_RANK_PRIMARY,
 26.2669 -      q3gp_type_find, q3gp_exts, Q3GP_CAPS, NULL, NULL);
 26.2670 -  TYPE_FIND_REGISTER (plugin, "video/quicktime", GST_RANK_SECONDARY,
 26.2671 -      qt_type_find, qt_exts, QT_CAPS, NULL, NULL);
 26.2672 -  TYPE_FIND_REGISTER (plugin, "image/x-quicktime", GST_RANK_SECONDARY,
 26.2673 -      qtif_type_find, qtif_exts, QTIF_CAPS, NULL, NULL);
 26.2674 -
 26.2675 -  TYPE_FIND_REGISTER (plugin, "text/html", GST_RANK_SECONDARY, html_type_find,
 26.2676 -      html_exts, HTML_CAPS, NULL, NULL);
 26.2677 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/vnd.rn-realmedia",
 26.2678 -      GST_RANK_SECONDARY, rm_exts, ".RMF", 4, GST_TYPE_FIND_MAXIMUM);
 26.2679 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-pn-realaudio",
 26.2680 -      GST_RANK_SECONDARY, rm_exts, ".ra\375", 4, GST_TYPE_FIND_MAXIMUM);
 26.2681 -  TYPE_FIND_REGISTER (plugin, "application/x-shockwave-flash",
 26.2682 -      GST_RANK_SECONDARY, swf_type_find, swf_exts, SWF_CAPS, NULL, NULL);
 26.2683 -  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-flv", GST_RANK_SECONDARY,
 26.2684 -      flv_exts, "FLV", 3, GST_TYPE_FIND_MAXIMUM);
 26.2685 -  TYPE_FIND_REGISTER (plugin, "text/plain", GST_RANK_MARGINAL, utf8_type_find,
 26.2686 -      utf8_exts, UTF8_CAPS, NULL, NULL);
 26.2687 -  TYPE_FIND_REGISTER (plugin, "text/uri-list", GST_RANK_MARGINAL, uri_type_find,
 26.2688 -      uri_exts, URI_CAPS, NULL, NULL);
 26.2689 -  TYPE_FIND_REGISTER (plugin, "application/smil", GST_RANK_SECONDARY,
 26.2690 -      smil_type_find, smil_exts, SMIL_CAPS, NULL, NULL);
 26.2691 -  TYPE_FIND_REGISTER (plugin, "application/xml", GST_RANK_MARGINAL,
 26.2692 -      xml_type_find, xml_exts, GENERIC_XML_CAPS, NULL, NULL);
 26.2693 -  TYPE_FIND_REGISTER_RIFF (plugin, "audio/x-wav", GST_RANK_PRIMARY, wav_exts,
 26.2694 -      "WAVE");
 26.2695 -  TYPE_FIND_REGISTER (plugin, "audio/x-aiff", GST_RANK_SECONDARY,
 26.2696 -      aiff_type_find, aiff_exts, AIFF_CAPS, NULL, NULL);
 26.2697 -  TYPE_FIND_REGISTER (plugin, "audio/x-svx", GST_RANK_SECONDARY, svx_type_find,
 26.2698 -      svx_exts, SVX_CAPS, NULL, NULL);
 26.2699 -  TYPE_FIND_REGISTER (plugin, "audio/x-paris", GST_RANK_SECONDARY,
 26.2700 -      paris_type_find, paris_exts, PARIS_CAPS, NULL, NULL);
 26.2701 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-nist", GST_RANK_SECONDARY,
 26.2702 -      nist_exts, "NIST", 4, GST_TYPE_FIND_MAXIMUM);
 26.2703 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-voc", GST_RANK_SECONDARY,
 26.2704 -      voc_exts, "Creative", 8, GST_TYPE_FIND_MAXIMUM);
 26.2705 -  TYPE_FIND_REGISTER (plugin, "audio/x-sds", GST_RANK_SECONDARY, sds_type_find,
 26.2706 -      sds_exts, SDS_CAPS, NULL, NULL);
 26.2707 -  TYPE_FIND_REGISTER (plugin, "audio/x-ircam", GST_RANK_SECONDARY,
 26.2708 -      ircam_type_find, ircam_exts, IRCAM_CAPS, NULL, NULL);
 26.2709 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-w64", GST_RANK_SECONDARY,
 26.2710 -      w64_exts, "riff", 4, GST_TYPE_FIND_MAXIMUM);
 26.2711 -  TYPE_FIND_REGISTER (plugin, "audio/x-shorten", GST_RANK_SECONDARY,
 26.2712 -      shn_type_find, shn_exts, SHN_CAPS, NULL, NULL);
 26.2713 -  TYPE_FIND_REGISTER (plugin, "application/x-ape", GST_RANK_SECONDARY,
 26.2714 -      ape_type_find, ape_exts, APE_CAPS, NULL, NULL);
 26.2715 -  TYPE_FIND_REGISTER (plugin, "image/jpeg", GST_RANK_PRIMARY, jpeg_type_find,
 26.2716 -      jpeg_exts, JPEG_CAPS, NULL, NULL);
 26.2717 -  TYPE_FIND_REGISTER_START_WITH (plugin, "image/gif", GST_RANK_PRIMARY,
 26.2718 -      gif_exts, "GIF8", 4, GST_TYPE_FIND_MAXIMUM);
 26.2719 -  TYPE_FIND_REGISTER_START_WITH (plugin, "image/png", GST_RANK_PRIMARY,
 26.2720 -      png_exts, "\211PNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
 26.2721 -  TYPE_FIND_REGISTER (plugin, "image/bmp", GST_RANK_PRIMARY, bmp_type_find,
 26.2722 -      bmp_exts, BMP_CAPS, NULL, NULL);
 26.2723 -  TYPE_FIND_REGISTER (plugin, "image/tiff", GST_RANK_PRIMARY, tiff_type_find,
 26.2724 -      tiff_exts, TIFF_CAPS, NULL, NULL);
 26.2725 -  TYPE_FIND_REGISTER (plugin, "video/x-matroska", GST_RANK_PRIMARY,
 26.2726 -      matroska_type_find, matroska_exts, MATROSKA_CAPS, NULL, NULL);
 26.2727 -  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-mve", GST_RANK_SECONDARY,
 26.2728 -      mve_exts, "Interplay MVE File\032\000\032\000\000\001\063\021", 26,
 26.2729 -      GST_TYPE_FIND_MAXIMUM);
 26.2730 -  TYPE_FIND_REGISTER (plugin, "video/x-dv", GST_RANK_SECONDARY, dv_type_find,
 26.2731 -      dv_exts, DV_CAPS, NULL, NULL);
 26.2732 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-nb-sh", GST_RANK_PRIMARY,
 26.2733 -      amr_exts, "#!AMR", 5, GST_TYPE_FIND_LIKELY);
 26.2734 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-wb-sh", GST_RANK_PRIMARY,
 26.2735 -      amr_exts, "#!AMR-WB", 7, GST_TYPE_FIND_MAXIMUM);
 26.2736 -  TYPE_FIND_REGISTER (plugin, "audio/iLBC-sh", GST_RANK_PRIMARY,
 26.2737 -      ilbc_type_find, ilbc_exts, ILBC_CAPS, NULL, NULL);
 26.2738 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-sid", GST_RANK_MARGINAL,
 26.2739 -      sid_exts, "PSID", 4, GST_TYPE_FIND_MAXIMUM);
 26.2740 -  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-xcf", GST_RANK_SECONDARY,
 26.2741 -      xcf_exts, "gimp xcf", 8, GST_TYPE_FIND_MAXIMUM);
 26.2742 -  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-mng", GST_RANK_SECONDARY,
 26.2743 -      mng_exts, "\212MNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
 26.2744 -  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-jng", GST_RANK_SECONDARY,
 26.2745 -      jng_exts, "\213JNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
 26.2746 -  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-xpixmap", GST_RANK_SECONDARY,
 26.2747 -      xpm_exts, "/* XPM */", 9, GST_TYPE_FIND_MAXIMUM);
 26.2748 -  TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-sun-raster",
 26.2749 -      GST_RANK_SECONDARY, ras_exts, "\131\246\152\225", 4,
 26.2750 -      GST_TYPE_FIND_MAXIMUM);
 26.2751 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-bzip",
 26.2752 -      GST_RANK_SECONDARY, bz2_exts, "BZh", 3, GST_TYPE_FIND_LIKELY);
 26.2753 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-gzip",
 26.2754 -      GST_RANK_SECONDARY, gz_exts, "\037\213", 2, GST_TYPE_FIND_LIKELY);
 26.2755 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/zip", GST_RANK_SECONDARY,
 26.2756 -      zip_exts, "PK\003\004", 4, GST_TYPE_FIND_LIKELY);
 26.2757 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-compress",
 26.2758 -      GST_RANK_SECONDARY, compress_exts, "\037\235", 2, GST_TYPE_FIND_LIKELY);
 26.2759 -  TYPE_FIND_REGISTER (plugin, "audio/x-vorbis", GST_RANK_PRIMARY,
 26.2760 -      vorbis_type_find, NULL, VORBIS_CAPS, NULL, NULL);
 26.2761 -  TYPE_FIND_REGISTER (plugin, "video/x-theora", GST_RANK_PRIMARY,
 26.2762 -      theora_type_find, NULL, THEORA_CAPS, NULL, NULL);
 26.2763 -  TYPE_FIND_REGISTER (plugin, "application/x-ogm-video", GST_RANK_PRIMARY,
 26.2764 -      ogmvideo_type_find, NULL, OGMVIDEO_CAPS, NULL, NULL);
 26.2765 -  TYPE_FIND_REGISTER (plugin, "application/x-ogm-audio", GST_RANK_PRIMARY,
 26.2766 -      ogmaudio_type_find, NULL, OGMAUDIO_CAPS, NULL, NULL);
 26.2767 -  TYPE_FIND_REGISTER (plugin, "application/x-ogm-text", GST_RANK_PRIMARY,
 26.2768 -      ogmtext_type_find, NULL, OGMTEXT_CAPS, NULL, NULL);
 26.2769 -  TYPE_FIND_REGISTER (plugin, "audio/x-speex", GST_RANK_PRIMARY,
 26.2770 -      speex_type_find, NULL, SPEEX_CAPS, NULL, NULL);
 26.2771 -  TYPE_FIND_REGISTER (plugin, "application/x-ogg-skeleton", GST_RANK_PRIMARY,
 26.2772 -      oggskel_type_find, NULL, OGG_SKELETON_CAPS, NULL, NULL);
 26.2773 -  TYPE_FIND_REGISTER (plugin, "text/x-cmml", GST_RANK_PRIMARY, cmml_type_find,
 26.2774 -      NULL, CMML_CAPS, NULL, NULL);
 26.2775 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-executable",
 26.2776 -      GST_RANK_MARGINAL, NULL, "\177ELF", 4, GST_TYPE_FIND_MAXIMUM);
 26.2777 -  TYPE_FIND_REGISTER (plugin, "adts_mpeg_stream", GST_RANK_SECONDARY,
 26.2778 -      aac_type_find, aac_exts, AAC_CAPS, NULL, NULL);
 26.2779 -  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-spc", GST_RANK_SECONDARY,
 26.2780 -      spc_exts, "SNES-SPC700 Sound File Data", 27, GST_TYPE_FIND_MAXIMUM);
 26.2781 -  TYPE_FIND_REGISTER (plugin, "audio/x-wavpack", GST_RANK_SECONDARY,
 26.2782 -      wavpack_type_find, wavpack_exts, WAVPACK_CAPS, NULL, NULL);
 26.2783 -  TYPE_FIND_REGISTER (plugin, "audio/x-wavpack-correction", GST_RANK_SECONDARY,
 26.2784 -      wavpack_type_find, wavpack_correction_exts, WAVPACK_CORRECTION_CAPS, NULL,
 26.2785 -      NULL);
 26.2786 -  TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-rar",
 26.2787 -      GST_RANK_SECONDARY, rar_exts, "Rar!", 4, GST_TYPE_FIND_LIKELY);
 26.2788 -  TYPE_FIND_REGISTER (plugin, "application/x-tar", GST_RANK_SECONDARY,
 26.2789 -      tar_type_find, tar_exts, TAR_CAPS, NULL, NULL);
 26.2790 -  TYPE_FIND_REGISTER (plugin, "application/x-ar", GST_RANK_SECONDARY,
 26.2791 -      ar_type_find, ar_exts, AR_CAPS, NULL, NULL);
 26.2792 -  TYPE_FIND_REGISTER (plugin, "application/x-ms-dos-executable",
 26.2793 -      GST_RANK_SECONDARY, msdos_type_find, msdos_exts, MSDOS_CAPS, NULL, NULL);
 26.2794 -#if 0
 26.2795 -  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-dirac",
 26.2796 -      GST_RANK_PRIMARY, NULL, "BBCD", 4, GST_TYPE_FIND_MAXIMUM);
 26.2797 -#endif
 26.2798 -  TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-dirac",
 26.2799 -      GST_RANK_PRIMARY, NULL, "KW-DIRAC", 8, GST_TYPE_FIND_MAXIMUM);
 26.2800 -  TYPE_FIND_REGISTER (plugin, "multipart/x-mixed-replace", GST_RANK_SECONDARY,
 26.2801 -      multipart_type_find, NULL, MULTIPART_CAPS, NULL, NULL);
 26.2802 -  TYPE_FIND_REGISTER (plugin, "application/x-mmsh", GST_RANK_SECONDARY,
 26.2803 -      mmsh_type_find, NULL, MMSH_CAPS, NULL, NULL);
 26.2804 -  return TRUE;
 26.2805 -}
 26.2806 -
 26.2807 -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
 26.2808 -    GST_VERSION_MINOR,
 26.2809 -    "typefindfunctions",
 26.2810 -    "default typefind functions",
 26.2811 -    plugin_init, VERSION, "LGPL", "GStreamer Base Plug-ins CVS/prerelease", "Gstreamer CVS")