summaryrefslogtreecommitdiff
path: root/gst/videoparsers/gstmpegvideoparse.c
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2011-09-14 16:14:24 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2011-09-14 16:14:54 +0200
commita31d541f0757e5a7446acec03c9d1eb20d409ad1 (patch)
treeb7b47dfbab19c0785ad6bae3e9ac9ad16bc6e360 /gst/videoparsers/gstmpegvideoparse.c
parent00e635e78676fd6680d2a0789dcad77e61c25d54 (diff)
downloadgstreamer-plugins-bad-a31d541f0757e5a7446acec03c9d1eb20d409ad1.tar.gz
mpegvideoparse: send a video-codec tag
https://bugzilla.gnome.org/show_bug.cgi?id=569305
Diffstat (limited to 'gst/videoparsers/gstmpegvideoparse.c')
-rw-r--r--gst/videoparsers/gstmpegvideoparse.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c
index bbf4194f9..f1593e106 100644
--- a/gst/videoparsers/gstmpegvideoparse.c
+++ b/gst/videoparsers/gstmpegvideoparse.c
@@ -71,6 +71,8 @@ static gboolean gst_mpegv_parse_check_valid_frame (GstBaseParse * parse,
static GstFlowReturn gst_mpegv_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
static gboolean gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps);
+static GstFlowReturn gst_mpegv_parse_pre_push_frame (GstBaseParse * parse,
+ GstBaseParseFrame * frame);
static void gst_mpegv_parse_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@@ -164,6 +166,8 @@ gst_mpegv_parse_class_init (GstMpegvParseClass * klass)
GST_DEBUG_FUNCPTR (gst_mpegv_parse_check_valid_frame);
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_mpegv_parse_parse_frame);
parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_mpegv_parse_set_caps);
+ parse_class->pre_push_frame =
+ GST_DEBUG_FUNCPTR (gst_mpegv_parse_pre_push_frame);
}
static void
@@ -187,6 +191,7 @@ gst_mpegv_parse_reset (GstMpegvParse * mpvparse)
gst_mpegv_parse_reset_frame (mpvparse);
mpvparse->profile = 0;
mpvparse->update_caps = TRUE;
+ mpvparse->send_codec_tag = TRUE;
gst_buffer_replace (&mpvparse->config, NULL);
memset (&mpvparse->sequencehdr, 0, sizeof (mpvparse->sequencehdr));
@@ -653,6 +658,37 @@ gst_mpegv_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
return GST_FLOW_OK;
}
+static GstFlowReturn
+gst_mpegv_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
+{
+ GstMpegvParse *mpvparse = GST_MPEGVIDEO_PARSE (parse);
+ GstTagList *taglist;
+
+ /* tag sending done late enough in hook to ensure pending events
+ * have already been sent */
+
+ if (G_UNLIKELY (mpvparse->send_codec_tag)) {
+ gchar *codec;
+
+ /* codec tag */
+ codec = g_strdup_printf ("MPEG %d Video", mpvparse->mpeg_version);
+ taglist = gst_tag_list_new ();
+ gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
+ GST_TAG_VIDEO_CODEC, codec, NULL);
+ g_free (codec);
+
+ gst_element_found_tags_for_pad (GST_ELEMENT (mpvparse),
+ GST_BASE_PARSE_SRC_PAD (mpvparse), taglist);
+
+ mpvparse->send_codec_tag = FALSE;
+ }
+
+ /* usual clipping applies */
+ frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP;
+
+ return GST_FLOW_OK;
+}
+
static gboolean
gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
{