diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index 76b868cdb1..044b5b9ae3 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -79,7 +79,7 @@ static gboolean gst_audio_convert_get_unit_size (GstBaseTransform * base, GstCaps * caps, gsize * size); static GstCaps *gst_audio_convert_transform_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * filter); -static void gst_audio_convert_fixate_caps (GstBaseTransform * base, +static GstCaps *gst_audio_convert_fixate_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); static gboolean gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps); @@ -585,7 +585,7 @@ gst_audio_convert_fixate_channels (GstBaseTransform * base, GstStructure * ins, /* try to keep as many of the structure members the same by fixating the * possible ranges; this way we convert the least amount of things as possible */ -static void +static GstCaps * gst_audio_convert_fixate_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) { @@ -593,7 +593,7 @@ gst_audio_convert_fixate_caps (GstBaseTransform * base, gint rate; const gchar *fmt; - g_return_if_fail (gst_caps_is_fixed (caps)); + othercaps = gst_caps_make_writable (othercaps); GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT " based on caps %" GST_PTR_FORMAT, othercaps, caps); @@ -616,6 +616,8 @@ gst_audio_convert_fixate_caps (GstBaseTransform * base, gst_caps_truncate (othercaps); GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps); + + return othercaps; } static gboolean diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c index dc653f476c..ebd5895aa0 100644 --- a/gst/audioresample/gstaudioresample.c +++ b/gst/audioresample/gstaudioresample.c @@ -106,7 +106,7 @@ static gboolean gst_audio_resample_get_unit_size (GstBaseTransform * base, GstCaps * caps, gsize * size); static GstCaps *gst_audio_resample_transform_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * filter); -static void gst_audio_resample_fixate_caps (GstBaseTransform * base, +static GstCaps *gst_audio_resample_fixate_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); static gboolean gst_audio_resample_transform_size (GstBaseTransform * trans, GstPadDirection direction, GstCaps * incaps, gsize insize, @@ -307,7 +307,7 @@ gst_audio_resample_transform_caps (GstBaseTransform * base, } /* Fixate rate to the allowed rate that has the smallest difference */ -static void +static GstCaps * gst_audio_resample_fixate_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) { @@ -316,11 +316,13 @@ gst_audio_resample_fixate_caps (GstBaseTransform * base, s = gst_caps_get_structure (caps, 0); if (G_UNLIKELY (!gst_structure_get_int (s, "rate", &rate))) - return; + return othercaps; + othercaps = gst_caps_make_writable (othercaps); gst_caps_truncate (othercaps); s = gst_caps_get_structure (othercaps, 0); gst_structure_fixate_field_nearest_int (s, "rate", rate); + return othercaps; } static const SpeexResampleFuncs * diff --git a/gst/videoconvert/gstvideoconvert.c b/gst/videoconvert/gstvideoconvert.c index 5b0033a983..5c4ca4b198 100644 --- a/gst/videoconvert/gstvideoconvert.c +++ b/gst/videoconvert/gstvideoconvert.c @@ -132,13 +132,15 @@ gst_video_convert_caps_remove_format_info (GstCaps * caps) return res; } -static void +static GstCaps * gst_video_convert_fixate_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) { GstStructure *ss, *ds; const gchar *val; + othercaps = gst_caps_make_writable (othercaps); + GST_DEBUG_OBJECT (trans, "fixating caps %" GST_PTR_FORMAT, othercaps); ss = gst_caps_get_structure (caps, 0); @@ -161,6 +163,8 @@ gst_video_convert_fixate_caps (GstBaseTransform * trans, /* fixate remaining fields */ gst_caps_fixate (othercaps); + + return othercaps; } /* The caps can be transformed into any other caps with format info removed. diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c index 1e07387929..483397fbb8 100644 --- a/gst/videorate/gstvideorate.c +++ b/gst/videorate/gstvideorate.c @@ -132,7 +132,7 @@ static gboolean gst_video_rate_setcaps (GstBaseTransform * trans, static GstCaps *gst_video_rate_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter); -static void gst_video_rate_fixate_caps (GstBaseTransform * trans, +static GstCaps *gst_video_rate_fixate_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); static GstFlowReturn gst_video_rate_transform_ip (GstBaseTransform * trans, @@ -454,7 +454,7 @@ gst_video_rate_transform_caps (GstBaseTransform * trans, return ret; } -static void +static GstCaps * gst_video_rate_fixate_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) { @@ -463,11 +463,14 @@ gst_video_rate_fixate_caps (GstBaseTransform * trans, s = gst_caps_get_structure (caps, 0); if (G_UNLIKELY (!gst_structure_get_fraction (s, "framerate", &num, &denom))) - return; + return othercaps; + othercaps = gst_caps_make_writable (othercaps); gst_caps_truncate (othercaps); s = gst_caps_get_structure (othercaps, 0); gst_structure_fixate_field_nearest_fraction (s, "framerate", num, denom); + + return othercaps; } static gboolean diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 86721b0459..1882d8ccfa 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -187,7 +187,7 @@ static gboolean gst_video_scale_src_event (GstBaseTransform * trans, /* base transform vmethods */ static GstCaps *gst_video_scale_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter); -static void gst_video_scale_fixate_caps (GstBaseTransform * base, +static GstCaps *gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); static gboolean gst_video_scale_set_info (GstVideoFilter * filter, @@ -511,7 +511,7 @@ gst_video_scale_set_info (GstVideoFilter * filter, GstCaps * in, return TRUE; } -static void +static GstCaps * gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) { @@ -520,8 +520,7 @@ gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction, GValue fpar = { 0, }, tpar = { 0,}; - g_return_if_fail (gst_caps_is_fixed (caps)); - + othercaps = gst_caps_make_writable (othercaps); gst_caps_truncate (othercaps); GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT @@ -572,7 +571,7 @@ gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction, gint num, den; /* from_par should be fixed */ - g_return_if_fail (gst_value_is_fixed (from_par)); + g_return_val_if_fail (gst_value_is_fixed (from_par), othercaps); from_par_n = gst_value_get_fraction_numerator (from_par); from_par_d = gst_value_get_fraction_denominator (from_par); @@ -945,6 +944,8 @@ done: g_value_unset (&fpar); if (to_par == &tpar) g_value_unset (&tpar); + + return othercaps; } static void