2005-08-05 12:59:46 +00:00
|
|
|
/* 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.
|
2005-08-02 21:35:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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
|
|
|
|
{
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
GstClockTime timestamp; /* timestamp of the value change */
|
|
|
|
GValue value; /* the new value */
|
2005-08-02 21:35:34 +00:00
|
|
|
/* 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:
|
2005-08-05 17:28:30 +00:00
|
|
|
* @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
|
2005-08-02 21:35:34 +00:00
|
|
|
*
|
2005-08-05 17:28:30 +00:00
|
|
|
* Structure to receive multiple values at once.
|
|
|
|
* If the pointer to the values array is NULL, it will be allocated (CHECKME).
|
2005-08-02 21:35:34 +00:00
|
|
|
*/
|
|
|
|
typedef struct _GstValueArray
|
|
|
|
{
|
|
|
|
gchar *property_name;
|
2005-08-05 17:28:30 +00:00
|
|
|
gint nbsamples;
|
|
|
|
GstClockTime sample_interval;
|
|
|
|
gpointer *values;
|
2005-08-02 21:35:34 +00:00
|
|
|
} GstValueArray;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstInterpolateMode:
|
|
|
|
* @GST_INTERPOLATE_NONE: steps-like interpolation, default
|
2005-10-15 15:53:59 +00:00
|
|
|
* @GST_INTERPOLATE_TRIGGER: returns the default value of the property,
|
2005-08-02 21:35:34 +00:00
|
|
|
* 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;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstController:
|
|
|
|
*
|
|
|
|
* The instance structure of GstController
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _GstController
|
|
|
|
{
|
|
|
|
GObject parent;
|
|
|
|
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
GList *properties; /* List of GstControlledProperty */
|
|
|
|
GMutex *lock; /* Secure property access, elements will access from threads */
|
|
|
|
GObject *object; /* the object we control */
|
2005-08-15 16:57:34 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2005-08-02 21:35:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstControllerClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
2005-08-15 16:57:34 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2005-08-02 21:35:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GType gst_controller_get_type (void);
|
|
|
|
|
|
|
|
/* GstController functions */
|
|
|
|
|
|
|
|
GstController *gst_controller_new_valist (GObject * object, va_list var_args);
|
2005-09-28 16:39:29 +00:00
|
|
|
GstController *gst_controller_new_list (GObject * object, GList *list);
|
2005-11-22 09:35:25 +00:00
|
|
|
GstController *gst_controller_new (GObject * object, ...) G_GNUC_NULL_TERMINATED;
|
2005-08-02 21:35:34 +00:00
|
|
|
|
|
|
|
gboolean gst_controller_remove_properties_valist (GstController * self,
|
|
|
|
va_list var_args);
|
2005-10-11 12:42:23 +00:00
|
|
|
gboolean gst_controller_remove_properties_list (GstController * self,
|
|
|
|
GList *list);
|
2005-11-22 09:35:25 +00:00
|
|
|
gboolean gst_controller_remove_properties (GstController * self, ...) G_GNUC_NULL_TERMINATED;
|
2005-08-02 21:35:34 +00:00
|
|
|
|
|
|
|
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);
|
2006-04-11 21:07:26 +00:00
|
|
|
gboolean gst_controller_unset_all (GstController * self, gchar * property_name);
|
2005-08-02 21:35:34 +00:00
|
|
|
|
|
|
|
GValue *gst_controller_get (GstController * self, gchar * property_name,
|
|
|
|
GstClockTime timestamp);
|
|
|
|
const GList *gst_controller_get_all (GstController * self,
|
|
|
|
gchar * property_name);
|
|
|
|
|
|
|
|
|
2005-09-26 15:43:30 +00:00
|
|
|
gboolean gst_controller_sync_values (GstController * self,
|
2005-08-02 21:35:34 +00:00
|
|
|
GstClockTime timestamp);
|
2005-10-15 15:53:59 +00:00
|
|
|
|
2005-08-02 21:35:34 +00:00
|
|
|
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 */
|
|
|
|
|
2005-11-22 09:35:25 +00:00
|
|
|
GstController *gst_object_control_properties (GObject * object, ...) G_GNUC_NULL_TERMINATED;
|
|
|
|
gboolean gst_object_uncontrol_properties (GObject * object, ...) G_GNUC_NULL_TERMINATED;
|
2005-08-02 21:35:34 +00:00
|
|
|
|
2005-08-05 10:02:44 +00:00
|
|
|
GstController *gst_object_get_controller (GObject * object);
|
|
|
|
gboolean gst_object_set_controller (GObject * object, GstController * controller);
|
2005-08-02 21:35:34 +00:00
|
|
|
|
2005-09-26 15:43:30 +00:00
|
|
|
gboolean gst_object_sync_values (GObject * object, GstClockTime timestamp);
|
2005-08-02 21:35:34 +00:00
|
|
|
|
2005-08-05 10:02:44 +00:00
|
|
|
gboolean gst_object_get_value_arrays (GObject * object,
|
2005-08-02 21:35:34 +00:00
|
|
|
GstClockTime timestamp, GSList * value_arrays);
|
2005-08-05 10:02:44 +00:00
|
|
|
gboolean gst_object_get_value_array (GObject * object,
|
2005-08-02 21:35:34 +00:00
|
|
|
GstClockTime timestamp, GstValueArray * value_array);
|
|
|
|
|
|
|
|
/* lib init/done */
|
|
|
|
|
|
|
|
gboolean gst_controller_init (int * argc, char ***argv);
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GST_CONTROLLER_H__ */
|