flacparse: Post AUDIO_CODEC tag

https://bugzilla.gnome.org/show_bug.cgi?id=720512
This commit is contained in:
Sebastian Dröge 2013-12-16 09:58:31 +01:00
parent 29f2cae129
commit 05e196cbb6
2 changed files with 25 additions and 3 deletions

View file

@ -58,9 +58,8 @@
#include <string.h>
#include <gst/tag/tag.h>
#include <gst/audio/audio.h>
#include <gst/base/gstbitreader.h>
#include <gst/base/gstbytereader.h>
#include <gst/base/base.h>
#include <gst/pbutils/pbutils.h>
GST_DEBUG_CATEGORY_STATIC (flacparse_debug);
#define GST_CAT_DEFAULT flacparse_debug
@ -338,6 +337,8 @@ gst_flac_parse_start (GstBaseParse * parse)
flacparse->sample_number = 0;
flacparse->strategy_checked = FALSE;
flacparse->sent_codec_tag = FALSE;
/* "fLaC" marker */
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), 4);
@ -1690,6 +1691,25 @@ gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
GstFlacParse *flacparse = GST_FLAC_PARSE (parse);
if (!flacparse->sent_codec_tag) {
GstTagList *taglist;
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);
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (flacparse),
gst_event_new_tag (taglist));
/* also signals the end of first-frame processing */
flacparse->sent_codec_tag = TRUE;
}
/* Push tags */
if (flacparse->tags) {
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (flacparse),

View file

@ -76,6 +76,8 @@ struct _GstFlacParse {
guint64 sample_number;
gboolean strategy_checked;
gboolean sent_codec_tag;
GstTagList *tags;
GstToc *toc;