diff options
author | Carlos Rafael Giani <dv@pseudoterminal.org> | 2012-10-24 00:22:05 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-10-24 13:43:16 +0100 |
commit | 8ba422839a3bd602a42f01140ca820e6b752055b (patch) | |
tree | 2ee7f2a1957f694116e7aa3805c1b15f2608fce4 /ext | |
parent | 2de930689c57291c12f2ea5ec9af984eccf6af4e (diff) | |
download | gstreamer-plugins-bad-8ba422839a3bd602a42f01140ca820e6b752055b.tar.gz |
mpg123: fixed bug with last frame, disabled internal resampler & chatter
* The last MP3 frame wasn't being pushed when base class was draining
* Made sure mpg123 cannot ever use its (crude) internal resampler
* Disabled mpg123 stderr output
https://bugzilla.gnome.org/show_bug.cgi?id=686595
Diffstat (limited to 'ext')
-rw-r--r-- | ext/mpg123/gstmpg123audiodec.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/ext/mpg123/gstmpg123audiodec.c b/ext/mpg123/gstmpg123audiodec.c index 5b05dbeb8..5052eaba1 100644 --- a/ext/mpg123/gstmpg123audiodec.c +++ b/ext/mpg123/gstmpg123audiodec.c @@ -228,6 +228,11 @@ gst_mpg123_audio_dec_start (GstAudioDecoder * dec) /* Sets the resync limit to the end of the stream (otherwise mpg123 may give * up on decoding prematurely, especially with mp3 web radios) */ mpg123_param (mpg123_decoder->handle, MPG123_RESYNC_LIMIT, -1, 0); + /* Don't let mpg123 resample output */ + mpg123_param (mpg123_decoder->handle, MPG123_REMOVE_FLAGS, + MPG123_AUTO_RESAMPLE, 0); + /* Don't let mpg123 print messages to stdout/stderr */ + mpg123_param (mpg123_decoder->handle, MPG123_ADD_FLAGS, MPG123_QUIET, 0); /* Open in feed mode (= encoded data is fed manually into the handle). */ error = mpg123_open_feed (mpg123_decoder->handle); @@ -315,24 +320,23 @@ gst_mpg123_audio_dec_handle_frame (GstAudioDecoder * dec, size_t num_decoded_bytes; GstFlowReturn retval; - if (G_UNLIKELY (input_buffer == NULL)) - return GST_FLOW_OK; - mpg123_decoder = GST_MPG123_AUDIO_DEC (dec); g_assert (mpg123_decoder->handle != NULL); /* The actual decoding */ { - GstMapInfo info; - - /* feed input data */ - if (gst_buffer_map (input_buffer, &info, GST_MAP_READ)) { - mpg123_feed (mpg123_decoder->handle, info.data, info.size); - gst_buffer_unmap (input_buffer, &info); - } else { - GST_ERROR_OBJECT (mpg123_decoder, "gst_memory_map() failed"); - return GST_FLOW_ERROR; + /* feed input data (if there is any) */ + if (G_LIKELY (input_buffer != NULL)) { + GstMapInfo info; + + if (gst_buffer_map (input_buffer, &info, GST_MAP_READ)) { + mpg123_feed (mpg123_decoder->handle, info.data, info.size); + gst_buffer_unmap (input_buffer, &info); + } else { + GST_ERROR_OBJECT (mpg123_decoder, "gst_memory_map() failed"); + return GST_FLOW_ERROR; + } } /* Try to decode a frame */ |