mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
autoconvert: Gratuitously move GST_OBJECT_LOCK into a macro
Create GST_AUTOCONVERT_LOCK/UNLOCK macros that (for now) just call GST_OBJECT_LOCK.
This commit is contained in:
parent
7f12cab9de
commit
de829eb7d0
1 changed files with 31 additions and 31 deletions
|
@ -45,6 +45,9 @@
|
||||||
GST_DEBUG_CATEGORY (autoconvert_debug);
|
GST_DEBUG_CATEGORY (autoconvert_debug);
|
||||||
#define GST_CAT_DEFAULT (autoconvert_debug)
|
#define GST_CAT_DEFAULT (autoconvert_debug)
|
||||||
|
|
||||||
|
#define GST_AUTOCONVERT_LOCK(ac) GST_OBJECT_LOCK (ac)
|
||||||
|
#define GST_AUTOCONVERT_UNLOCK(ac) GST_OBJECT_UNLOCK (ac)
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
|
@ -233,7 +236,7 @@ gst_auto_convert_dispose (GObject * object)
|
||||||
|
|
||||||
gst_pad_set_fixatecaps_function (autoconvert->sinkpad, NULL);
|
gst_pad_set_fixatecaps_function (autoconvert->sinkpad, NULL);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (object);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->current_subelement) {
|
if (autoconvert->current_subelement) {
|
||||||
gst_object_unref (autoconvert->current_subelement);
|
gst_object_unref (autoconvert->current_subelement);
|
||||||
autoconvert->current_subelement = NULL;
|
autoconvert->current_subelement = NULL;
|
||||||
|
@ -245,12 +248,11 @@ gst_auto_convert_dispose (GObject * object)
|
||||||
NULL);
|
NULL);
|
||||||
g_list_free (autoconvert->cached_events);
|
g_list_free (autoconvert->cached_events);
|
||||||
autoconvert->cached_events = NULL;
|
autoconvert->cached_events = NULL;
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_auto_convert_set_property (GObject * object,
|
gst_auto_convert_set_property (GObject * object,
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||||
|
@ -262,13 +264,13 @@ gst_auto_convert_set_property (GObject * object,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
case PROP_FACTORIES:
|
case PROP_FACTORIES:
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->factories == NULL)
|
if (autoconvert->factories == NULL)
|
||||||
autoconvert->factories = g_value_get_pointer (value);
|
autoconvert->factories = g_value_get_pointer (value);
|
||||||
else
|
else
|
||||||
GST_WARNING_OBJECT (object, "Can not reset factories after they"
|
GST_WARNING_OBJECT (object, "Can not reset factories after they"
|
||||||
" have been set or auto-discovered");
|
" have been set or auto-discovered");
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,9 +286,9 @@ gst_auto_convert_get_property (GObject * object,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
case PROP_FACTORIES:
|
case PROP_FACTORIES:
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
g_value_set_pointer (value, &autoconvert->factories);
|
g_value_set_pointer (value, &autoconvert->factories);
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,10 +437,10 @@ gst_auto_convert_get_subelement (GstAutoConvert * autoconvert)
|
||||||
{
|
{
|
||||||
GstElement *element = NULL;
|
GstElement *element = NULL;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->current_subelement)
|
if (autoconvert->current_subelement)
|
||||||
element = gst_object_ref (autoconvert->current_subelement);
|
element = gst_object_ref (autoconvert->current_subelement);
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
@ -448,24 +450,23 @@ gst_auto_convert_get_internal_sinkpad (GstAutoConvert * autoconvert)
|
||||||
{
|
{
|
||||||
GstPad *pad = NULL;
|
GstPad *pad = NULL;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->current_internal_sinkpad)
|
if (autoconvert->current_internal_sinkpad)
|
||||||
pad = gst_object_ref (autoconvert->current_internal_sinkpad);
|
pad = gst_object_ref (autoconvert->current_internal_sinkpad);
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GstPad *
|
static GstPad *
|
||||||
gst_auto_convert_get_internal_srcpad (GstAutoConvert * autoconvert)
|
gst_auto_convert_get_internal_srcpad (GstAutoConvert * autoconvert)
|
||||||
{
|
{
|
||||||
GstPad *pad = NULL;
|
GstPad *pad = NULL;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->current_internal_srcpad)
|
if (autoconvert->current_internal_srcpad)
|
||||||
pad = gst_object_ref (autoconvert->current_internal_srcpad);
|
pad = gst_object_ref (autoconvert->current_internal_srcpad);
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
@ -706,14 +707,14 @@ gst_auto_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
* By unsetting the fixatecaps function, we go back to the default one
|
* By unsetting the fixatecaps function, we go back to the default one
|
||||||
*/
|
*/
|
||||||
gst_pad_set_fixatecaps_function (autoconvert->sinkpad, NULL);
|
gst_pad_set_fixatecaps_function (autoconvert->sinkpad, NULL);
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->current_subelement == subelement) {
|
if (autoconvert->current_subelement == subelement) {
|
||||||
gst_object_unref (autoconvert->current_subelement);
|
gst_object_unref (autoconvert->current_subelement);
|
||||||
autoconvert->current_subelement = NULL;
|
autoconvert->current_subelement = NULL;
|
||||||
autoconvert->current_internal_srcpad = NULL;
|
autoconvert->current_internal_srcpad = NULL;
|
||||||
autoconvert->current_internal_sinkpad = NULL;
|
autoconvert->current_internal_sinkpad = NULL;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
gst_object_unref (subelement);
|
gst_object_unref (subelement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -724,9 +725,9 @@ gst_auto_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
factories = autoconvert->factories;
|
factories = autoconvert->factories;
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
if (!factories)
|
if (!factories)
|
||||||
factories = gst_auto_convert_load_factories (autoconvert);
|
factories = gst_auto_convert_load_factories (autoconvert);
|
||||||
|
@ -780,16 +781,15 @@ gst_auto_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
|
|
||||||
gst_pad_set_fixatecaps_function (autoconvert->sinkpad,
|
gst_pad_set_fixatecaps_function (autoconvert->sinkpad,
|
||||||
gst_auto_convert_sink_fixatecaps);
|
gst_auto_convert_sink_fixatecaps);
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
autoconvert->current_subelement = element;
|
autoconvert->current_subelement = element;
|
||||||
autoconvert->current_internal_srcpad = internal_srcpad;
|
autoconvert->current_internal_srcpad = internal_srcpad;
|
||||||
autoconvert->current_internal_sinkpad = internal_sinkpad;
|
autoconvert->current_internal_sinkpad = internal_sinkpad;
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
GST_INFO_OBJECT (autoconvert,
|
GST_INFO_OBJECT (autoconvert,
|
||||||
"Selected element %s",
|
"Selected element %s",
|
||||||
GST_OBJECT_NAME (GST_OBJECT (autoconvert->current_subelement)));
|
GST_OBJECT_NAME (GST_OBJECT (autoconvert->current_subelement)));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
next_element:
|
next_element:
|
||||||
|
@ -901,13 +901,13 @@ gst_auto_convert_load_factories (GstAutoConvert * autoconvert)
|
||||||
|
|
||||||
g_assert (all_factories);
|
g_assert (all_factories);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->factories == NULL) {
|
if (autoconvert->factories == NULL) {
|
||||||
autoconvert->factories = all_factories;
|
autoconvert->factories = all_factories;
|
||||||
all_factories = NULL;
|
all_factories = NULL;
|
||||||
}
|
}
|
||||||
out_factories = autoconvert->factories;
|
out_factories = autoconvert->factories;
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
if (all_factories) {
|
if (all_factories) {
|
||||||
/* In this case, someone set the property while we were looking! */
|
/* In this case, someone set the property while we were looking! */
|
||||||
|
@ -933,12 +933,12 @@ gst_auto_convert_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
GList *events = NULL;
|
GList *events = NULL;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
if (autoconvert->cached_events) {
|
if (autoconvert->cached_events) {
|
||||||
events = g_list_reverse (autoconvert->cached_events);
|
events = g_list_reverse (autoconvert->cached_events);
|
||||||
autoconvert->cached_events = NULL;
|
autoconvert->cached_events = NULL;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
if (events) {
|
if (events) {
|
||||||
GST_DEBUG_OBJECT (autoconvert, "Sending cached events downstream");
|
GST_DEBUG_OBJECT (autoconvert, "Sending cached events downstream");
|
||||||
|
@ -973,22 +973,22 @@ gst_auto_convert_sink_event (GstPad * pad, GstEvent * event)
|
||||||
} else {
|
} else {
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
g_list_foreach (autoconvert->cached_events,
|
g_list_foreach (autoconvert->cached_events,
|
||||||
(GFunc) gst_mini_object_unref, NULL);
|
(GFunc) gst_mini_object_unref, NULL);
|
||||||
g_list_free (autoconvert->cached_events);
|
g_list_free (autoconvert->cached_events);
|
||||||
autoconvert->cached_events = NULL;
|
autoconvert->cached_events = NULL;
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
ret = gst_pad_push_event (autoconvert->srcpad, event);
|
ret = gst_pad_push_event (autoconvert->srcpad, event);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
autoconvert->cached_events =
|
autoconvert->cached_events =
|
||||||
g_list_prepend (autoconvert->cached_events, event);
|
g_list_prepend (autoconvert->cached_events, event);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1101,9 +1101,9 @@ gst_auto_convert_sink_getcaps (GstPad * pad)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_OBJECT_LOCK (autoconvert);
|
GST_AUTOCONVERT_LOCK (autoconvert);
|
||||||
factories = autoconvert->factories;
|
factories = autoconvert->factories;
|
||||||
GST_OBJECT_UNLOCK (autoconvert);
|
GST_AUTOCONVERT_UNLOCK (autoconvert);
|
||||||
|
|
||||||
if (!factories)
|
if (!factories)
|
||||||
factories = gst_auto_convert_load_factories (autoconvert);
|
factories = gst_auto_convert_load_factories (autoconvert);
|
||||||
|
|
Loading…
Reference in a new issue