From 8f30fca6362dabf9fc709e9974fa48edc79b8294 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Thu, 18 Nov 2010 23:29:51 +0530 Subject: [PATCH] mpeg4videoparse: Use sinkpad caps as base for srcpad caps This way, we don't lose additional fields that come from upstream (like profile/level for now). https://bugzilla.gnome.org/show_bug.cgi?id=635202 --- gst/mpeg4videoparse/mpeg4videoparse.c | 17 ++++++++++++++--- gst/mpeg4videoparse/mpeg4videoparse.h | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gst/mpeg4videoparse/mpeg4videoparse.c b/gst/mpeg4videoparse/mpeg4videoparse.c index 7dfa556..969ca7e 100644 --- a/gst/mpeg4videoparse/mpeg4videoparse.c +++ b/gst/mpeg4videoparse/mpeg4videoparse.c @@ -65,9 +65,15 @@ gst_mpeg4vparse_set_new_caps (GstMpeg4VParse * parse, gint aspect_ratio_width, gint aspect_ratio_height, gint width, gint height) { gboolean res; - GstCaps *out_caps = gst_caps_new_simple ("video/mpeg", - "mpegversion", G_TYPE_INT, 4, - "systemstream", G_TYPE_BOOLEAN, FALSE, + GstCaps *out_caps; + + if (parse->sink_caps) { + out_caps = gst_caps_copy (parse->sink_caps); + } else { + out_caps = gst_caps_new_simple ("video/mpeg", + "mpegversion", G_TYPE_INT, 4, NULL); + } + gst_caps_set_simple (out_caps, "systemstream", G_TYPE_BOOLEAN, FALSE, "parsed", G_TYPE_BOOLEAN, TRUE, NULL); if (parse->profile != 0) { @@ -710,6 +716,7 @@ gst_mpeg4vparse_sink_setcaps (GstPad * pad, GstCaps * caps) const GValue *value; GST_DEBUG_OBJECT (parse, "setcaps called with %" GST_PTR_FORMAT, caps); + parse->sink_caps = gst_caps_ref (caps); s = gst_caps_get_structure (caps, 0); @@ -860,6 +867,10 @@ gst_mpeg4vparse_src_query (GstPad * pad, GstQuery * query) static void gst_mpeg4vparse_cleanup (GstMpeg4VParse * parse) { + if (parse->sink_caps) { + gst_caps_unref (parse->sink_caps); + parse->sink_caps = NULL; + } if (parse->adapter) { gst_adapter_clear (parse->adapter); } diff --git a/gst/mpeg4videoparse/mpeg4videoparse.h b/gst/mpeg4videoparse/mpeg4videoparse.h index f5ce3f3..3c114ca 100644 --- a/gst/mpeg4videoparse/mpeg4videoparse.h +++ b/gst/mpeg4videoparse/mpeg4videoparse.h @@ -54,6 +54,8 @@ struct _GstMpeg4VParse { GstPad * sinkpad; GstPad * srcpad; + GstCaps *sink_caps; + guint interval; GstClockTime last_report; -- 2.7.4