From: Sebastian Dröge Date: Mon, 5 May 2008 08:43:38 +0000 (+0000) Subject: gst/mpegaudioparse/gstmpegaudioparse.c: Send a new duration message if the average... X-Git-Tag: 1.19.3~505^2~1589 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=744d36d359eeef9a639b2be2cf2edd7976b158d6;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/ChangeLog b/ChangeLog index c362cde..d87baa3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-05 Sebastian Dröge + + * 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-04-30 Wim Taymans * gst/realmedia/rtspreal.c: (rtsp_ext_real_before_send), diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index 544efd9..56dc567 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -39,6 +39,11 @@ GST_DEBUG_CATEGORY_STATIC (mp3parse_debug); #define CRC_PROTECTED 0 #define CRC_NOT_PROTECTED 1 +#define XING_FRAMES_FLAG 0x0001 +#define XING_BYTES_FLAG 0x0002 +#define XING_TOC_FLAG 0x0004 +#define XING_VBR_SCALE_FLAG 0x0008 + #define GST_READ_UINT24_BE(p) (p[2] | (p[1] << 8) | (p[0] << 16)) static inline MPEGAudioSeekEntry * @@ -690,6 +695,16 @@ gst_mp3parse_emit_frame (GstMPEGAudioParse * mp3parse, guint size, mp3parse->last_posted_bitrate = bitrate; gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE, mp3parse->last_posted_bitrate, NULL); + + /* Post a new duration message if the average bitrate changes that much + * so applications can update their cached values + */ + if ((mp3parse->xing_flags & XING_TOC_FLAG) == 0 + && mp3parse->vbri_total_time == 0) { + gst_element_post_message (GST_ELEMENT (mp3parse), + gst_message_new_duration (GST_OBJECT (mp3parse), GST_FORMAT_TIME, + -1)); + } } if (mp3parse->last_posted_crc != crc) { @@ -805,11 +820,6 @@ gst_mp3parse_emit_frame (GstMPEGAudioParse * mp3parse, guint size, return ret; } -#define XING_FRAMES_FLAG 0x0001 -#define XING_BYTES_FLAG 0x0002 -#define XING_TOC_FLAG 0x0004 -#define XING_VBR_SCALE_FLAG 0x0008 - static void gst_mp3parse_handle_first_frame (GstMPEGAudioParse * mp3parse) {