vc1parse: Post VIDEO_CODEC tag
authorSebastian Dröge <sebastian@centricular.com>
Mon, 16 Dec 2013 09:25:22 +0000 (10:25 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 16 Dec 2013 09:25:22 +0000 (10:25 +0100)
gst/videoparsers/gstvc1parse.c
gst/videoparsers/gstvc1parse.h

index 7495df2..9868afa 100644 (file)
@@ -81,7 +81,8 @@
 
 #include "gstvc1parse.h"
 
-#include <gst/base/gstbytereader.h>
+#include <gst/base/base.h>
+#include <gst/pbutils/pbutils.h>
 #include <string.h>
 
 GST_DEBUG_CATEGORY (vc1_parse_debug);
@@ -1218,6 +1219,25 @@ gst_vc1_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
 {
   GstVC1Parse *vc1parse = GST_VC1_PARSE (parse);
 
+  if (!vc1parse->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_VIDEO_CODEC, caps);
+    gst_caps_unref (caps);
+
+    gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (vc1parse),
+        gst_event_new_tag (taglist));
+
+    /* also signals the end of first-frame processing */
+    vc1parse->sent_codec_tag = TRUE;
+  }
+
   if (vc1parse->input_header_format != vc1parse->output_header_format ||
       vc1parse->input_stream_format != vc1parse->output_stream_format) {
     GST_WARNING_OBJECT (vc1parse, "stream conversion not implemented yet");
index ec09fd4..6d97ec8 100644 (file)
@@ -88,6 +88,8 @@ struct _GstVC1Parse
   /* TRUE if the srcpads should be updated */
   gboolean update_caps;
 
+  gboolean sent_codec_tag;
+
   VC1HeaderFormat input_header_format;
   VC1HeaderFormat output_header_format;
   VC1StreamFormat input_stream_format;