Commit graph

135 commits

Author SHA1 Message Date
Sebastian Dröge
c88c88de0d build: Add all kinds of compiler warning flags and fix the resulting warnings 2010-03-24 11:27:40 +01:00
Benjamin Otte
9850bd814f gst_element_class_set_details => gst_element_class_set_details_simple 2010-03-18 15:53:14 +01:00
Mark Nauwelaerts
8e5df1a902 mp3parse: minor validation check of (Xing, VBRI) metadata
... to detect e.g. a truncated file, rendering some of the metadata invalid.
2010-01-04 15:25:52 +01:00
Mark Nauwelaerts
b64f6065c2 mp3parse: use proper total_time and total_bytes in various cases
The correct basis for (Xing, VBRI) seek table calculations is the
byte size and duration provided by that metadata, rather than some
other (possibly even estimated) one.  This also prevents an infinite
conversion loop in (unlikely) case where a TOC is provided without
such corresponding (duration) metdata.
2010-01-04 15:25:50 +01:00
Thiago Santos
5e3f07b6a1 mp3parse: conserve stop time for non-accurate seek
Use the same strategy as accurate seeks to store
pending non-accurate seeks to avoid overwriting non-definite
stop times. When doing non-accurate seeks our position
reporting might drift off by some secs and the stream can
end up before it should.

Fixes #603695
2010-01-04 10:01:44 -03:00
Thiago Santos
ea7a9e550a mp3parse: return false when we can't seek
When upstream can't seek, we return false as well
2009-12-08 19:01:50 -03:00
Mark Nauwelaerts
9fe72b5da3 mp3parse: fix non-flushing seek
Specifically, in addition to clearing lots of variables/offsets
when receiving newsegment, also clear leftover data to match.
2009-11-26 15:58:57 +01:00
Edward Hervey
33b4528a0e mpegaudioparse: Don't use expensive glib ways to get an enum nick.
Fixes #598761

This removes a good 50% of processing time for parsing a buffer.

We do this by simply... getting the nicks that we already have handy
instead of going through the expensive glib system.
2009-10-24 20:37:13 +02:00
Josep Torra
9c6b0cacb5 mpegaudioparse: fix warning in macosx snow leopard 2009-10-11 16:14:08 +02:00
René Stadler
0b0b07eb49 mp3parse: don't fail SEEKING query when upstream query fails for TIME format 2009-10-08 20:10:11 +03:00
Mark Nauwelaerts
820abb3ab8 mpegaudioparse: prevent infinite (re)syncing
Conflicts:

	gst/mpegaudioparse/gstmpegaudioparse.c
2009-09-25 18:11:48 +02:00
Michael Smith
8307e177ba mp3parse: Refactor checking for sync. Make resyncing more reliable.
Previously, we could get false sync relatively easily - it sometimes happened
on real files. This cleans the code up a fair bit, and makes it require more
confirmation that we've found valid sync before continuing.
2009-09-22 12:17:18 -07:00
Mark Nauwelaerts
57d01c2526 mpegaudioparse: ensure 2 valid headers in a row when resyncing 2009-09-17 16:22:36 +02:00
Mark Nauwelaerts
52f6764e4c mpegaudioparse: use metadata (xing, vbri) provided bytesize for conversions
Metadata provided seek tables are consistent with metadata's view of
total size, which typically matches real size, but need not do so
(e.g. a truncated file).  Fixes seeking and position reporting
in such truncated files (although duration based on metadata may then
still be incorrect).
2009-08-14 12:07:40 +02:00
Mark Nauwelaerts
6aa267cfc8 mpegaudioparse: fix Xing inverse seek table building 2009-06-25 18:27:54 +02:00
Tim-Philipp Müller
af3ab2ae94 mp3parse: don't put every single frame into the index
Let's not put every single mp3 frame in our index, a few frames per
second should be more than enough. For now use an index interval
of 100ms-500ms depending on the upstream size, to keep the index at
a reasonable size. Factor out the code that adds the index entry
into a separate function for better code readability.
2009-06-22 10:41:26 +01:00
Tim-Philipp Müller
1db592839e mp3parse: assume seekability only if we know the upstream size
While technically upstream may be seekable even if it doesn't know
the exact size, I can't think of a use case where this distincation
is relevant in practice, so for now just assume we're not seekable
if upstream doesn't provide us with a size. Makes sure we don't
build a seek index when streaming internet radio with sources that
pretend to be seekable until you try to actually seek.
2009-06-22 10:41:26 +01:00
Tim-Philipp Müller
674323b56d mpegaudioparse: remove some pointless g_return_if_fail()s 2009-05-09 10:57:34 +01:00
Jan Schmidt
b18371c1ca mp3parse: Don't reject valid Xing tables of contents
Some Xing headers apparently start the TOC at byte 1 instead of 0. Don't
reject them because of it, just subtract the initial offset when reading
the table.
2009-05-06 15:37:44 +01:00
Jan Schmidt
85a88a0a64 mp3parse: Allow more bits to change in headers during resynch
Be more lenient about what we accept as changing bits in a header - basically,
only require that the mp3 sync marker is present, for the mpeg version,
layer and samplerate.

Fixes: #581464
2009-05-06 15:27:01 +01:00
Edward Hervey
c1953235fa mpegaudioparse: Remove useless checks for valid buffer duration.
The buffer duration is set to a valid value at the very top of
emit_frame(), we therefore don't need to check it later on.
2009-05-06 13:15:30 +02:00
Edward Hervey
21d2fffb13 mpegaudioparse: Fix stop condition for outputting buffers.
Some mp3 streams have an offset in timestamps, requiring us to push the
frame *AFTER* segment.stop in order for the decoder to be able to push
all data up to the segment.stop position.
2009-05-06 13:13:35 +02:00
Michael Smith
e7450c2df7 mp3parse: don't build seek table if we can't seek.
Fixes #573720 - unbounded memory usage increase when listening to mp3
stream for a long time.
2009-04-21 14:16:52 -07:00
Edward Hervey
8dcbcd6645 mpegaudioparse: Remove dead assignment and duplicate code 2009-04-21 20:37:20 +02:00
Jan Schmidt
d2c6f0b2b6 mp3parse: Fix glitches in the output when playing (for e.g.) AVI
Don't introduce glitches in the output by a) relaxing the threshold for
taking upstream timestamps in preference to our calculated timestamps and
b) only set the discont flag on outgoing buffers in response to an incoming
discont buffer.

Fixes: #575046
2009-03-13 19:25:12 +00:00
Alessandro Decina
abf7f47769 mp3parse: fix deadlock with accurate seeks.
Release pending_accurate_seeks_lock before forwarding the seek event upstream.
Fixes #575068.
2009-03-12 15:57:31 +01:00
Michael Smith
777eb4d9cc mp3parse: be more conservative when changing layer/rate/etc.
Don't allow a change in sample rate/channels/layer/version unless we can
see another frame at the correct offset. Prevents accidently flipping
due to simple single-bit corruption.
2009-03-06 13:21:36 -08:00
René Stadler
be6292d4de mpegaudioparse: Remove empty lines added by buggy indent. 2009-03-04 16:17:06 +02:00
Mark Nauwelaerts
d950699d2e mpegaudioparse: Provide SEEKING query handling.
Since SEEK event handling might perform some conversion
from TIME to BYTES, do not let upstream fool application
into (TIME) seeking not being possible.
2009-02-27 14:58:21 +01:00
Michael Smith
d61498d842 mp3parse: fix accurate seeks to near 0
Integer underflow made accurate seeks to near zero fail and seek to
completely the wrong place. Fix by clamping to zero, since we can't seek
to negative times anyway.
2009-02-25 13:34:05 -08:00
Tim-Philipp Müller
8c6bcd6771 gst/mpegaudioparse/gstmpegaudioparse.*: Do an initial class_ref on an internal enum type from within the class_init f...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (channel_mode_class),
(GST_TYPE_MP3_CHANNEL_MODE), (mp3_type_frame_length_from_header),
(gst_mp3parse_emit_frame), (mp3parse_get_query_types):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Do an initial class_ref on an internal enum type from within the
class_init function so that there aren't any issues when multiple
mp3parse elements are started in separate threads at the same
time. (Why we use an enum type here if the tag is registered as
a string type, I don't know). Also remove custom UNUSED macro
and use GLib's instead.
2008-12-10 15:42:21 +00:00
Michael Smith
46c5294930 gst/mpegaudioparse/gstmpegaudioparse.c: Calculate samples per frame correctly for "MPEG 2.5" layer 3.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
Calculate samples per frame correctly for "MPEG 2.5" layer 3.
Fixes skipping on these files.
2008-10-14 19:28:05 +00:00
Sebastian Dröge
62d483656b gst/mpegaudioparse/gstmpegaudioparse.c: Post a GST_ELEMENT_ERROR if we get EOS before seeing any valid frames. Partia...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event):
Post a GST_ELEMENT_ERROR if we get EOS before seeing any valid
frames. Partially fixes bug #552237.
2008-10-13 09:04:15 +00:00
Sebastian Dröge
6d5dba30d2 gst/mpegaudioparse/gstmpegaudioparse.c: Don't recurse from mp3parse_bytepos_to_time() to mp3parse_total_time() if we'...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event), (gst_mp3parse_emit_frame),
(mp3parse_total_time), (mp3parse_bytepos_to_time):
Don't recurse from mp3parse_bytepos_to_time() to mp3parse_total_time()
if we're called from there already. Otherwise we end up in a endless
recursion and crash with a stack overflow.
This can happen when a Xing or VBRI header with TOC exists but it
doesn't contain the total time. Fixes bug #545370.
2008-07-31 14:35:40 +00:00
Sebastian Dröge
d2d56eb183 Put the MPEG audio version into the caps as "mpegaudioversion".
Original commit message from CVS:
* ext/lame/gstlame.c: (gst_lame_sink_setcaps):
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (mp3_caps_create),
(gst_mp3parse_chain):
Put the MPEG audio version into the caps as "mpegaudioversion".
This is different from "mpegversion".
2008-07-27 11:01:12 +00:00
Edward Hervey
8c0a922780 gst/mpegaudioparse/gstmpegaudioparse.c: Fix build on macosx.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (head_check):
Fix build on macosx.
2008-06-26 10:40:03 +00:00
Sebastian Dröge
9838809d93 gst/mpegaudioparse/gstmpegaudioparse.c: Don't mark MPEG headers with emphasis == 0x2 as invalid. This emphasis value ...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (head_check):
Don't mark MPEG headers with emphasis == 0x2 as invalid. This
emphasis value is reserved but unfortunately files with that
value exist and the information is not important for the decoder
anyway. Fixes bug #537235.
2008-06-09 07:51:00 +00:00
Edward Hervey
130c46902a Always let FLUSH_START events flow downstream.
Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_sink_event):
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event):
Always let FLUSH_START events flow downstream.
2008-05-10 00:44:00 +00:00
Sebastian Dröge
744d36d359 gst/mpegaudioparse/gstmpegaudioparse.c: Send a new duration message if the average bitrate changed and we don't know ...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_emit_frame):
Send a new duration message if the average bitrate changed and
we don't know the duration from the Xing or VBRI header.
Fixes bug #321857.
2008-05-05 08:43:38 +00:00
Sebastian Dröge
0815b78811 Depend on GLib 2.12 and use it unconditionally as we do in other modules too already.
Original commit message from CVS:
* configure.ac:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mpeg_audio_seek_entry_free):
* gst/mpegaudioparse/gstxingmux.c: (gst_xing_seek_entry_free):
Depend on GLib 2.12 and use it unconditionally as we do in other
modules too already.
2008-04-04 19:04:20 +00:00
Sebastian Dröge
e6107e7b39 gst/mpegaudioparse/: Use GSlice for allocating the seek table entries if we compile with
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mpeg_audio_seek_entry_new), (mpeg_audio_seek_entry_free),
(gst_mp3parse_reset), (gst_mp3parse_emit_frame):
* gst/mpegaudioparse/gstxingmux.c: (gst_xing_seek_entry_new),
(gst_xing_seek_entry_free), (gst_xing_mux_finalize), (xing_reset),
(gst_xing_mux_chain):
Use GSlice for allocating the seek table entries if we compile with
GLib 2.10 or newer.
2008-04-03 15:21:50 +00:00
Sebastian Dröge
62204cad3d gst/mpegaudioparse/gstmpegaudioparse.c: Don't take the stream lock when caching events. This is not necessary and res...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event):
Don't take the stream lock when caching events. This is not necessary
and results in a deadlock when seeking with rhythmbox (but not with
totem or banshee for some reason).
2008-03-12 16:09:48 +00:00
Wim Taymans
9142cfca7f gst/mpegaudioparse/gstmpegaudioparse.c: Remove trailing newlines from debug statements.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event), (gst_mp3parse_chain):
Remove trailing newlines from debug statements.
2008-03-10 15:13:10 +00:00
Sebastian Dröge
71f6199a90 Push EOS, FLUSH_STOP and NEWSEGMENT immediately instead of dropping and leaking them.
Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_sink_event):
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event):
Push EOS, FLUSH_STOP and NEWSEGMENT immediately instead
of dropping and leaking them.
2008-02-27 15:23:51 +00:00
Sebastian Dröge
b6529e9d60 Cache all events except EOS if we still have to send a NEWSEGMENT event. This will let TAG events be forwarded until ...
Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_dispose), (gst_mad_sink_event),
(gst_mad_chain):
* ext/mad/gstmad.h:
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_emit_frame):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Cache all events except EOS if we still have to send a NEWSEGMENT
event. This will let TAG events be forwarded until after decodebin
to an encoder for example as decodebin only links the pads
after NEWSEGMENT. Fixes bug #518933.
2008-02-27 13:18:57 +00:00
Thiago Sousa Santos
a07c914565 gst/mpegaudioparse/gstmpegaudioparse.*: Post channel mode and CRC as tags. Fixes bug #504493.
Original commit message from CVS:
Patch by: Thiago Sousa Santos <thiagoss at lcc dot ufcg dot edu dot br>
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3_channel_mode_get_type),
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_emit_frame),
(gst_mp3parse_chain):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Post channel mode and CRC as tags. Fixes bug #504493.
2008-02-22 07:11:17 +00:00
Sebastian Dröge
14926b9c60 gst/mpegaudioparse/gstmpegaudioparse.c: Try a bit harder to get valid timestamps, especially if upstream gives us one...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_emit_frame), (gst_mp3parse_chain):
Try a bit harder to get valid timestamps, especially if upstream
gives us one and we are at the first frame or resyncing.
Return UNEXPECTED if we get a valid timestamp that is outside of
our configured segment. After all changes done so far this doesn't
seem to cause any regression, please test.
2008-02-22 06:25:28 +00:00
Sebastian Dröge
2a179a3b1a gst/mpegaudioparse/gstmpegaudioparse.c: Handler buffers without valid timestamp more correctly: Don't drop them and d...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_emit_frame):
Handler buffers without valid timestamp more correctly: Don't drop
them and don't use the invalid timestamp to calculate the next
timestamp. Fixes bug #516811.
2008-02-18 10:25:16 +00:00
Jan Schmidt
a739f67bc2 gst/mpegaudioparse/gstmpegaudioparse.c: Revert previous commit to mp3parse, as it breaks playback of AVI files.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
Revert previous commit to mp3parse, as it breaks playback
of AVI files.
2008-02-17 18:49:30 +00:00
Sebastian Dröge
451f53d7de gst/mpegaudioparse/gstmpegaudioparse.c: Return GST_FLOW_UNEXPECTED if we get data that is after our configured segmen...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_emit_frame):
Return GST_FLOW_UNEXPECTED if we get data that is after our
configured segment. This makes upstream go EOS immediately instead
of sending us the complete stream. Also improve debugging a bit.
2008-02-14 13:58:42 +00:00