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

index 5698019..badc32d 100644 (file)
@@ -29,8 +29,8 @@
 #endif
 
 #include <string.h>
-#include <gst/base/gstbytereader.h>
-#include <gst/pbutils/codec-utils.h>
+#include <gst/base/base.h>
+#include <gst/pbutils/pbutils.h>
 #include <gst/video/video.h>
 
 #include "gstmpeg4videoparse.h"
@@ -709,6 +709,25 @@ gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
   gboolean push_codec = FALSE;
   GstEvent *event = NULL;
 
+  if (!mp4vparse->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 (mp4vparse),
+        gst_event_new_tag (taglist));
+
+    /* also signals the end of first-frame processing */
+    mp4vparse->sent_codec_tag = TRUE;
+  }
+
   if ((event = check_pending_key_unit_event (mp4vparse->force_key_unit_event,
               &parse->segment, GST_BUFFER_TIMESTAMP (buffer),
               GST_BUFFER_FLAGS (buffer), mp4vparse->pending_key_unit_ts))) {
index b81b488..a675324 100644 (file)
@@ -54,6 +54,7 @@ struct _GstMpeg4VParse {
   gboolean config_found;
   gboolean intra_frame;
   gboolean update_caps;
+  gboolean sent_codec_tag;
 
   GstMpeg4VisualObject vo;
   gint vo_offset;