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

index 752c0ff..1dc0927 100644 (file)
@@ -22,9 +22,8 @@
 #  include "config.h"
 #endif
 
-#include <gst/base/gstbytereader.h>
-#include <gst/base/gstbytewriter.h>
-#include <gst/base/gstadapter.h>
+#include <gst/base/base.h>
+#include <gst/pbutils/pbutils.h>
 #include <gst/video/video.h>
 #include "gsth265parse.h"
 
@@ -198,6 +197,8 @@ gst_h265_parse_reset (GstH265Parse * h265parse)
   h265parse->have_sps = FALSE;
   h265parse->have_vps = FALSE;
 
+  h265parse->sent_codec_tag = FALSE;
+
   h265parse->pending_key_unit_ts = GST_CLOCK_TIME_NONE;
   h265parse->force_key_unit_event = NULL;
 
@@ -1518,6 +1519,26 @@ gst_h265_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
   GstEvent *event;
 
   h265parse = GST_H265_PARSE (parse);
+
+  if (!h265parse->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 (h265parse),
+        gst_event_new_tag (taglist));
+
+    /* also signals the end of first-frame processing */
+    h265parse->sent_codec_tag = TRUE;
+  }
+
   buffer = frame->buffer;
 
   if ((event = check_pending_key_unit_event (h265parse->force_key_unit_event,
index 108739b..7e07a60 100644 (file)
@@ -89,6 +89,8 @@ struct _GstH265Parse
   /* props */
   guint interval;
 
+  gboolean sent_codec_tag;
+
   GstClockTime pending_key_unit_ts;
   GstEvent *force_key_unit_event;
 };