Commit graph

281 commits

Author SHA1 Message Date
Mark Nauwelaerts
95c2251390 baseparse: minor typo and debug statement cleanup 2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
d1bb142b68 baseparse: reduce locking
... which is either already mute and/or implicitly handled by STREAM_LOCK.
2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
ce23c62f58 baseparse: avoid loop in frame locating interpolation 2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
eafcdf67b9 flacparse: mind gst_buffer_unref not liking NULL
Fixes #639950.
2011-04-08 18:07:13 +01:00
Thiago Santos
244f747df2 audioparsers: baseparse: Be careful to not lose the event ref
Don't unref the event if it hasn't been handled, because the caller
assumes it is still valid and might reuse it.

I ran into this problem when transcoding an AVI (with mp3 inside)
to gpp.

https://bugzilla.gnome.org/show_bug.cgi?id=639555
2011-04-08 18:07:13 +01:00
Tim-Philipp Müller
bb8f0d3b4c dcaparse: fix sync word for 14-bit little endian coding
Fix copy'n'paste bug that made us look for the raw little endian
sync word twice instead of looking for the 14-bit LE sync word
as well. Fixes parsing of such streams (see #636234 for sample file).
2011-04-08 18:07:13 +01:00
Tim-Philipp Müller
a8c854374b docs: minor baseparse docs/comment fixes
Remove copy'n'paste leftovers.
2011-04-08 18:07:13 +01:00
Edward Hervey
6fbdfa07a8 flacparse: Fix unitialized variable on macosx 2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
cf5b01a55f ac3parse: relax bsid checking
... to the widest possible spec interpretation.

Fixes #637062.
2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
d2a9daec36 audioparsers: update some documentation 2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
cfbc40aca7 mpegaudioparse: add to documentation 2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
d1d1239fe4 dcaparse: add to documentation 2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
0bb654ed66 baseparse: increase keyframe awareness
... which is not particular relevant for audio parsing, but more so
in video cases.  In particular, auto-determine if dealing with video (caps).
2011-04-08 18:07:13 +01:00
Mark Nauwelaerts
f7de334d61 ac3parse: use proper EAC-3 caps 2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
b8af812987 baseparse: avoid unexpected stray metadata 2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
24cf864c91 baseparse: use proper _NONE output value when applicable 2011-04-08 18:07:12 +01:00
Edward Hervey
1e71d31e67 audioparsers: Remove dead assignments 2011-04-08 18:07:12 +01:00
Andoni Morales Alastruey
5bfc92714e audioparse: fix possible division-by-zero
https://bugzilla.gnome.org/show_bug.cgi?id=635786
2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
a45019fdd6 baseparse: use correct offset when adding index entry
... bearing in mind that BUFFER_OFFSET is media specific and may not
reflect the basic offset after having been parsed.
2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
76b322a429 baseparse: enhancements for timestamp marked framed formats
That is, as such formats allow subclass to extract position from frame,
it is possible to extract duration (if not otherwise provided)
from (near) last frame, and a seek can fairly accurately target the required
position.

Fixes #631389.
2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
634d4de627 baseparse: refactor frame scanning peformed by _loop 2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
563f1a136b baseparse: slightly optimize sending of pending newsegment events 2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
5eeb1f2e1f baseparse: minor fixes and enhancements
Arrange for upstream as well as downstream flushing when seeking.
Also determine upstream size as well as seekability.  Adjust some comments
to reality and employ debug statement in proper order.
2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
3e50f0a3c9 aacparse: minor cleanups 2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
31d387f7b5 aacparse: fix regression in ADIF src caps setting 2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
55da8e46eb flacparse: parse seektable
Fixes #631389 (partially).
2011-04-08 18:07:12 +01:00
Mark Nauwelaerts
b1f8380e4c flacparse: minor refactor and enable default baseparse segment clipping 2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
b25d139538 mpegaudioparse: fix silly leak in _reset 2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
ba56999212 baseparse: use only upstream duration if it provides one 2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
3d72afd924 baseparse: reflow update_bitrate code
... which makes local variables represent real state better, and avoids
triggering unneeded updates/actions.
2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
5aafc17dec baseparse: add some debug statements 2011-04-08 18:07:11 +01:00
Tim-Philipp Müller
3018bdf8de dcaparse: init variable to make osx build bot happy
gstdcaparse.c: In function 'gst_dca_parse_check_valid_frame':
gstdcaparse.c:246: warning: 'best_sync' may be used uninitialized in this function
2011-04-08 18:07:11 +01:00
Tim-Philipp Müller
75735c4573 audioparsers: add very basic dts/dca parser
Still some issues, e.g. with seekable queries in totem, but also
processing already-chunked input (created with matroskademux ! gdppay).
2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
5d52d3f6c2 ac3parse: properly parse e-ac3 frame header
Also add a few debug statements.
2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
98c7f4b2f6 flacparse: tweak setting buffer metadata; avoid timestamp jitter
Fixes #631993.
2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
5369b97246 aacparse: streamline src caps setting
In particular, also set src caps whenever changes in stream warrant doing so.
2011-04-08 18:07:11 +01:00
Sebastian Dröge
274414e3d6 flacparse: Don't drop the last frame if it is followed by garbage
See bug #631814.
2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
2c7c4fa9e4 baseparse: perform bitrate handling and posting after newsegment sending 2011-04-08 18:07:11 +01:00
Mark Nauwelaerts
0edaf8470e baseparse: immediately post subclass provided bitrate 2011-04-08 18:07:10 +01:00
Mark Nauwelaerts
4a7f899f6e flacparse: fix parsing with unknown framesizes
Fixes #631814 (mostly).
2011-04-08 18:07:10 +01:00
Sebastian Dröge
c3678a5384 flacparse: Simplify frame header parsing by using lookup tables
Based on a patch by Felipe Contreras.

See bug #631200.
2011-04-08 18:07:10 +01:00
Sebastian Dröge
572366e179 flacparse: Don't parse the complete FLAC frames but only look for valid frame headers
Thanks to Felipe Contreras for the suggestion. This is partially
based on his patches and makes flacparse more than 3.5 times faster.

Looking for valid frame headers is unlikely to give false positives
because every frame header is at least 9 bytes long, contains a
14 bit sync code and a 8 bit checksum over the first 8 bytes.

Fixes bug #631200.
2011-04-08 18:07:10 +01:00
Sebastian Dröge
bfdc132ad0 flacparse: Really post tags only after the initial newsegment event
The first newsegment event will be send by the first call to
gst_base_parse_push_buffer() if necessary, posting the tags
before that is not a good idea. Instead do it from the
GstBaseParse::pre_push_buffer vfunc.
2011-04-08 18:07:09 +01:00
Tim-Philipp Müller
6b71b65289 Revert "baseparse: add skip property"
This reverts commit b5a3d60363.

Reverting this for now, since no one really seems to remember why this
property exists or what it could possibly be good for. It seems to have
been in the original mp3parse since the beginning of time and was back-
ported from there.
2011-04-08 18:07:09 +01:00
Sebastian Dröge
872b49efa7 flacparse: Fix uninitialized variable compiler warnings
These warnings are wrong, the variables are only used if they were
initialized by the bit reader.
2011-04-08 18:07:09 +01:00
Felipe Contreras
70d5346ee8 flacparse: fix picture parsing
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2011-04-08 18:07:09 +01:00
Sebastian Dröge
36f48450b1 flacparse: Push tags before the header buffers are pushed 2011-04-08 18:07:09 +01:00
Felipe Contreras
eaa6f789b2 flacparse: trivial caps fix
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2011-04-08 18:07:09 +01:00
Sebastian Dröge
4cc901ed96 audioparser: Let the format string agree with the parameters to fix compiler warning 2011-04-08 18:07:09 +01:00
Sebastian Dröge
6f04047f0c ac3parse: Use unchecked versions of the bitreader get functions
We didn't check the return values anyway...
2011-04-08 18:07:09 +01:00
Arun Raghavan
8ef15e6247 baseparse: Fix debug output
We lose the reference to the buffer after gst_pad_push(), so the debug
print should happen before.

https://bugzilla.gnome.org/show_bug.cgi?id=622276
2011-04-08 18:07:09 +01:00
Mark Nauwelaerts
0f5f06d5fa baseparse: support reverse playback
... in pull mode or upstream driven.
2011-04-08 18:07:09 +01:00
Mark Nauwelaerts
304b3c78dd baseparse: remove done TODOs and update documentation 2011-04-08 18:07:09 +01:00
Mark Nauwelaerts
1a54736255 baseparse: use determined seekability in answering SEEKING query 2011-04-08 18:07:09 +01:00
Mark Nauwelaerts
3f02dbd3ab baseparse: add skip property 2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
dd140c7b4d mpegaudioparse: initial version
... adequately equivalent to mp3parse, so lets boldly set it
to higher rank.
2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
2d482deabe aacparse: set minimum frame size at _start
... rather than one time at _init.
2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
589c455ccb baseparse: use _set_frame_props to configure frame lead_in and lead_out
... provided a corresponding decoder with sufficient leading and following
frames to carry out full decoding for a particular segment.
2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
f218b984cc baseparse: use _set_duration to configure duration update interval
... as it logically belongs there as one or the other; either subclass
can provide a duration, or an estimate must be made (reguarly updated).
2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
1f7359d388 baseparse: localize use of provided fps information 2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
5dd8a489d5 baseparse: seek table and accurate seek support 2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
5a69aa4903 baseparse: proper and more extended segment and seek handling
That is, loop pause handling, segment seek support, newsegment for gaps, etc
2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
f16146df62 baseparse: add index support 2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
261b7ec15f baseparse: refactor state reset 2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
2c81b3bf77 baseparse: prevent indefinite resyncing 2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
de189e327f baseparse: specific EOS handling if no output so far 2011-04-08 18:07:08 +01:00
Mark Nauwelaerts
0707c189db baseparse: adjust _set_frame_prop documentation and set default as claimed 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
723059c688 baseparse: fix bitrate copy-and-paste and update heuristic 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
fea135b3de baseparse: post duration message if average bitrates is updated 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
0198d6320b baseparse: remove is_seekable vmethod and use a set_seek instead
Seekability, like duration, etc is unlikely to change (frequently), and
the default assumption covers most cases, so let subclass set when needed.
At the same time, allow subclass to indicate if it has seek-metadata (table)
available, and possibly have it provide an average bitrate.
2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
10611c2826 ac3parse: remove redundant default is_seekable 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
30be03004e baseparse: add another hook for subclass prior to pushing buffer
... and allow subclass to perform custom segment clipping, or to
emit tags or messages at this time.
2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
dc6bd085ed baseparse: 0 converts to 0 by default 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
0e60101a28 basepase: refactor conversion using helper function and export default convert 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
a84eee533f baseparse: streamline query handling 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
1c65b8287d baseparse: cleanup struct and remove unused member 2011-04-08 18:07:07 +01:00
Mark Nauwelaerts
952b27a140 audioparsers: increase ranks to enable auto-plugging
Because we can, and should, have some shakedown testing before having
these make it into -good later on ...
2011-04-08 18:07:07 +01:00
Arun Raghavan
3448e83c73 baseparse: Allow chaining of subclass event handlers
This allows the child class to chain its event handler with
GstBaseParse, so that subclasses don't have to duplicate all the default
event handling logic.

https://bugzilla.gnome.org/show_bug.cgi?id=622276
2011-04-08 18:07:07 +01:00
Sebastian Dröge
8df3c8477a baseparse: Don't use GST_FLOW_IS_FATAL()
Also don't post an error message for UNEXPECTED and do it
for NOT_LINKED.
2011-04-08 18:07:06 +01:00
Mark Nauwelaerts
7831661c40 baseparse: non-TIME seek event is simply not handled 2011-04-08 18:07:06 +01:00
Mark Nauwelaerts
835473b792 baseparse: fix seek event ref handling 2011-04-08 18:07:06 +01:00
Mark Nauwelaerts
baefba9748 baseparse: prevent arithmetic overflows in pull mode buffer cache handling 2011-04-08 18:07:06 +01:00
Mark Nauwelaerts
a459494097 baseparse: fix seek handling
Allow a few more seek event type combinations, and really use the result
of gst_segment_set_seek to perform the seek.  Also add some debug.
2011-04-08 18:07:06 +01:00
Arun Raghavan
f7e228edb0 baseparse: Don't emit bitrate tags too early
We wait to parse a minimum number of frames (10, arbitrarily) before
emiting bitrate tags so that our early estimates are not wildly
inaccurate for streams that start with a silence. If the stream ends
before that, we just emit the tags anyway.

While it _would_ be nicer to be specify the threshold to start pushing
the tags in terms of duration, this would introduce more complexity than
this merits.

https://bugzilla.gnome.org/show_bug.cgi?id=614991
2011-04-08 18:07:06 +01:00
Sebastian Dröge
00b0444618 flacparse: Optionally check the overall frame checksums too before accepting a frame as valid
This is optional because it's a quite expensive operation and it's very
unlikely that a non-frame is detected as frame after the header CRC check
and checking all bits for valid values. The overall frame checksums are
mainly useful to detect inconsistencies in the encoded payload.
2011-04-08 18:07:06 +01:00
Sebastian Dröge
7b10c2afce flacparse: Check the CRC-8 of the headers before accepting a frame as valid
This makes false-positives during seeking much less likely and detection of
them much faster.
2011-04-08 18:07:06 +01:00
Sebastian Dröge
0cf1285980 baseparse: Set the last stop to the buffer starttime if the duration is invalid
...instead of not setting it at all.
2011-04-08 18:07:06 +01:00
Joshua M. Doe
017bb65d06 baseparse: Send NEWSEGMENT event with correct start and position
Instead of taking the last stop (which could be buffer endtime instead
of starttime) always take the buffer starttime.

Fixes bug #614016.
2011-04-08 18:07:06 +01:00
Arun Raghavan
7184fe911d flacparse: Fix buffer refcount issue
When called from the GST_FLAC_PARSE_STATE_HEADERS case,
gst_flac_parse_hand_headers() does a gst_buffer_set_caps() on a buffer
with refcount > 1. This change handles this case by making the buffer
metadata_Writable.

https://bugzilla.gnome.org/show_bug.cgi?id=614037
2011-04-08 18:07:06 +01:00
Tim-Philipp Müller
bb7f3ffe41 audioparsers: remove unused GstBaseParseClassPrivate structure 2011-04-08 18:07:05 +01:00
Arun Raghavan
fb4673cde9 flacparse: Make bitrate estimation more accurate
This implements the get_frame_overhead() vfunc so that baseparse can
make more accurate bitrate estimates.
2011-04-08 18:07:05 +01:00
Arun Raghavan
44878511b2 aacparse: Fix bitrate calculation
This patch adds the get_frame_overhead() vfunc so that baseparse can
accurately calculate the min/avg/max bitrates for aacparse.

Note: The bitrate was being incorrectly calculated for ADTS streams
(it's not in the header as the code suggests).
2011-04-08 18:07:05 +01:00
Arun Raghavan
733669e076 audioparsers: Add bitrate calculation to baseparse
This makes baseparse keep a running average of the stream bitrate, as
well as the minimum and maximum bitrates. Subclasses can override a
vfunc to make sure that per-frame overhead from the container is not
accounted for in the bitrate calculation.

We take care not to override the bitrate, minimum-bitrate, and
maximum-bitrate tags if they have been posted upstream. We also
rate-limit the emission of bitrate so that it is only triggered by a
change of >10 kbps.
2011-04-08 18:07:04 +01:00
Benjamin Otte
1b5d7be2c9 gst_element_class_set_details => gst_element_class_set_details_simple 2011-04-08 18:07:04 +01:00
Mark Nauwelaerts
e75e19e7f0 audioparsers: rename baseparse GType name to avoid possible conflicts 2011-04-08 18:07:04 +01:00
Edward Hervey
85ceeaefe5 flacparse: Initialize variables.
Fixes build on $#@*( macosx
2011-04-08 18:07:04 +01:00
fc94c56c55 win32: Include config.h before anything else. Fix mpegdemux LIBADD
Because config.h defines __MSVCRT_VERSION__, which should be defined
before inclusion of any system header.

Also fixes mpegdemux Makefile.am LIBADD typo.

Fixes #606665
2011-04-08 18:07:04 +01:00
Thiago Santos
d02ef41d32 aacparse: Also add stream-format to template caps
Do not forget to add stream-format to template caps
off aacparse
2011-04-08 18:07:04 +01:00
Thiago Santos
13c76e3bc3 Rename aac's stream-format 'none' to 'raw'
Renames aac's stream-format from previous commits from none to
raw
2011-04-08 18:07:04 +01:00
Thiago Santos
000754cf63 aacparse: Add stream-format to output caps
Adds stream-format field to output caps
2011-04-08 18:07:04 +01:00
Mark Nauwelaerts
b314dabb98 audioparsers: documentation fixes 2011-04-08 18:07:04 +01:00
Mark Nauwelaerts
d3660bbee7 ac3parse: add documentation 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
4ee63d49dd flacparse: add documentation 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
9bcd66cb98 flacparse: perform additional frame checks when resyncing 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
84e0aae90c flacparse: fix (multiple channel) frame parsing 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
a18863c8ec flacparse: declare unparsed input and parsed output 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
d283a44302 ac3parse: fix scanning for next syncword 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
fd848904f9 baseparse: adjust seek handling and newsegment sending
Perform sanity check on type of seek, and only perform one that is
appropriately supported.  Adjust downstream newsegment event
to first buffer timestamp that is sent downstream.
2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
748b96ddef baseparse: minor refactor cleanup
Also add some debug logging.
2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
83f02e8bc8 flacparse: locate next sync code more efficiently 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
534e2d7f49 flacparse: baseparse takes care of handling leftover pieces 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
6f3106b603 baseparse: implement leftover draining in pull mode 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
0d53b6ad62 flacparse: set _OFFSET and _OFFSET_END on outgoing buffers 2011-04-08 18:07:03 +01:00
Mark Nauwelaerts
4db789a18c audioparsers: move 'flacparse' into it 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
14763a68be baseparse: provide default conversion using bps if no fps available
Also store estimated duration as such, rather than pretending otherwise
(e.g. set by subclass).
2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
a7f46ed82a baseparse: check for remaining data when draining in push mode 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
23e55f4d6b baseparse: fix pull mode cache size comparison 2011-04-08 18:07:02 +01:00
Edward Hervey
be9c6045d0 ac3parse: Fix unitialized variable. 2011-04-08 18:07:02 +01:00
Christian Schaller
d461f7529b Update spec file and fix ac3parser header listing in Makefile.am 2011-04-08 18:07:02 +01:00
Michael Smith
3be2f72344 audioparse: fix a format string as reported on irc. 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
432abf42c3 ac3parse: ensure sufficient data available for parsing 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
d90c80e017 ac3parse: extract and use some more details for Enhanced Ac-3 streams 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
0777806170 baseparse: custom bufferflag indicates not to count frame in stats 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
b320b08149 ac3parse: perform additional frame checks when resyncing 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
41e3099d66 ac3parse: inform base parser of frame duration 2011-04-08 18:07:02 +01:00
Mark Nauwelaerts
138c4d7f9c ac3parse: improve src caps settings 2011-04-08 18:07:01 +01:00
Mark Nauwelaerts
37a58ebe3a ac3parse: initial version
MARGINAL rank for now; might take some time for some (useful)
framed=true/false to appear here and there.
2011-04-08 18:07:01 +01:00
Mark Nauwelaerts
781b61b166 amrparse: use (default) time handling of baseparser class 2011-04-08 18:07:01 +01:00
Mark Nauwelaerts
3279f55a77 audioparsers: move 'amrparse' into it 2011-04-08 18:07:01 +01:00
Mark Nauwelaerts
db4181119d audioparsers: reference GstBaseParse now lives here 2011-04-08 18:07:01 +01:00
Mark Nauwelaerts
bd56e3ad79 audioparsers: rename 'aacparse' plugin to generic 'audioparsers' plugin 2011-04-08 18:07:01 +01:00