mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
configure.ac: say what CHECK flags we use
Original commit message from CVS: * configure.ac: say what CHECK flags we use * docs/libs/gstreamer-libs.types: * libs/gst/controller/Makefile.am: * libs/gst/controller/gst-controller.c: * libs/gst/controller/gst-controller.h: * libs/gst/controller/gst-helper.c: * libs/gst/controller/gst-interpolation.c: * libs/gst/controller/gstcontroller.c: * libs/gst/controller/gsthelper.c: * libs/gst/controller/gstinterpolation.c: * tools/gst-inspect.c: (print_plugin_info): we don't use dashes in header names
This commit is contained in:
parent
8b61247c78
commit
3ca1c236d9
12 changed files with 44 additions and 1769 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2005-09-09 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
reviewed by: <delete if not using a buddy>
|
||||||
|
|
||||||
|
* check/gst/gstpad.c: (GST_START_TEST), (name_is_valid),
|
||||||
|
(gst_pad_suite):
|
||||||
|
* configure.ac:
|
||||||
|
* docs/libs/gstreamer-libs.types:
|
||||||
|
* gst/check/gstcheck.c: (gst_check_log_message_func):
|
||||||
|
* gst/gstpad.c:
|
||||||
|
* libs/gst/controller/Makefile.am:
|
||||||
|
* libs/gst/controller/gst-controller.c:
|
||||||
|
* libs/gst/controller/gst-controller.h:
|
||||||
|
* libs/gst/controller/gst-helper.c:
|
||||||
|
* libs/gst/controller/gst-interpolation.c:
|
||||||
|
* libs/gst/controller/gstcontroller.c:
|
||||||
|
* libs/gst/controller/gsthelper.c:
|
||||||
|
* libs/gst/controller/gstinterpolation.c:
|
||||||
|
* tools/gst-inspect.c: (print_plugin_info):
|
||||||
|
|
||||||
2005-09-09 Thomas Vander Stichele <thomas at apestaart dot org>
|
2005-09-09 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* check/Makefile.am:
|
* check/Makefile.am:
|
||||||
|
|
|
@ -285,7 +285,13 @@ dnl Check for ucontext.h
|
||||||
AC_CHECK_HEADER(ucontext.h, AC_DEFINE(HAVE_UCONTEXT_H, 1, [defined if we have ucontext.h]))
|
AC_CHECK_HEADER(ucontext.h, AC_DEFINE(HAVE_UCONTEXT_H, 1, [defined if we have ucontext.h]))
|
||||||
|
|
||||||
dnl check for "check", unit testing library/header
|
dnl check for "check", unit testing library/header
|
||||||
AM_PATH_CHECK(0.9.2, HAVE_CHECK=yes, HAVE_CHECK=no)
|
AM_PATH_CHECK(0.9.2,
|
||||||
|
[
|
||||||
|
HAVE_CHECK=yes
|
||||||
|
AC_MSG_NOTICE(CHECK_CFLAGS: $CHECK_CFLAGS)
|
||||||
|
AC_MSG_NOTICE(CHECK_LIBS: $CHECK_LIBS)
|
||||||
|
]
|
||||||
|
HAVE_CHECK=no)
|
||||||
AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
|
AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
|
||||||
|
|
||||||
dnl ######################################################################
|
dnl ######################################################################
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/controller/gst-controller.h>
|
#include <gst/controller/gstcontroller.h>
|
||||||
|
|
||||||
gst_controller_get_type
|
gst_controller_get_type
|
||||||
|
|
|
@ -2,13 +2,13 @@ lib_LTLIBRARIES = libgstcontroller-@GST_MAJORMINOR@.la
|
||||||
|
|
||||||
libgstcontroller_@GST_MAJORMINOR@_includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/controller
|
libgstcontroller_@GST_MAJORMINOR@_includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/controller
|
||||||
libgstcontroller_@GST_MAJORMINOR@_include_HEADERS = \
|
libgstcontroller_@GST_MAJORMINOR@_include_HEADERS = \
|
||||||
gst-controller.h
|
gstcontroller.h
|
||||||
|
|
||||||
libgstcontroller_@GST_MAJORMINOR@_la_SOURCES = \
|
libgstcontroller_@GST_MAJORMINOR@_la_SOURCES = \
|
||||||
lib.c \
|
lib.c \
|
||||||
gst-controller.c \
|
gstcontroller.c \
|
||||||
gst-interpolation.c \
|
gstinterpolation.c \
|
||||||
gst-helper.c
|
gsthelper.c
|
||||||
|
|
||||||
libgstcontroller_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_srcdir)/libs
|
libgstcontroller_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_srcdir)/libs
|
||||||
libgstcontroller_@GST_MAJORMINOR@_la_LDFLAGS = @GST_LIB_LDFLAGS@
|
libgstcontroller_@GST_MAJORMINOR@_la_LDFLAGS = @GST_LIB_LDFLAGS@
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,260 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
*
|
|
||||||
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
|
||||||
*
|
|
||||||
* gst-controller.h: dynamic parameter control subsystem
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GST_CONTROLLER_H__
|
|
||||||
#define __GST_CONTROLLER_H__
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <glib/gprintf.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GST_PARAM_CONTROLLABLE:
|
|
||||||
*
|
|
||||||
* Use this flag on GstElement properties you wish to be (eventually) handled
|
|
||||||
* by a GstController.
|
|
||||||
* TODO: needs to go to gstelemnt.h (to avoid clashes on G_PARAM_USER_SHIFT)
|
|
||||||
*/
|
|
||||||
#define GST_PARAM_CONTROLLABLE (1 << (G_PARAM_USER_SHIFT + 1))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstTimedValue:
|
|
||||||
*
|
|
||||||
* a structure for value+time
|
|
||||||
*/
|
|
||||||
typedef struct _GstTimedValue
|
|
||||||
{
|
|
||||||
GstClockTime timestamp; // timestamp of the value change
|
|
||||||
GValue value; // the new value
|
|
||||||
/* TODO what about storing the difference to next timestamp and value here
|
|
||||||
+ make calculations slightly easier and faster
|
|
||||||
- determining the GType for the value_dif is not simple
|
|
||||||
e.g. if value is G_TYPE_UCHAR value_diff needs to be G_TYPE_INT
|
|
||||||
*/
|
|
||||||
} GstTimedValue;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstValueArray:
|
|
||||||
* @property_name: the name of the property this array belongs to
|
|
||||||
* @nbsamples: number of samples requested
|
|
||||||
* @sample_interval: interval between each sample
|
|
||||||
* @values: pointer to the array
|
|
||||||
*
|
|
||||||
* Structure to receive multiple values at once.
|
|
||||||
* If the pointer to the values array is NULL, it will be allocated (CHECKME).
|
|
||||||
*/
|
|
||||||
typedef struct _GstValueArray
|
|
||||||
{
|
|
||||||
gchar *property_name;
|
|
||||||
gint nbsamples;
|
|
||||||
GstClockTime sample_interval;
|
|
||||||
gpointer *values;
|
|
||||||
} GstValueArray;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstInterpolateMode:
|
|
||||||
* @GST_INTERPOLATE_NONE: steps-like interpolation, default
|
|
||||||
* @GST_INTERPOLATE_TRIGGER: returns the default value of the property,
|
|
||||||
* except for times with specific values
|
|
||||||
* @GST_INTERPOLATE_LINEAR: linear interpolation
|
|
||||||
* @GST_INTERPOLATE_QUADRATIC: square interpolation
|
|
||||||
* @GST_INTERPOLATE_CUBIC: cubic interpolation
|
|
||||||
* @GST_INTERPOLATE_USER: user-provided interpolation
|
|
||||||
*
|
|
||||||
* The various interpolation modes available.
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GST_INTERPOLATE_NONE,
|
|
||||||
GST_INTERPOLATE_TRIGGER,
|
|
||||||
GST_INTERPOLATE_LINEAR,
|
|
||||||
GST_INTERPOLATE_QUADRATIC,
|
|
||||||
GST_INTERPOLATE_CUBIC,
|
|
||||||
GST_INTERPOLATE_USER
|
|
||||||
} GstInterpolateMode;
|
|
||||||
|
|
||||||
|
|
||||||
struct _GstControlledProperty;
|
|
||||||
|
|
||||||
typedef GValue *(*InterpolateGet) (struct _GstControlledProperty * prop,
|
|
||||||
GstClockTime timestamp);
|
|
||||||
typedef gboolean (*InterpolateGetValueArray) (struct _GstControlledProperty * prop,
|
|
||||||
GstClockTime timestamp, GstValueArray * value_array);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstInterpolateMethod:
|
|
||||||
*
|
|
||||||
* Function pointer structure to do user-defined interpolation methods
|
|
||||||
*/
|
|
||||||
typedef struct _GstInterpolateMethod
|
|
||||||
{
|
|
||||||
InterpolateGet get_int;
|
|
||||||
InterpolateGetValueArray get_int_value_array;
|
|
||||||
InterpolateGet get_long;
|
|
||||||
InterpolateGetValueArray get_long_value_array;
|
|
||||||
InterpolateGet get_float;
|
|
||||||
InterpolateGetValueArray get_float_value_array;
|
|
||||||
InterpolateGet get_double;
|
|
||||||
InterpolateGetValueArray get_double_value_array;
|
|
||||||
InterpolateGet get_boolean;
|
|
||||||
InterpolateGetValueArray get_boolean_value_array;
|
|
||||||
} GstInterpolateMethod;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstControlledProperty:
|
|
||||||
*/
|
|
||||||
typedef struct _GstControlledProperty
|
|
||||||
{
|
|
||||||
gchar *name; // name of the property
|
|
||||||
GType type; // type of the handled property
|
|
||||||
GValue default_value; // default value for the handled property
|
|
||||||
GValue result_value; // result value location for the interpolation method
|
|
||||||
GstTimedValue last_value; // the last value a _sink call wrote
|
|
||||||
GstTimedValue live_value; // temporary value override for live input
|
|
||||||
gulong notify_handler_id; // id of the notify::<name> signal handler
|
|
||||||
GstInterpolateMode interpolation; // Interpolation mode
|
|
||||||
/* TODO instead of *method, have pointers to get() and get_value_array() here
|
|
||||||
gst_controller_set_interpolation_mode() will pick the right ones for the
|
|
||||||
properties value type
|
|
||||||
GstInterpolateMethod *method; // User-implemented handler (if interpolation == GST_INTERPOLATE_USER)
|
|
||||||
*/
|
|
||||||
InterpolateGet get;
|
|
||||||
InterpolateGetValueArray get_value_array;
|
|
||||||
|
|
||||||
GList *values; // List of GstTimedValue
|
|
||||||
/* TODO keep the last search result to be able to continue
|
|
||||||
GList *last_value; // last search result, can be used for incremental searches
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
|
||||||
} GstControlledProperty;
|
|
||||||
|
|
||||||
#define GST_CONTROLLED_PROPERTY(obj) ((GstControlledProperty *)(obj))
|
|
||||||
|
|
||||||
/* type macros */
|
|
||||||
|
|
||||||
#define GST_TYPE_CONTROLLER (gst_controller_get_type ())
|
|
||||||
#define GST_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CONTROLLER, GstController))
|
|
||||||
#define GST_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CONTROLLER, GstControllerClass))
|
|
||||||
#define GST_IS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CONTROLLER))
|
|
||||||
#define GST_IS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CONTROLLERE))
|
|
||||||
#define GST_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTROLLER, GstControllerClass))
|
|
||||||
|
|
||||||
typedef struct _GstController GstController;
|
|
||||||
typedef struct _GstControllerClass GstControllerClass;
|
|
||||||
|
|
||||||
//typedef struct _GstControllerPrivate GstControllerPrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstController:
|
|
||||||
*
|
|
||||||
* The instance structure of GstController
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct _GstController
|
|
||||||
{
|
|
||||||
GObject parent;
|
|
||||||
|
|
||||||
GList *properties; // List of GstControlledProperty
|
|
||||||
GMutex *lock; // Secure property access, elements will access from threads
|
|
||||||
GObject *object; // the object we control
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstControllerClass
|
|
||||||
{
|
|
||||||
GObjectClass parent_class;
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gst_controller_get_type (void);
|
|
||||||
|
|
||||||
/* GstController functions */
|
|
||||||
|
|
||||||
GstController *gst_controller_new_valist (GObject * object, va_list var_args);
|
|
||||||
GstController *gst_controller_new (GObject * object, ...);
|
|
||||||
|
|
||||||
gboolean gst_controller_remove_properties_valist (GstController * self,
|
|
||||||
va_list var_args);
|
|
||||||
gboolean gst_controller_remove_properties (GstController * self, ...);
|
|
||||||
|
|
||||||
gboolean gst_controller_set (GstController * self, gchar * property_name,
|
|
||||||
GstClockTime timestamp, GValue * value);
|
|
||||||
gboolean gst_controller_set_from_list (GstController * self,
|
|
||||||
gchar * property_name, GSList * timedvalues);
|
|
||||||
|
|
||||||
gboolean gst_controller_unset (GstController * self, gchar * property_name,
|
|
||||||
GstClockTime timestamp);
|
|
||||||
|
|
||||||
|
|
||||||
GValue *gst_controller_get (GstController * self, gchar * property_name,
|
|
||||||
GstClockTime timestamp);
|
|
||||||
const GList *gst_controller_get_all (GstController * self,
|
|
||||||
gchar * property_name);
|
|
||||||
|
|
||||||
|
|
||||||
gboolean gst_controller_sink_values (GstController * self,
|
|
||||||
GstClockTime timestamp);
|
|
||||||
|
|
||||||
gboolean gst_controller_get_value_arrays (GstController * self,
|
|
||||||
GstClockTime timestamp, GSList * value_arrays);
|
|
||||||
gboolean gst_controller_get_value_array (GstController * self,
|
|
||||||
GstClockTime timestamp, GstValueArray * value_array);
|
|
||||||
|
|
||||||
gboolean gst_controller_set_interpolation_mode (GstController * self,
|
|
||||||
gchar * property_name, GstInterpolateMode mode);
|
|
||||||
|
|
||||||
|
|
||||||
/* GObject convenience functions */
|
|
||||||
|
|
||||||
GstController *gst_object_control_properties (GObject * object, ...);
|
|
||||||
gboolean gst_object_uncontrol_properties (GObject * object, ...);
|
|
||||||
|
|
||||||
GstController *gst_object_get_controller (GObject * object);
|
|
||||||
gboolean gst_object_set_controller (GObject * object, GstController * controller);
|
|
||||||
|
|
||||||
gboolean gst_object_sink_values (GObject * object, GstClockTime timestamp);
|
|
||||||
|
|
||||||
gboolean gst_object_get_value_arrays (GObject * object,
|
|
||||||
GstClockTime timestamp, GSList * value_arrays);
|
|
||||||
gboolean gst_object_get_value_array (GObject * object,
|
|
||||||
GstClockTime timestamp, GstValueArray * value_array);
|
|
||||||
|
|
||||||
/* lib init/done */
|
|
||||||
|
|
||||||
gboolean gst_controller_init (int * argc, char ***argv);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
#endif /* __GST_CONTROLLER_H__ */
|
|
|
@ -1,227 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
*
|
|
||||||
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
|
||||||
*
|
|
||||||
* gst-helper.c: GObject convinience methods for using dynamic properties
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:gstcontrollergobject
|
|
||||||
* @short_description: #GObject convinience methods for using dynamic properties
|
|
||||||
* @see_also: #GstController
|
|
||||||
*
|
|
||||||
* These methods allow to use some #GstController functionallity directly from
|
|
||||||
* the #GObject class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "gst-controller.h"
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_controller_debug
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
|
||||||
|
|
||||||
extern GQuark controller_key;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_control_properties:
|
|
||||||
* @object: the object of which some properties should be controlled
|
|
||||||
* @...: %NULL terminated list of property names that should be controlled
|
|
||||||
*
|
|
||||||
* Convenience function for GObject
|
|
||||||
*
|
|
||||||
* Creates a GstController that allows you to dynamically control one, or more, GObject properties.
|
|
||||||
* If the given GObject already has a GstController, it adds the given properties to the existing
|
|
||||||
* controller and returns that controller.
|
|
||||||
*
|
|
||||||
* Returns: The GstController with which the user can control the given properties dynamically or NULL if
|
|
||||||
* one or more of the given properties aren't available, or cannot be controlled, for the given element.
|
|
||||||
* Since: 0.9
|
|
||||||
*/
|
|
||||||
GstController *
|
|
||||||
gst_object_control_properties (GObject * object, ...)
|
|
||||||
{
|
|
||||||
GstController *ctrl;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
|
||||||
|
|
||||||
va_list var_args;
|
|
||||||
|
|
||||||
va_start (var_args, object);
|
|
||||||
ctrl = gst_controller_new_valist (object, var_args);
|
|
||||||
va_end (var_args);
|
|
||||||
return (ctrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_uncontrol_properties:
|
|
||||||
* @object: the object of which some properties should not be controlled anymore
|
|
||||||
* @...: %NULL terminated list of property names that should be controlled
|
|
||||||
*
|
|
||||||
* Convenience function for GObject
|
|
||||||
*
|
|
||||||
* Removes the given element's properties from it's controller
|
|
||||||
*
|
|
||||||
* Returns: %FALSE if one of the given property names isn't handled by the
|
|
||||||
* controller, %TRUE otherwise
|
|
||||||
* Since: 0.9
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_object_uncontrol_properties (GObject * object, ...)
|
|
||||||
{
|
|
||||||
gboolean res = FALSE;
|
|
||||||
GstController *ctrl;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
|
||||||
|
|
||||||
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
|
||||||
va_list var_args;
|
|
||||||
|
|
||||||
va_start (var_args, object);
|
|
||||||
res = gst_controller_remove_properties_valist (ctrl, var_args);
|
|
||||||
va_end (var_args);
|
|
||||||
}
|
|
||||||
return (res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_get_controller:
|
|
||||||
* @object: the object that has controlled properties
|
|
||||||
*
|
|
||||||
* Returns: the controller handling some of the given element's properties, %NULL if no controller
|
|
||||||
* Since: 0.9
|
|
||||||
*/
|
|
||||||
GstController *
|
|
||||||
gst_object_get_controller (GObject * object)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
|
||||||
|
|
||||||
return (g_object_get_qdata (object, controller_key));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_set_controller:
|
|
||||||
* @object: the object that should get the controller
|
|
||||||
* @controller: the controller object to plug in
|
|
||||||
*
|
|
||||||
* Sets the controller on the given GObject
|
|
||||||
*
|
|
||||||
* Returns: %FALSE if the GObject already has an controller, %TRUE otherwise
|
|
||||||
* Since: 0.9
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_object_set_controller (GObject * object, GstController * controller)
|
|
||||||
{
|
|
||||||
GstController *ctrl;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
|
||||||
g_return_val_if_fail (controller, FALSE);
|
|
||||||
|
|
||||||
if (!(ctrl = g_object_get_qdata (object, controller_key))) {
|
|
||||||
g_object_set_qdata (object, controller_key, controller);
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_sink_values:
|
|
||||||
* @object: the object that has controlled properties
|
|
||||||
* @timestamp: the time that should be processed
|
|
||||||
*
|
|
||||||
* Convenience function for GObject
|
|
||||||
*
|
|
||||||
* Returns: same thing as gst_controller_sink_values()
|
|
||||||
* Since: 0.9
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_object_sink_values (GObject * object, GstClockTime timestamp)
|
|
||||||
{
|
|
||||||
GstController *ctrl = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
|
||||||
|
|
||||||
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
|
||||||
return gst_controller_sink_values (ctrl, timestamp);
|
|
||||||
}
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_get_value_arrays:
|
|
||||||
* @object: the object that has controlled properties
|
|
||||||
* @timestamp: the time that should be processed
|
|
||||||
* @value_arrays: list to return the control-values in
|
|
||||||
*
|
|
||||||
* Function to be able to get an array of values for one or more given element
|
|
||||||
* properties.
|
|
||||||
*
|
|
||||||
* If the GstValueArray->values array in list nodes is NULL, it will be created
|
|
||||||
* by the function.
|
|
||||||
* The type of the values in the array are the same as the property's type.
|
|
||||||
*
|
|
||||||
* The g_object_* functions are just convenience functions for GObject
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the given array(s) could be filled, %FALSE otherwise
|
|
||||||
* Since: 0.9
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_object_get_value_arrays (GObject * object, GstClockTime timestamp,
|
|
||||||
GSList * value_arrays)
|
|
||||||
{
|
|
||||||
GstController *ctrl;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
|
||||||
|
|
||||||
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
|
||||||
return gst_controller_get_value_arrays (ctrl, timestamp, value_arrays);
|
|
||||||
}
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_get_value_array:
|
|
||||||
* @object: the object that has controlled properties
|
|
||||||
* @timestamp: the time that should be processed
|
|
||||||
* @value_array: array to put control-values in
|
|
||||||
*
|
|
||||||
* Function to be able to get an array of values for one element properties
|
|
||||||
*
|
|
||||||
* If the GstValueArray->values array is NULL, it will be created by the function.
|
|
||||||
* The type of the values in the array are the same as the property's type.
|
|
||||||
*
|
|
||||||
* The g_object_* functions are just convenience functions for GObject
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the given array(s) could be filled, %FALSE otherwise
|
|
||||||
* Since: 0.9
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_object_get_value_array (GObject * object, GstClockTime timestamp,
|
|
||||||
GstValueArray * value_array)
|
|
||||||
{
|
|
||||||
GstController *ctrl;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
|
||||||
|
|
||||||
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
|
||||||
return gst_controller_get_value_array (ctrl, timestamp, value_array);
|
|
||||||
}
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
|
@ -1,254 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
*
|
|
||||||
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
|
||||||
*
|
|
||||||
* gst-interpolation.c: Interpolation methodws for dynamic properties
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "gst-controller.h"
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_controller_debug
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
|
||||||
|
|
||||||
// common helper
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gst_controlled_property_find_timed_value_node:
|
|
||||||
* @prop: the controlled property to search in
|
|
||||||
* @timestamp: the search key
|
|
||||||
*
|
|
||||||
* Find last value before given timestamp in timed value list.
|
|
||||||
*
|
|
||||||
* Returns: the found #GList node or %NULL
|
|
||||||
*/
|
|
||||||
GList *
|
|
||||||
gst_controlled_property_find_timed_value_node (GstControlledProperty * prop,
|
|
||||||
GstClockTime timestamp)
|
|
||||||
{
|
|
||||||
//GList *prev_node = NULL;
|
|
||||||
GList *prev_node = g_list_last (prop->values);
|
|
||||||
GList *node;
|
|
||||||
GstTimedValue *tv;
|
|
||||||
|
|
||||||
/*
|
|
||||||
if((prop->last_value) &&
|
|
||||||
(timestamp>((GstTimedValue *)(prop->last_value->data))->timestamp)) {
|
|
||||||
node=prop->last_value;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
node=prop->values;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* iterate over timed value list */
|
|
||||||
for (node = prop->values; node; node = g_list_next (node)) {
|
|
||||||
tv = node->data;
|
|
||||||
/* this timestamp is newer that the one we look for */
|
|
||||||
if (timestamp < tv->timestamp) {
|
|
||||||
/* get previous one again */
|
|
||||||
prev_node = g_list_previous (node);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if(node) {
|
|
||||||
prop->last_value=prev_node;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return (prev_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// steps-like (no-)interpolation, default
|
|
||||||
// just returns the value for the most recent key-frame
|
|
||||||
|
|
||||||
static GValue *
|
|
||||||
interpolate_none_get (GstControlledProperty * prop, GstClockTime timestamp)
|
|
||||||
{
|
|
||||||
GList *node;
|
|
||||||
|
|
||||||
if ((node = gst_controlled_property_find_timed_value_node (prop, timestamp))) {
|
|
||||||
GstTimedValue *tv = node->data;
|
|
||||||
|
|
||||||
return (&tv->value);
|
|
||||||
}
|
|
||||||
return (&prop->default_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_NONE_GET(type) \
|
|
||||||
static gboolean \
|
|
||||||
interpolate_none_get_##type##_value_array (GstControlledProperty * prop, \
|
|
||||||
GstClockTime timestamp, GstValueArray * value_array) \
|
|
||||||
{ \
|
|
||||||
gint i; \
|
|
||||||
GstClockTime ts=timestamp; \
|
|
||||||
g##type *values=(g##type *)value_array->values; \
|
|
||||||
\
|
|
||||||
for(i=0;i<value_array->nbsamples;i++) { \
|
|
||||||
*values=g_value_get_##type (interpolate_none_get (prop,ts)); \
|
|
||||||
ts+=value_array->sample_interval; \
|
|
||||||
values++; \
|
|
||||||
} \
|
|
||||||
return (TRUE); \
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_NONE_GET (int)
|
|
||||||
DEFINE_NONE_GET (long)
|
|
||||||
DEFINE_NONE_GET (float)
|
|
||||||
DEFINE_NONE_GET (double)
|
|
||||||
DEFINE_NONE_GET (boolean)
|
|
||||||
|
|
||||||
static GstInterpolateMethod interpolate_none = {
|
|
||||||
interpolate_none_get,
|
|
||||||
interpolate_none_get_int_value_array,
|
|
||||||
interpolate_none_get,
|
|
||||||
interpolate_none_get_long_value_array,
|
|
||||||
interpolate_none_get,
|
|
||||||
interpolate_none_get_float_value_array,
|
|
||||||
interpolate_none_get,
|
|
||||||
interpolate_none_get_double_value_array,
|
|
||||||
interpolate_none_get,
|
|
||||||
interpolate_none_get_boolean_value_array
|
|
||||||
};
|
|
||||||
|
|
||||||
// returns the default value of the property, except for times with specific values
|
|
||||||
// needed for one-shot events, such as notes and triggers
|
|
||||||
|
|
||||||
static GValue *
|
|
||||||
interpolate_trigger_get (GstControlledProperty * prop, GstClockTime timestamp)
|
|
||||||
{
|
|
||||||
GList *node;
|
|
||||||
GstTimedValue *tv;
|
|
||||||
|
|
||||||
/* check if there is a value at the registered timestamp */
|
|
||||||
for (node = prop->values; node; node = g_list_next (node)) {
|
|
||||||
tv = node->data;
|
|
||||||
if (timestamp == tv->timestamp) {
|
|
||||||
return (&tv->value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (&prop->default_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
interpolate_trigger_get_value_array (GstControlledProperty * prop,
|
|
||||||
GstClockTime timestamp, GstValueArray * value_array)
|
|
||||||
{
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstInterpolateMethod interpolate_trigger = {
|
|
||||||
interpolate_trigger_get,
|
|
||||||
interpolate_trigger_get_value_array,
|
|
||||||
interpolate_trigger_get,
|
|
||||||
NULL,
|
|
||||||
interpolate_trigger_get,
|
|
||||||
NULL,
|
|
||||||
interpolate_trigger_get,
|
|
||||||
NULL,
|
|
||||||
interpolate_trigger_get,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
// linear interpolation
|
|
||||||
// smoothes inbetween values
|
|
||||||
|
|
||||||
#define DEFINE_LINEAR_GET(type) \
|
|
||||||
static g##type \
|
|
||||||
_interpolate_linear_get_##type (GstControlledProperty * prop, GstClockTime timestamp) \
|
|
||||||
{ \
|
|
||||||
GList *node; \
|
|
||||||
\
|
|
||||||
if ((node = gst_controlled_property_find_timed_value_node (prop, timestamp))) { \
|
|
||||||
GstTimedValue *tv1, *tv2; \
|
|
||||||
\
|
|
||||||
tv1 = node->data; \
|
|
||||||
if ((node = g_list_next (node))) { \
|
|
||||||
gdouble timediff,valuediff; \
|
|
||||||
g##type value1,value2; \
|
|
||||||
\
|
|
||||||
tv2 = node->data; \
|
|
||||||
\
|
|
||||||
timediff = (gdouble)(tv2->timestamp - tv1->timestamp); \
|
|
||||||
value1 = g_value_get_##type (&tv1->value); \
|
|
||||||
value2 = g_value_get_##type (&tv2->value); \
|
|
||||||
valuediff = (gdouble)(value2-value1); \
|
|
||||||
\
|
|
||||||
return((g##type)(value1+valuediff*((timestamp-tv1->timestamp)/timediff))); \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
return (g_value_get_##type (&tv1->value)); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
return (g_value_get_##type (&prop->default_value)); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
static GValue * \
|
|
||||||
interpolate_linear_get_##type (GstControlledProperty * prop, GstClockTime timestamp) \
|
|
||||||
{ \
|
|
||||||
g_value_set_##type (&prop->result_value,_interpolate_linear_get_##type (prop,timestamp)); \
|
|
||||||
return (&prop->result_value); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
static gboolean \
|
|
||||||
interpolate_linear_get_##type##_value_array (GstControlledProperty * prop, \
|
|
||||||
GstClockTime timestamp, GstValueArray * value_array) \
|
|
||||||
{ \
|
|
||||||
gint i; \
|
|
||||||
GstClockTime ts=timestamp; \
|
|
||||||
gint *values=(gint *)value_array->values; \
|
|
||||||
\
|
|
||||||
for(i=0;i<value_array->nbsamples;i++) { \
|
|
||||||
*values=_interpolate_linear_get_##type (prop,ts); \
|
|
||||||
ts+=value_array->sample_interval; \
|
|
||||||
values++; \
|
|
||||||
} \
|
|
||||||
return (TRUE); \
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_LINEAR_GET (int)
|
|
||||||
DEFINE_LINEAR_GET (long)
|
|
||||||
DEFINE_LINEAR_GET (float)
|
|
||||||
DEFINE_LINEAR_GET (double)
|
|
||||||
|
|
||||||
static GstInterpolateMethod interpolate_linear = {
|
|
||||||
interpolate_linear_get_int,
|
|
||||||
interpolate_linear_get_int_value_array,
|
|
||||||
interpolate_linear_get_long,
|
|
||||||
interpolate_linear_get_long_value_array,
|
|
||||||
interpolate_linear_get_float,
|
|
||||||
interpolate_linear_get_float_value_array,
|
|
||||||
interpolate_linear_get_double,
|
|
||||||
interpolate_linear_get_double_value_array,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
// square interpolation
|
|
||||||
|
|
||||||
// cubic interpolation
|
|
||||||
|
|
||||||
// register all interpolation methods
|
|
||||||
GstInterpolateMethod *interpolation_methods[] = {
|
|
||||||
&interpolate_none,
|
|
||||||
&interpolate_trigger,
|
|
||||||
&interpolate_linear,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
||||||
*
|
*
|
||||||
* gst-controller.c: dynamic parameter control subsystem
|
* gstcontroller.c: dynamic parameter control subsystem
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -48,8 +48,8 @@
|
||||||
* Again its not a lot to change.
|
* Again its not a lot to change.
|
||||||
* <orderedlist>
|
* <orderedlist>
|
||||||
* <listitem><para>
|
* <listitem><para>
|
||||||
* first put some properties under control, by calling
|
* first put some properties under control, by calling
|
||||||
* controller=g_object_control_properties(object, "prop1", "prop2",...);
|
* controller = g_object_control_properties(object, "prop1", "prop2",...);
|
||||||
* </para></listitem>
|
* </para></listitem>
|
||||||
* <listitem><para>
|
* <listitem><para>
|
||||||
* set how the controller will smooth inbetween values.
|
* set how the controller will smooth inbetween values.
|
||||||
|
@ -57,8 +57,8 @@
|
||||||
* </para></listitem>
|
* </para></listitem>
|
||||||
* <listitem><para>
|
* <listitem><para>
|
||||||
* set key values
|
* set key values
|
||||||
* gst_controller_set(controller,"prop1",0*GST_SECOND,value1);
|
* gst_controller_set (controller, "prop1" ,0 * GST_SECOND, value1);
|
||||||
* gst_controller_set(controller,"prop1",1*GST_SECOND,value2);
|
* gst_controller_set (controller, "prop1" ,1 * GST_SECOND, value2);
|
||||||
* </para></listitem>
|
* </para></listitem>
|
||||||
* <listitem><para>
|
* <listitem><para>
|
||||||
* start your pipeline
|
* start your pipeline
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gst-controller.h"
|
#include "gstcontroller.h"
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_controller_debug
|
#define GST_CAT_DEFAULT gst_controller_debug
|
||||||
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
||||||
*
|
*
|
||||||
* gst-helper.c: GObject convinience methods for using dynamic properties
|
* gsthelper.c: GObject convenience methods for using dynamic properties
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gst-controller.h"
|
#include "gstcontroller.h"
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_controller_debug
|
#define GST_CAT_DEFAULT gst_controller_debug
|
||||||
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
||||||
*
|
*
|
||||||
* gst-interpolation.c: Interpolation methodws for dynamic properties
|
* gstinterpolation.c: Interpolation methods for dynamic properties
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -21,12 +21,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gst-controller.h"
|
#include "gstcontroller.h"
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_controller_debug
|
#define GST_CAT_DEFAULT gst_controller_debug
|
||||||
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
|
||||||
|
|
||||||
// common helper
|
/* common helper */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_controlled_property_find_timed_value_node:
|
* gst_controlled_property_find_timed_value_node:
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/controller/gst-controller.h>
|
#include <gst/controller/gstcontroller.h>
|
||||||
|
|
||||||
#include "gst/gst-i18n-app.h"
|
#include "gst/gst-i18n-app.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue