2 * Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
4 * gstdparammanager.h: Dynamic Parameter group functionality
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #ifndef __GST_DPMAN_H__
23 #define __GST_DPMAN_H__
25 #include <gst/gstobject.h>
26 #include <gst/gstprops.h>
27 #include <gst/control/dparamcommon.h>
28 #include <gst/control/dparam.h>
32 #endif /* __cplusplus */
34 #define GST_TYPE_DPMAN (gst_dpman_get_type ())
35 #define GST_DPMAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DPMAN,GstDParamManager))
36 #define GST_DPMAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DPMAN,GstDParamManager))
37 #define GST_IS_DPMAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DPMAN))
38 #define GST_IS_DPMAN_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DPMAN))
40 #define GST_DPMAN_NAME(dpman) (GST_OBJECT_NAME(dpman))
41 #define GST_DPMAN_PARENT(dpman) (GST_OBJECT_PARENT(dpman))
42 #define GST_DPMAN_DPARAMS(dpman) ((dpman)->dparams)
43 #define GST_DPMAN_DPARAMS_LIST(dpman) ((dpman)->dparams_list)
45 #define GST_DPMAN_MODE_NAME(dpman) ((dpman)->mode_name)
46 #define GST_DPMAN_MODE(dpman) ((dpman)->mode)
47 #define GST_DPMAN_MODE_DATA(dpman) ((dpman)->mode_data)
48 #define GST_DPMAN_RATE(dpman) ((dpman)->rate)
56 typedef struct _GstDParamManagerClass GstDParamManagerClass;
57 typedef struct _GstDPMMode GstDPMMode;
58 typedef struct _GstDParamWrapper GstDParamWrapper;
60 typedef guint (*GstDPMModePreProcessFunction) (GstDParamManager *dpman, guint frames, gint64 timestamp);
61 typedef guint (*GstDPMModeProcessFunction) (GstDParamManager *dpman, guint frame_count);
62 typedef void (*GstDPMModeSetupFunction) (GstDParamManager *dpman);
63 typedef void (*GstDPMModeTeardownFunction) (GstDParamManager *dpman);
65 typedef void (*GstDPMUpdateFunction) (GValue *value, gpointer data);
67 struct _GstDParamManager {
81 struct _GstDParamManagerClass {
82 GstObjectClass parent_class;
83 void (*new_required_dparam) (GstDParamManager *dpman, gchar* dparam_name);
85 /* signal callbacks */
89 GstDPMModePreProcessFunction preprocessfunc;
90 GstDPMModeProcessFunction processfunc;
91 GstDPMModeSetupFunction setupfunc;
92 GstDPMModeTeardownFunction teardownfunc;
95 struct _GstDParamWrapper {
96 GParamSpec* param_spec;
99 GstDPMUpdateMethod update_method;
100 gpointer update_data;
101 GstDPMUpdateFunction update_func;
106 #define GST_DPMAN_PREPROCESSFUNC(dpman) (((dpman)->mode)->preprocessfunc)
107 #define GST_DPMAN_PROCESSFUNC(dpman) (((dpman)->mode)->processfunc)
108 #define GST_DPMAN_SETUPFUNC(dpman) (((dpman)->mode)->setupfunc)
109 #define GST_DPMAN_TEARDOWNFUNC(dpman) (((dpman)->mode)->teardownfunc)
111 #define GST_DPMAN_PREPROCESS(dpman, buffer_size, timestamp) \
112 (GST_DPMAN_PREPROCESSFUNC(dpman)(dpman, buffer_size, timestamp))
114 #define GST_DPMAN_PROCESS(dpman, frame_count) \
115 (GST_DPMAN_PROCESSFUNC(dpman)(dpman, frame_count))
117 #define GST_DPMAN_PROCESS_COUNTDOWN(dpman, frame_countdown, frame_count) \
118 (frame_countdown-- || \
119 (frame_countdown = GST_DPMAN_PROCESS(dpman, frame_count)))
121 #define GST_DPMAN_DO_UPDATE(dpwrap) ((dpwrap->update_func)(dpwrap->value, dpwrap->update_data))
123 void _gst_dpman_initialize();
124 GType gst_dpman_get_type (void);
125 GstDParamManager* gst_dpman_new (gchar *name, GstElement *parent);
126 void gst_dpman_set_parent (GstDParamManager *dpman, GstElement *parent);
127 GstDParamManager* gst_dpman_get_manager (GstElement *parent);
129 gboolean gst_dpman_add_required_dparam_callback (GstDParamManager *dpman,
130 GParamSpec *param_spec,
133 GstDPMUpdateFunction update_func,
134 gpointer update_data);
135 gboolean gst_dpman_add_required_dparam_direct (GstDParamManager *dpman,
136 GParamSpec *param_spec,
139 gpointer update_data);
141 gboolean gst_dpman_add_required_dparam_array (GstDParamManager *dpman,
142 GParamSpec *param_spec,
145 gpointer update_data);
147 void gst_dpman_remove_required_dparam (GstDParamManager *dpman, gchar *dparam_name);
148 gboolean gst_dpman_attach_dparam (GstDParamManager *dpman, gchar *dparam_name, GstDParam *dparam);
149 void gst_dpman_detach_dparam (GstDParamManager *dpman, gchar *dparam_name);
150 GstDParam* gst_dpman_get_dparam(GstDParamManager *dpman, gchar *name);
151 GType gst_dpman_get_dparam_type (GstDParamManager *dpman, gchar *name);
153 GParamSpec** gst_dpman_list_param_specs(GstDParamManager *dpman);
154 GParamSpec* gst_dpman_get_param_spec (GstDParamManager *dpman, gchar *dparam_name);
155 void gst_dpman_dparam_spec_has_changed (GstDParamManager *dpman, gchar *dparam_name);
157 void gst_dpman_set_rate_change_pad(GstDParamManager *dpman, GstPad *pad);
158 void gst_dpman_bypass_dparam(GstDParamManager *dpman, gchar *dparam_name);
160 gboolean gst_dpman_set_mode(GstDParamManager *dpman, gchar *modename);
161 void gst_dpman_register_mode (GstDParamManagerClass *klass,
163 GstDPMModePreProcessFunction preprocessfunc,
164 GstDPMModeProcessFunction processfunc,
165 GstDPMModeSetupFunction setupfunc,
166 GstDPMModeTeardownFunction teardownfunc);
170 #endif /* __cplusplus */
172 #endif /* __GST_DPMAN_H__ */