From e65b9b974a7abf0bd80b0608d3197f9de254462a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 Dec 2013 10:13:36 +0100 Subject: [PATCH] diracparse: Post VIDEO_CODEC tag --- gst/videoparsers/gstdiracparse.c | 27 ++++++++++++++++++++++++++- gst/videoparsers/gstdiracparse.h | 2 ++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gst/videoparsers/gstdiracparse.c b/gst/videoparsers/gstdiracparse.c index e71383c406..9307f108b0 100644 --- a/gst/videoparsers/gstdiracparse.c +++ b/gst/videoparsers/gstdiracparse.c @@ -35,7 +35,8 @@ #endif #include -#include +#include +#include #include #include "gstdiracparse.h" #include "dirac_parse.h" @@ -189,8 +190,12 @@ gst_dirac_parse_finalize (GObject * object) static gboolean gst_dirac_parse_start (GstBaseParse * parse) { + GstDiracParse *diracparse = GST_DIRAC_PARSE (parse); + gst_base_parse_set_min_frame_size (parse, 13); + diracparse->sent_codec_tag = FALSE; + return TRUE; } @@ -384,6 +389,26 @@ gst_dirac_parse_convert (GstBaseParse * parse, GstFormat src_format, static GstFlowReturn gst_dirac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) { + GstDiracParse *diracparse = GST_DIRAC_PARSE (parse); + + if (!diracparse->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 (diracparse), + gst_event_new_tag (taglist)); + + /* also signals the end of first-frame processing */ + diracparse->sent_codec_tag = TRUE; + } return GST_FLOW_OK; } diff --git a/gst/videoparsers/gstdiracparse.h b/gst/videoparsers/gstdiracparse.h index 407f272c4b..8b764deeb9 100644 --- a/gst/videoparsers/gstdiracparse.h +++ b/gst/videoparsers/gstdiracparse.h @@ -42,6 +42,8 @@ struct _GstDiracParse DiracSequenceHeader sequence_header; guint32 frame_number; + + gboolean sent_codec_tag; }; struct _GstDiracParseClass