Commit graph

325 commits

Author SHA1 Message Date
Tim-Philipp Müller 09e06add66 typefindfunctions: backport some const-ifications from 0.11 branch
To keep code identical as much as possible between the two branches,
for easier merging.
2011-09-25 15:33:35 +01:00
Tim-Philipp Müller bfb33e09a9 typefindfunctions: fix indentation 2011-09-25 15:33:35 +01:00
Vincent Penquerc'h 4095551b31 typefind: recognize Asylum modules
Note that there is already a AMF detection for a different
magic, I'm not sure if that's a different format with the
same initials or not. AMF is used for a few different formats
(including video), so...

This fixes playbin2 playing Asylum modules.

https://bugzilla.gnome.org/show_bug.cgi?id=658514
2011-09-09 13:54:45 +02:00
Vincent Penquerc'h fa3e246866 typefind: bump probability if all frames we found are similar
Similar meaning same layer, same bitrate, and same number of channels

This fixes misdetection of (some MP3 files that have zero padding
between the ID3 tag and the MP3 stream) as H.264 video.

https://bugzilla.gnome.org/show_bug.cgi?id=656018
2011-08-10 11:20:31 +02:00
Piotr Fusik b27d2469bd typefind: fixed detection of audio/x-sap
Fixes: #654295.

Signed-off-by: David Schleef <ds@schleef.org>
2011-07-09 16:19:48 -07:00
Philip Jägenstedt f3e65f1c93 typefind: NULL check in degas_type_find
The length check isn't sufficient, an source might
report the correct length, but then still fail to
read the requested number of bytes for some reason.

https://bugzilla.gnome.org/show_bug.cgi?id=652642
2011-06-26 23:31:33 +01:00
Tim-Philipp Müller d10a7b439b typefinding: add typefinder for WAP WBMP bitmaps
https://bugzilla.gnome.org/show_bug.cgi?id=651294
2011-06-02 14:36:06 +01:00
Tim-Philipp Müller dd62fdc585 typefindfunctions: fix unused-but-set-variable warning with gcc 4.6
We don't compare the bitrates of consecutive mp3 frames on purpose
here.

https://bugzilla.gnome.org/show_bug.cgi?id=647294
2011-04-13 22:59:03 +01:00
Tim-Philipp Müller 143dc4810d typefindfunctions: rename type playlist/m3u8 to application/x-hls
We should keep playlist/m3u8 available for normal m3u8 playlists,
which we we'll likely support some day. Also, we probably don't
want this handled like other playlists, so application/* seems
more appropriate in this case, even if it's really just a playlist.
2011-03-30 15:44:45 +01:00
Sebastian Dröge 34548c16d8 typefind: Fix comment typo and add a link the the HTTP live streaming spec 2011-03-30 09:18:00 +02:00
Sebastian Dröge 70148cdf97 typefind: Use the DataScanCtx for the m3u8 typefinder 2011-03-30 09:12:25 +02:00
Andoni Morales Alastruey 7eb1ded8c1 typefind: add m3u8 playlists 2011-03-30 09:00:54 +02:00
Tim-Philipp Müller a558af4bbf typefinding: add depth and endianness to DTS caps
https://bugzilla.gnome.org/show_bug.cgi?id=644208
2011-03-14 18:35:27 +00:00
Tim-Philipp Müller 09f15da2f8 typefindfunctions: fix compiler warning on 32-bit systems
Mark 64-bit interger constant as such to avoid warnings such as:
gsttypefindfunctions.c:2152: error: integer constant is too large for ‘long’ type
2011-03-02 15:38:01 +00:00
Parthasarathi Susarla 0ebc34adf9 typefinding: detect raw h.263
https://bugzilla.gnome.org/show_bug.cgi?id=623846
2011-02-22 11:47:53 +00:00
David Schleef 7902e13df5 typefind: Fix mpeg TS detection 2011-02-17 18:29:57 -08:00
Philippe Normand 749f541cc4 typefinding: register H264 typefinder with H264 caps
https://bugzilla.gnome.org/show_bug.cgi?id=640709
2011-01-27 12:21:19 +00:00
Tim-Philipp Müller 11a1acfe88 typefinding: use image/x-icon as media type for ICON files
That's what we've been using so far (e.g. gdkpixbufdec).
2011-01-26 09:06:10 +00:00
Vincent Penquerc'h 2acdbdabaa typefind: add typefinder for DEGAS images
This fixes at least one DEGAS image from being misdetected as DTS audio.

https://bugzilla.gnome.org/show_bug.cgi?id=625129
2011-01-25 13:39:25 +00:00
Vincent Penquerc'h 7caf9e5e81 typefind: add detection for windows icon files to get them out of the way
Some of them can otherwise be misdetected for MPEG audio.

https://bugzilla.gnome.org/show_bug.cgi?id=620364
2011-01-24 19:54:52 +01:00
Tim-Philipp Müller adb84c6dae typefinding: set framed=false on DTS caps 2011-01-13 13:59:41 +00:00
David Schleef e3451e5ab8 typefind: Add stream-format to h264 caps 2011-01-02 15:49:42 -08:00
Tim-Philipp Müller bb786dfb5c typefinding: assume EBML files without doctype are matroska
https://bugzilla.gnome.org/show_bug.cgi?id=638019
2010-12-29 22:36:41 +00:00
David Schleef 525776df79 typefind: Add check for yuv4mpeg 2010-12-14 00:40:58 -08:00
Stefan Kost 7728f3d3a7 typefinders: name "aac" typefinder "audio/aac"
This is in sync how we call the others.
2010-12-13 10:42:02 +02:00
Mark Nauwelaerts ea7349e4c7 typefinding: improve iso media typefinding
... by also considering compatible brands rather than only aiming at major brand
(of which there are a seemingly ever expanding great many).
2010-12-08 12:55:24 +01:00
René Stadler 1e75501c10 typefind: ignore AC-3 BSIDs 9, 10 and >16
These are reserved for future extensions which will not be backwards
compatible to E-AC-3.
2010-12-07 21:28:20 +02:00
René Stadler 725968c612 typefind: accept consecutive AC-3 frames of different sizes
This is perfectly valid and occurs in particular when there are
(in)dependent substreams present.
2010-12-07 21:28:20 +02:00
René Stadler 0e39c62878 typefind: remove useless masking in (E-)AC-3 typefinders 2010-12-07 21:28:20 +02:00
René Stadler cc65ba987a typefind: stop scanning after suggesting E-AC-3 caps 2010-12-07 21:28:20 +02:00
René Stadler 886ea051e7 typefind: fix E-AC-3 frame size parsing
Frame size is given in words; it is already multiplied by two where
needed, so the left shift is superfluous. This extra multiplication
caused the code to inspect the third packet instead of the second,
which would fail for files where the second packet has a size
different from the first.
2010-12-07 21:28:20 +02:00
Tim-Philipp Müller df6bd68b80 typefinding: fix ADTS caps stream-format detail
Field should be "stream-format", not "stream-type".
2010-10-14 16:46:44 +01:00
Andrzej K. Haczewski 6c5cee1d02 typefinding: extend AAC typefinder to detect LOAS streams
Extend AAC typefinder to recognize LOAS stream as specified by
ISO/IEC 14496-3:2009.

https://bugzilla.gnome.org/show_bug.cgi?id=623918
2010-10-14 16:46:41 +01:00
Arun Raghavan 0cf81938a1 pbutils: add AAC profile detection to codec utils
This moves AAC profile detection to pbutils, and uses this in
typefindfunctions. This will also be used in qtdemux.

https://bugzilla.gnome.org/show_bug.cgi?id=617314

API: gst_codec_utils_aac_get_profile()
API: codec_utils_aac_caps_set_level_and_profile()
2010-09-30 13:09:29 +01:00
Arun Raghavan c77f88cac6 pbutils: add codec-specific utility functions for AAC
This allows us to add generic codec-specific functionality, like
extracting profile/level data from headers, without having to duplicate
code across demuxers and typefindfunctions.

As a starting point, this moves over AAC level extraction code from
typefindfunctions, so it can be reused in qtdemux, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=617314

API: gst_codec_utils_aac_get_sample_rate_from_index()
API: gst_codec_utils_aac_get_level()
2010-09-30 13:09:28 +01:00
Sebastian Dröge ff45b44e19 typefindfunctions: Add mp3 to the apetag extensions 2010-09-20 11:14:55 +02:00
Thiago Santos d123ab7bb1 typefind: Detect avc1 ftyp as video/quicktime
Detects avc1 ftyp as video/quicktime (iso variant)
2010-08-01 06:53:28 -03:00
Arun Raghavan ae03de8ff8 typefindfunctions: export 3gp profile in caps
This reads the 3gp profile from the major/compatible brands and puts
this as a 'profile' field in caps. This can be used by demuxers to
decide whether they can handle this stream or not. Also needed for
DLNA.

https://bugzilla.gnome.org/show_bug.cgi?id=620291
2010-07-24 10:50:45 +01:00
Parthasarathi Susarla aad661ec77 typefinding: detect enhanced AC-3
https://bugzilla.gnome.org/show_bug.cgi?id=623846
2010-07-24 09:48:41 +01:00
Tim-Philipp Müller bd0adb11fd typefinding: make mpeg-ts typefinder scan more data
We only look for packets with payload, but it appears there may be packets without,
which makes it harder to find the N packets with payload in a row that we need in
order to typefind this successfully, so scan some more data than necessary in the
optimistic scenario. Alternatively we could change IS_MPEGTS_HEADER().

Fixes #623663.
2010-07-18 11:37:11 +01:00
Philip Jägenstedt 72ca12e4c1 typefind: only associate .webm with WebM
.weba (audio) and .webv (video) were speculation on my part before
the public launch. As of yet no decision has been made on the
file extension for audio-only WebM, and I'm pretty sure there will
never be one for video-only.

Fixes bug #623837.
2010-07-16 17:40:45 +02:00
Arun Raghavan 026e5d3e67 typefinding: Mark ISO 14496-14 files as video/quicktime
These are currently being marked as audio/x-m4a which is incorrect.

https://bugzilla.gnome.org/show_bug.cgi?id=620720
2010-06-24 14:25:38 +01:00
Edward Hervey 7b2584ed68 typefindfunctions: Fix unitialized variables
yay macosx compilers :(
2010-06-14 14:13:32 +02:00
Tim-Philipp Müller b5a7e96291 typefinding: look for dts frames at non-zero offsets too
Scan a bit into the data when checking for dts frames instead
of expecting the frame sync to be right at the start of the
data. This is needed for some dts-disguised-as-pcm-in-wav files.

See #413942.
2010-06-11 15:59:54 +01:00
Tim-Philipp Müller 9235c91bec typefinding: add typefinder for dts audio 2010-06-11 15:59:53 +01:00
Tim-Philipp Müller 261a1447fa typefinding: fix log function printf format issue 2010-06-06 16:46:55 +01:00
Tim-Philipp Müller d4269515fa typefinding: stop jpeg typefinding once we found a SOF marker 2010-06-05 18:25:51 +01:00
Tim-Philipp Müller 95b4de4ed7 typefinding: improve jpeg typefinder
Make jpeg typefinder check more than just the first two bytes
plus Exif or JFIF marker. This allows us to report MAXIMUM
probability in cases where there's no Exif or JFIF marker,
making typefinding stop early. Also extract width and height,
because we can.
2010-06-05 18:06:42 +01:00
Tim-Philipp Müller 14d14a9143 typefinding: fix AC-3 typefinding so that it actually checks for a second frame
Fix typo that made the AC-3 typefinder not actually check for a
second frame, but rather compare the sync point found to itself,
which resulted in the AC-3 typefinder reporting an overly optimistic
MAXIMUM or VERY_LIKELY probability when it found a possible frame
sync.
2010-06-05 17:24:31 +01:00
Sebastian Dröge 760ae91ec3 typefindfunctions: Add IVF typefinder 2010-05-22 08:55:51 +02:00
Philip Jägenstedt 3762cfd3d7 typefind: Detect WebM as video/webm
Refactor matroska_type_find into ebml_check_header and a new
matroska_type_find and webm_type_find.
2010-05-19 19:24:35 +02:00
Tim-Philipp Müller 555a3a5d14 typefinding: add channels and rate to ADTS caps if we can 2010-04-12 15:04:31 +01:00
Arun Raghavan 43a04483d9 typefinding: add AAC level to ADTS caps
This adds code to calculate the level for a given AAC stream and export
it in the stream caps. For AAC LC streams, the level is calculated
according to the definition under the AAC Profile. For other streams,
the definition under the Main Profile is used.

HE-AAC support is still to be done, and is dependent on detecting the
presence of SBR and PS in the stream.

Level is added as a field of type string because that's the way it's
done in H.264 caps as well. There are only a few possible levels, so
not using a numerical type is not too painful in this case, and
consistency is nice.

Fixes #613589.
2010-04-12 15:04:31 +01:00
Arun Raghavan 34dcb8458e typefinding: add AAC profile to ADTS caps
This looks at the AAC profile for ADTS streams and adds the profile as a
string in the corresponding caps.

Profile is the actual profile, base-profile denotes the minimum codec
requirements to decode this stream. In this case they're always the
same, but they may differ e.g. in case of certain HE-AAC streams that
can be partially decoded by LC decoders (with loss of quality of course)
if no suitable HE-AAC decoder is available.

Fixes #612312.
2010-04-12 15:04:23 +01:00
Benjamin Otte 3bd4aa26ff Add -Wwrite-strings to configure
Fixes for the code included
2010-03-16 17:41:51 +01:00
David Hoyt cfa8de336c typefind: use g_ascii_strncasecmp() instead of strncasecmp()
g_ascii_strncasecmp() is more portable and likely more robust as
well (with random binary data as input).

Fixes #612845.
2010-03-15 18:45:13 +00:00
Kaj-Michael Lang 0230f7ed9e typefind: Handle stm module format
Fixes #609314.
2010-02-15 12:50:45 +00:00
Sebastian Dröge 1ae783dafc typefindfunctions: Add typefinder for ISO MP4 files
Fixes bug #607848.
2010-01-24 20:46:58 +01:00
Tim-Philipp Müller eef885cf86 typefinding: optimise AC-3 typefinder a bit
Make AC-3 typefinder use the DataScanCtx stuff so we don't have to
do gst_type_find_peek() in the inner loop all the time. Also return
when we've suggested AC3 caps, instead of continuing with the loop.
2010-01-23 15:28:02 +00:00
Tim-Philipp Müller ca7ba91e5b Revert "typefind: Reduce number of calls to gst_type_find_peek."
This reverts commit c661bfaa99.

This breaks AC-3 typefinding for all cases where the first frame
is at an offset > 0.
2010-01-23 15:27:49 +00:00
Stefan Kost 8ebb6be803 typefind: include stdio.h for sscanf 2010-01-22 16:15:54 +02:00
Tim-Philipp Müller 2a84cf0941 typefinding: add PNM typefinder
Add PNM typefinder, so we can remove the one that's in the PNM plugin
in -bad (which btw uses different/wrong media types that don't match
the ones used by gdkpixbufdec) and people don't make fun of us for
loading image decoders when typefinding and playing back audio files.
2010-01-22 02:09:58 +00:00
David Schleef e432c8ebc2 typefind: rewrite h.264 detection
Make detection simpler: check for NALs, check that they make
sense, and report how certain we are that it's a raw H.264 stream.
Fixes: #583376.
2010-01-19 13:37:12 -08:00
Wim Taymans 8d30d92740 typefind: mp4 video is not parsed 2010-01-13 17:36:05 +01:00
Thiago Santos 148d951fbc typefind: Add aac stream-format to caps
Also add the aac stream-format field on the caps when
detecting it.
2010-01-13 12:49:20 -03:00
Edward Hervey c661bfaa99 typefind: Reduce number of calls to gst_type_find_peek.
Shaves off a couple percents off typefinding
2009-11-09 19:18:07 +01:00
Tim-Philipp Müller 37f8957181 typefind: fix typo in previous mxf typefinder change 2009-10-21 20:36:23 +01:00
Edward Hervey d48d47e683 typefind: speed up mxf_type_find over 300 times for worst case scenarios
* memcmp is expensive and was being abused, reduce calling it by checking
  the first byte.
* iterating one byte at at time over 64 kbites introduces a certain overhead,
  therefore we now do it in chunks of 1024 bytes

And I do mean over 300 times. The average instruction call per mxf_type_find
was previously 785685 and it's now down to 2458 :)
2009-10-21 21:04:45 +02:00
David Schleef 1871a6025d typefind: detect 'ftypqt ' as video/quicktime 2009-10-06 12:19:12 -07:00
Tim-Philipp Müller f051514f69 typefinding: disable typefinder for headerless flac
Disable headerless flac typefinder as long as it happily typefinds anything
including /dev/urandom as flac and as long as it's not particularly useful
given that such streams don't really exist in the wild.

Also fix up some comments so that gtk-doc doesn't complain about them.
2009-09-07 17:13:12 +01:00
Wim Taymans f1b209f409 typefind: fix midi typefinding
We already have a audio/midi typefinder so don't override it with the midi in
RIFF typefinder or else we fail to detect plain midi files.
2009-09-04 15:48:06 +02:00
Sebastian Dröge a69ffb5886 typefindfunctions: Add typefinder for Midi inside RIFF
This is a standard Midi file format that should be supported by
all Midi decoders and also has the mimetype audio/mid according to
the Midi specification homepage.

Fixes bug #594094.
2009-09-04 07:36:10 +02:00
Tim-Philipp Müller 4cacc441d8 typefinding: move gio-based xdg mime typefinder from -bad to -base
Its purposes is mainly to avoid false positives (e.g. mp3 typefinder
reporting a 20% probability and somesuch). Won't be registered if
the gio plugin has been disabled via ./configure --disable-gio.
2009-09-03 09:01:47 +01:00
Sebastian Dröge 3c8ff21ba2 typefindfunctions: Detect AVF files as RIFF files too
AVF is valid RIFF but has AVF0 as first fourcc instead of RIFF.

Partially fixes bug #593117.
2009-08-26 09:10:19 +02:00
Sebastian Dröge 3b4c35e319 typefindfunctions: Also detect SVG by the <svg> starting tag
Not all SVG images have the DOCTYPE specified.
2009-08-12 12:11:08 +02:00
Sebastian Dröge 141c3f52cd typefindfunctions: Add typefinders for many game sound console formats supported by gme
These are AY, GBS, GYM, KSS, SAP and VGM. SPC and NSF already had typefinders.
2009-08-07 09:33:34 +02:00
Tim-Philipp Müller 85a08d8dc2 typefinding: fix postscript typefinder probability
Two bytes for a rare format hardly warrants MAXIMUM typefinding
probability, POSSIBLE seems more appropriate.
2009-08-06 09:57:25 +01:00
Sebastian Dröge 76571840ef typefindfunctions: Add SVG typefinder 2009-08-06 06:43:35 +02:00
Sebastian Dröge 5c52513aab typefindfunctions: Add postscript typefinder 2009-08-06 06:43:35 +02:00
Sebastian Dröge 37839ee2b3 typefindfunctions: Use static caps again for MPEG4 typefinding 2009-08-06 06:43:35 +02:00
Arnout Vandecappelle ce24ac4ed0 typefindfunctions: Implement better & more flexible MPEG4 typefinding
This detects more MPEG4 streams as MPEG4.

Fixes bug #556537.
2009-08-06 06:43:35 +02:00
Benjamin Gaignard 2f4c65bb06 typefindfunctions: Fix typefinding of SDP files
Fixes bug #589574.
2009-08-06 06:43:33 +02:00
Tim-Philipp Müller e199d7e1cd typefinding: fix detection of fLaC id packet in broken flac-in-ogg
There are flac-in-ogg files without the usual flac packet framing
and these files just have a 4-byte fLaC ID packet as first packet.
We need to recognise the type just from these four bytes if we
want oggdemux to recognise these streams correctly.
2009-08-01 19:01:39 +01:00
Tim-Philipp Müller 2670f23812 typefind: recognise Kate spu subtitles as well
Recognise spu-subtitles, SUB and K-SPU as valid categories for
Kate subtitles as well.
2009-07-24 09:42:05 +01:00
Tim-Philipp Müller d53e754d42 typefinding: use subtitle/x-kate for Kate subtitle streams and application/x-kate for the rest
Differentiate subtitle streams and lyrics/cracktastic/complex streams via
the category string in the headers. This seems like a useful distinction
to make, and also seems more future-proof. See #525743.
2009-07-13 23:00:04 +01:00
Tim-Philipp Müller 8b94cd3934 typefinding: lower the h264 typefinder's probability
A NEARLY_CERTAIN is absolutely not warranted given the kind
of things it checks for. Even a LIKELY is probably not entirely
appropriate.
2009-06-25 12:09:59 +01:00
Edward Hervey 31e7bf098d typefindfunctions: Fix caps for ogg typefinder. 2009-06-02 09:54:23 +02:00
Arnout Vandecappelle 192a34af40 typefindfunctions: made mp3_type_find less aggressive
mp3_type_find could suggest already when only a single valid header
was found, if it ran out of data before the end of the next frame.
Therefore, ignore the last found frame if it was incomplete.
Fixes bug #579692.
2009-05-12 09:03:22 +02:00
Tim-Philipp Müller 04a860c6f7 typefinding: make flac typefinder return lower probability for frame headers
The flac frame header typefinder overstates the likelihood of a match, leading
to false positives with e.g. aac streams and PDF files. Reduce probabilty
returned from LIKELY to POSSIBLE for the frame header matchin code.
Fixes #574939.
2009-03-15 19:57:36 +00:00
Tim-Philipp Müller a622ff74b0 typefinding: improve image/bmp typefinder
Detect more variations and also bail out in more cases where the values
don't make sense. Furthermore, add width/height and bpp to the caps,
because we can.
2009-03-15 19:52:46 +00:00
Tim-Philipp Müller 4cbe4d2c72 typefinding: flac typefinder fixes
Use scan context for initial peek as well. Peek 6 bytes in the initial
peek rather than 5 bytes, to match the length of the memcmp we're doing
on that data later. Return immediately when we found caps from looking
at the beginning of the data - no point in continuing to scan the next
64kB for something matching a frame header.
2009-03-11 13:33:33 +00:00
Jonathan Matthew db7ecda64f typefind: add photoshop typefind functions
Add photoshop typefind functions.
Fixes #574516.
2009-03-09 16:19:40 +01:00
Edward Hervey 9acf7de5a4 typefind: Use the proper data pointer instead of poking random memory. 2009-03-09 09:08:00 +01:00
Stefan Kost 080493ccff typefind: Make the flac check more tight to not mistace some aac files for flac. Fixes #570356.
Add comments about the flac format. Tighten the check to not allow values that
refer to headers.
2009-02-03 15:28:50 +02:00
Michael Smith 81cc88326f Ensure we have sufficient data when using data scan contexts.
Fixes crashes typefinding things that look like they might contain AAC
data (but probably aren't actually AAC).
2009-01-26 18:02:00 -08:00
Sebastian Dröge 5dfcb63252 Rename files and types from speexresample to audioresample
Rename files and types from speexresample to audioresample
to finish the move and to prevent any confusion.
2009-01-23 12:33:41 +01:00
Wim Taymans cc8b9ae5e8 Add typefind function for gsm
Because core now supports typefindfactories without a typefind function we can
register a factory fo GSM that will --if all else fails-- assume the file is a
GSM file based on the registered extension.
Fixes #566661.
2009-01-23 11:40:26 +01:00
Benjamin Gaignard 336e1346e4 Add typefinder for Mobile XMF. Fixes bug #568707. 2009-01-23 10:19:27 +01:00
Guillaume Emont d477a37e7e gst/typefind/gsttypefindfunctions.c: Add typefinders for MS Word files and OS X .DS_Store files to prevent them to be...
Original commit message from CVS:
Patch by: Guillaume Emont <guillaume at fluendo dot com>
* gst/typefind/gsttypefindfunctions.c: (plugin_init):
Add typefinders for MS Word files and OS X .DS_Store files to
prevent them to be recognized as MPEG files. Fixes bug #564098.
2008-12-11 12:32:03 +00:00
Luis Menina a4493595a6 gst/: Include glib.h instead of a specific GLib header. Including single
Original commit message from CVS:
Patch by: Luis Menina <liberforce at freeside dot fr>
* gst-libs/gst/floatcast/floatcast.h:
* gst/typefind/gsttypefindfunctions.c:
Include glib.h instead of a specific GLib header. Including single
GLib headers is deprecated. Fixes bug #563904.
2008-12-10 08:19:13 +00:00