Remove threadsafe properties. Fix elements because GObject complains when installing a property before declaring a se...

Original commit message from CVS:
Remove threadsafe properties. Fix elements because GObject
complains when installing a property before declaring a
set/get_property handler.
Rearrange gstelement.h file, use STATE macros for state locks.
Free mutexes in the finalize method instead of dispose.
This commit is contained in:
Wim Taymans 2005-03-08 17:42:29 +00:00
parent 1c9569392f
commit 9e24b85a9d
34 changed files with 223 additions and 697 deletions

View file

@ -1,3 +1,40 @@
2005-03-08 Wim Taymans <wim@fluendo.com>
* gst/elements/gstaggregator.c: (gst_aggregator_class_init):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfdsink.c: (gst_fdsink_class_init):
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init):
* gst/elements/gstfilesink.c: (gst_filesink_class_init):
* gst/elements/gstfilesrc.c: (gst_filesrc_class_init):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gstmd5sink.c: (gst_md5sink_class_init):
* gst/elements/gstmultifilesrc.c: (gst_multifilesrc_class_init):
* gst/elements/gstshaper.c: (gst_shaper_class_init):
* gst/elements/gststatistics.c: (gst_statistics_class_init):
* gst/elements/gsttee.c: (gst_tee_class_init), (gst_tee_getcaps),
(gst_tee_link):
* gst/gstelement.c: (gst_element_class_init),
(gst_element_base_class_init), (gst_element_init),
(gst_element_get_random_pad), (gst_element_wait_state_change),
(gst_element_change_state), (gst_element_dispose),
(gst_element_finalize), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstqueue.c: (gst_queue_class_init), (gst_queue_link_src):
* gst/gstthread.c: (gst_thread_class_init),
(gst_thread_release_children_locks), (gst_thread_change_state):
* gst/schedulers/gstbasicscheduler.c:
(gst_basic_scheduler_loopfunc_wrapper),
(gst_basic_scheduler_chain_wrapper),
(gst_basic_scheduler_src_wrapper),
(gst_basic_scheduler_remove_element):
* gst/schedulers/gstoptimalscheduler.c: (schedule_group):
Remove threadsafe properties. Fix elements because GObject
complains when installing a property before declaring a
set/get_property handler.
Rearrange gstelement.h file, use STATE macros for state locks.
Free mutexes in the finalize method instead of dispose.
2005-03-08 Wim Taymans <wim@fluendo.com>
* check/gst/gstobject.c: (START_TEST), (gst_object_suite):

View file

@ -137,6 +137,9 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
g_param_spec_int ("num_pads", "Num pads", "The number of source pads",
0, G_MAXINT, 0, G_PARAM_READABLE));
@ -152,8 +155,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
"The current state of the element", NULL, G_PARAM_READABLE));
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_aggregator_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_aggregator_request_new_pad);

View file

@ -138,6 +138,8 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SINKS,
g_param_spec_int ("num_sinks", "Number of sinks",
@ -169,9 +171,6 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_fakesink_request_new_pad);
gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_fakesink_set_clock);

View file

@ -214,6 +214,8 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesrc_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesrc_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
g_param_spec_int ("num-sources", "num-sources", "Number of sources",
@ -281,9 +283,6 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesrc_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesrc_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_fakesrc_request_new_pad);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_fakesrc_change_state);

View file

@ -88,13 +88,12 @@ gst_fdsink_class_init (GstFdSinkClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_fdsink_set_property;
gobject_class->get_property = gst_fdsink_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
0, G_MAXINT, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_fdsink_set_property;
gobject_class->get_property = gst_fdsink_get_property;
}
static void

View file

@ -103,6 +103,9 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_fdsrc_set_property;
gobject_class->get_property = gst_fdsrc_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
0, G_MAXINT, 0, G_PARAM_READWRITE));
@ -119,9 +122,6 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
G_STRUCT_OFFSET (GstFdSrcClass, timeout), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gobject_class->set_property = gst_fdsrc_set_property;
gobject_class->get_property = gst_fdsrc_get_property;
gstelement_class->change_state = gst_fdsrc_change_state;
}

View file

@ -145,6 +145,8 @@ gst_filesink_class_init (GstFileSinkClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_filesink_set_property;
gobject_class->get_property = gst_filesink_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
g_param_spec_string ("location", "File Location",
@ -155,8 +157,6 @@ gst_filesink_class_init (GstFileSinkClass * klass)
G_STRUCT_OFFSET (GstFileSinkClass, handoff), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gobject_class->set_property = gst_filesink_set_property;
gobject_class->get_property = gst_filesink_get_property;
gobject_class->dispose = gst_filesink_dispose;
}
static void

View file

@ -214,6 +214,8 @@ gst_filesrc_class_init (GstFileSrcClass * klass)
gobject_class = (GObjectClass *) klass;
gobject_class->set_property = gst_filesrc_set_property;
gobject_class->get_property = gst_filesrc_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
g_param_spec_int ("fd", "File-descriptor",
@ -235,8 +237,6 @@ gst_filesrc_class_init (GstFileSrcClass * klass)
"Touch data to force disk read", FALSE, G_PARAM_READWRITE));
gobject_class->dispose = gst_filesrc_dispose;
gobject_class->set_property = gst_filesrc_set_property;
gobject_class->get_property = gst_filesrc_get_property;
gstelement_class->change_state = gst_filesrc_change_state;
}

View file

@ -138,6 +138,9 @@ gst_identity_class_init (GstIdentityClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gstelement_class = GST_ELEMENT_CLASS (klass);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
g_param_spec_boolean ("loop-based", "Loop-based",
"Set to TRUE to use loop-based rather than chain-based scheduling",
@ -185,8 +188,6 @@ gst_identity_class_init (GstIdentityClass * klass)
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_identity_set_clock);
gstelement_class->change_state =

View file

@ -392,7 +392,6 @@ gst_md5sink_class_init (GstMD5SinkClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5,

View file

@ -107,6 +107,8 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_multifilesrc_set_property;
gobject_class->get_property = gst_multifilesrc_get_property;
gst_multifilesrc_signals[NEW_FILE] =
g_signal_new ("new-file", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
@ -114,16 +116,11 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass)
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATIONS, g_param_spec_pointer ("locations", "locations", "locations", G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HAVENEWMEDIA,
g_param_spec_boolean ("newmedia", "newmedia",
"generate new media events?", FALSE, G_PARAM_READWRITE));
gobject_class->set_property = gst_multifilesrc_set_property;
gobject_class->get_property = gst_multifilesrc_get_property;
gstelement_class->change_state = gst_multifilesrc_change_state;
}

View file

@ -127,6 +127,8 @@ gst_shaper_class_init (GstShaperClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY,
g_param_spec_enum ("policy", "Policy", "Shaper policy",
@ -138,9 +140,6 @@ gst_shaper_class_init (GstShaperClass * klass)
g_param_spec_string ("last-message", "last-message", "last-message",
NULL, G_PARAM_READABLE));
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_shaper_request_new_pad);
}

View file

@ -124,6 +124,8 @@ gst_statistics_class_init (GstStatisticsClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS,
g_param_spec_int64 ("buffers", "buffers", "total buffers count",
@ -162,8 +164,6 @@ gst_statistics_class_init (GstStatisticsClass * klass)
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_statistics_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
}
static void

View file

@ -113,6 +113,8 @@ gst_tee_class_init (GstTeeClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
g_param_spec_int ("num_pads", "num_pads", "num_pads",
@ -126,8 +128,6 @@ gst_tee_class_init (GstTeeClass * klass)
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tee_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_tee_request_new_pad);

View file

@ -64,11 +64,6 @@ static void gst_element_init (GstElement * element);
static void gst_element_base_class_init (gpointer g_class);
static void gst_element_base_class_finalize (gpointer g_class);
static void gst_element_real_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_element_real_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_element_dispose (GObject * object);
static void gst_element_finalize (GObject * object);
@ -207,11 +202,6 @@ gst_element_class_init (GstElementClass * klass)
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstElementClass, no_more_pads), NULL,
NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
gobject_class->set_property =
GST_DEBUG_FUNCPTR (gst_element_real_set_property);
gobject_class->get_property =
GST_DEBUG_FUNCPTR (gst_element_real_get_property);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_element_dispose);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_element_finalize);
@ -233,15 +223,8 @@ gst_element_class_init (GstElementClass * klass)
static void
gst_element_base_class_init (gpointer g_class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gobject_class->set_property =
GST_DEBUG_FUNCPTR (gst_element_real_set_property);
gobject_class->get_property =
GST_DEBUG_FUNCPTR (gst_element_real_get_property);
memset (&element_class->details, 0, sizeof (GstElementDetails));
element_class->padtemplates = NULL;
}
@ -272,30 +255,10 @@ gst_element_init (GstElement * element)
element->sched = NULL;
element->clock = NULL;
element->sched_private = NULL;
element->state_mutex = g_mutex_new ();
element->state_lock = g_mutex_new ();
element->state_cond = g_cond_new ();
}
static void
gst_element_real_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstElementClass *oclass = GST_ELEMENT_GET_CLASS (object);
if (oclass->set_property)
(oclass->set_property) (object, prop_id, value, pspec);
}
static void
gst_element_real_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstElementClass *oclass = GST_ELEMENT_GET_CLASS (object);
if (oclass->get_property)
(oclass->get_property) (object, prop_id, value, pspec);
}
/**
* gst_element_default_error:
* @object: a #GObject that signalled the error.
@ -323,408 +286,6 @@ gst_element_default_error (GObject * object, GstObject * source, GError * error,
g_free (name);
}
typedef struct
{
const GParamSpec *pspec;
GValue value;
}
prop_value_t;
static void
element_set_property (GstElement * element, const GParamSpec * pspec,
const GValue * value)
{
prop_value_t *prop_value = g_new0 (prop_value_t, 1);
prop_value->pspec = pspec;
prop_value->value = *value;
g_async_queue_push (element->prop_value_queue, prop_value);
}
static void
element_get_property (GstElement * element, const GParamSpec * pspec,
GValue * value)
{
g_mutex_lock (element->property_mutex);
g_object_get_property ((GObject *) element, pspec->name, value);
g_mutex_unlock (element->property_mutex);
}
static void
gst_element_threadsafe_properties_pre_run (GstElement * element)
{
/* need to ref the object because we don't want to lose the object
* before the post run function is called */
gst_object_ref (GST_OBJECT (element));
GST_DEBUG ("locking element %s", GST_OBJECT_NAME (element));
g_mutex_lock (element->property_mutex);
gst_element_set_pending_properties (element);
}
static void
gst_element_threadsafe_properties_post_run (GstElement * element)
{
GST_DEBUG ("unlocking element %s", GST_OBJECT_NAME (element));
g_mutex_unlock (element->property_mutex);
gst_object_unref (GST_OBJECT (element));
}
/**
* gst_element_enable_threadsafe_properties:
* @element: a #GstElement to enable threadsafe properties on.
*
* Installs an asynchronous queue, a mutex and pre- and post-run functions on
* this element so that properties on the element can be set in a
* threadsafe way.
*/
void
gst_element_enable_threadsafe_properties (GstElement * element)
{
g_return_if_fail (GST_IS_ELEMENT (element));
GST_FLAG_SET (element, GST_ELEMENT_USE_THREADSAFE_PROPERTIES);
element->pre_run_func = gst_element_threadsafe_properties_pre_run;
element->post_run_func = gst_element_threadsafe_properties_post_run;
if (!element->prop_value_queue)
element->prop_value_queue = g_async_queue_new ();
if (!element->property_mutex)
element->property_mutex = g_mutex_new ();
}
/**
* gst_element_disable_threadsafe_properties:
* @element: a #GstElement to disable threadsafe properties on.
*
* Removes the threadsafe properties, post- and pre-run locks from
* this element.
*/
void
gst_element_disable_threadsafe_properties (GstElement * element)
{
g_return_if_fail (GST_IS_ELEMENT (element));
GST_FLAG_UNSET (element, GST_ELEMENT_USE_THREADSAFE_PROPERTIES);
//element->pre_run_func = NULL;
//element->post_run_func = NULL;
/* let's keep around that async queue */
}
/**
* gst_element_set_pending_properties:
* @element: a #GstElement to set the pending properties on.
*
* Sets all pending properties on the threadsafe properties enabled
* element.
*/
void
gst_element_set_pending_properties (GstElement * element)
{
prop_value_t *prop_value;
while ((prop_value = g_async_queue_try_pop (element->prop_value_queue))) {
g_object_set_property ((GObject *) element, prop_value->pspec->name,
&prop_value->value);
g_value_unset (&prop_value->value);
g_free (prop_value);
}
}
/* following 6 functions taken mostly from gobject.c */
/**
* gst_element_set:
* @element: a #GstElement to set properties on.
* @first_property_name: the first property to set.
* @...: value of the first property, and more properties to set, ending
* with NULL.
*
* Sets properties on an element. If the element uses threadsafe properties,
* they will be queued and set on the object when it is scheduled again.
*/
void
gst_element_set (GstElement * element, const gchar * first_property_name, ...)
{
va_list var_args;
g_return_if_fail (GST_IS_ELEMENT (element));
va_start (var_args, first_property_name);
gst_element_set_valist (element, first_property_name, var_args);
va_end (var_args);
}
/**
* gst_element_get:
* @element: a #GstElement to get properties of.
* @first_property_name: the first property to get.
* @...: pointer to a variable to store the first property in, as well as
* more properties to get, ending with NULL.
*
* Gets properties from an element. If the element uses threadsafe properties,
* the element will be locked before getting the given properties.
*/
void
gst_element_get (GstElement * element, const gchar * first_property_name, ...)
{
va_list var_args;
g_return_if_fail (GST_IS_ELEMENT (element));
va_start (var_args, first_property_name);
gst_element_get_valist (element, first_property_name, var_args);
va_end (var_args);
}
/**
* gst_element_set_valist:
* @element: a #GstElement to set properties on.
* @first_property_name: the first property to set.
* @var_args: the var_args list of other properties to get.
*
* Sets properties on an element. If the element uses threadsafe properties,
* the property change will be put on the async queue.
*/
void
gst_element_set_valist (GstElement * element, const gchar * first_property_name,
va_list var_args)
{
const gchar *name;
GObject *object;
g_return_if_fail (GST_IS_ELEMENT (element));
object = (GObject *) element;
GST_CAT_DEBUG (GST_CAT_PROPERTIES,
"setting valist of properties starting with %s on element %s",
first_property_name, gst_element_get_name (element));
if (!GST_FLAG_IS_SET (element, GST_ELEMENT_USE_THREADSAFE_PROPERTIES)) {
g_object_set_valist (object, first_property_name, var_args);
return;
}
g_object_ref (object);
name = first_property_name;
while (name) {
GValue value = { 0, };
GParamSpec *pspec;
gchar *error = NULL;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), name);
if (!pspec) {
g_warning ("%s: object class `%s' has no property named `%s'",
G_STRLOC, G_OBJECT_TYPE_NAME (object), name);
break;
}
if (!(pspec->flags & G_PARAM_WRITABLE)) {
g_warning ("%s: property `%s' of object class `%s' is not writable",
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (object));
break;
}
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
G_VALUE_COLLECT (&value, var_args, 0, &error);
if (error) {
g_warning ("%s: %s", G_STRLOC, error);
g_free (error);
/* we purposely leak the value here, it might not be
* in a sane state if an error condition occoured
*/
break;
}
element_set_property (element, pspec, &value);
g_value_unset (&value);
name = va_arg (var_args, gchar *);
}
g_object_unref (object);
}
/**
* gst_element_get_valist:
* @element: a #GstElement to get properties of.
* @first_property_name: the first property to get.
* @var_args: the var_args list of other properties to get.
*
* Gets properties from an element. If the element uses threadsafe properties,
* the element will be locked before getting the given properties.
*/
void
gst_element_get_valist (GstElement * element, const gchar * first_property_name,
va_list var_args)
{
const gchar *name;
GObject *object;
g_return_if_fail (GST_IS_ELEMENT (element));
object = (GObject *) element;
if (!GST_FLAG_IS_SET (element, GST_ELEMENT_USE_THREADSAFE_PROPERTIES)) {
g_object_get_valist (object, first_property_name, var_args);
return;
}
g_object_ref (object);
name = first_property_name;
while (name) {
GValue value = { 0, };
GParamSpec *pspec;
gchar *error;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), name);
if (!pspec) {
g_warning ("%s: object class `%s' has no property named `%s'",
G_STRLOC, G_OBJECT_TYPE_NAME (object), name);
break;
}
if (!(pspec->flags & G_PARAM_READABLE)) {
g_warning ("%s: property `%s' of object class `%s' is not readable",
G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (object));
break;
}
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
element_get_property (element, pspec, &value);
G_VALUE_LCOPY (&value, var_args, 0, &error);
if (error) {
g_warning ("%s: %s", G_STRLOC, error);
g_free (error);
g_value_unset (&value);
break;
}
g_value_unset (&value);
name = va_arg (var_args, gchar *);
}
g_object_unref (object);
}
/**
* gst_element_set_property:
* @element: a #GstElement to set properties on.
* @property_name: the first property to get.
* @value: the #GValue that holds the value to set.
*
* Sets a property on an element. If the element uses threadsafe properties,
* the property will be put on the async queue.
*/
void
gst_element_set_property (GstElement * element, const gchar * property_name,
const GValue * value)
{
GParamSpec *pspec;
GObject *object;
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (property_name != NULL);
g_return_if_fail (G_IS_VALUE (value));
object = (GObject *) element;
GST_CAT_DEBUG (GST_CAT_PROPERTIES, "setting property %s on element %s",
property_name, gst_element_get_name (element));
if (!GST_FLAG_IS_SET (element, GST_ELEMENT_USE_THREADSAFE_PROPERTIES)) {
g_object_set_property (object, property_name, value);
return;
}
g_object_ref (object);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object),
property_name);
if (!pspec)
g_warning ("%s: object class `%s' has no property named `%s'",
G_STRLOC, G_OBJECT_TYPE_NAME (object), property_name);
else
element_set_property (element, pspec, value);
g_object_unref (object);
}
/**
* gst_element_get_property:
* @element: a #GstElement to get properties of.
* @property_name: the first property to get.
* @value: the #GValue to store the property value in.
*
* Gets a property from an element. If the element uses threadsafe properties,
* the element will be locked before getting the given property.
*/
void
gst_element_get_property (GstElement * element, const gchar * property_name,
GValue * value)
{
GParamSpec *pspec;
GObject *object;
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (property_name != NULL);
g_return_if_fail (G_IS_VALUE (value));
object = (GObject *) element;
if (!GST_FLAG_IS_SET (element, GST_ELEMENT_USE_THREADSAFE_PROPERTIES)) {
g_object_get_property (object, property_name, value);
return;
}
g_object_ref (object);
pspec =
g_object_class_find_property (G_OBJECT_GET_CLASS (object), property_name);
if (!pspec)
g_warning ("%s: object class `%s' has no property named `%s'",
G_STRLOC, G_OBJECT_TYPE_NAME (object), property_name);
else {
GValue *prop_value, tmp_value = { 0, };
/* auto-conversion of the callers value type
*/
if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (pspec)) {
g_value_reset (value);
prop_value = value;
} else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (pspec),
G_VALUE_TYPE (value))) {
g_warning
("can't retrieve property `%s' of type `%s' as value of type `%s'",
pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
G_VALUE_TYPE_NAME (value));
g_object_unref (object);
return;
} else {
g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
prop_value = &tmp_value;
}
element_get_property (element, pspec, prop_value);
if (prop_value != value) {
g_value_transform (prop_value, value);
g_value_unset (&tmp_value);
}
}
g_object_unref (object);
}
/**
* gst_element_release_request_pad:
* @element: a #GstElement to release the request pad of.
@ -1593,7 +1154,7 @@ iterate_pad (GstIterator * it, GstPad * pad)
*
* Retrieves an iterattor of @element's pads.
*
* Returns: the #GstIterator of pads.
* Returns: the #GstIterator of #GstPad. unref each pad after usage.
*
* MT safe.
*/
@ -1747,17 +1308,17 @@ gst_element_get_random_pad (GstElement * element, GstPadDirection dir)
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "getting a random pad");
GST_LOCK (element);
switch (dir) {
case GST_PAD_SRC:
GST_LOCK (element);
pads = element->srcpads;
break;
case GST_PAD_SINK:
GST_LOCK (element);
pads = element->sinkpads;
break;
default:
g_warning ("unknown pad direction");
return NULL;
goto wrong_direction;
}
for (; pads; pads = g_list_next (pads)) {
GstPad *pad = GST_PAD (pads->data);
@ -1782,6 +1343,13 @@ gst_element_get_random_pad (GstElement * element, GstPadDirection dir)
GST_UNLOCK (element);
return result;
/* ERROR handling */
wrong_direction:
{
g_warning ("unknown pad direction");
return NULL;
}
}
/**
@ -2349,9 +1917,9 @@ gst_element_get_state (GstElement * element)
void
gst_element_wait_state_change (GstElement * element)
{
g_mutex_lock (element->state_mutex);
g_cond_wait (element->state_cond, element->state_mutex);
g_mutex_unlock (element->state_mutex);
GST_STATE_LOCK (element);
GST_STATE_WAIT (element);
GST_STATE_UNLOCK (element);
}
/**
@ -2652,7 +2220,7 @@ gst_element_change_state (GstElement * element)
0, old_state, GST_STATE (element));
/* signal the state change in case somebody is waiting for us */
g_cond_signal (element->state_cond);
GST_STATE_BROADCAST (element);
gst_object_unref (GST_OBJECT (element));
return GST_STATE_SUCCESS;
@ -2699,19 +2267,6 @@ gst_element_dispose (GObject * object)
element->numsrcpads = 0;
element->numsinkpads = 0;
element->numpads = 0;
if (element->state_mutex)
g_mutex_free (element->state_mutex);
element->state_mutex = NULL;
if (element->state_cond)
g_cond_free (element->state_cond);
element->state_cond = NULL;
if (element->prop_value_queue)
g_async_queue_unref (element->prop_value_queue);
element->prop_value_queue = NULL;
if (element->property_mutex)
g_mutex_free (element->property_mutex);
element->property_mutex = NULL;
gst_object_replace ((GstObject **) & element->sched, NULL);
gst_object_replace ((GstObject **) & element->clock, NULL);
@ -2722,7 +2277,10 @@ gst_element_dispose (GObject * object)
static void
gst_element_finalize (GObject * object)
{
//GstElement *element = GST_ELEMENT (object);
GstElement *element = GST_ELEMENT (object);
g_mutex_free (element->state_lock);
g_cond_free (element->state_cond);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View file

@ -1,7 +1,6 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2004 Wim Taymans <wim@fluendo.com>
* 2000,2004 Wim Taymans <wim@fluendo.com>
*
* gstelement.h: Header for GstElement
*
@ -118,9 +117,6 @@ typedef enum
GST_ELEMENT_NEW_LOOPFUNC,
/* if this element can handle events */
GST_ELEMENT_EVENT_AWARE,
/* use threadsafe property get/set implementation */
GST_ELEMENT_USE_THREADSAFE_PROPERTIES,
/* private flags that can be used by the scheduler */
GST_ELEMENT_SCHEDULER_PRIVATE1,
@ -142,9 +138,9 @@ typedef enum
#define GST_ELEMENT_NAME(obj) (GST_OBJECT_NAME(obj))
#define GST_ELEMENT_PARENT(obj) (GST_OBJECT_PARENT(obj))
#define GST_ELEMENT_SCHEDULER(obj) (((GstElement*)(obj))->sched)
#define GST_ELEMENT_CLOCK(obj) (((GstElement*)(obj))->clock)
#define GST_ELEMENT_PADS(obj) ((obj)->pads)
#define GST_ELEMENT_SCHEDULER(obj) (GST_ELEMENT_CAST(obj)->sched)
#define GST_ELEMENT_CLOCK(obj) (GST_ELEMENT_CAST(obj)->clock)
#define GST_ELEMENT_PADS(obj) (GST_ELEMENT_CAST(obj)->pads)
/**
* GST_ELEMENT_ERROR:
@ -158,91 +154,120 @@ typedef enum
* data processing error. The pipeline will throw an error signal and the
* application will be requested to stop further media processing.
*/
#define GST_ELEMENT_ERROR(el, domain, code, message, debug) G_STMT_START { \
gchar *__msg = _gst_element_error_printf message; \
gchar *__dbg = _gst_element_error_printf debug; \
if (__msg) \
GST_ERROR_OBJECT (el, "%s", __msg); \
if (__dbg) \
GST_ERROR_OBJECT (el, "%s", __dbg); \
gst_element_error_full (GST_ELEMENT(el), \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
__msg, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
#define GST_ELEMENT_ERROR(el, domain, code, message, debug) \
G_STMT_START { \
gchar *__msg = _gst_element_error_printf message; \
gchar *__dbg = _gst_element_error_printf debug; \
if (__msg) \
GST_ERROR_OBJECT (el, "%s", __msg); \
if (__dbg) \
GST_ERROR_OBJECT (el, "%s", __dbg); \
gst_element_error_full (GST_ELEMENT(el), \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code, \
__msg, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
} G_STMT_END
typedef struct _GstElementFactory GstElementFactory;
typedef struct _GstElementFactoryClass GstElementFactoryClass;
typedef void (*GstElementLoopFunction) (GstElement *element);
typedef void (*GstElementPreRunFunction) (GstElement *element);
typedef void (*GstElementPostRunFunction) (GstElement *element);
struct _GstElement {
/* the state change mutexes and conds */
#define GST_STATE_GET_LOCK(elem) (GST_ELEMENT_CAST(elem)->state_lock)
#define GST_STATE_LOCK(elem) g_mutex_lock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_TRYLOCK(elem) g_mutex_trylock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_UNLOCK(elem) g_mutex_unlock(GST_STATE_GET_LOCK(elem))
#define GST_STATE_GET_COND(elem) (GST_ELEMENT_CAST(elem)->state_cond)
#define GST_STATE_WAIT(elem) g_cond_wait (GST_STATE_GET_COND (elem), GST_STATE_GET_LOCK (elem))
#define GST_STATE_TIMED_WAIT(elem, timeval) g_cond_timed_wait (GST_STATE_GET_COND (elem), GST_STATE_GET_LOCK (elem),\
timeval)
#define GST_STATE_SIGNAL(elem) g_cond_signal (GST_STATE_GET_COND (elem));
#define GST_STATE_BROADCAST(elem) g_cond_broadcast (GST_STATE_GET_COND (elem));
struct _GstElement
{
GstObject object;
/* element state and scheduling */
guint8 current_state;
guint8 pending_state;
/*< public >*/ /* with STATE_LOCK */
/* element state */
GMutex *state_lock;
GCond *state_cond;
guint8 current_state;
guint8 pending_state;
gboolean state_error; /* flag is set when the element has an error in the last state
change. it is cleared when doing another state change. */
/*< public >*/ /* with LOCK */
/* scheduling */
GstElementLoopFunction loopfunc;
GstScheduler *sched;
GstScheduler *sched;
/* private pointer for the scheduler */
gpointer sched_private;
/* allocated clock */
GstClock *clock;
GstClock *clock;
GstClockTimeDiff base_time; /* NULL/READY: 0 - PAUSED: current time - PLAYING: difference to clock */
/* element pads, these lists can only be iterated while holding
/* element pads, these lists can only be iterated while holding
* the LOCK or checking the cookie after each LOCK. */
guint16 numpads;
GList *pads;
guint16 numsrcpads;
GList *srcpads;
guint16 numsinkpads;
GList *sinkpads;
guint32 pads_cookie;
GMutex *state_mutex;
GCond *state_cond;
GstElementPreRunFunction pre_run_func;
GstElementPostRunFunction post_run_func;
GAsyncQueue *prop_value_queue;
GMutex *property_mutex;
guint16 numpads;
GList *pads;
guint16 numsrcpads;
GList *srcpads;
guint16 numsinkpads;
GList *sinkpads;
guint32 pads_cookie;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstElementClass
{
GstObjectClass parent_class;
GstObjectClass parent_class;
/*< public > */
/*< public >*/
/* the element details */
GstElementDetails details;
GstElementDetails details;
/* factory that the element was created from */
GstElementFactory *elementfactory;
/* templates for our pads */
GList *padtemplates;
gint numpadtemplates;
guint32 pad_templ_cookie;
GList *padtemplates;
gint numpadtemplates;
guint32 pad_templ_cookie;
/* signal callbacks */
void (*state_change) (GstElement *element, GstElementState old, GstElementState state);
void (*new_pad) (GstElement *element, GstPad *pad);
void (*pad_removed) (GstElement *element, GstPad *pad);
void (*no_more_pads) (GstElement *element);
void (*error) (GstElement *element, GstElement *source, GError *error, gchar *debug);
void (*eos) (GstElement *element);
void (*found_tag) (GstElement *element, GstElement *source, const GstTagList *tag_list);
/* local pointers for get/set */
void (*set_property) (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
void (*get_property) (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
/*< protected >*/
/* vtable*/
/* request/release pads */
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ, const gchar* name);
void (*release_pad) (GstElement *element, GstPad *pad);
/* state changes */
GstElementStateReturn (*change_state) (GstElement *element);
GstElementStateReturn (*set_state) (GstElement *element, GstElementState state);
/* scheduling */
gboolean (*release_locks) (GstElement *element);
void (*set_scheduler) (GstElement *element, GstScheduler *scheduler);
/* set/get clocks */
GstClock* (*get_clock) (GstElement *element);
void (*set_clock) (GstElement *element, GstClock *clock);
/* index */
GstIndex* (*get_index) (GstElement *element);
void (*set_index) (GstElement *element, GstIndex *index);
/* query/convert/events functions */
const GstEventMask* (*get_event_masks) (GstElement *element);
@ -254,72 +279,26 @@ struct _GstElementClass
const GstQueryType* (*get_query_types) (GstElement *element);
gboolean (*query) (GstElement *element, GstQueryType type,
GstFormat *format, gint64 *value);
/* change the element state */
GstElementStateReturn (*change_state) (GstElement *element);
/* request/release pads */
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ, const gchar* name);
void (*release_pad) (GstElement *element, GstPad *pad);
/* set/get clocks */
GstClock* (*get_clock) (GstElement *element);
void (*set_clock) (GstElement *element, GstClock *clock);
/* index */
GstIndex* (*get_index) (GstElement *element);
void (*set_index) (GstElement *element, GstIndex *index);
/* scheduler */
void (*set_scheduler) (GstElement *element, GstScheduler *scheduler);
GstElementStateReturn (*set_state) (GstElement *element, GstElementState state);
/* FIXME 0.9: move up to signals */
void (*no_more_pads) (GstElement *element);
gpointer _gst_reserved[GST_PADDING - 1];
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GType gst_element_get_type (void);
/* element class pad templates */
void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ);
GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
/* element class details */
void gst_element_class_set_details (GstElementClass *klass,
const GstElementDetails *details);
#define gst_element_default_deep_notify gst_object_default_deep_notify
void gst_element_default_error (GObject *object, GstObject *orig, GError *error, gchar *debug);
void gst_element_set_loop_function (GstElement *element,
GstElementLoopFunction loop);
/* element instance */
GType gst_element_get_type (void);
/* basic name and parentage stuff from GstObject */
#define gst_element_get_name(elem) gst_object_get_name(GST_OBJECT(elem))
#define gst_element_set_name(elem,name) gst_object_set_name(GST_OBJECT(elem),name)
#define gst_element_get_parent(elem) gst_object_get_parent(GST_OBJECT(elem))
#define gst_element_set_parent(elem,parent) gst_object_set_parent(GST_OBJECT(elem),parent)
/* threadsafe versions of their g_object_* counterparts */
void gst_element_set (GstElement *element, const gchar *first_property_name, ...);
void gst_element_get (GstElement *element, const gchar *first_property_name, ...);
void gst_element_set_valist (GstElement *element, const gchar *first_property_name,
va_list var_args);
void gst_element_get_valist (GstElement *element, const gchar *first_property_name,
va_list var_args);
void gst_element_set_property (GstElement *element, const gchar *property_name,
const GValue *value);
void gst_element_get_property (GstElement *element, const gchar *property_name,
GValue *value);
void gst_element_enable_threadsafe_properties (GstElement *element);
void gst_element_disable_threadsafe_properties (GstElement *element);
void gst_element_set_pending_properties (GstElement *element);
/* clocking */
gboolean gst_element_requires_clock (GstElement *element);
gboolean gst_element_provides_clock (GstElement *element);
@ -333,20 +312,24 @@ void gst_element_set_time (GstElement *element, GstClockTime time);
void gst_element_set_time_delay (GstElement *element, GstClockTime time, GstClockTime delay);
void gst_element_adjust_time (GstElement *element, GstClockTimeDiff diff);
/* indexs */
/* indexes */
gboolean gst_element_is_indexable (GstElement *element);
void gst_element_set_index (GstElement *element, GstIndex *index);
GstIndex* gst_element_get_index (GstElement *element);
/* scheduling */
void gst_element_set_loop_function (GstElement *element,
GstElementLoopFunction loop);
gboolean gst_element_release_locks (GstElement *element);
void gst_element_yield (GstElement *element);
gboolean gst_element_interrupt (GstElement *element);
void gst_element_set_scheduler (GstElement *element, GstScheduler *sched);
GstScheduler* gst_element_get_scheduler (GstElement *element);
GstBin* gst_element_get_managing_bin (GstElement *element);
/* pad management */
gboolean gst_element_add_pad (GstElement *element, GstPad *pad);
gboolean gst_element_remove_pad (GstElement *element, GstPad *pad);
GstPad * gst_element_add_ghost_pad (GstElement *element, GstPad *pad, const gchar *name);
@ -359,6 +342,7 @@ void gst_element_release_request_pad (GstElement *element, GstPad *pad);
GstIterator * gst_element_iterate_pads (GstElement * element);
/* event/query/format stuff */
G_CONST_RETURN GstEventMask*
gst_element_get_event_masks (GstElement *element);
gboolean gst_element_send_event (GstElement *element, GstEvent *event);
@ -374,16 +358,16 @@ gboolean gst_element_convert (GstElement *element,
GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
void gst_element_found_tags (GstElement *element, const GstTagList *tag_list);
void gst_element_found_tags_for_pad (GstElement *element, GstPad *pad, GstClockTime timestamp,
GstTagList *list);
void gst_element_set_eos (GstElement *element);
/* error handling */
gchar * _gst_element_error_printf (const gchar *format, ...);
void gst_element_error_full (GstElement *element, GQuark domain, gint code,
gchar *message, gchar *debug,
const gchar *file, const gchar *function, gint line);
void gst_element_default_error (GObject *object, GstObject *orig, GError *error, gchar *debug);
#define gst_element_default_deep_notify gst_object_default_deep_notify
/* state management */
void gst_element_set_eos (GstElement *element);
gboolean gst_element_is_locked_state (GstElement *element);
gboolean gst_element_set_locked_state (GstElement *element, gboolean locked_state);
@ -393,12 +377,15 @@ GstElementState gst_element_get_state (GstElement *element);
GstElementStateReturn gst_element_set_state (GstElement *element, GstElementState state);
void gst_element_wait_state_change (GstElement *element);
/* factory management */
GstElementFactory* gst_element_get_factory (GstElement *element);
GstBin* gst_element_get_managing_bin (GstElement *element);
/* misc */
void gst_element_found_tags (GstElement *element, const GstTagList *tag_list);
void gst_element_found_tags_for_pad (GstElement *element, GstPad *pad, GstClockTime timestamp,
GstTagList *list);
/*
*
* factories stuff
@ -470,9 +457,7 @@ void __gst_element_factory_add_pad_template (GstElementFactory *elementfactory
void __gst_element_factory_add_interface (GstElementFactory *elementfactory,
const gchar *interfacename);
G_END_DECLS
#endif /* __GST_ELEMENT_H__ */

View file

@ -217,6 +217,9 @@ gst_queue_class_init (GstQueueClass * klass)
parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_queue_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_queue_get_property);
/* signals */
gst_queue_signals[SIGNAL_UNDERRUN] =
g_signal_new ("underrun", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
@ -287,8 +290,6 @@ gst_queue_class_init (GstQueueClass * klass)
/* set several parent class virtual functions */
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_queue_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_queue_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_queue_get_property);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_queue_change_state);
gstelement_class->release_locks = GST_DEBUG_FUNCPTR (gst_queue_release_locks);

View file

@ -163,6 +163,9 @@ gst_thread_class_init (gpointer g_class, gpointer class_data)
parent_class = g_type_class_peek_parent (g_class);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_thread_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_thread_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRIORITY,
g_param_spec_enum ("priority", "Scheduling Policy",
"The scheduling priority of the thread", GST_TYPE_THREAD_PRIORITY,
@ -183,9 +186,6 @@ gst_thread_class_init (gpointer g_class, gpointer class_data)
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_thread_change_state);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_thread_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_thread_get_property);
gstbin_class->child_state_change =
GST_DEBUG_FUNCPTR (gst_thread_child_state_change);
}
@ -476,32 +476,13 @@ revert:
break;
case GST_STATE_PAUSED_TO_PLAYING:
{
/* FIXME: recurse into sub-bins. not MT safe but gstthread is going
* away soon. */
GList *elements = (GList *) GST_BIN (thread)->children;
while (elements) {
gst_element_enable_threadsafe_properties ((GstElement *) elements->
data);
elements = g_list_next (elements);
}
/* reset self to spinning */
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
break;
}
case GST_STATE_PLAYING_TO_PAUSED:
{
GList *elements;
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
elements = (GList *) GST_BIN (thread)->children;
while (elements) {
gst_element_disable_threadsafe_properties ((GstElement *) elements->
data);
elements = g_list_next (elements);
}
break;
}
case GST_STATE_PAUSED_TO_READY:

View file

@ -152,19 +152,11 @@ static GstSchedulerClass *parent_class = NULL;
* that will avoid using do_cothread_switch from within the scheduler. */
#define do_element_switch(element) G_STMT_START{ \
GstElement *from = SCHED (element)->current; \
if (from && from->post_run_func) \
from->post_run_func (from); \
SCHED (element)->current = element; \
if (element->pre_run_func) \
element->pre_run_func (element); \
do_cothread_switch (GST_ELEMENT_THREADSTATE (element)); \
}G_STMT_END
#define do_switch_to_main(sched) G_STMT_START{ \
GstElement *current = ((GstBasicScheduler*)sched)->current; \
if (current && current->post_run_func) \
current->post_run_func (current); \
((GstBasicScheduler*) sched)->current = NULL; \
do_cothread_switch \
(do_cothread_get_main \
@ -172,8 +164,6 @@ static GstSchedulerClass *parent_class = NULL;
}G_STMT_END
#define do_switch_from_main(entry) G_STMT_START{ \
if (entry->pre_run_func) \
entry->pre_run_func (entry); \
SCHED (entry)->current = entry; \
do_cothread_switch (GST_ELEMENT_THREADSTATE (entry)); \
}G_STMT_END
@ -302,9 +292,6 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
/* due to oddities in the cothreads code, when this function returns it will
* switch to the main cothread. thus, we need to unlock the current element. */
if (SCHED (element)) {
if (SCHED (element)->current && SCHED (element)->current->post_run_func) {
SCHED (element)->current->post_run_func (SCHED (element)->current);
}
SCHED (element)->current = NULL;
}
@ -381,9 +368,6 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv)
/* due to oddities in the cothreads code, when this function returns it will
* switch to the main cothread. thus, we need to unlock the current element. */
if (SCHED (element)) {
if (SCHED (element)->current && SCHED (element)->current->post_run_func) {
SCHED (element)->current->post_run_func (SCHED (element)->current);
}
SCHED (element)->current = NULL;
}
@ -434,8 +418,6 @@ gst_basic_scheduler_src_wrapper (int argc, char **argv)
/* due to oddities in the cothreads code, when this function returns it will
* switch to the main cothread. thus, we need to unlock the current element. */
if (SCHED (element)->current->post_run_func)
SCHED (element)->current->post_run_func (SCHED (element)->current);
SCHED (element)->current = NULL;
GST_DEBUG ("leaving src wrapper of element %s", name);
@ -1128,8 +1110,6 @@ gst_basic_scheduler_remove_element (GstScheduler * sched, GstElement * element)
/* if we are removing the currently scheduled element */
if (bsched->current == element) {
GST_FLAG_SET (element, GST_ELEMENT_COTHREAD_STOPPING);
if (element->post_run_func)
element->post_run_func (element);
bsched->current = NULL;
}
/* find what chain the element is in */

View file

@ -1215,8 +1215,6 @@ schedule_group (GstOptSchedulerGroup * group)
GstElement *e = (GstElement *) l->data;
gst_object_ref (GST_OBJECT (e));
if (e->pre_run_func)
e->pre_run_func (e);
}
group->schedulefunc (group->argc, group->argv);
@ -1224,9 +1222,6 @@ schedule_group (GstOptSchedulerGroup * group)
for (l = lcopy; l; l = l->next) {
GstElement *e = (GstElement *) l->data;
if (e->post_run_func)
e->post_run_func (e);
gst_object_unref (GST_OBJECT (e));
}
if (entry)

View file

@ -137,6 +137,9 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
g_param_spec_int ("num_pads", "Num pads", "The number of source pads",
0, G_MAXINT, 0, G_PARAM_READABLE));
@ -152,8 +155,6 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
"The current state of the element", NULL, G_PARAM_READABLE));
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_aggregator_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_aggregator_request_new_pad);

View file

@ -138,6 +138,8 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SINKS,
g_param_spec_int ("num_sinks", "Number of sinks",
@ -169,9 +171,6 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_fakesink_request_new_pad);
gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_fakesink_set_clock);

View file

@ -214,6 +214,8 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesrc_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesrc_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
g_param_spec_int ("num-sources", "num-sources", "Number of sources",
@ -281,9 +283,6 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesrc_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesrc_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_fakesrc_request_new_pad);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_fakesrc_change_state);

View file

@ -88,13 +88,12 @@ gst_fdsink_class_init (GstFdSinkClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_fdsink_set_property;
gobject_class->get_property = gst_fdsink_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
0, G_MAXINT, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_fdsink_set_property;
gobject_class->get_property = gst_fdsink_get_property;
}
static void

View file

@ -103,6 +103,9 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_fdsrc_set_property;
gobject_class->get_property = gst_fdsrc_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
0, G_MAXINT, 0, G_PARAM_READWRITE));
@ -119,9 +122,6 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
G_STRUCT_OFFSET (GstFdSrcClass, timeout), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gobject_class->set_property = gst_fdsrc_set_property;
gobject_class->get_property = gst_fdsrc_get_property;
gstelement_class->change_state = gst_fdsrc_change_state;
}

View file

@ -145,6 +145,8 @@ gst_filesink_class_init (GstFileSinkClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_filesink_set_property;
gobject_class->get_property = gst_filesink_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
g_param_spec_string ("location", "File Location",
@ -155,8 +157,6 @@ gst_filesink_class_init (GstFileSinkClass * klass)
G_STRUCT_OFFSET (GstFileSinkClass, handoff), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gobject_class->set_property = gst_filesink_set_property;
gobject_class->get_property = gst_filesink_get_property;
gobject_class->dispose = gst_filesink_dispose;
}
static void

View file

@ -214,6 +214,8 @@ gst_filesrc_class_init (GstFileSrcClass * klass)
gobject_class = (GObjectClass *) klass;
gobject_class->set_property = gst_filesrc_set_property;
gobject_class->get_property = gst_filesrc_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
g_param_spec_int ("fd", "File-descriptor",
@ -235,8 +237,6 @@ gst_filesrc_class_init (GstFileSrcClass * klass)
"Touch data to force disk read", FALSE, G_PARAM_READWRITE));
gobject_class->dispose = gst_filesrc_dispose;
gobject_class->set_property = gst_filesrc_set_property;
gobject_class->get_property = gst_filesrc_get_property;
gstelement_class->change_state = gst_filesrc_change_state;
}

View file

@ -138,6 +138,9 @@ gst_identity_class_init (GstIdentityClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gstelement_class = GST_ELEMENT_CLASS (klass);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
g_param_spec_boolean ("loop-based", "Loop-based",
"Set to TRUE to use loop-based rather than chain-based scheduling",
@ -185,8 +188,6 @@ gst_identity_class_init (GstIdentityClass * klass)
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_identity_set_clock);
gstelement_class->change_state =

View file

@ -392,7 +392,6 @@ gst_md5sink_class_init (GstMD5SinkClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5,

View file

@ -107,6 +107,8 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_multifilesrc_set_property;
gobject_class->get_property = gst_multifilesrc_get_property;
gst_multifilesrc_signals[NEW_FILE] =
g_signal_new ("new-file", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
@ -114,16 +116,11 @@ gst_multifilesrc_class_init (GstMultiFileSrcClass * klass)
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATIONS, g_param_spec_pointer ("locations", "locations", "locations", G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HAVENEWMEDIA,
g_param_spec_boolean ("newmedia", "newmedia",
"generate new media events?", FALSE, G_PARAM_READWRITE));
gobject_class->set_property = gst_multifilesrc_set_property;
gobject_class->get_property = gst_multifilesrc_get_property;
gstelement_class->change_state = gst_multifilesrc_change_state;
}

View file

@ -217,6 +217,9 @@ gst_queue_class_init (GstQueueClass * klass)
parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_queue_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_queue_get_property);
/* signals */
gst_queue_signals[SIGNAL_UNDERRUN] =
g_signal_new ("underrun", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
@ -287,8 +290,6 @@ gst_queue_class_init (GstQueueClass * klass)
/* set several parent class virtual functions */
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_queue_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_queue_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_queue_get_property);
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_queue_change_state);
gstelement_class->release_locks = GST_DEBUG_FUNCPTR (gst_queue_release_locks);

View file

@ -127,6 +127,8 @@ gst_shaper_class_init (GstShaperClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY,
g_param_spec_enum ("policy", "Policy", "Shaper policy",
@ -138,9 +140,6 @@ gst_shaper_class_init (GstShaperClass * klass)
g_param_spec_string ("last-message", "last-message", "last-message",
NULL, G_PARAM_READABLE));
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_shaper_request_new_pad);
}

View file

@ -124,6 +124,8 @@ gst_statistics_class_init (GstStatisticsClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS,
g_param_spec_int64 ("buffers", "buffers", "total buffers count",
@ -162,8 +164,6 @@ gst_statistics_class_init (GstStatisticsClass * klass)
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_statistics_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property);
}
static void

View file

@ -113,6 +113,8 @@ gst_tee_class_init (GstTeeClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
g_param_spec_int ("num_pads", "num_pads", "num_pads",
@ -126,8 +128,6 @@ gst_tee_class_init (GstTeeClass * klass)
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tee_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_tee_request_new_pad);