mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
Added a signal which notifies when a required dparam is added.
Original commit message from CVS: Added a signal which notifies when a required dparam is added. Added gst_dpman_bypass_dparam so that some dparams can be exposed as object properties as well. If the object property is set, a connected dparam is disconnected to avoid the two subsystems fighting over setting the value.
This commit is contained in:
parent
c02b4ef60d
commit
b2fa9adc50
2 changed files with 49 additions and 3 deletions
|
@ -24,6 +24,10 @@
|
|||
#include <gst/gstinfo.h>
|
||||
|
||||
static GHashTable *_element_registry;
|
||||
enum {
|
||||
NEW_REQUIRED_DPARAM,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static void gst_dpman_class_init (GstDParamManagerClass *klass);
|
||||
static void gst_dpman_init (GstDParamManager *dpman);
|
||||
|
@ -37,6 +41,7 @@ static guint gst_dpman_preprocess_noop(GstDParamManager *dpman, guint frames, gi
|
|||
static guint gst_dpman_process_noop(GstDParamManager *dpman, guint frame_count);
|
||||
|
||||
static GObjectClass *parent_class;
|
||||
static guint gst_dpman_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
void
|
||||
_gst_dpman_initialize()
|
||||
|
@ -87,6 +92,13 @@ gst_dpman_class_init (GstDParamManagerClass *klass)
|
|||
gst_dpman_preprocess_noop, gst_dpman_process_noop, NULL, NULL);
|
||||
|
||||
_element_registry = g_hash_table_new(NULL,NULL);
|
||||
|
||||
gst_dpman_signals[NEW_REQUIRED_DPARAM] =
|
||||
g_signal_new ("new_required_dparam", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstDParamManagerClass, new_required_dparam), NULL, NULL,
|
||||
gst_marshal_VOID__STRING, G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -165,6 +177,8 @@ gst_dpman_add_required_dparam_callback (GstDParamManager *dpman,
|
|||
dpwrap->update_func = update_func;
|
||||
dpwrap->update_data = update_data;
|
||||
|
||||
g_signal_emit (G_OBJECT (dpman), gst_dpman_signals[NEW_REQUIRED_DPARAM], 0, g_param_spec_get_name(param_spec));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -196,6 +210,8 @@ gst_dpman_add_required_dparam_direct (GstDParamManager *dpman,
|
|||
|
||||
dpwrap->update_data = update_data;
|
||||
|
||||
g_signal_emit (G_OBJECT (dpman), gst_dpman_signals[NEW_REQUIRED_DPARAM], 0, g_param_spec_get_name(param_spec));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -228,6 +244,8 @@ gst_dpman_add_required_dparam_array (GstDParamManager *dpman,
|
|||
|
||||
dpwrap->update_data = update_data;
|
||||
|
||||
g_signal_emit (G_OBJECT (dpman), gst_dpman_signals[NEW_REQUIRED_DPARAM], 0, g_param_spec_get_name(param_spec));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -359,7 +377,7 @@ gst_dpman_get_dparam_type (GstDParamManager *dpman, gchar *name)
|
|||
return G_VALUE_TYPE(dpwrap->value);
|
||||
}
|
||||
|
||||
/*GstDParamSpec**
|
||||
GParamSpec**
|
||||
gst_dpman_list_dparam_specs(GstDParamManager *dpman)
|
||||
{
|
||||
GstDParamWrapper* dpwrap;
|
||||
|
@ -381,7 +399,6 @@ gst_dpman_list_dparam_specs(GstDParamManager *dpman)
|
|||
}
|
||||
return param_specs;
|
||||
}
|
||||
*/
|
||||
|
||||
GParamSpec*
|
||||
gst_dpman_get_param_spec (GstDParamManager *dpman, gchar *dparam_name)
|
||||
|
@ -528,6 +545,34 @@ gst_dpman_set_rate_change_pad(GstDParamManager *dpman, GstPad *pad)
|
|||
G_CALLBACK (gst_dpman_caps_changed), dpman);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_dpman_bypass_dparam:
|
||||
* @dpman: GstDParamManager instance
|
||||
* @dparam_name: the name of dparam
|
||||
*
|
||||
* If a dparam is attached to this dparam_name, it will be detached
|
||||
* and a warning will be issued. This should be called in the _set_property
|
||||
* function of an element if the value it changes is also changed by a dparam.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gst_dpman_bypass_dparam(GstDParamManager *dpman, gchar *dparam_name)
|
||||
{
|
||||
GstDParamWrapper* dpwrap;
|
||||
|
||||
g_return_if_fail (dpman != NULL);
|
||||
g_return_if_fail (GST_IS_DPMAN (dpman));
|
||||
g_return_if_fail (dparam_name != NULL);
|
||||
|
||||
dpwrap = gst_dpman_get_wrapper(dpman, dparam_name);
|
||||
g_return_if_fail (dpwrap != NULL);
|
||||
|
||||
if (dpwrap->dparam != NULL){
|
||||
g_warning("Bypassing attached dparam '%s'. It will be detached", dparam_name);
|
||||
gst_dpman_detach_dparam(dpman, dparam_name);
|
||||
}
|
||||
}
|
||||
|
||||
static GstDParamWrapper*
|
||||
gst_dpman_get_wrapper(GstDParamManager *dpman, gchar *dparam_name)
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ struct _GstDParamManager {
|
|||
|
||||
struct _GstDParamManagerClass {
|
||||
GstObjectClass parent_class;
|
||||
|
||||
void (*new_required_dparam) (GstDParamManager *dpman, gchar* dparam_name);
|
||||
GHashTable *modes;
|
||||
/* signal callbacks */
|
||||
};
|
||||
|
@ -155,6 +155,7 @@ GParamSpec* gst_dpman_get_param_spec (GstDParamManager *dpman, gchar *dparam_nam
|
|||
void gst_dpman_dparam_spec_has_changed (GstDParamManager *dpman, gchar *dparam_name);
|
||||
|
||||
void gst_dpman_set_rate_change_pad(GstDParamManager *dpman, GstPad *pad);
|
||||
void gst_dpman_bypass_dparam(GstDParamManager *dpman, gchar *dparam_name);
|
||||
|
||||
gboolean gst_dpman_set_mode(GstDParamManager *dpman, gchar *modename);
|
||||
void gst_dpman_register_mode (GstDParamManagerClass *klass,
|
||||
|
|
Loading…
Reference in a new issue