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;
}
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 */