gst/: Make those function act on the ghostpad target when it's a ghostpad. (Closes #331727)

Original commit message from CVS:


* gst/gstpad.c: (gst_pad_set_blocked_async):
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe): Make those function act on the
ghostpad target when it's a ghostpad. (Closes #331727)
------------------------------------------------------
This commit is contained in:
Julien Moutte 2006-02-20 15:07:33 +00:00
parent 2c04844949
commit 52cfed6470
3 changed files with 108 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2006-02-20 Julien MOUTTE <julien@moutte.net>
* gst/gstpad.c: (gst_pad_set_blocked_async):
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe): Make those function act on the
ghostpad target when it's a ghostpad. (Closes #331727)
2006-02-20 Julien MOUTTE <julien@moutte.net> 2006-02-20 Julien MOUTTE <julien@moutte.net>
* libs/gst/base/gstbasetransform.c: * libs/gst/base/gstbasetransform.c:

View file

@ -63,6 +63,7 @@
#include "gst_private.h" #include "gst_private.h"
#include "gstpad.h" #include "gstpad.h"
#include "gstghostpad.h"
#include "gstpadtemplate.h" #include "gstpadtemplate.h"
#include "gstenumtypes.h" #include "gstenumtypes.h"
#include "gstmarshal.h" #include "gstmarshal.h"
@ -876,10 +877,18 @@ gboolean
gst_pad_set_blocked_async (GstPad * pad, gboolean blocked, gst_pad_set_blocked_async (GstPad * pad, gboolean blocked,
GstPadBlockCallback callback, gpointer user_data) GstPadBlockCallback callback, gpointer user_data)
{ {
gboolean was_blocked; gboolean was_blocked, was_ghost = FALSE;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE); g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
if (GST_IS_GHOST_PAD (pad)) {
pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
if (!pad) {
return FALSE;
}
was_ghost = TRUE;
}
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
was_blocked = GST_PAD_IS_BLOCKED (pad); was_blocked = GST_PAD_IS_BLOCKED (pad);
@ -919,6 +928,10 @@ gst_pad_set_blocked_async (GstPad * pad, gboolean blocked,
} }
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
return TRUE; return TRUE;
had_right_state: had_right_state:
@ -926,6 +939,10 @@ had_right_state:
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"pad %s:%s was in right state", GST_DEBUG_PAD_NAME (pad)); "pad %s:%s was in right state", GST_DEBUG_PAD_NAME (pad));
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
return FALSE; return FALSE;
} }
} }

View file

@ -2652,10 +2652,19 @@ gulong
gst_pad_add_data_probe (GstPad * pad, GCallback handler, gpointer data) gst_pad_add_data_probe (GstPad * pad, GCallback handler, gpointer data)
{ {
gulong sigid; gulong sigid;
gboolean was_ghost = FALSE;
g_return_val_if_fail (GST_IS_PAD (pad), 0); g_return_val_if_fail (GST_IS_PAD (pad), 0);
g_return_val_if_fail (handler != NULL, 0); g_return_val_if_fail (handler != NULL, 0);
if (GST_IS_GHOST_PAD (pad)) {
pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
if (!pad) {
return 0;
}
was_ghost = TRUE;
}
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
sigid = g_signal_connect (pad, "have-data", handler, data); sigid = g_signal_connect (pad, "have-data", handler, data);
GST_PAD_DO_EVENT_SIGNALS (pad)++; GST_PAD_DO_EVENT_SIGNALS (pad)++;
@ -2665,6 +2674,10 @@ gst_pad_add_data_probe (GstPad * pad, GCallback handler, gpointer data)
GST_PAD_DO_BUFFER_SIGNALS (pad), GST_PAD_DO_EVENT_SIGNALS (pad)); GST_PAD_DO_BUFFER_SIGNALS (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
return sigid; return sigid;
} }
@ -2683,10 +2696,19 @@ gulong
gst_pad_add_event_probe (GstPad * pad, GCallback handler, gpointer data) gst_pad_add_event_probe (GstPad * pad, GCallback handler, gpointer data)
{ {
gulong sigid; gulong sigid;
gboolean was_ghost = FALSE;
g_return_val_if_fail (GST_IS_PAD (pad), 0); g_return_val_if_fail (GST_IS_PAD (pad), 0);
g_return_val_if_fail (handler != NULL, 0); g_return_val_if_fail (handler != NULL, 0);
if (GST_IS_GHOST_PAD (pad)) {
pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
if (!pad) {
return 0;
}
was_ghost = TRUE;
}
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
sigid = g_signal_connect (pad, "have-data::event", handler, data); sigid = g_signal_connect (pad, "have-data::event", handler, data);
GST_PAD_DO_EVENT_SIGNALS (pad)++; GST_PAD_DO_EVENT_SIGNALS (pad)++;
@ -2694,6 +2716,10 @@ gst_pad_add_event_probe (GstPad * pad, GCallback handler, gpointer data)
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad)); GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
return sigid; return sigid;
} }
@ -2712,10 +2738,19 @@ gulong
gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data) gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data)
{ {
gulong sigid; gulong sigid;
gboolean was_ghost = FALSE;
g_return_val_if_fail (GST_IS_PAD (pad), 0); g_return_val_if_fail (GST_IS_PAD (pad), 0);
g_return_val_if_fail (handler != NULL, 0); g_return_val_if_fail (handler != NULL, 0);
if (GST_IS_GHOST_PAD (pad)) {
pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
if (!pad) {
return 0;
}
was_ghost = TRUE;
}
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
sigid = g_signal_connect (pad, "have-data::buffer", handler, data); sigid = g_signal_connect (pad, "have-data::buffer", handler, data);
GST_PAD_DO_BUFFER_SIGNALS (pad)++; GST_PAD_DO_BUFFER_SIGNALS (pad)++;
@ -2723,6 +2758,10 @@ gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data)
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad)); GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad));
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
return sigid; return sigid;
} }
@ -2736,9 +2775,19 @@ gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data)
void void
gst_pad_remove_data_probe (GstPad * pad, guint handler_id) gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
{ {
gboolean was_ghost = FALSE;
g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id > 0); g_return_if_fail (handler_id > 0);
if (GST_IS_GHOST_PAD (pad)) {
pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
if (!pad) {
return;
}
was_ghost = TRUE;
}
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id); g_signal_handler_disconnect (pad, handler_id);
GST_PAD_DO_BUFFER_SIGNALS (pad)--; GST_PAD_DO_BUFFER_SIGNALS (pad)--;
@ -2748,6 +2797,10 @@ gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad), GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad),
GST_PAD_DO_BUFFER_SIGNALS (pad)); GST_PAD_DO_BUFFER_SIGNALS (pad));
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
} }
/** /**
@ -2760,15 +2813,29 @@ gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
void void
gst_pad_remove_event_probe (GstPad * pad, guint handler_id) gst_pad_remove_event_probe (GstPad * pad, guint handler_id)
{ {
gboolean was_ghost = FALSE;
g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id > 0); g_return_if_fail (handler_id > 0);
if (GST_IS_GHOST_PAD (pad)) {
pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
if (!pad) {
return;
}
was_ghost = TRUE;
}
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id); g_signal_handler_disconnect (pad, handler_id);
GST_PAD_DO_EVENT_SIGNALS (pad)--; GST_PAD_DO_EVENT_SIGNALS (pad)--;
GST_DEBUG ("removed event probe from pad %s:%s, now %d event probes", GST_DEBUG ("removed event probe from pad %s:%s, now %d event probes",
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad)); GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
} }
/** /**
@ -2781,15 +2848,29 @@ gst_pad_remove_event_probe (GstPad * pad, guint handler_id)
void void
gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id) gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id)
{ {
gboolean was_ghost = FALSE;
g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id > 0); g_return_if_fail (handler_id > 0);
if (GST_IS_GHOST_PAD (pad)) {
pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
if (!pad) {
return;
}
was_ghost = TRUE;
}
GST_OBJECT_LOCK (pad); GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id); g_signal_handler_disconnect (pad, handler_id);
GST_PAD_DO_BUFFER_SIGNALS (pad)--; GST_PAD_DO_BUFFER_SIGNALS (pad)--;
GST_DEBUG ("removed buffer probe from pad %s:%s, now %d buffer probes", GST_DEBUG ("removed buffer probe from pad %s:%s, now %d buffer probes",
GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad)); GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad));
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (was_ghost) {
gst_object_unref (pad);
}
} }
/** /**