libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
2009-05-14 20:11:57 +00:00
|
|
|
* Copyright (C) 2007,2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
*
|
|
|
|
* gstinterpolationcontrolsource.c: Control source that provides several
|
|
|
|
* interpolation methods
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:gstinterpolationcontrolsource
|
2017-01-16 14:26:16 +00:00
|
|
|
* @title: GstInterpolationControlSource
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
* @short_description: interpolation control source
|
|
|
|
*
|
|
|
|
* #GstInterpolationControlSource is a #GstControlSource, that interpolates values between user-given
|
|
|
|
* control points. It supports several interpolation modes and property types.
|
|
|
|
*
|
|
|
|
* To use #GstInterpolationControlSource get a new instance by calling
|
2011-12-19 22:32:57 +00:00
|
|
|
* gst_interpolation_control_source_new(), bind it to a #GParamSpec and set some
|
|
|
|
* control points by calling gst_timed_value_control_source_set().
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
*
|
|
|
|
* All functions are MT-safe.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
#include "gstinterpolationcontrolsource.h"
|
2011-12-04 13:35:38 +00:00
|
|
|
#include "gst/glib-compat-private.h"
|
2011-12-30 12:32:18 +00:00
|
|
|
#include "gst/math-compat.h"
|
2011-12-22 22:48:30 +00:00
|
|
|
|
2009-06-09 17:08:26 +00:00
|
|
|
#define GST_CAT_DEFAULT controller_debug
|
2011-11-04 10:34:11 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
2009-06-09 17:08:26 +00:00
|
|
|
|
2015-09-07 07:37:05 +00:00
|
|
|
/* helper functions */
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
_get_nearest_control_points (GstTimedValueControlSource * self,
|
|
|
|
GstClockTime ts, GstControlPoint ** cp1, GstControlPoint ** cp2)
|
|
|
|
{
|
|
|
|
GSequenceIter *iter;
|
|
|
|
|
|
|
|
iter = gst_timed_value_control_source_find_control_point_iter (self, ts);
|
|
|
|
if (iter) {
|
|
|
|
*cp1 = g_sequence_get (iter);
|
|
|
|
iter = g_sequence_iter_next (iter);
|
|
|
|
if (iter && !g_sequence_iter_is_end (iter)) {
|
|
|
|
*cp2 = g_sequence_get (iter);
|
|
|
|
} else {
|
|
|
|
*cp2 = NULL;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_get_nearest_control_points2 (GstTimedValueControlSource * self,
|
|
|
|
GstClockTime ts, GstControlPoint ** cp1, GstControlPoint ** cp2,
|
|
|
|
GstClockTime * next_ts)
|
|
|
|
{
|
|
|
|
GSequenceIter *iter1, *iter2 = NULL;
|
|
|
|
|
|
|
|
*cp1 = *cp2 = NULL;
|
|
|
|
iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts);
|
|
|
|
if (iter1) {
|
|
|
|
*cp1 = g_sequence_get (iter1);
|
|
|
|
iter2 = g_sequence_iter_next (iter1);
|
|
|
|
} else {
|
|
|
|
if (G_LIKELY (self->values)) {
|
|
|
|
/* all values in the control point list come after the given timestamp */
|
|
|
|
iter2 = g_sequence_get_begin_iter (self->values);
|
|
|
|
/* why this? if !cp1 we don't interpolate anyway
|
|
|
|
* if we can eliminate this, we can also use _get_nearest_control_points()
|
|
|
|
* here, is this just to set next_ts? */
|
|
|
|
} else {
|
|
|
|
/* no values */
|
|
|
|
iter2 = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iter2 && !g_sequence_iter_is_end (iter2)) {
|
|
|
|
*cp2 = g_sequence_get (iter2);
|
|
|
|
*next_ts = (*cp2)->timestamp;
|
|
|
|
} else {
|
|
|
|
*next_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-22 22:48:30 +00:00
|
|
|
/* steps-like (no-)interpolation, default */
|
|
|
|
/* just returns the value for the most recent key-frame */
|
2011-12-27 11:24:48 +00:00
|
|
|
static inline gdouble
|
2015-09-07 07:37:05 +00:00
|
|
|
_interpolate_none (GstTimedValueControlSource * self, GstControlPoint * cp)
|
2011-12-22 22:48:30 +00:00
|
|
|
{
|
|
|
|
return cp->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
interpolate_none_get (GstTimedValueControlSource * self, GstClockTime timestamp,
|
|
|
|
gdouble * value)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
GSequenceIter *iter;
|
2015-09-07 07:37:05 +00:00
|
|
|
GstControlPoint *cp;
|
2011-12-22 22:48:30 +00:00
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_lock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
|
|
|
|
iter =
|
|
|
|
gst_timed_value_control_source_find_control_point_iter (self, timestamp);
|
|
|
|
if (iter) {
|
2015-09-07 07:37:05 +00:00
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
*value = _interpolate_none (self, cp);
|
2011-12-22 22:48:30 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_unlock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
interpolate_none_get_value_array (GstTimedValueControlSource * self,
|
|
|
|
GstClockTime timestamp, GstClockTime interval, guint n_values,
|
|
|
|
gdouble * values)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
guint i;
|
|
|
|
GstClockTime ts = timestamp;
|
|
|
|
GstClockTime next_ts = 0;
|
2015-09-07 07:37:05 +00:00
|
|
|
GstControlPoint *cp1 = NULL, *cp2 = NULL;
|
2011-12-22 22:48:30 +00:00
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_lock (&self->lock);
|
2012-01-01 14:01:22 +00:00
|
|
|
|
2011-12-22 22:48:30 +00:00
|
|
|
for (i = 0; i < n_values; i++) {
|
2012-01-01 14:01:22 +00:00
|
|
|
GST_LOG ("values[%3d] : ts=%" GST_TIME_FORMAT ", next_ts=%" GST_TIME_FORMAT,
|
|
|
|
i, GST_TIME_ARGS (ts), GST_TIME_ARGS (next_ts));
|
2011-12-22 22:48:30 +00:00
|
|
|
if (ts >= next_ts) {
|
2015-09-07 07:37:05 +00:00
|
|
|
_get_nearest_control_points2 (self, ts, &cp1, &cp2, &next_ts);
|
2012-01-01 14:01:22 +00:00
|
|
|
}
|
2015-09-07 07:37:05 +00:00
|
|
|
if (cp1) {
|
|
|
|
*values = _interpolate_none (self, cp1);
|
2012-01-01 14:01:22 +00:00
|
|
|
ret = TRUE;
|
2015-09-07 07:37:05 +00:00
|
|
|
GST_LOG ("values[%3d]=%lf", i, *values);
|
2012-01-01 14:01:22 +00:00
|
|
|
} else {
|
2015-09-07 07:37:05 +00:00
|
|
|
*values = NAN;
|
2012-01-01 14:01:22 +00:00
|
|
|
GST_LOG ("values[%3d]=-", i);
|
2011-12-22 22:48:30 +00:00
|
|
|
}
|
|
|
|
ts += interval;
|
|
|
|
values++;
|
|
|
|
}
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_unlock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* linear interpolation */
|
2018-04-27 16:40:31 +00:00
|
|
|
/* smoothes in between values */
|
2011-12-22 22:48:30 +00:00
|
|
|
static inline gdouble
|
|
|
|
_interpolate_linear (GstClockTime timestamp1, gdouble value1,
|
|
|
|
GstClockTime timestamp2, gdouble value2, GstClockTime timestamp)
|
|
|
|
{
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp2)) {
|
|
|
|
gdouble slope;
|
|
|
|
|
|
|
|
slope =
|
|
|
|
(value2 - value1) / gst_guint64_to_gdouble (timestamp2 - timestamp1);
|
|
|
|
return value1 + (gst_guint64_to_gdouble (timestamp - timestamp1) * slope);
|
|
|
|
} else {
|
|
|
|
return value1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
interpolate_linear_get (GstTimedValueControlSource * self,
|
|
|
|
GstClockTime timestamp, gdouble * value)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
GstControlPoint *cp1, *cp2;
|
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_lock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
|
2015-09-07 07:37:05 +00:00
|
|
|
if (_get_nearest_control_points (self, timestamp, &cp1, &cp2)) {
|
2011-12-22 22:48:30 +00:00
|
|
|
*value = _interpolate_linear (cp1->timestamp, cp1->value,
|
|
|
|
(cp2 ? cp2->timestamp : GST_CLOCK_TIME_NONE),
|
|
|
|
(cp2 ? cp2->value : 0.0), timestamp);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_unlock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
interpolate_linear_get_value_array (GstTimedValueControlSource * self,
|
|
|
|
GstClockTime timestamp, GstClockTime interval, guint n_values,
|
|
|
|
gdouble * values)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
guint i;
|
|
|
|
GstClockTime ts = timestamp;
|
|
|
|
GstClockTime next_ts = 0;
|
|
|
|
GstControlPoint *cp1 = NULL, *cp2 = NULL;
|
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_lock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n_values; i++) {
|
2012-01-01 14:01:22 +00:00
|
|
|
GST_LOG ("values[%3d] : ts=%" GST_TIME_FORMAT ", next_ts=%" GST_TIME_FORMAT,
|
|
|
|
i, GST_TIME_ARGS (ts), GST_TIME_ARGS (next_ts));
|
2011-12-22 22:48:30 +00:00
|
|
|
if (ts >= next_ts) {
|
2015-09-07 07:37:05 +00:00
|
|
|
_get_nearest_control_points2 (self, ts, &cp1, &cp2, &next_ts);
|
2011-12-22 22:48:30 +00:00
|
|
|
}
|
|
|
|
if (cp1) {
|
2015-09-07 07:37:05 +00:00
|
|
|
*values = _interpolate_linear (cp1->timestamp, cp1->value,
|
2011-12-22 22:48:30 +00:00
|
|
|
(cp2 ? cp2->timestamp : GST_CLOCK_TIME_NONE),
|
|
|
|
(cp2 ? cp2->value : 0.0), ts);
|
|
|
|
ret = TRUE;
|
2015-09-07 07:37:05 +00:00
|
|
|
GST_LOG ("values[%3d]=%lf", i, *values);
|
2012-01-01 14:01:22 +00:00
|
|
|
} else {
|
2015-10-01 20:09:58 +00:00
|
|
|
*values = NAN;
|
2012-01-01 14:01:22 +00:00
|
|
|
GST_LOG ("values[%3d]=-", i);
|
2011-12-22 22:48:30 +00:00
|
|
|
}
|
|
|
|
ts += interval;
|
|
|
|
values++;
|
|
|
|
}
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_unlock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* cubic interpolation */
|
|
|
|
|
|
|
|
/* The following functions implement a natural cubic spline interpolator.
|
|
|
|
* For details look at http://en.wikipedia.org/wiki/Spline_interpolation
|
|
|
|
*
|
|
|
|
* Instead of using a real matrix with n^2 elements for the linear system
|
|
|
|
* of equations we use three arrays o, p, q to hold the tridiagonal matrix
|
|
|
|
* as following to save memory:
|
|
|
|
*
|
|
|
|
* p[0] q[0] 0 0 0
|
|
|
|
* o[1] p[1] q[1] 0 0
|
|
|
|
* 0 o[2] p[2] q[2] .
|
|
|
|
* . . . . .
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
_interpolate_cubic_update_cache (GstTimedValueControlSource * self)
|
|
|
|
{
|
|
|
|
gint i, n = self->nvalues;
|
|
|
|
gdouble *o = g_new0 (gdouble, n);
|
|
|
|
gdouble *p = g_new0 (gdouble, n);
|
|
|
|
gdouble *q = g_new0 (gdouble, n);
|
|
|
|
|
|
|
|
gdouble *h = g_new0 (gdouble, n);
|
|
|
|
gdouble *b = g_new0 (gdouble, n);
|
|
|
|
gdouble *z = g_new0 (gdouble, n);
|
|
|
|
|
|
|
|
GSequenceIter *iter;
|
|
|
|
GstControlPoint *cp;
|
|
|
|
GstClockTime x, x_next;
|
|
|
|
gdouble y_prev, y, y_next;
|
|
|
|
|
|
|
|
/* Fill linear system of equations */
|
|
|
|
iter = g_sequence_get_begin_iter (self->values);
|
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
x = cp->timestamp;
|
|
|
|
y = cp->value;
|
|
|
|
|
|
|
|
p[0] = 1.0;
|
|
|
|
|
|
|
|
iter = g_sequence_iter_next (iter);
|
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
x_next = cp->timestamp;
|
|
|
|
y_next = cp->value;
|
|
|
|
h[0] = gst_guint64_to_gdouble (x_next - x);
|
|
|
|
|
|
|
|
for (i = 1; i < n - 1; i++) {
|
|
|
|
/* Shuffle x and y values */
|
|
|
|
y_prev = y;
|
|
|
|
x = x_next;
|
|
|
|
y = y_next;
|
|
|
|
iter = g_sequence_iter_next (iter);
|
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
x_next = cp->timestamp;
|
|
|
|
y_next = cp->value;
|
|
|
|
|
|
|
|
h[i] = gst_guint64_to_gdouble (x_next - x);
|
|
|
|
o[i] = h[i - 1];
|
|
|
|
p[i] = 2.0 * (h[i - 1] + h[i]);
|
|
|
|
q[i] = h[i];
|
|
|
|
b[i] = (y_next - y) / h[i] - (y - y_prev) / h[i - 1];
|
|
|
|
}
|
|
|
|
p[n - 1] = 1.0;
|
|
|
|
|
|
|
|
/* Use Gauss elimination to set everything below the diagonal to zero */
|
|
|
|
for (i = 1; i < n - 1; i++) {
|
|
|
|
gdouble a = o[i] / p[i - 1];
|
|
|
|
p[i] -= a * q[i - 1];
|
|
|
|
b[i] -= a * b[i - 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Solve everything else from bottom to top */
|
|
|
|
for (i = n - 2; i > 0; i--)
|
|
|
|
z[i] = (b[i] - q[i] * z[i + 1]) / p[i];
|
|
|
|
|
|
|
|
/* Save cache next in the GstControlPoint */
|
|
|
|
|
|
|
|
iter = g_sequence_get_begin_iter (self->values);
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
cp->cache.cubic.h = h[i];
|
|
|
|
cp->cache.cubic.z = z[i];
|
|
|
|
iter = g_sequence_iter_next (iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free our temporary arrays */
|
|
|
|
g_free (o);
|
|
|
|
g_free (p);
|
|
|
|
g_free (q);
|
|
|
|
g_free (h);
|
|
|
|
g_free (b);
|
|
|
|
g_free (z);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gdouble
|
|
|
|
_interpolate_cubic (GstTimedValueControlSource * self, GstControlPoint * cp1,
|
|
|
|
gdouble value1, GstControlPoint * cp2, gdouble value2,
|
|
|
|
GstClockTime timestamp)
|
|
|
|
{
|
|
|
|
if (!self->valid_cache) {
|
|
|
|
_interpolate_cubic_update_cache (self);
|
|
|
|
self->valid_cache = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cp2) {
|
|
|
|
gdouble diff1, diff2;
|
|
|
|
gdouble out;
|
|
|
|
|
|
|
|
diff1 = gst_guint64_to_gdouble (timestamp - cp1->timestamp);
|
|
|
|
diff2 = gst_guint64_to_gdouble (cp2->timestamp - timestamp);
|
|
|
|
|
|
|
|
out =
|
|
|
|
(cp2->cache.cubic.z * diff1 * diff1 * diff1 +
|
|
|
|
cp1->cache.cubic.z * diff2 * diff2 * diff2) / cp1->cache.cubic.h;
|
|
|
|
out +=
|
|
|
|
(value2 / cp1->cache.cubic.h -
|
|
|
|
cp1->cache.cubic.h * cp2->cache.cubic.z) * diff1;
|
|
|
|
out +=
|
|
|
|
(value1 / cp1->cache.cubic.h -
|
|
|
|
cp1->cache.cubic.h * cp1->cache.cubic.z) * diff2;
|
|
|
|
return out;
|
|
|
|
} else {
|
|
|
|
return value1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
interpolate_cubic_get (GstTimedValueControlSource * self,
|
|
|
|
GstClockTime timestamp, gdouble * value)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
GstControlPoint *cp1, *cp2 = NULL;
|
|
|
|
|
|
|
|
if (self->nvalues <= 2)
|
|
|
|
return interpolate_linear_get (self, timestamp, value);
|
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_lock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
|
2015-09-07 07:37:05 +00:00
|
|
|
if (_get_nearest_control_points (self, timestamp, &cp1, &cp2)) {
|
2011-12-22 22:48:30 +00:00
|
|
|
*value = _interpolate_cubic (self, cp1, cp1->value, cp2,
|
|
|
|
(cp2 ? cp2->value : 0.0), timestamp);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_unlock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
interpolate_cubic_get_value_array (GstTimedValueControlSource * self,
|
|
|
|
GstClockTime timestamp, GstClockTime interval, guint n_values,
|
|
|
|
gdouble * values)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
guint i;
|
|
|
|
GstClockTime ts = timestamp;
|
|
|
|
GstClockTime next_ts = 0;
|
|
|
|
GstControlPoint *cp1 = NULL, *cp2 = NULL;
|
|
|
|
|
|
|
|
if (self->nvalues <= 2)
|
|
|
|
return interpolate_linear_get_value_array (self, timestamp, interval,
|
|
|
|
n_values, values);
|
|
|
|
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_lock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n_values; i++) {
|
2012-01-01 14:01:22 +00:00
|
|
|
GST_LOG ("values[%3d] : ts=%" GST_TIME_FORMAT ", next_ts=%" GST_TIME_FORMAT,
|
|
|
|
i, GST_TIME_ARGS (ts), GST_TIME_ARGS (next_ts));
|
2011-12-22 22:48:30 +00:00
|
|
|
if (ts >= next_ts) {
|
2015-09-07 07:37:05 +00:00
|
|
|
_get_nearest_control_points2 (self, ts, &cp1, &cp2, &next_ts);
|
2012-01-01 14:01:22 +00:00
|
|
|
}
|
|
|
|
if (cp1) {
|
2015-09-07 07:37:05 +00:00
|
|
|
*values = _interpolate_cubic (self, cp1, cp1->value, cp2,
|
2012-01-01 17:54:23 +00:00
|
|
|
(cp2 ? cp2->value : 0.0), ts);
|
2012-01-01 14:01:22 +00:00
|
|
|
ret = TRUE;
|
2015-09-07 07:37:05 +00:00
|
|
|
GST_LOG ("values[%3d]=%lf", i, *values);
|
2012-01-01 14:01:22 +00:00
|
|
|
} else {
|
2015-09-07 07:37:05 +00:00
|
|
|
*values = NAN;
|
2012-01-01 14:01:22 +00:00
|
|
|
GST_LOG ("values[%3d]=-", i);
|
2011-12-22 22:48:30 +00:00
|
|
|
}
|
|
|
|
ts += interval;
|
|
|
|
values++;
|
|
|
|
}
|
2012-01-19 08:27:04 +00:00
|
|
|
g_mutex_unlock (&self->lock);
|
2011-12-22 22:48:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-09-07 07:39:32 +00:00
|
|
|
|
|
|
|
/* monotonic cubic interpolation */
|
|
|
|
|
|
|
|
/* the following functions implement monotonic cubic spline interpolation.
|
|
|
|
* For details: http://en.wikipedia.org/wiki/Monotone_cubic_interpolation
|
|
|
|
*
|
|
|
|
* In contrast to the previous cubic mode, the values won't overshoot.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2016-01-05 12:57:12 +00:00
|
|
|
_interpolate_cubic_monotonic_update_cache (GstTimedValueControlSource * self)
|
2015-09-07 07:39:32 +00:00
|
|
|
{
|
|
|
|
gint i, n = self->nvalues;
|
|
|
|
gdouble *dxs = g_new0 (gdouble, n);
|
|
|
|
gdouble *dys = g_new0 (gdouble, n);
|
|
|
|
gdouble *ms = g_new0 (gdouble, n);
|
|
|
|
gdouble *c1s = g_new0 (gdouble, n);
|
|
|
|
|
|
|
|
GSequenceIter *iter;
|
|
|
|
GstControlPoint *cp;
|
|
|
|
GstClockTime x, x_next, dx;
|
|
|
|
gdouble y, y_next, dy;
|
|
|
|
|
|
|
|
/* Get consecutive differences and slopes */
|
|
|
|
iter = g_sequence_get_begin_iter (self->values);
|
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
x_next = cp->timestamp;
|
|
|
|
y_next = cp->value;
|
|
|
|
for (i = 0; i < n - 1; i++) {
|
|
|
|
x = x_next;
|
|
|
|
y = y_next;
|
|
|
|
iter = g_sequence_iter_next (iter);
|
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
x_next = cp->timestamp;
|
|
|
|
y_next = cp->value;
|
|
|
|
|
|
|
|
dx = gst_guint64_to_gdouble (x_next - x);
|
|
|
|
dy = y_next - y;
|
|
|
|
dxs[i] = dx;
|
|
|
|
dys[i] = dy;
|
|
|
|
ms[i] = dy / dx;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get degree-1 coefficients */
|
|
|
|
c1s[0] = ms[0];
|
|
|
|
for (i = 1; i < n; i++) {
|
|
|
|
gdouble m = ms[i - 1];
|
|
|
|
gdouble m_next = ms[i];
|
|
|
|
|
|
|
|
if (m * m_next <= 0) {
|
|
|
|
c1s[i] = 0.0;
|
|
|
|
} else {
|
|
|
|
gdouble dx_next, dx_sum;
|
|
|
|
|
|
|
|
dx = dxs[i], dx_next = dxs[i + 1], dx_sum = dx + dx_next;
|
|
|
|
c1s[i] = 3.0 * dx_sum / ((dx_sum + dx_next) / m + (dx_sum + dx) / m_next);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c1s[n - 1] = ms[n - 1];
|
|
|
|
|
|
|
|
/* Get degree-2 and degree-3 coefficients */
|
|
|
|
iter = g_sequence_get_begin_iter (self->values);
|
|
|
|
for (i = 0; i < n - 1; i++) {
|
|
|
|
gdouble c1, m, inv_dx, common;
|
|
|
|
cp = g_sequence_get (iter);
|
|
|
|
|
|
|
|
c1 = c1s[i];
|
|
|
|
m = ms[i];
|
|
|
|
inv_dx = 1.0 / dxs[i];
|
|
|
|
common = c1 + c1s[i + 1] - m - m;
|
|
|
|
|
2016-01-05 12:57:12 +00:00
|
|
|
cp->cache.cubic_monotonic.c1s = c1;
|
|
|
|
cp->cache.cubic_monotonic.c2s = (m - c1 - common) * inv_dx;
|
|
|
|
cp->cache.cubic_monotonic.c3s = common * inv_dx * inv_dx;
|
2015-09-07 07:39:32 +00:00
|
|
|
|
|
|
|
iter = g_sequence_iter_next (iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free our temporary arrays */
|
|
|
|
g_free (dxs);
|
|
|
|
g_free (dys);
|
|
|
|
g_free (ms);
|
|
|
|
g_free (c1s);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gdouble
|
2016-01-05 12:57:12 +00:00
|
|
|
_interpolate_cubic_monotonic (GstTimedValueControlSource * self,
|
2015-09-07 07:39:32 +00:00
|
|
|
GstControlPoint * cp1, gdouble value1, GstControlPoint * cp2,
|
|
|
|
gdouble value2, GstClockTime timestamp)
|
|
|
|
{
|
|
|
|
if (!self->valid_cache) {
|
2016-01-05 12:57:12 +00:00
|
|
|
_interpolate_cubic_monotonic_update_cache (self);
|
2015-09-07 07:39:32 +00:00
|
|
|
self->valid_cache = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cp2) {
|
|
|
|
gdouble diff = gst_guint64_to_gdouble (timestamp - cp1->timestamp);
|
|
|
|
gdouble diff2 = diff * diff;
|
|
|
|
gdouble out;
|
|
|
|
|
2016-01-05 12:57:12 +00:00
|
|
|
out = value1 + cp1->cache.cubic_monotonic.c1s * diff;
|
|
|
|
out += cp1->cache.cubic_monotonic.c2s * diff2;
|
|
|
|
out += cp1->cache.cubic_monotonic.c3s * diff * diff2;
|
2015-09-07 07:39:32 +00:00
|
|
|
return out;
|
|
|
|
} else {
|
|
|
|
return value1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2016-01-05 12:57:12 +00:00
|
|
|
interpolate_cubic_monotonic_get (GstTimedValueControlSource * self,
|
2015-09-07 07:39:32 +00:00
|
|
|
GstClockTime timestamp, gdouble * value)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
GstControlPoint *cp1, *cp2 = NULL;
|
|
|
|
|
|
|
|
if (self->nvalues <= 2)
|
|
|
|
return interpolate_linear_get (self, timestamp, value);
|
|
|
|
|
|
|
|
g_mutex_lock (&self->lock);
|
|
|
|
|
|
|
|
if (_get_nearest_control_points (self, timestamp, &cp1, &cp2)) {
|
2016-01-05 12:57:12 +00:00
|
|
|
*value = _interpolate_cubic_monotonic (self, cp1, cp1->value, cp2,
|
2015-09-07 07:39:32 +00:00
|
|
|
(cp2 ? cp2->value : 0.0), timestamp);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
g_mutex_unlock (&self->lock);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2016-01-05 12:57:12 +00:00
|
|
|
interpolate_cubic_monotonic_get_value_array (GstTimedValueControlSource * self,
|
2015-09-07 07:39:32 +00:00
|
|
|
GstClockTime timestamp, GstClockTime interval, guint n_values,
|
|
|
|
gdouble * values)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
guint i;
|
|
|
|
GstClockTime ts = timestamp;
|
|
|
|
GstClockTime next_ts = 0;
|
|
|
|
GstControlPoint *cp1 = NULL, *cp2 = NULL;
|
|
|
|
|
|
|
|
if (self->nvalues <= 2)
|
|
|
|
return interpolate_linear_get_value_array (self, timestamp, interval,
|
|
|
|
n_values, values);
|
|
|
|
|
|
|
|
g_mutex_lock (&self->lock);
|
|
|
|
|
|
|
|
for (i = 0; i < n_values; i++) {
|
|
|
|
GST_LOG ("values[%3d] : ts=%" GST_TIME_FORMAT ", next_ts=%" GST_TIME_FORMAT,
|
|
|
|
i, GST_TIME_ARGS (ts), GST_TIME_ARGS (next_ts));
|
|
|
|
if (ts >= next_ts) {
|
|
|
|
_get_nearest_control_points2 (self, ts, &cp1, &cp2, &next_ts);
|
|
|
|
}
|
|
|
|
if (cp1) {
|
2016-01-05 12:57:12 +00:00
|
|
|
*values = _interpolate_cubic_monotonic (self, cp1, cp1->value, cp2,
|
2015-09-07 07:39:32 +00:00
|
|
|
(cp2 ? cp2->value : 0.0), ts);
|
|
|
|
ret = TRUE;
|
|
|
|
GST_LOG ("values[%3d]=%lf", i, *values);
|
|
|
|
} else {
|
|
|
|
*values = NAN;
|
|
|
|
GST_LOG ("values[%3d]=-", i);
|
|
|
|
}
|
|
|
|
ts += interval;
|
|
|
|
values++;
|
|
|
|
}
|
|
|
|
g_mutex_unlock (&self->lock);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-22 22:48:30 +00:00
|
|
|
static struct
|
|
|
|
{
|
|
|
|
GstControlSourceGetValue get;
|
|
|
|
GstControlSourceGetValueArray get_value_array;
|
|
|
|
} interpolation_modes[] = {
|
|
|
|
{
|
|
|
|
(GstControlSourceGetValue) interpolate_none_get,
|
|
|
|
(GstControlSourceGetValueArray) interpolate_none_get_value_array}, {
|
|
|
|
(GstControlSourceGetValue) interpolate_linear_get,
|
|
|
|
(GstControlSourceGetValueArray) interpolate_linear_get_value_array}, {
|
|
|
|
(GstControlSourceGetValue) interpolate_cubic_get,
|
2015-09-07 07:39:32 +00:00
|
|
|
(GstControlSourceGetValueArray) interpolate_cubic_get_value_array}, {
|
2016-01-05 12:57:12 +00:00
|
|
|
(GstControlSourceGetValue) interpolate_cubic_monotonic_get,
|
2015-09-07 07:39:32 +00:00
|
|
|
(GstControlSourceGetValueArray)
|
2016-01-05 12:57:12 +00:00
|
|
|
interpolate_cubic_monotonic_get_value_array}};
|
2011-12-22 22:48:30 +00:00
|
|
|
|
|
|
|
static const guint num_interpolation_modes = G_N_ELEMENTS (interpolation_modes);
|
|
|
|
|
2011-12-19 22:32:57 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_MODE = 1
|
|
|
|
};
|
|
|
|
|
2018-06-23 15:01:09 +00:00
|
|
|
struct _GstInterpolationControlSourcePrivate
|
|
|
|
{
|
|
|
|
GstInterpolationMode interpolation_mode;
|
|
|
|
};
|
|
|
|
|
2011-11-04 10:34:11 +00:00
|
|
|
#define _do_init \
|
2011-12-19 10:13:45 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "interpolation control source", 0, \
|
|
|
|
"timeline value interpolating control source")
|
2011-11-04 10:34:11 +00:00
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstInterpolationControlSource,
|
2011-12-19 10:13:45 +00:00
|
|
|
gst_interpolation_control_source, GST_TYPE_TIMED_VALUE_CONTROL_SOURCE,
|
2018-06-23 15:01:09 +00:00
|
|
|
G_ADD_PRIVATE (GstInterpolationControlSource)
|
2011-12-19 10:13:45 +00:00
|
|
|
_do_init);
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_interpolation_control_source_new:
|
|
|
|
*
|
|
|
|
* This returns a new, unbound #GstInterpolationControlSource.
|
|
|
|
*
|
2012-01-27 12:05:48 +00:00
|
|
|
* Returns: (transfer full): a new, unbound #GstInterpolationControlSource.
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
*/
|
2012-01-31 11:20:41 +00:00
|
|
|
GstControlSource *
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
gst_interpolation_control_source_new (void)
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
{
|
2017-05-15 11:32:48 +00:00
|
|
|
GstControlSource *csource =
|
|
|
|
g_object_new (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, NULL);
|
|
|
|
|
|
|
|
/* Clear floating flag */
|
|
|
|
gst_object_ref_sink (csource);
|
|
|
|
|
|
|
|
return csource;
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
}
|
|
|
|
|
2011-12-19 22:32:57 +00:00
|
|
|
static gboolean
|
|
|
|
gst_interpolation_control_source_set_interpolation_mode
|
|
|
|
(GstInterpolationControlSource * self, GstInterpolationMode mode)
|
2009-05-22 11:17:56 +00:00
|
|
|
{
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
GstControlSource *csource = GST_CONTROL_SOURCE (self);
|
|
|
|
|
2013-12-10 22:09:07 +00:00
|
|
|
if (mode >= num_interpolation_modes || (int) mode < 0) {
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
GST_WARNING ("interpolation mode %d invalid or not implemented yet", mode);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-12-19 10:13:45 +00:00
|
|
|
GST_TIMED_VALUE_CONTROL_SOURCE_LOCK (self);
|
2011-12-22 22:48:30 +00:00
|
|
|
csource->get_value = interpolation_modes[mode].get;
|
|
|
|
csource->get_value_array = interpolation_modes[mode].get_value_array;
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
|
2011-12-19 10:13:45 +00:00
|
|
|
gst_timed_value_control_invalidate_cache ((GstTimedValueControlSource *)
|
|
|
|
csource);
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
self->priv->interpolation_mode = mode;
|
|
|
|
|
2011-12-19 10:13:45 +00:00
|
|
|
GST_TIMED_VALUE_CONTROL_SOURCE_UNLOCK (self);
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
|
2011-12-22 22:48:30 +00:00
|
|
|
return TRUE;
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_interpolation_control_source_init (GstInterpolationControlSource * self)
|
|
|
|
{
|
2018-06-23 15:01:09 +00:00
|
|
|
self->priv = gst_interpolation_control_source_get_instance_private (self);
|
2011-12-22 22:48:30 +00:00
|
|
|
gst_interpolation_control_source_set_interpolation_mode (self,
|
|
|
|
GST_INTERPOLATION_MODE_NONE);
|
2011-12-19 22:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_interpolation_control_source_class_init (GstInterpolationControlSourceClass
|
|
|
|
* klass)
|
|
|
|
{
|
2011-12-19 22:32:57 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
|
2011-12-19 22:32:57 +00:00
|
|
|
gobject_class->set_property = gst_interpolation_control_source_set_property;
|
|
|
|
gobject_class->get_property = gst_interpolation_control_source_get_property;
|
|
|
|
|
|
|
|
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));
|
libs/gst/controller/: API: Refactor GstController into the core controller which can take a GstControlSource for prov...
Original commit message from CVS:
Reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/Makefile.am:
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_add_interpolation_control_source),
(gst_controlled_property_new), (gst_controlled_property_free),
(gst_controller_find_controlled_property),
(gst_controller_new_valist), (gst_controller_new_list),
(gst_controller_new), (gst_controller_remove_properties_valist),
(gst_controller_remove_properties_list),
(gst_controller_remove_properties),
(gst_controller_set_property_disabled),
(gst_controller_set_disabled), (gst_controller_set_control_source),
(gst_controller_get_control_source), (gst_controller_get),
(gst_controller_sync_values), (gst_controller_get_value_array),
(_gst_controller_dispose), (gst_controller_get_type),
(gst_controlled_property_set_interpolation_mode),
(gst_controller_set), (gst_controller_set_from_list),
(gst_controller_unset), (gst_controller_unset_all),
(gst_controller_get_all), (gst_controller_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstcontrolsource.c:
(gst_control_source_class_init), (gst_control_source_init),
(gst_control_source_get_value),
(gst_control_source_get_value_array), (gst_control_source_bind):
* libs/gst/controller/gstcontrolsource.h:
* libs/gst/controller/gsthelper.c: (gst_object_set_control_source),
(gst_object_get_control_source):
* libs/gst/controller/gstinterpolation.c:
(gst_interpolation_control_source_find_control_point_node),
(gst_interpolation_control_source_get_first_value),
(_interpolate_none_get), (interpolate_none_get),
(interpolate_none_get_boolean_value_array),
(interpolate_none_get_enum_value_array),
(interpolate_none_get_string_value_array),
(_interpolate_trigger_get), (interpolate_trigger_get),
(interpolate_trigger_get_boolean_value_array),
(interpolate_trigger_get_enum_value_array),
(interpolate_trigger_get_string_value_array):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_control_point_free), (gst_interpolation_control_source_reset),
(gst_interpolation_control_source_new),
(gst_interpolation_control_source_set_interpolation_mode),
(gst_interpolation_control_source_bind),
(gst_control_point_compare), (gst_control_point_find),
(gst_interpolation_control_source_set_internal),
(gst_interpolation_control_source_set),
(gst_interpolation_control_source_set_from_list),
(gst_interpolation_control_source_unset),
(gst_interpolation_control_source_unset_all),
(gst_interpolation_control_source_get_all),
(gst_interpolation_control_source_get_count),
(gst_interpolation_control_source_init),
(gst_interpolation_control_source_finalize),
(gst_interpolation_control_source_dispose),
(gst_interpolation_control_source_class_init):
* libs/gst/controller/gstinterpolationcontrolsource.h:
* libs/gst/controller/gstinterpolationcontrolsourceprivate.h:
API: Refactor GstController into the core controller which can take
a GstControlSource for providing actual values for timestamps.
Implement a interpolation control source and use this for backward
compatibility, deprecate a bunch of functions that are now handled
by GstControlSource or GstInterpolationControlSource.
Make it possible to disable the controller completely or only for
specific properties. Fixes #450711.
* docs/libs/gstreamer-libs-docs.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/gstreamer-libs.types:
Add new functions and classes to the docs.
* tests/check/libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* tests/examples/controller/audio-example.c: (main):
Port unit test and example to the new API and add some new
unit tests.
2007-07-06 21:50:02 +00:00
|
|
|
}
|