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);
/* 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)
{
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);
gst_caps_truncate (othercaps);
GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
+
+ return othercaps;
}
static gboolean
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,
}
/* 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)
{
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 *
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);
/* fixate remaining fields */
gst_caps_fixate (othercaps);
+
+ return othercaps;
}
/* The caps can be transformed into any other caps with format info removed.
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,
return ret;
}
-static void
+static GstCaps *
gst_video_rate_fixate_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
{
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
/* 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,
return TRUE;
}
-static void
+static GstCaps *
gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
GstCaps * caps, GstCaps * othercaps)
{
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
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);
g_value_unset (&fpar);
if (to_par == &tpar)
g_value_unset (&tpar);
+
+ return othercaps;
}
static void