Commit graph

116 commits

Author SHA1 Message Date
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
Jan Schmidt
18df8e3250 Move xingmux from -bad.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-ugly-plugins-docs.sgml:
* docs/plugins/gst-plugins-ugly-plugins-sections.txt:
* docs/plugins/inspect/plugin-mpegaudioparse.xml:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
* gst/mpegaudioparse/gstxingmux.c:
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
Move xingmux from -bad.
2008-02-08 00:36:51 +00:00
Sébastien Moutte
c29660156f gst/mpegaudioparse/gstmpegaudioparse.c: Use gst_guint64_to_gdouble for conversion
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:(mp3parse_time_to_bytepos):
Use gst_guint64_to_gdouble for conversion
* win32/vs6/libgstasfdemux.dsp:
* win32/vs6/libgstdvdsub.dsp:
* win32/vs6/libgstrealmedia.dsp:
Update project dependencies and add new source files
2008-02-07 19:25:08 +00:00
Sebastian Dröge
0679293a71 gst/mpegaudioparse/gstmpegaudioparse.c: Don't set new caps on the srcpad everytime the bitrate or MPEG version change...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_caps_create),
(gst_mp3parse_chain):
Don't set new caps on the srcpad everytime the bitrate or MPEG
version changes but calculate new spf value when the MPEG version
changes.
2008-01-29 19:10:38 +00:00
Sebastian Dröge
eecdae5af2 gst/mpegaudioparse/gstmpegaudioparse.c: Interpolate the VBRI seek table entries to get better results, support 3 byte...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_handle_first_frame), (mp3parse_time_to_bytepos),
(mp3parse_bytepos_to_time):
Interpolate the VBRI seek table entries to get better results,
support 3 byte seek table entries and prevent overflows in the
seek table by adding the relative offsets when using the seek
table in a large enough data type.
2008-01-15 17:18:31 +00:00
Sebastian Dröge
7b5d4c287e gst/mpegaudioparse/gstmpegaudioparse.*: Add support for seeking based on the VBRI seek table. Might make sense to use...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_reset),
(gst_mp3parse_handle_first_frame), (mp3parse_time_to_bytepos),
(mp3parse_bytepos_to_time):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Add support for seeking based on the VBRI seek table. Might make
sense to use interpolation in the table later to get hopefully a
bit more accurate values.
2008-01-14 15:02:13 +00:00
Sebastian Dröge
be2f3d1d99 gst/mpegaudioparse/gstmpegaudioparse.*: Add initial support for reading VBRI headers as found in VBR files created by...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_reset),
(gst_mp3parse_emit_frame), (gst_mp3parse_handle_first_frame),
(mp3parse_total_bytes), (mp3parse_total_time):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Add initial support for reading VBRI headers as found in VBR files
created by some Fraunhofer encoders. Currently we only read the
number of frames and bytes (and calculate duration, etc from this)
but there is also a seek table that we currently don't use.
2008-01-14 10:42:48 +00:00
Sebastian Dröge
1db9aa8d23 gst/mpegaudioparse/gstmpegaudioparse.c: Guard against 0 values in the Xing header as frame count and byte count and c...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_handle_first_frame):
Guard against 0 values in the Xing header as frame count and
byte count and calculate the bitrate when we have all values
we need and not before.
2008-01-14 09:13:29 +00:00
Sebastian Dröge
d7f415e09f Make sure that the Xing TOC starts with 0 and the entries are increasing over time. Otherwise it's broken and should ...
Original commit message from CVS:
* ext/mad/gstmad.c: (mpg123_parse_xing_header):
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_handle_first_frame):
Make sure that the Xing TOC starts with 0 and the entries
are increasing over time. Otherwise it's broken and should
be skipped. Fixes bug #507821.
2008-01-08 19:42:38 +00:00
Sebastian Dröge
2e915caedb gst/mpegaudioparse/gstmpegaudioparse.c: Don't post SEGMENT_START messages on the bus, only the element driving the pi...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event), (mp3parse_handle_seek):
Don't post SEGMENT_START messages on the bus, only the element
driving the pipeline should do that.
2007-12-13 11:20:11 +00:00
Jan Schmidt
a71b8048bc gst/mpegaudioparse/gstmpegaudioparse.c: Restore the segment handling logic.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
Restore the segment handling logic.
Please don't do behavioural changes under the heading of 'leak fixes'
or 'whitespace changes', people.
2007-11-19 11:38:49 +00:00
Stefan Kost
b4cde6fa14 gst/mpegaudioparse/gstmpegaudioparse.c: Plug some leaks.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
Plug some leaks.
2007-11-19 09:50:58 +00:00
Wim Taymans
5bfb6579b8 gst/mpegaudioparse/gstmpegaudioparse.c: Remove some more broken code, it seems to clip even when it should not.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_emit_frame):
Remove some more broken code, it seems to clip even when it should not.
See #491305.
2007-10-30 12:27:32 +00:00
Wim Taymans
2b5d45e3f6 gst/mpegaudioparse/gstmpegaudioparse.c: When the element is not driving the streaming thread it is not supposed to em...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_emit_frame):
When the element is not driving the streaming thread it is not supposed
to emit EOS or post SEGMENT done. It is allowed to return UNEXPECTED
upstream when it detects EOS. See #491305.
2007-10-30 11:13:49 +00:00
Sébastien Moutte
2add92153f gst/mpegaudioparse/gstmpegaudioparse.c: Use gst_util_guint64_to_gdouble for conversions.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (mp3parse_time_to_bytepos),
(mp3parse_bytepos_to_time):
Use gst_util_guint64_to_gdouble for conversions.
* win32/vs6/libgstmad.dsp:
Add a link to libgstaudio.
2007-09-29 17:11:16 +00:00
Jan Schmidt
cf06fbf1b7 gst/dvdlpcmdec/gstdvdlpcmdec.c: Add other allowed rates to the pad templates.
Original commit message from CVS:
* gst/dvdlpcmdec/gstdvdlpcmdec.c:
Add other allowed rates to the pad templates.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_dispose):
Reset the parser to release memory in dispose.
2007-08-24 15:55:03 +00:00
Wim Taymans
5b39e551b1 gst/mpegaudioparse/gstmpegaudioparse.*: Queue segment event and push it after we know the caps on the pad or else an ...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event), (gst_mp3parse_emit_frame):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Queue segment event and push it after we know the caps on the pad or
else an autoplugger might not have plugged the element yet and the
segment is lost.
2007-08-16 11:52:57 +00:00
Sebastian Dröge
d1e3a616ca gst/mpegaudioparse/gstmpegaudioparse.*: Save some memory for each frame by only saving the start timestamp and start ...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_reset),
(gst_mp3parse_emit_frame), (mp3parse_handle_seek):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Save some memory for each frame by only saving the start timestamp
and start byte position instead of additionally the stop timestamp
and stop byte position. This requires us to use a doubly-linked list
but still saves 8-12 bytes per frame.
2007-07-18 17:51:55 +00:00
Jan Schmidt
4039063c80 gst/mpegaudioparse/gstmpegaudioparse.c: Fix a calculation that was causing mp3parse to drop every incoming frame when...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_emit_frame):
Fix a calculation that was causing mp3parse to drop every incoming
frame when upstream delivered a segment in TIME format, breaking
playback of all mpeg system streams.
2007-07-15 19:39:46 +00:00
Sebastian Dröge
712a416ecd gst/mpegaudioparse/gstmpegaudioparse.*: Implement accurate seeking in mpegaudioparse. Fixes #308312.
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_reset),
(gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (mp3parse_seek_table_last_entry),
(gst_mp3parse_emit_frame), (gst_mp3parse_chain),
(mp3parse_handle_seek), (mp3parse_src_query):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Implement accurate seeking in mpegaudioparse. Fixes #308312.
Also implement segment seeks.
2007-07-13 16:27:56 +00:00