<SUBSECTION Standard>
GstTimedValueControlSourceClass
GstTimedValueControlSourcePrivate
-GST_INTERPOLATION_CONTROL_SOURCE
-GST_IS_INTERPOLATION_CONTROL_SOURCE
-GST_INTERPOLATION_CONTROL_SOURCE_CLASS
-GST_IS_INTERPOLATION_CONTROL_SOURCE_CLASS
-GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS
-GST_TYPE_INTERPOLATION_CONTROL_SOURCE
+GST_TIMED_VALUE_CONTROL_SOURCE
+GST_IS_TIMED_VALUE_CONTROL_SOURCE
+GST_TIMED_VALUE_CONTROL_SOURCE_CLASS
+GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS
+GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS
+GST_TYPE_TIMED_VALUE_CONTROL_SOURCE
<SUBSECTION Private>
gst_timed_value_control_source_get_type
</SECTION>
<TITLE>GstInterpolationControlSource</TITLE>
<INCLUDE>libs/controller/gstinterpolationcontrolsource.h</INCLUDE>
GstInterpolationControlSource
-GstInterpolateMode
+GstInterpolationMode
gst_interpolation_control_source_new
-gst_interpolation_control_source_set_interpolation_mode
<SUBSECTION Standard>
GstInterpolationControlSourceClass
GstInterpolationControlSourcePrivate
-GST_TIMED_VALUE_CONTROL_SOURCE
-GST_IS_TIMED_VALUE_CONTROL_SOURCE
-GST_TIMED_VALUE_CONTROL_SOURCE_CLASS
-GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS
-GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS
-GST_TYPE_TIMED_VALUE_CONTROL_SOURCE
+GST_INTERPOLATION_CONTROL_SOURCE
+GST_IS_INTERPOLATION_CONTROL_SOURCE
+GST_INTERPOLATION_CONTROL_SOURCE_CLASS
+GST_IS_INTERPOLATION_CONTROL_SOURCE_CLASS
+GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS
+GST_TYPE_INTERPOLATION_CONTROL_SOURCE
+GST_TYPE_INTERPOLATION_MODE
<SUBSECTION Private>
gst_interpolation_control_source_get_type
+gst_interpolation_mode_get_type
</SECTION>
<SECTION>
GstTimedValueControlSource baseclass and 2 sub classes:
GstInterpolationControlSource and GstTriggerControlSource. The API for setting
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.
* <listitem><para>
* create a #GstControlSource.
* 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>
* <listitem><para>
* Attach the #GstControlSource on the controller to a property.
GstInterpolateMethod *priv_gst_interpolation_methods[] = {
&interpolate_none,
&interpolate_linear,
- &interpolate_cubic,
&interpolate_cubic
};
* control points. It supports several interpolation modes and property types.
*
* 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_set_interpolation_mode() and set some control points by calling
- * gst_timed_value_control_source_set().
+ * gst_interpolation_control_source_new(), bind it to a #GParamSpec and set some
+ * control points by calling gst_timed_value_control_source_set().
*
* All functions are MT-safe.
*
#define GST_CAT_DEFAULT controller_debug
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 \
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "interpolation control source", 0, \
"timeline value interpolating control source")
struct _GstInterpolationControlSourcePrivate
{
- GstInterpolateMode interpolation_mode;
+ GstInterpolationMode interpolation_mode;
};
/**
return g_object_newv (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, 0, NULL);
}
-/**
- * gst_interpolation_control_source_set_interpolation_mode:
- * @self: the #GstInterpolationControlSource object
- * @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* */
+static gboolean
+ gst_interpolation_control_source_set_interpolation_mode
+ (GstInterpolationControlSource * self, GstInterpolationMode mode)
{
gboolean ret = TRUE;
GstControlSource *csource = GST_CONTROL_SOURCE (self);
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);
switch (gst_timed_value_control_source_get_base_value_type (
(GstTimedValueControlSource *) self)) {
self->priv =
G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_INTERPOLATION_CONTROL_SOURCE,
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
gst_interpolation_control_source_class_init (GstInterpolationControlSourceClass
* klass)
{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstControlSourceClass *csource_class = GST_CONTROL_SOURCE_CLASS (klass);
g_type_class_add_private (klass,
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;
+
+ 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));
}
#define GST_INTERPOLATION_CONTROL_SOURCE_GET_CLASS(inst) \
(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 _GstInterpolationControlSourceClass GstInterpolationControlSourceClass;
typedef struct _GstInterpolationControlSourcePrivate GstInterpolationControlSourcePrivate;
/**
- * GstInterpolateMode:
- * @GST_INTERPOLATE_NONE: steps-like interpolation, default
- * @GST_INTERPOLATE_LINEAR: linear interpolation
- * @GST_INTERPOLATE_QUADRATIC: square interpolation (deprecated, maps to cubic)
- * @GST_INTERPOLATE_CUBIC: cubic interpolation
+ * GstInterpolationMode:
+ * @GST_INTERPOLATION_MODE_NONE: steps-like interpolation, default
+ * @GST_INTERPOLATION_MODE_LINEAR: linear interpolation
+ * @GST_INTERPOLATION_MODE_CUBIC: cubic interpolation
*
* The various interpolation modes available.
*/
typedef enum
{
- GST_INTERPOLATE_NONE,
- GST_INTERPOLATE_LINEAR,
- GST_INTERPOLATE_QUADRATIC,
- GST_INTERPOLATE_CUBIC
-} GstInterpolateMode;
+ GST_INTERPOLATION_MODE_NONE,
+ GST_INTERPOLATION_MODE_LINEAR,
+ GST_INTERPOLATION_MODE_CUBIC
+} GstInterpolationMode;
/**
* GstInterpolationControlSource:
};
GType gst_interpolation_control_source_get_type (void);
+GType gst_interpolation_mode_get_type (void);
/* Functions */
GstInterpolationControlSource *
gst_interpolation_control_source_new (void);
-gboolean gst_interpolation_control_source_set_interpolation_mode
- (GstInterpolationControlSource *self,
- GstInterpolateMode mode);
G_END_DECLS
csource = gst_interpolation_control_source_new ();
gst_object_set_control_source (GST_OBJECT (src), "freq",
GST_CONTROL_SOURCE (csource));
- gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR);
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
g_value_init (&freq, G_TYPE_DOUBLE);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_NONE));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
fail_unless (gst_timed_value_control_source_get_count (
(GstTimedValueControlSource *) csource) == 0);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_CUBIC));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
/* set control values */
g_value_init (&val_double, G_TYPE_DOUBLE);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_CUBIC));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
/* set 2 control values */
g_value_init (&val_double, G_TYPE_DOUBLE);
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() */
GST_START_TEST (controller_interpolation_unset)
{
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_NONE));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_NONE));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */
g_value_init (&val_float, G_TYPE_FLOAT);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
g_value_init (&val_ulong, G_TYPE_ULONG);
GST_CONTROL_SOURCE (csource2)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR));
- fail_unless (gst_interpolation_control_source_set_interpolation_mode
- (csource2, GST_INTERPOLATE_LINEAR));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
+ g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control value */
tval = g_new0 (GstTimedValue, 1);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_LINEAR));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
- fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_NONE));
+ g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
fail_unless (gst_timed_value_control_source_get_count (
(GstTimedValueControlSource *) csource) == 0);
tcase_add_test (tc, controller_interpolate_linear);
tcase_add_test (tc, controller_interpolate_cubic);
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_all);
tcase_add_test (tc, controller_interpolation_linear_value_array);
/* Set interpolation mode */
- gst_interpolation_control_source_set_interpolation_mode (csource1,
- GST_INTERPOLATE_LINEAR);
- gst_interpolation_control_source_set_interpolation_mode (csource2,
- GST_INTERPOLATE_LINEAR);
+ g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
+ g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */
g_value_init (&vol, G_TYPE_DOUBLE);