mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
controller: cleanup interpolation modes
Remove deprecated/unimplemented modes. Turn interpolation mode into a gobject property. Update docs and examples.
This commit is contained in:
parent
2c7a8b924a
commit
503b739b23
9 changed files with 125 additions and 118 deletions
|
@ -69,12 +69,12 @@ gst_timed_value_control_invalidate_cache
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GstTimedValueControlSourceClass
|
GstTimedValueControlSourceClass
|
||||||
GstTimedValueControlSourcePrivate
|
GstTimedValueControlSourcePrivate
|
||||||
GST_INTERPOLATION_CONTROL_SOURCE
|
GST_TIMED_VALUE_CONTROL_SOURCE
|
||||||
GST_IS_INTERPOLATION_CONTROL_SOURCE
|
GST_IS_TIMED_VALUE_CONTROL_SOURCE
|
||||||
GST_INTERPOLATION_CONTROL_SOURCE_CLASS
|
GST_TIMED_VALUE_CONTROL_SOURCE_CLASS
|
||||||
GST_IS_INTERPOLATION_CONTROL_SOURCE_CLASS
|
GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS
|
||||||
GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS
|
GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS
|
||||||
GST_TYPE_INTERPOLATION_CONTROL_SOURCE
|
GST_TYPE_TIMED_VALUE_CONTROL_SOURCE
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
gst_timed_value_control_source_get_type
|
gst_timed_value_control_source_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
@ -84,20 +84,21 @@ gst_timed_value_control_source_get_type
|
||||||
<TITLE>GstInterpolationControlSource</TITLE>
|
<TITLE>GstInterpolationControlSource</TITLE>
|
||||||
<INCLUDE>libs/controller/gstinterpolationcontrolsource.h</INCLUDE>
|
<INCLUDE>libs/controller/gstinterpolationcontrolsource.h</INCLUDE>
|
||||||
GstInterpolationControlSource
|
GstInterpolationControlSource
|
||||||
GstInterpolateMode
|
GstInterpolationMode
|
||||||
gst_interpolation_control_source_new
|
gst_interpolation_control_source_new
|
||||||
gst_interpolation_control_source_set_interpolation_mode
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GstInterpolationControlSourceClass
|
GstInterpolationControlSourceClass
|
||||||
GstInterpolationControlSourcePrivate
|
GstInterpolationControlSourcePrivate
|
||||||
GST_TIMED_VALUE_CONTROL_SOURCE
|
GST_INTERPOLATION_CONTROL_SOURCE
|
||||||
GST_IS_TIMED_VALUE_CONTROL_SOURCE
|
GST_IS_INTERPOLATION_CONTROL_SOURCE
|
||||||
GST_TIMED_VALUE_CONTROL_SOURCE_CLASS
|
GST_INTERPOLATION_CONTROL_SOURCE_CLASS
|
||||||
GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS
|
GST_IS_INTERPOLATION_CONTROL_SOURCE_CLASS
|
||||||
GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS
|
GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS
|
||||||
GST_TYPE_TIMED_VALUE_CONTROL_SOURCE
|
GST_TYPE_INTERPOLATION_CONTROL_SOURCE
|
||||||
|
GST_TYPE_INTERPOLATION_MODE
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
gst_interpolation_control_source_get_type
|
gst_interpolation_control_source_get_type
|
||||||
|
gst_interpolation_mode_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
|
|
@ -452,3 +452,8 @@ The 0.11 porting guide
|
||||||
GstTimedValueControlSource baseclass and 2 sub classes:
|
GstTimedValueControlSource baseclass and 2 sub classes:
|
||||||
GstInterpolationControlSource and GstTriggerControlSource. The API for setting
|
GstInterpolationControlSource and GstTriggerControlSource. The API for setting
|
||||||
and getting the timestamps is in GstTimedValueControlSource.
|
and getting the timestamps is in GstTimedValueControlSource.
|
||||||
|
|
||||||
|
gst_interpolation_control_source_set_interpolation_mode() has been removed.
|
||||||
|
Set the "mode" gobject property on the control-source instead. The possible
|
||||||
|
enum values have been renamed from GST_INTERPOLATE_XXX to
|
||||||
|
GST_INTERPOLATION_MODE_XXX.
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
* <listitem><para>
|
* <listitem><para>
|
||||||
* create a #GstControlSource.
|
* create a #GstControlSource.
|
||||||
* csource = gst_interpolation_control_source_new ();
|
* csource = gst_interpolation_control_source_new ();
|
||||||
* gst_interpolation_control_source_set_interpolation_mode(csource, mode);
|
* g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
* </para></listitem>
|
* </para></listitem>
|
||||||
* <listitem><para>
|
* <listitem><para>
|
||||||
* Attach the #GstControlSource on the controller to a property.
|
* Attach the #GstControlSource on the controller to a property.
|
||||||
|
|
|
@ -585,7 +585,6 @@ static GstInterpolateMethod interpolate_cubic = {
|
||||||
GstInterpolateMethod *priv_gst_interpolation_methods[] = {
|
GstInterpolateMethod *priv_gst_interpolation_methods[] = {
|
||||||
&interpolate_none,
|
&interpolate_none,
|
||||||
&interpolate_linear,
|
&interpolate_linear,
|
||||||
&interpolate_cubic,
|
|
||||||
&interpolate_cubic
|
&interpolate_cubic
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,8 @@
|
||||||
* control points. It supports several interpolation modes and property types.
|
* control points. It supports several interpolation modes and property types.
|
||||||
*
|
*
|
||||||
* To use #GstInterpolationControlSource get a new instance by calling
|
* To use #GstInterpolationControlSource get a new instance by calling
|
||||||
* gst_interpolation_control_source_new(), bind it to a #GParamSpec, select a interpolation mode with
|
* gst_interpolation_control_source_new(), bind it to a #GParamSpec and set some
|
||||||
* gst_interpolation_control_source_set_interpolation_mode() and set some control points by calling
|
* control points by calling gst_timed_value_control_source_set().
|
||||||
* gst_timed_value_control_source_set().
|
|
||||||
*
|
*
|
||||||
* All functions are MT-safe.
|
* All functions are MT-safe.
|
||||||
*
|
*
|
||||||
|
@ -47,6 +46,31 @@
|
||||||
#define GST_CAT_DEFAULT controller_debug
|
#define GST_CAT_DEFAULT controller_debug
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_MODE = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
GType
|
||||||
|
gst_interpolation_mode_get_type (void)
|
||||||
|
{
|
||||||
|
static gsize gtype = 0;
|
||||||
|
static const GEnumValue values[] = {
|
||||||
|
{GST_INTERPOLATION_MODE_NONE, "GST_INTERPOLATION_MODE_NONE", "none"},
|
||||||
|
{GST_INTERPOLATION_MODE_LINEAR, "GST_INTERPOLATION_MODE_LINEAR", "linear"},
|
||||||
|
{GST_INTERPOLATION_MODE_CUBIC, "GST_INTERPOLATION_MODE_CUBIC", "cubic"},
|
||||||
|
{0, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (g_once_init_enter (>ype)) {
|
||||||
|
GType tmp = g_enum_register_static ("GstLFOWaveform", values);
|
||||||
|
g_once_init_leave (>ype, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GType) gtype;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define _do_init \
|
#define _do_init \
|
||||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "interpolation control source", 0, \
|
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "interpolation control source", 0, \
|
||||||
"timeline value interpolating control source")
|
"timeline value interpolating control source")
|
||||||
|
@ -57,7 +81,7 @@ G_DEFINE_TYPE_WITH_CODE (GstInterpolationControlSource,
|
||||||
|
|
||||||
struct _GstInterpolationControlSourcePrivate
|
struct _GstInterpolationControlSourcePrivate
|
||||||
{
|
{
|
||||||
GstInterpolateMode interpolation_mode;
|
GstInterpolationMode interpolation_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,23 +97,9 @@ gst_interpolation_control_source_new (void)
|
||||||
return g_object_newv (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, 0, NULL);
|
return g_object_newv (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static gboolean
|
||||||
* gst_interpolation_control_source_set_interpolation_mode:
|
gst_interpolation_control_source_set_interpolation_mode
|
||||||
* @self: the #GstInterpolationControlSource object
|
(GstInterpolationControlSource * self, GstInterpolationMode mode)
|
||||||
* @mode: interpolation mode
|
|
||||||
*
|
|
||||||
* Sets the given interpolation mode.
|
|
||||||
*
|
|
||||||
* <note><para>User interpolation is not yet available and quadratic interpolation
|
|
||||||
* is deprecated and maps to cubic interpolation.</para></note>
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the interpolation mode could be set, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
gboolean
|
|
||||||
gst_interpolation_control_source_set_interpolation_mode (
|
|
||||||
GstInterpolationControlSource * self, GstInterpolateMode mode)
|
|
||||||
/* *INDENT-ON* */
|
|
||||||
{
|
{
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
GstControlSource *csource = GST_CONTROL_SOURCE (self);
|
GstControlSource *csource = GST_CONTROL_SOURCE (self);
|
||||||
|
@ -100,11 +110,6 @@ gst_interpolation_control_source_set_interpolation_mode (
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == GST_INTERPOLATE_QUADRATIC) {
|
|
||||||
GST_WARNING ("Quadratic interpolation mode is deprecated, using cubic"
|
|
||||||
"interpolation mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_TIMED_VALUE_CONTROL_SOURCE_LOCK (self);
|
GST_TIMED_VALUE_CONTROL_SOURCE_LOCK (self);
|
||||||
switch (gst_timed_value_control_source_get_base_value_type (
|
switch (gst_timed_value_control_source_get_base_value_type (
|
||||||
(GstTimedValueControlSource *) self)) {
|
(GstTimedValueControlSource *) self)) {
|
||||||
|
@ -203,17 +208,61 @@ gst_interpolation_control_source_init (GstInterpolationControlSource * self)
|
||||||
self->priv =
|
self->priv =
|
||||||
G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_INTERPOLATION_CONTROL_SOURCE,
|
G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_INTERPOLATION_CONTROL_SOURCE,
|
||||||
GstInterpolationControlSourcePrivate);
|
GstInterpolationControlSourcePrivate);
|
||||||
self->priv->interpolation_mode = GST_INTERPOLATE_NONE;
|
self->priv->interpolation_mode = GST_INTERPOLATION_MODE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_interpolation_control_source_set_property (GObject * object, guint prop_id,
|
||||||
|
const GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GstInterpolationControlSource *self =
|
||||||
|
GST_INTERPOLATION_CONTROL_SOURCE (object);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_MODE:
|
||||||
|
gst_interpolation_control_source_set_interpolation_mode (self,
|
||||||
|
(GstInterpolationMode) g_value_get_enum (value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_interpolation_control_source_get_property (GObject * object, guint prop_id,
|
||||||
|
GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GstInterpolationControlSource *self =
|
||||||
|
GST_INTERPOLATION_CONTROL_SOURCE (object);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_MODE:
|
||||||
|
g_value_set_enum (value, self->priv->interpolation_mode);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_interpolation_control_source_class_init (GstInterpolationControlSourceClass
|
gst_interpolation_control_source_class_init (GstInterpolationControlSourceClass
|
||||||
* klass)
|
* klass)
|
||||||
{
|
{
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
GstControlSourceClass *csource_class = GST_CONTROL_SOURCE_CLASS (klass);
|
GstControlSourceClass *csource_class = GST_CONTROL_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass,
|
g_type_class_add_private (klass,
|
||||||
sizeof (GstInterpolationControlSourcePrivate));
|
sizeof (GstInterpolationControlSourcePrivate));
|
||||||
|
|
||||||
|
gobject_class->set_property = gst_interpolation_control_source_set_property;
|
||||||
|
gobject_class->get_property = gst_interpolation_control_source_get_property;
|
||||||
|
|
||||||
csource_class->bind = gst_interpolation_control_source_bind;
|
csource_class->bind = gst_interpolation_control_source_bind;
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_MODE,
|
||||||
|
g_param_spec_enum ("mode", "Mode", "Interpolation mode",
|
||||||
|
GST_TYPE_INTERPOLATION_MODE, GST_INTERPOLATION_MODE_NONE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,26 +44,26 @@ G_BEGIN_DECLS
|
||||||
#define GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS(inst) \
|
#define GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS(inst) \
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSourceClass))
|
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_INTERPOLATION_CONTROL_SOURCE, GstInterpolationControlSourceClass))
|
||||||
|
|
||||||
|
#define GST_TYPE_INTERPOLATION_MODE (gst_interpolation_mode_get_type ())
|
||||||
|
|
||||||
typedef struct _GstInterpolationControlSource GstInterpolationControlSource;
|
typedef struct _GstInterpolationControlSource GstInterpolationControlSource;
|
||||||
typedef struct _GstInterpolationControlSourceClass GstInterpolationControlSourceClass;
|
typedef struct _GstInterpolationControlSourceClass GstInterpolationControlSourceClass;
|
||||||
typedef struct _GstInterpolationControlSourcePrivate GstInterpolationControlSourcePrivate;
|
typedef struct _GstInterpolationControlSourcePrivate GstInterpolationControlSourcePrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstInterpolateMode:
|
* GstInterpolationMode:
|
||||||
* @GST_INTERPOLATE_NONE: steps-like interpolation, default
|
* @GST_INTERPOLATION_MODE_NONE: steps-like interpolation, default
|
||||||
* @GST_INTERPOLATE_LINEAR: linear interpolation
|
* @GST_INTERPOLATION_MODE_LINEAR: linear interpolation
|
||||||
* @GST_INTERPOLATE_QUADRATIC: square interpolation (deprecated, maps to cubic)
|
* @GST_INTERPOLATION_MODE_CUBIC: cubic interpolation
|
||||||
* @GST_INTERPOLATE_CUBIC: cubic interpolation
|
|
||||||
*
|
*
|
||||||
* The various interpolation modes available.
|
* The various interpolation modes available.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GST_INTERPOLATE_NONE,
|
GST_INTERPOLATION_MODE_NONE,
|
||||||
GST_INTERPOLATE_LINEAR,
|
GST_INTERPOLATION_MODE_LINEAR,
|
||||||
GST_INTERPOLATE_QUADRATIC,
|
GST_INTERPOLATION_MODE_CUBIC
|
||||||
GST_INTERPOLATE_CUBIC
|
} GstInterpolationMode;
|
||||||
} GstInterpolateMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstInterpolationControlSource:
|
* GstInterpolationControlSource:
|
||||||
|
@ -86,14 +86,12 @@ struct _GstInterpolationControlSourceClass {
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_interpolation_control_source_get_type (void);
|
GType gst_interpolation_control_source_get_type (void);
|
||||||
|
GType gst_interpolation_mode_get_type (void);
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
GstInterpolationControlSource *
|
GstInterpolationControlSource *
|
||||||
gst_interpolation_control_source_new (void);
|
gst_interpolation_control_source_new (void);
|
||||||
gboolean gst_interpolation_control_source_set_interpolation_mode
|
|
||||||
(GstInterpolationControlSource *self,
|
|
||||||
GstInterpolateMode mode);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,7 @@ main (gint argc, gchar * argv[])
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
gst_object_set_control_source (GST_OBJECT (src), "freq",
|
gst_object_set_control_source (GST_OBJECT (src), "freq",
|
||||||
GST_CONTROL_SOURCE (csource));
|
GST_CONTROL_SOURCE (csource));
|
||||||
gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR);
|
|
||||||
g_value_init (&freq, G_TYPE_DOUBLE);
|
g_value_init (&freq, G_TYPE_DOUBLE);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -520,8 +520,7 @@ GST_START_TEST (controller_interpolate_none)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
|
||||||
GST_INTERPOLATE_NONE));
|
|
||||||
|
|
||||||
fail_unless (gst_timed_value_control_source_get_count (
|
fail_unless (gst_timed_value_control_source_get_count (
|
||||||
(GstTimedValueControlSource *) csource) == 0);
|
(GstTimedValueControlSource *) csource) == 0);
|
||||||
|
@ -574,8 +573,7 @@ GST_START_TEST (controller_interpolate_linear)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_ulong, G_TYPE_ULONG);
|
g_value_init (&val_ulong, G_TYPE_ULONG);
|
||||||
|
@ -621,8 +619,7 @@ GST_START_TEST (controller_interpolate_cubic)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
|
||||||
GST_INTERPOLATE_CUBIC));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_double, G_TYPE_DOUBLE);
|
g_value_init (&val_double, G_TYPE_DOUBLE);
|
||||||
|
@ -683,8 +680,7 @@ GST_START_TEST (controller_interpolate_cubic_too_few_cp)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
|
||||||
GST_INTERPOLATE_CUBIC));
|
|
||||||
|
|
||||||
/* set 2 control values */
|
/* set 2 control values */
|
||||||
g_value_init (&val_double, G_TYPE_DOUBLE);
|
g_value_init (&val_double, G_TYPE_DOUBLE);
|
||||||
|
@ -714,33 +710,6 @@ GST_START_TEST (controller_interpolate_cubic_too_few_cp)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
/* make sure we don't crash when someone sets an unsupported interpolation
|
|
||||||
* mode */
|
|
||||||
GST_START_TEST (controller_interpolate_unimplemented)
|
|
||||||
{
|
|
||||||
GstInterpolationControlSource *csource;
|
|
||||||
GstElement *elem;
|
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
|
||||||
csource = gst_interpolation_control_source_new ();
|
|
||||||
|
|
||||||
fail_unless (csource != NULL);
|
|
||||||
fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
|
|
||||||
GST_CONTROL_SOURCE (csource)));
|
|
||||||
|
|
||||||
/* set completely bogus interpolation mode */
|
|
||||||
fail_if (gst_interpolation_control_source_set_interpolation_mode (csource,
|
|
||||||
(GstInterpolateMode) 93871));
|
|
||||||
|
|
||||||
g_object_unref (csource);
|
|
||||||
|
|
||||||
gst_object_unref (elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_END_TEST;
|
|
||||||
|
|
||||||
/* test _unset() */
|
/* test _unset() */
|
||||||
GST_START_TEST (controller_interpolation_unset)
|
GST_START_TEST (controller_interpolation_unset)
|
||||||
{
|
{
|
||||||
|
@ -759,8 +728,7 @@ GST_START_TEST (controller_interpolation_unset)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
|
||||||
GST_INTERPOLATE_NONE));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_ulong, G_TYPE_ULONG);
|
g_value_init (&val_ulong, G_TYPE_ULONG);
|
||||||
|
@ -831,8 +799,7 @@ GST_START_TEST (controller_interpolation_unset_all)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
|
||||||
GST_INTERPOLATE_NONE));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_ulong, G_TYPE_ULONG);
|
g_value_init (&val_ulong, G_TYPE_ULONG);
|
||||||
|
@ -885,8 +852,7 @@ GST_START_TEST (controller_interpolation_linear_value_array)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_ulong, G_TYPE_ULONG);
|
g_value_init (&val_ulong, G_TYPE_ULONG);
|
||||||
|
@ -934,8 +900,7 @@ GST_START_TEST (controller_interpolation_linear_invalid_values)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_float, G_TYPE_FLOAT);
|
g_value_init (&val_float, G_TYPE_FLOAT);
|
||||||
|
@ -993,8 +958,7 @@ GST_START_TEST (controller_interpolation_linear_default_values)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR));
|
|
||||||
|
|
||||||
g_value_init (&val_ulong, G_TYPE_ULONG);
|
g_value_init (&val_ulong, G_TYPE_ULONG);
|
||||||
|
|
||||||
|
@ -1084,10 +1048,8 @@ GST_START_TEST (controller_interpolate_linear_disabled)
|
||||||
GST_CONTROL_SOURCE (csource2)));
|
GST_CONTROL_SOURCE (csource2)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR));
|
g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode
|
|
||||||
(csource2, GST_INTERPOLATE_LINEAR));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_ulong, G_TYPE_ULONG);
|
g_value_init (&val_ulong, G_TYPE_ULONG);
|
||||||
|
@ -1223,8 +1185,7 @@ GST_START_TEST (controller_interpolation_set_from_list)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR));
|
|
||||||
|
|
||||||
/* set control value */
|
/* set control value */
|
||||||
tval = g_new0 (GstTimedValue, 1);
|
tval = g_new0 (GstTimedValue, 1);
|
||||||
|
@ -1272,8 +1233,7 @@ GST_START_TEST (controller_interpolate_linear_before_ts0)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR));
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&val_ulong, G_TYPE_ULONG);
|
g_value_init (&val_ulong, G_TYPE_ULONG);
|
||||||
|
@ -1325,8 +1285,7 @@ GST_START_TEST (controller_interpolation_cp_count)
|
||||||
GST_CONTROL_SOURCE (csource)));
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
/* set interpolation mode */
|
/* set interpolation mode */
|
||||||
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
|
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
|
||||||
GST_INTERPOLATE_NONE));
|
|
||||||
|
|
||||||
fail_unless (gst_timed_value_control_source_get_count (
|
fail_unless (gst_timed_value_control_source_get_count (
|
||||||
(GstTimedValueControlSource *) csource) == 0);
|
(GstTimedValueControlSource *) csource) == 0);
|
||||||
|
@ -1907,7 +1866,6 @@ gst_controller_suite (void)
|
||||||
tcase_add_test (tc, controller_interpolate_linear);
|
tcase_add_test (tc, controller_interpolate_linear);
|
||||||
tcase_add_test (tc, controller_interpolate_cubic);
|
tcase_add_test (tc, controller_interpolate_cubic);
|
||||||
tcase_add_test (tc, controller_interpolate_cubic_too_few_cp);
|
tcase_add_test (tc, controller_interpolate_cubic_too_few_cp);
|
||||||
tcase_add_test (tc, controller_interpolate_unimplemented);
|
|
||||||
tcase_add_test (tc, controller_interpolation_unset);
|
tcase_add_test (tc, controller_interpolation_unset);
|
||||||
tcase_add_test (tc, controller_interpolation_unset_all);
|
tcase_add_test (tc, controller_interpolation_unset_all);
|
||||||
tcase_add_test (tc, controller_interpolation_linear_value_array);
|
tcase_add_test (tc, controller_interpolation_linear_value_array);
|
||||||
|
|
|
@ -58,10 +58,8 @@ main (gint argc, gchar ** argv)
|
||||||
|
|
||||||
/* Set interpolation mode */
|
/* Set interpolation mode */
|
||||||
|
|
||||||
gst_interpolation_control_source_set_interpolation_mode (csource1,
|
g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
GST_INTERPOLATE_LINEAR);
|
g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
|
||||||
gst_interpolation_control_source_set_interpolation_mode (csource2,
|
|
||||||
GST_INTERPOLATE_LINEAR);
|
|
||||||
|
|
||||||
/* set control values */
|
/* set control values */
|
||||||
g_value_init (&vol, G_TYPE_DOUBLE);
|
g_value_init (&vol, G_TYPE_DOUBLE);
|
||||||
|
|
Loading…
Reference in a new issue