From 68aaa637b83840b547350022474295b52604fb83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Fri, 11 Jun 2010 18:31:05 -0400 Subject: [PATCH] videomaxrate: Add fixates_caps --- gst/videomaxrate/videomaxrate.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gst/videomaxrate/videomaxrate.c b/gst/videomaxrate/videomaxrate.c index e1f7118..52edbce 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) -- 2.7.4