From: Olivier CrĂȘte Date: Fri, 11 Jun 2010 22:31:05 +0000 (-0400) Subject: videomaxrate: Add fixates_caps X-Git-Tag: 1.19.3~507^2~16772 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68aaa637b83840b547350022474295b52604fb83;p=platform%2Fupstream%2Fgstreamer.git videomaxrate: Add fixates_caps --- diff --git a/gst/videomaxrate/videomaxrate.c b/gst/videomaxrate/videomaxrate.c index e1f7118d5e..52edbceec4 100644 --- a/gst/videomaxrate/videomaxrate.c +++ b/gst/videomaxrate/videomaxrate.c @@ -60,6 +60,8 @@ static gboolean gst_video_max_rate_set_caps (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps); static GstFlowReturn gst_video_max_rate_transform_ip (GstBaseTransform * trans, GstBuffer * buf); +static void gst_video_max_rate_fixate_caps (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); GST_BOILERPLATE (GstVideoMaxRate, gst_video_max_rate, GstBaseTransform, GST_TYPE_BASE_TRANSFORM); @@ -104,6 +106,7 @@ gst_video_max_rate_class_init (GstVideoMaxRateClass * klass) GST_DEBUG_FUNCPTR (gst_video_max_rate_transform_ip); base_class->event = GST_DEBUG_FUNCPTR (gst_video_max_rate_sink_event); base_class->start = GST_DEBUG_FUNCPTR (gst_video_max_rate_start); + base_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_video_max_rate_fixate_caps); g_object_class_install_property (gobject_class, PROP_AVERAGE_PERIOD, g_param_spec_uint64 ("average-period", "Period over which to average", @@ -215,6 +218,21 @@ gst_video_max_rate_transform_caps (GstBaseTransform * trans, return ret; } +static void +gst_video_max_rate_fixate_caps (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) +{ + GstStructure *s; + gint nom, denom; + + s = gst_caps_get_structure (caps, 0); + if (G_UNLIKELY (!gst_structure_get_fraction (s, "framerate", &nom, &denom))) + return; + + s = gst_caps_get_structure (othercaps, 0); + gst_structure_fixate_field_nearest_fraction (s, "framerate", nom, denom); +} + gboolean gst_video_max_rate_set_caps (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps)