G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static void
-gst_vorbis_dec_reset (GstVorbisDec * dec)
-{
- if (dec->taglist)
- gst_tag_list_free (dec->taglist);
- dec->taglist = NULL;
-}
-
static gboolean
vorbis_dec_start (GstAudioDecoder * dec)
{
vorbis_info_init (&vd->vi);
vorbis_comment_init (&vd->vc);
vd->initialized = FALSE;
- gst_vorbis_dec_reset (vd);
return TRUE;
}
vorbis_dsp_clear (&vd->vd);
vorbis_comment_clear (&vd->vc);
vorbis_info_clear (&vd->vi);
- gst_vorbis_dec_reset (vd);
return TRUE;
}
{
guint bitrate = 0;
gchar *encoder = NULL;
- GstTagList *list, *old_list;
+ GstTagList *list;
GstBuffer *buf;
GST_DEBUG_OBJECT (vd, "parsing comment packet");
gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\003vorbis", 7,
&encoder);
- old_list = vd->taglist;
- vd->taglist = gst_tag_list_merge (vd->taglist, list, GST_TAG_MERGE_REPLACE);
+ if (!list) {
+ GST_ERROR_OBJECT (vd, "couldn't decode comments");
+ list = gst_tag_list_new ();
+ }
- if (old_list)
- gst_tag_list_free (old_list);
- gst_tag_list_free (list);
gst_buffer_unref (buf);
- if (!vd->taglist) {
- GST_ERROR_OBJECT (vd, "couldn't decode comments");
- vd->taglist = gst_tag_list_new ();
- }
if (encoder) {
if (encoder[0])
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_ENCODER, encoder, NULL);
g_free (encoder);
}
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_ENCODER_VERSION, vd->vi.version,
GST_TAG_AUDIO_CODEC, "Vorbis", NULL);
if (vd->vi.bitrate_nominal > 0 && vd->vi.bitrate_nominal <= 0x7FFFFFFF) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL);
bitrate = vd->vi.bitrate_nominal;
}
if (vd->vi.bitrate_upper > 0 && vd->vi.bitrate_upper <= 0x7FFFFFFF) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL);
if (!bitrate)
bitrate = vd->vi.bitrate_upper;
}
if (vd->vi.bitrate_lower > 0 && vd->vi.bitrate_lower <= 0x7FFFFFFF) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL);
if (!bitrate)
bitrate = vd->vi.bitrate_lower;
}
if (bitrate) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
+ gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_BITRATE, (guint) bitrate, NULL);
}
+ gst_audio_decoder_merge_tags (GST_AUDIO_DECODER_CAST (vd), list,
+ GST_TAG_MERGE_REPLACE);
if (vd->initialized) {
- gst_element_found_tags_for_pad (GST_ELEMENT_CAST (vd),
- GST_AUDIO_DECODER_SRC_PAD (vd), vd->taglist);
- vd->taglist = NULL;
+ gst_tag_list_free (list);
} else {
/* Only post them as messages for the time being. *
* They will be pushed on the pad once the decoder is initialized */
gst_element_post_message (GST_ELEMENT_CAST (vd),
- gst_message_new_tag (GST_OBJECT (vd), gst_tag_list_copy (vd->taglist)));
+ gst_message_new_tag (GST_OBJECT (vd), list));
}
return GST_FLOW_OK;
vd->initialized = TRUE;
- if (vd->taglist) {
- /* The tags have already been sent on the bus as messages. */
- gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (vd),
- gst_event_new_tag (vd->taglist));
- vd->taglist = NULL;
- }
return GST_FLOW_OK;
/* ERRORS */
#ifdef HAVE_VORBIS_SYNTHESIS_RESTART
vorbis_synthesis_restart (&vd->vd);
#endif
-
- if (hard)
- gst_vorbis_dec_reset (vd);
}