mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
update for new fixate_caps function
This commit is contained in:
parent
aa7ee3733d
commit
9212619549
5 changed files with 27 additions and 15 deletions
|
@ -79,7 +79,7 @@ static gboolean gst_audio_convert_get_unit_size (GstBaseTransform * base,
|
||||||
GstCaps * caps, gsize * size);
|
GstCaps * caps, gsize * size);
|
||||||
static GstCaps *gst_audio_convert_transform_caps (GstBaseTransform * base,
|
static GstCaps *gst_audio_convert_transform_caps (GstBaseTransform * base,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
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);
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
||||||
static gboolean gst_audio_convert_set_caps (GstBaseTransform * base,
|
static gboolean gst_audio_convert_set_caps (GstBaseTransform * base,
|
||||||
GstCaps * incaps, GstCaps * outcaps);
|
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
|
/* 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
|
* possible ranges; this way we convert the least amount of things as possible
|
||||||
*/
|
*/
|
||||||
static void
|
static GstCaps *
|
||||||
gst_audio_convert_fixate_caps (GstBaseTransform * base,
|
gst_audio_convert_fixate_caps (GstBaseTransform * base,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,7 @@ gst_audio_convert_fixate_caps (GstBaseTransform * base,
|
||||||
gint rate;
|
gint rate;
|
||||||
const gchar *fmt;
|
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
|
GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
|
||||||
" based on caps %" GST_PTR_FORMAT, othercaps, caps);
|
" based on caps %" GST_PTR_FORMAT, othercaps, caps);
|
||||||
|
@ -616,6 +616,8 @@ gst_audio_convert_fixate_caps (GstBaseTransform * base,
|
||||||
|
|
||||||
gst_caps_truncate (othercaps);
|
gst_caps_truncate (othercaps);
|
||||||
GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
|
GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
|
||||||
|
|
||||||
|
return othercaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -106,7 +106,7 @@ static gboolean gst_audio_resample_get_unit_size (GstBaseTransform * base,
|
||||||
GstCaps * caps, gsize * size);
|
GstCaps * caps, gsize * size);
|
||||||
static GstCaps *gst_audio_resample_transform_caps (GstBaseTransform * base,
|
static GstCaps *gst_audio_resample_transform_caps (GstBaseTransform * base,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
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);
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
||||||
static gboolean gst_audio_resample_transform_size (GstBaseTransform * trans,
|
static gboolean gst_audio_resample_transform_size (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * incaps, gsize insize,
|
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 */
|
/* Fixate rate to the allowed rate that has the smallest difference */
|
||||||
static void
|
static GstCaps *
|
||||||
gst_audio_resample_fixate_caps (GstBaseTransform * base,
|
gst_audio_resample_fixate_caps (GstBaseTransform * base,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
||||||
{
|
{
|
||||||
|
@ -316,11 +316,13 @@ gst_audio_resample_fixate_caps (GstBaseTransform * base,
|
||||||
|
|
||||||
s = gst_caps_get_structure (caps, 0);
|
s = gst_caps_get_structure (caps, 0);
|
||||||
if (G_UNLIKELY (!gst_structure_get_int (s, "rate", &rate)))
|
if (G_UNLIKELY (!gst_structure_get_int (s, "rate", &rate)))
|
||||||
return;
|
return othercaps;
|
||||||
|
|
||||||
|
othercaps = gst_caps_make_writable (othercaps);
|
||||||
gst_caps_truncate (othercaps);
|
gst_caps_truncate (othercaps);
|
||||||
s = gst_caps_get_structure (othercaps, 0);
|
s = gst_caps_get_structure (othercaps, 0);
|
||||||
gst_structure_fixate_field_nearest_int (s, "rate", rate);
|
gst_structure_fixate_field_nearest_int (s, "rate", rate);
|
||||||
|
return othercaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SpeexResampleFuncs *
|
static const SpeexResampleFuncs *
|
||||||
|
|
|
@ -132,13 +132,15 @@ gst_video_convert_caps_remove_format_info (GstCaps * caps)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstCaps *
|
||||||
gst_video_convert_fixate_caps (GstBaseTransform * trans,
|
gst_video_convert_fixate_caps (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
||||||
{
|
{
|
||||||
GstStructure *ss, *ds;
|
GstStructure *ss, *ds;
|
||||||
const gchar *val;
|
const gchar *val;
|
||||||
|
|
||||||
|
othercaps = gst_caps_make_writable (othercaps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (trans, "fixating caps %" GST_PTR_FORMAT, othercaps);
|
GST_DEBUG_OBJECT (trans, "fixating caps %" GST_PTR_FORMAT, othercaps);
|
||||||
|
|
||||||
ss = gst_caps_get_structure (caps, 0);
|
ss = gst_caps_get_structure (caps, 0);
|
||||||
|
@ -161,6 +163,8 @@ gst_video_convert_fixate_caps (GstBaseTransform * trans,
|
||||||
|
|
||||||
/* fixate remaining fields */
|
/* fixate remaining fields */
|
||||||
gst_caps_fixate (othercaps);
|
gst_caps_fixate (othercaps);
|
||||||
|
|
||||||
|
return othercaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The caps can be transformed into any other caps with format info removed.
|
/* The caps can be transformed into any other caps with format info removed.
|
||||||
|
|
|
@ -132,7 +132,7 @@ static gboolean gst_video_rate_setcaps (GstBaseTransform * trans,
|
||||||
static GstCaps *gst_video_rate_transform_caps (GstBaseTransform * trans,
|
static GstCaps *gst_video_rate_transform_caps (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
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);
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
||||||
|
|
||||||
static GstFlowReturn gst_video_rate_transform_ip (GstBaseTransform * trans,
|
static GstFlowReturn gst_video_rate_transform_ip (GstBaseTransform * trans,
|
||||||
|
@ -454,7 +454,7 @@ gst_video_rate_transform_caps (GstBaseTransform * trans,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstCaps *
|
||||||
gst_video_rate_fixate_caps (GstBaseTransform * trans,
|
gst_video_rate_fixate_caps (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
||||||
{
|
{
|
||||||
|
@ -463,11 +463,14 @@ gst_video_rate_fixate_caps (GstBaseTransform * trans,
|
||||||
|
|
||||||
s = gst_caps_get_structure (caps, 0);
|
s = gst_caps_get_structure (caps, 0);
|
||||||
if (G_UNLIKELY (!gst_structure_get_fraction (s, "framerate", &num, &denom)))
|
if (G_UNLIKELY (!gst_structure_get_fraction (s, "framerate", &num, &denom)))
|
||||||
return;
|
return othercaps;
|
||||||
|
|
||||||
|
othercaps = gst_caps_make_writable (othercaps);
|
||||||
gst_caps_truncate (othercaps);
|
gst_caps_truncate (othercaps);
|
||||||
s = gst_caps_get_structure (othercaps, 0);
|
s = gst_caps_get_structure (othercaps, 0);
|
||||||
gst_structure_fixate_field_nearest_fraction (s, "framerate", num, denom);
|
gst_structure_fixate_field_nearest_fraction (s, "framerate", num, denom);
|
||||||
|
|
||||||
|
return othercaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -187,7 +187,7 @@ static gboolean gst_video_scale_src_event (GstBaseTransform * trans,
|
||||||
/* base transform vmethods */
|
/* base transform vmethods */
|
||||||
static GstCaps *gst_video_scale_transform_caps (GstBaseTransform * trans,
|
static GstCaps *gst_video_scale_transform_caps (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
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);
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
||||||
|
|
||||||
static gboolean gst_video_scale_set_info (GstVideoFilter * filter,
|
static gboolean gst_video_scale_set_info (GstVideoFilter * filter,
|
||||||
|
@ -511,7 +511,7 @@ gst_video_scale_set_info (GstVideoFilter * filter, GstCaps * in,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstCaps *
|
||||||
gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
|
gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
|
||||||
GstCaps * caps, GstCaps * othercaps)
|
GstCaps * caps, GstCaps * othercaps)
|
||||||
{
|
{
|
||||||
|
@ -520,8 +520,7 @@ gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
|
||||||
GValue fpar = { 0, }, tpar = {
|
GValue fpar = { 0, }, tpar = {
|
||||||
0,};
|
0,};
|
||||||
|
|
||||||
g_return_if_fail (gst_caps_is_fixed (caps));
|
othercaps = gst_caps_make_writable (othercaps);
|
||||||
|
|
||||||
gst_caps_truncate (othercaps);
|
gst_caps_truncate (othercaps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
|
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;
|
gint num, den;
|
||||||
|
|
||||||
/* from_par should be fixed */
|
/* 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_n = gst_value_get_fraction_numerator (from_par);
|
||||||
from_par_d = gst_value_get_fraction_denominator (from_par);
|
from_par_d = gst_value_get_fraction_denominator (from_par);
|
||||||
|
@ -945,6 +944,8 @@ done:
|
||||||
g_value_unset (&fpar);
|
g_value_unset (&fpar);
|
||||||
if (to_par == &tpar)
|
if (to_par == &tpar)
|
||||||
g_value_unset (&tpar);
|
g_value_unset (&tpar);
|
||||||
|
|
||||||
|
return othercaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue