From 6934c7e2fc7d06534419d22c3dbb964287c81ab0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 Dec 2013 10:18:23 +0100 Subject: [PATCH] h264parse: Post VIDEO_CODEC tag --- gst/videoparsers/gsth264parse.c | 27 ++++++++++++++++++++++++--- gst/videoparsers/gsth264parse.h | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index a9153c8..8a144d6 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -26,9 +26,8 @@ # include "config.h" #endif -#include -#include -#include +#include +#include #include #include "gsth264parse.h" @@ -207,6 +206,8 @@ gst_h264_parse_reset (GstH264Parse * h264parse) h264parse->ts_trn_nb = GST_CLOCK_TIME_NONE; h264parse->do_ts = TRUE; + h264parse->sent_codec_tag = FALSE; + h264parse->pending_key_unit_ts = GST_CLOCK_TIME_NONE; h264parse->force_key_unit_event = NULL; @@ -1568,6 +1569,26 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GstEvent *event; h264parse = GST_H264_PARSE (parse); + + if (!h264parse->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 (h264parse), + gst_event_new_tag (taglist)); + + /* also signals the end of first-frame processing */ + h264parse->sent_codec_tag = TRUE; + } + buffer = frame->buffer; if ((event = check_pending_key_unit_event (h264parse->force_key_unit_event, diff --git a/gst/videoparsers/gsth264parse.h b/gst/videoparsers/gsth264parse.h index 88de544..d8eb4d9 100644 --- a/gst/videoparsers/gsth264parse.h +++ b/gst/videoparsers/gsth264parse.h @@ -78,6 +78,8 @@ struct _GstH264Parse gboolean have_sps; gboolean have_pps; + gboolean sent_codec_tag; + /* collected SPS and PPS NALUs */ GstBuffer *sps_nals[GST_H264_MAX_SPS_COUNT]; GstBuffer *pps_nals[GST_H264_MAX_PPS_COUNT]; -- 2.7.4