summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-08-16 17:21:24 +0100
committerTim-Philipp Müller <tim@centricular.com>2015-08-16 17:21:24 +0100
commita39bebb5feecfd35745e946249586f5413000c0d (patch)
tree2cc4546d022b39586a08f890a91f6bb29d1dfd20
parentb1dfe209c271dff0bf5e09f682efd70f0ce55266 (diff)
mpegaudioparse: use new baseparse API to fix tag handling
https://bugzilla.gnome.org/show_bug.cgi?id=679768
-rw-r--r--gst/audioparsers/gstmpegaudioparse.c71
1 files changed, 34 insertions, 37 deletions
diff --git a/gst/audioparsers/gstmpegaudioparse.c b/gst/audioparsers/gstmpegaudioparse.c
index 7438bb841..51421cf68 100644
--- a/gst/audioparsers/gstmpegaudioparse.c
+++ b/gst/audioparsers/gstmpegaudioparse.c
@@ -1321,45 +1321,16 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse,
GstBaseParseFrame * frame)
{
GstMpegAudioParse *mp3parse = GST_MPEG_AUDIO_PARSE (parse);
- GstTagList *taglist;
-
- /* tag sending done late enough in hook to ensure pending events
- * have already been sent */
-
- if (!mp3parse->sent_codec_tag) {
- GstCaps *caps;
-
- taglist = gst_tag_list_new_empty ();
-
- /* codec tag */
- caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
- gst_pb_utils_add_codec_description_to_tag_list (taglist,
- GST_TAG_AUDIO_CODEC, caps);
- gst_caps_unref (caps);
-
- if (mp3parse->hdr_bitrate > 0 && mp3parse->xing_bitrate == 0 &&
- mp3parse->vbri_bitrate == 0) {
- /* We don't have a VBR bitrate, so post the available bitrate as
- * nominal and let baseparse calculate the real bitrate */
- gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
- GST_TAG_NOMINAL_BITRATE, mp3parse->hdr_bitrate, NULL);
- }
- gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (mp3parse),
- gst_event_new_tag (taglist));
-
- /* also signals the end of first-frame processing */
- mp3parse->sent_codec_tag = TRUE;
- }
+ GstTagList *taglist = NULL;
/* we will create a taglist (if any of the parameters has changed)
* to add the tags that changed */
- taglist = NULL;
if (mp3parse->last_posted_crc != mp3parse->last_crc) {
gboolean using_crc;
- if (!taglist) {
+ if (!taglist)
taglist = gst_tag_list_new_empty ();
- }
+
mp3parse->last_posted_crc = mp3parse->last_crc;
if (mp3parse->last_posted_crc == CRC_PROTECTED) {
using_crc = TRUE;
@@ -1371,19 +1342,45 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse,
}
if (mp3parse->last_posted_channel_mode != mp3parse->last_mode) {
- if (!taglist) {
+ if (!taglist)
taglist = gst_tag_list_new_empty ();
- }
+
mp3parse->last_posted_channel_mode = mp3parse->last_mode;
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_MODE,
gst_mpeg_audio_channel_mode_get_nick (mp3parse->last_mode), NULL);
}
- /* if the taglist exists, we need to send it */
+ /* tag sending done late enough in hook to ensure pending events
+ * have already been sent */
+ if (taglist != NULL || !mp3parse->sent_codec_tag) {
+ GstCaps *caps;
+
+ if (taglist == NULL)
+ taglist = gst_tag_list_new_empty ();
+
+ /* codec tag */
+ caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
+ gst_pb_utils_add_codec_description_to_tag_list (taglist,
+ GST_TAG_AUDIO_CODEC, caps);
+ gst_caps_unref (caps);
+
+ if (mp3parse->hdr_bitrate > 0 && mp3parse->xing_bitrate == 0 &&
+ mp3parse->vbri_bitrate == 0) {
+ /* We don't have a VBR bitrate, so post the available bitrate as
+ * nominal and let baseparse calculate the real bitrate */
+ gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
+ GST_TAG_NOMINAL_BITRATE, mp3parse->hdr_bitrate, NULL);
+ }
+
+ /* also signals the end of first-frame processing */
+ mp3parse->sent_codec_tag = TRUE;
+ }
+
+ /* if the taglist exists, we need to update it so it gets sent out */
if (taglist) {
- gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (mp3parse),
- gst_event_new_tag (taglist));
+ gst_base_parse_merge_tags (parse, taglist, GST_TAG_MERGE_REPLACE);
+ gst_tag_list_unref (taglist);
}
/* usual clipping applies */