mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
- Make the return GList of gst_element_get_pad_list as const
Original commit message from CVS: - Make the return GList of gst_element_get_pad_list as const - Pad scheduler refactoring - Remove gst_pad_set/unset_scheduler as it's not needed - Reimplement gst_pad_get_scheduler using the parent scheduler - Remove gst_pad_peek as it cannot work reliably - Remove the pad bufpen, replace with scheduler private gpointer - Make queue use the new _get_scheduler implementation - Remove _pad_unset_scheduler from GstScheduler - Remove LOOP_SEEK mode from aggregator - Other fixes for API changes.
This commit is contained in:
parent
498d3181d7
commit
37a127d9ed
21 changed files with 121 additions and 188 deletions
|
@ -410,7 +410,7 @@ void
|
|||
gst_spider_identity_plug (GstSpiderIdentity *ident)
|
||||
{
|
||||
GstSpider *spider;
|
||||
GList *padlist;
|
||||
const GList *padlist;
|
||||
GstPadDirection dir;
|
||||
GstSpiderConnection *conn;
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
|
|||
static gboolean
|
||||
gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
||||
{
|
||||
GList *sinkpads;
|
||||
const GList *sinkpads;
|
||||
gboolean connected = FALSE;
|
||||
|
||||
GST_DEBUG (0,"gstpipeline: autoplug pad connect function for \"%s\" to \"%s\"",
|
||||
|
@ -190,7 +190,7 @@ static void
|
|||
autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data)
|
||||
{
|
||||
dynamic_pad_struct *info = (dynamic_pad_struct *)data;
|
||||
GList *pads = gst_element_get_pad_list (element);
|
||||
const GList *pads = gst_element_get_pad_list (element);
|
||||
|
||||
GST_DEBUG (0,"attempting to dynamically create a ghostpad for %s=%s", GST_ELEMENT_NAME (element),
|
||||
GST_PAD_NAME (pad));
|
||||
|
@ -216,7 +216,7 @@ autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data)
|
|||
static void
|
||||
gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink)
|
||||
{
|
||||
GList *srcpads;
|
||||
const GList *srcpads;
|
||||
gboolean connected = FALSE;
|
||||
|
||||
srcpads = gst_element_get_pad_list(src);
|
||||
|
@ -391,7 +391,7 @@ gst_static_autoplug_to_caps (GstAutoplug *autoplug, GstCaps *srccaps, GstCaps *s
|
|||
}
|
||||
/* this is the first element, find a good ghostpad */
|
||||
else {
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
|
||||
pads = gst_element_get_pad_list (element);
|
||||
|
||||
|
@ -453,7 +453,7 @@ differ:
|
|||
*/
|
||||
{
|
||||
GstCaps *endcap = (GstCaps *)(endcaps->data);
|
||||
GList *pads = gst_element_get_pad_list (thesrcelement);
|
||||
const GList *pads = gst_element_get_pad_list (thesrcelement);
|
||||
gboolean have_pad = FALSE;
|
||||
endcaps = g_list_next (endcaps);
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
|
|||
static gboolean
|
||||
gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
||||
{
|
||||
GList *sinkpads;
|
||||
const GList *sinkpads;
|
||||
gboolean connected = FALSE;
|
||||
GstElementState state = GST_STATE (gst_element_get_parent (src));
|
||||
|
||||
|
@ -212,7 +212,7 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
|||
static void
|
||||
gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink)
|
||||
{
|
||||
GList *srcpads;
|
||||
const GList *srcpads;
|
||||
gboolean connected = FALSE;
|
||||
|
||||
srcpads = gst_element_get_pad_list(src);
|
||||
|
@ -406,7 +406,7 @@ next:
|
|||
}
|
||||
/* this is the first element, find a good ghostpad */
|
||||
else {
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
|
||||
pads = gst_element_get_pad_list (element);
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ gst_aggregator_sched_get_type (void)
|
|||
static GType aggregator_sched_type = 0;
|
||||
static GEnumValue aggregator_sched[] = {
|
||||
{ AGGREGATOR_LOOP, "1", "Loop Based"},
|
||||
{ AGGREGATOR_LOOP_PEEK, "2", "Loop Based Peek"},
|
||||
{ AGGREGATOR_LOOP_SELECT, "3", "Loop Based Select"},
|
||||
{ AGGREGATOR_CHAIN, "4", "Chain Based"},
|
||||
{0, NULL, NULL},
|
||||
|
@ -286,26 +285,16 @@ gst_aggregator_loop (GstElement *element)
|
|||
|
||||
aggregator = GST_AGGREGATOR (element);
|
||||
|
||||
if (aggregator->sched == AGGREGATOR_LOOP ||
|
||||
aggregator->sched == AGGREGATOR_LOOP_PEEK) {
|
||||
if (aggregator->sched == AGGREGATOR_LOOP) {
|
||||
GList *pads = aggregator->sinkpads;
|
||||
|
||||
while (pads) {
|
||||
GstPad *pad = GST_PAD (pads->data);
|
||||
pads = g_list_next (pads);
|
||||
|
||||
if (aggregator->sched == AGGREGATOR_LOOP_PEEK) {
|
||||
buf = gst_pad_peek (pad);
|
||||
if (buf == NULL)
|
||||
continue;
|
||||
buf = gst_pad_pull (pad);
|
||||
debug = "loop";
|
||||
|
||||
g_assert (buf == gst_pad_pull (pad));
|
||||
debug = "loop_peek";
|
||||
}
|
||||
else {
|
||||
buf = gst_pad_pull (pad);
|
||||
debug = "loop";
|
||||
}
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ extern GstElementDetails gst_aggregator_details;
|
|||
|
||||
typedef enum {
|
||||
AGGREGATOR_LOOP = 1,
|
||||
AGGREGATOR_LOOP_PEEK,
|
||||
AGGREGATOR_LOOP_SELECT,
|
||||
AGGREGATOR_CHAIN,
|
||||
} GstAggregatorSchedType;
|
||||
|
|
|
@ -308,6 +308,7 @@ gst_fakesrc_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
|||
|
||||
srcpad = gst_pad_new_from_template (templ, name);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesrc), srcpad);
|
||||
gst_fakesrc_update_functions (fakesrc);
|
||||
|
||||
g_free (name);
|
||||
|
||||
|
@ -783,7 +784,7 @@ static void
|
|||
gst_fakesrc_loop(GstElement *element)
|
||||
{
|
||||
GstFakeSrc *src;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
|
||||
g_return_if_fail(element != NULL);
|
||||
g_return_if_fail(GST_IS_FAKESRC(element));
|
||||
|
|
|
@ -122,7 +122,7 @@ static GstPadConnectReturn
|
|||
gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
|
||||
{
|
||||
GstTee *tee;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
GstPadConnectReturn set_retval;
|
||||
|
||||
tee = GST_TEE (gst_pad_get_parent (pad));
|
||||
|
@ -177,8 +177,8 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
|
|||
gchar *name;
|
||||
GstPad *srcpad;
|
||||
GstTee *tee;
|
||||
int i = 0;
|
||||
GList *pads;
|
||||
gint i = 0;
|
||||
const GList *pads;
|
||||
|
||||
g_return_val_if_fail (GST_IS_TEE (element), NULL);
|
||||
|
||||
|
@ -196,7 +196,7 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
|
|||
while (!name)
|
||||
{
|
||||
name = g_strdup_printf ("src%d", i);
|
||||
if (g_list_find_custom (pads, (gconstpointer) name, name_pad_compare) != NULL)
|
||||
if (g_list_find_custom ((GList *)pads, (gconstpointer) name, name_pad_compare) != NULL)
|
||||
{
|
||||
/* this name is taken, use the next one */
|
||||
++i;
|
||||
|
@ -279,7 +279,7 @@ static void
|
|||
gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstTee *tee;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
|
|
@ -1199,7 +1199,7 @@ gst_element_get_request_pad (GstElement *element, const gchar *name)
|
|||
*
|
||||
* Returns: the #GList of pads.
|
||||
*/
|
||||
GList*
|
||||
const GList*
|
||||
gst_element_get_pad_list (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
|
@ -1391,7 +1391,7 @@ GstPad*
|
|||
gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
|
||||
GstCaps *filtercaps)
|
||||
{
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
GstPadTemplate *templ;
|
||||
GstCaps *templcaps;
|
||||
GstPad *foundpad = NULL;
|
||||
|
@ -1482,7 +1482,7 @@ gboolean
|
|||
gst_element_connect_filtered (GstElement *src, GstElement *dest,
|
||||
GstCaps *filtercaps)
|
||||
{
|
||||
GList *srcpads, *destpads, *srctempls, *desttempls, *l;
|
||||
const GList *srcpads, *destpads, *srctempls, *desttempls, *l;
|
||||
GstPad *srcpad, *destpad;
|
||||
GstPadTemplate *srctempl, *desttempl;
|
||||
|
||||
|
@ -1769,7 +1769,7 @@ gst_element_disconnect_many (GstElement *element_1, GstElement *element_2, ...)
|
|||
void
|
||||
gst_element_disconnect (GstElement *src, GstElement *dest)
|
||||
{
|
||||
GList *srcpads;
|
||||
const GList *srcpads;
|
||||
GstPad *pad;
|
||||
|
||||
g_return_if_fail (GST_IS_ELEMENT (src));
|
||||
|
|
|
@ -236,7 +236,7 @@ GstPad* gst_element_get_static_pad (GstElement *element, const gchar *name);
|
|||
GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name);
|
||||
void gst_element_release_request_pad (GstElement *element, GstPad *pad);
|
||||
|
||||
GList* gst_element_get_pad_list (GstElement *element);
|
||||
const GList* gst_element_get_pad_list (GstElement *element);
|
||||
GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad);
|
||||
GstPad* gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
|
||||
GstCaps *filtercaps);
|
||||
|
|
162
gst/gstpad.c
162
gst/gstpad.c
|
@ -207,9 +207,6 @@ gst_real_pad_init (GstRealPad *pad)
|
|||
pad->direction = GST_PAD_UNKNOWN;
|
||||
pad->peer = NULL;
|
||||
|
||||
pad->sched = NULL;
|
||||
pad->sched_private = NULL;
|
||||
|
||||
pad->chainfunc = NULL;
|
||||
pad->getfunc = NULL;
|
||||
|
||||
|
@ -245,6 +242,7 @@ gst_real_pad_set_property (GObject *object, guint prop_id,
|
|||
gst_pad_set_active (GST_PAD (object), g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +251,6 @@ static void
|
|||
gst_real_pad_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_PAD (object));
|
||||
|
||||
switch (prop_id) {
|
||||
|
@ -261,6 +258,7 @@ gst_real_pad_get_property (GObject *object, guint prop_id,
|
|||
g_value_set_boolean (value, !GST_FLAG_IS_SET (object, GST_PAD_DISABLED));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -784,6 +782,7 @@ gst_pad_disconnect (GstPad *srcpad,
|
|||
GstPad *sinkpad)
|
||||
{
|
||||
GstRealPad *realsrc, *realsink;
|
||||
GstScheduler *src_sched, *sink_sched;
|
||||
|
||||
/* generic checks */
|
||||
g_return_if_fail (srcpad != NULL);
|
||||
|
@ -813,6 +812,10 @@ gst_pad_disconnect (GstPad *srcpad,
|
|||
g_return_if_fail ((GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC) &&
|
||||
(GST_RPAD_DIRECTION (realsink) == GST_PAD_SINK));
|
||||
|
||||
/* get the schedulers before we disconnect */
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsrc));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsink));
|
||||
|
||||
/* first clear peers */
|
||||
GST_RPAD_PEER (realsrc) = NULL;
|
||||
GST_RPAD_PEER (realsink) = NULL;
|
||||
|
@ -824,13 +827,11 @@ gst_pad_disconnect (GstPad *srcpad,
|
|||
GST_RPAD_FILTER (realsrc) = NULL;
|
||||
}
|
||||
|
||||
/* now tell the scheduler */
|
||||
if (GST_PAD_PARENT (realsrc)->sched)
|
||||
gst_scheduler_pad_disconnect (GST_PAD_PARENT (realsrc)->sched,
|
||||
(GstPad *) realsrc, (GstPad *) realsink);
|
||||
else if (GST_PAD_PARENT (realsink)->sched)
|
||||
gst_scheduler_pad_disconnect (GST_PAD_PARENT (realsink)->sched,
|
||||
(GstPad *) realsrc, (GstPad *) realsink);
|
||||
/* now tell the scheduler, the schedulers on both paths are guaranteed to be the same,
|
||||
* so we can just take one */
|
||||
if (src_sched && src_sched == sink_sched)
|
||||
gst_scheduler_pad_disconnect (src_sched,
|
||||
GST_PAD_CAST (realsrc), GST_PAD_CAST (realsink));
|
||||
|
||||
/* hold a reference, as they can go away in the signal handlers */
|
||||
gst_object_ref (GST_OBJECT (realsrc));
|
||||
|
@ -850,6 +851,28 @@ gst_pad_disconnect (GstPad *srcpad,
|
|||
gst_object_unref (GST_OBJECT (realsink));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pad_check_schedulers (GstRealPad *realsrc, GstRealPad *realsink)
|
||||
{
|
||||
GstScheduler *src_sched, *sink_sched;
|
||||
gint num_decoupled = 0;
|
||||
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsrc));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsink));
|
||||
|
||||
if (src_sched && sink_sched) {
|
||||
if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsrc), GST_ELEMENT_DECOUPLED))
|
||||
num_decoupled++;
|
||||
if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsink), GST_ELEMENT_DECOUPLED))
|
||||
num_decoupled++;
|
||||
|
||||
if (src_sched != sink_sched && num_decoupled != 1) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_can_connect_filtered:
|
||||
* @srcpad: the source #GstPad to connect.
|
||||
|
@ -865,7 +888,6 @@ gboolean
|
|||
gst_pad_can_connect_filtered (GstPad *srcpad, GstPad *sinkpad,
|
||||
GstCaps *filtercaps)
|
||||
{
|
||||
gint num_decoupled = 0;
|
||||
GstRealPad *realsrc, *realsink;
|
||||
|
||||
/* generic checks */
|
||||
|
@ -883,17 +905,10 @@ gst_pad_can_connect_filtered (GstPad *srcpad, GstPad *sinkpad,
|
|||
g_return_val_if_fail (GST_PAD_PARENT (realsrc) != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_PAD_PARENT (realsink) != NULL, FALSE);
|
||||
|
||||
if (realsrc->sched && realsink->sched) {
|
||||
if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsrc), GST_ELEMENT_DECOUPLED))
|
||||
num_decoupled++;
|
||||
if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsink), GST_ELEMENT_DECOUPLED))
|
||||
num_decoupled++;
|
||||
|
||||
if (realsrc->sched != realsink->sched && num_decoupled != 1) {
|
||||
g_warning ("connecting pads with different scheds requires "
|
||||
"exactly one decoupled element (queue)");
|
||||
return FALSE;
|
||||
}
|
||||
if (!gst_pad_check_schedulers (realsrc, realsink)) {
|
||||
g_warning ("connecting pads with different scheds requires "
|
||||
"exactly one decoupled element (queue)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* check if the directions are compatible */
|
||||
|
@ -935,7 +950,7 @@ gboolean
|
|||
gst_pad_connect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps)
|
||||
{
|
||||
GstRealPad *realsrc, *realsink;
|
||||
gint num_decoupled = 0;
|
||||
GstScheduler *src_sched, *sink_sched;
|
||||
|
||||
/* generic checks */
|
||||
g_return_val_if_fail (srcpad != NULL, FALSE);
|
||||
|
@ -960,19 +975,12 @@ gst_pad_connect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps)
|
|||
g_return_val_if_fail (GST_PAD_PARENT (realsrc) != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_PAD_PARENT (realsink) != NULL, FALSE);
|
||||
|
||||
if (realsrc->sched && realsink->sched) {
|
||||
if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsrc), GST_ELEMENT_DECOUPLED))
|
||||
num_decoupled++;
|
||||
if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsink), GST_ELEMENT_DECOUPLED))
|
||||
num_decoupled++;
|
||||
|
||||
if (realsrc->sched != realsink->sched && num_decoupled != 1) {
|
||||
g_warning ("connecting pads with different scheds "
|
||||
"requires exactly one decoupled element (queue)\n");
|
||||
return FALSE;
|
||||
}
|
||||
if (!gst_pad_check_schedulers (realsrc, realsink)) {
|
||||
g_warning ("connecting pads with different scheds requires "
|
||||
"exactly one decoupled element (such as queue)");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* check for reversed directions and swap if necessary */
|
||||
if ((GST_RPAD_DIRECTION (realsrc) == GST_PAD_SINK) &&
|
||||
(GST_RPAD_DIRECTION (realsink) == GST_PAD_SRC)) {
|
||||
|
@ -1007,13 +1015,14 @@ gst_pad_connect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps)
|
|||
g_signal_emit (G_OBJECT (realsink), gst_real_pad_signals[REAL_CONNECTED],
|
||||
0, realsrc);
|
||||
|
||||
/* now tell the scheduler(s) */
|
||||
if (realsrc->sched)
|
||||
gst_scheduler_pad_connect (realsrc->sched,
|
||||
(GstPad *) realsrc, (GstPad *) realsink);
|
||||
else if (realsink->sched)
|
||||
gst_scheduler_pad_connect (realsink->sched,
|
||||
(GstPad *) realsrc, (GstPad *) realsink);
|
||||
src_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsrc));
|
||||
sink_sched = gst_pad_get_scheduler (GST_PAD_CAST (realsink));
|
||||
|
||||
/* now tell the scheduler, the schedulers on both paths have to be the same,
|
||||
* so we can just take one */
|
||||
if (src_sched && src_sched == sink_sched)
|
||||
gst_scheduler_pad_connect (src_sched,
|
||||
GST_PAD_CAST (realsrc), GST_PAD_CAST (realsink));
|
||||
|
||||
GST_INFO (GST_CAT_PADS, "connected %s:%s and %s:%s",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
|
@ -1093,22 +1102,6 @@ gst_pad_get_pad_template (GstPad *pad)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* gst_pad_set_scheduler:
|
||||
* @pad: a #GstPad to set the scheduler of.
|
||||
* @sched: the #GstScheduler to set.
|
||||
*
|
||||
* Sets the scheduler on the pad.
|
||||
*/
|
||||
void
|
||||
gst_pad_set_scheduler (GstPad *pad, GstScheduler *sched)
|
||||
{
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
||||
GST_RPAD_SCHED(pad) = sched;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_get_scheduler:
|
||||
* @pad: a #GstPad to get the scheduler of.
|
||||
|
@ -1120,27 +1113,29 @@ gst_pad_set_scheduler (GstPad *pad, GstScheduler *sched)
|
|||
GstScheduler*
|
||||
gst_pad_get_scheduler (GstPad *pad)
|
||||
{
|
||||
GstScheduler *scheduler = NULL;
|
||||
GstElement *parent;
|
||||
|
||||
g_return_val_if_fail (pad != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||
|
||||
parent = gst_pad_get_parent (pad);
|
||||
if (parent) {
|
||||
if (GST_FLAG_IS_SET (parent, GST_ELEMENT_DECOUPLED)) {
|
||||
GstRealPad *peer = GST_RPAD_PEER (pad);
|
||||
|
||||
if (peer) {
|
||||
scheduler = gst_element_get_scheduler (gst_pad_get_parent (GST_PAD_CAST (peer)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
scheduler = gst_element_get_scheduler (parent);
|
||||
}
|
||||
}
|
||||
|
||||
return GST_RPAD_SCHED (pad);
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_unset_scheduler:
|
||||
* @pad: a #GstPad to unset the scheduler for.
|
||||
*
|
||||
* Unsets the scheduler for the pad.
|
||||
*/
|
||||
void
|
||||
gst_pad_unset_scheduler (GstPad *pad)
|
||||
{
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
||||
GST_RPAD_SCHED (pad) = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_get_real_parent:
|
||||
* @pad: a #GstPad to get the real parent of.
|
||||
|
@ -2148,23 +2143,6 @@ gst_pad_pull (GstPad *pad)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_peek:
|
||||
* @pad: the #GstPad to peek at.
|
||||
*
|
||||
* Peeks for the presence of a buffer on the peer pad.
|
||||
*
|
||||
* Returns: a #GstBuffer waiting on the the peer pad,
|
||||
* or NULL if the peer has no waiting buffer.
|
||||
*/
|
||||
GstBuffer*
|
||||
gst_pad_peek (GstPad *pad)
|
||||
{
|
||||
g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK, NULL);
|
||||
|
||||
return GST_RPAD_BUFPEN (GST_RPAD_PEER (pad));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_select:
|
||||
* @padlist: a #GList of pads.
|
||||
|
|
10
gst/gstpad.h
10
gst/gstpad.h
|
@ -197,13 +197,10 @@ struct _GstRealPad {
|
|||
|
||||
GstPadDirection direction;
|
||||
|
||||
GstScheduler *sched;
|
||||
gpointer sched_private;
|
||||
|
||||
GstPadConnectFunction connectfunc;
|
||||
GstRealPad *peer;
|
||||
|
||||
GstBuffer *bufpen;
|
||||
gpointer sched_private;
|
||||
|
||||
/* data transport functions */
|
||||
GstPadChainFunction chainfunc;
|
||||
|
@ -264,8 +261,6 @@ struct _GstGhostPadClass {
|
|||
#define GST_RPAD_FILTER(pad) (((GstRealPad *)(pad))->filter)
|
||||
#define GST_RPAD_APPFILTER(pad) (((GstRealPad *)(pad))->appfilter)
|
||||
#define GST_RPAD_PEER(pad) (((GstRealPad *)(pad))->peer)
|
||||
#define GST_RPAD_BUFPEN(pad) (((GstRealPad *)(pad))->bufpen)
|
||||
#define GST_RPAD_SCHED(pad) (((GstRealPad *)(pad))->sched)
|
||||
#define GST_RPAD_CHAINFUNC(pad) (((GstRealPad *)(pad))->chainfunc)
|
||||
#define GST_RPAD_CHAINHANDLER(pad) (((GstRealPad *)(pad))->chainhandler)
|
||||
#define GST_RPAD_GETFUNC(pad) (((GstRealPad *)(pad))->getfunc)
|
||||
|
@ -394,9 +389,7 @@ void gst_pad_set_parent (GstPad *pad, GstElement *parent);
|
|||
GstElement* gst_pad_get_parent (GstPad *pad);
|
||||
GstElement* gst_pad_get_real_parent (GstPad *pad);
|
||||
|
||||
void gst_pad_set_scheduler (GstPad *pad, GstScheduler *sched);
|
||||
GstScheduler* gst_pad_get_scheduler (GstPad *pad);
|
||||
void gst_pad_unset_scheduler (GstPad *pad);
|
||||
|
||||
void gst_pad_add_ghost_pad (GstPad *pad, GstPad *ghostpad);
|
||||
void gst_pad_remove_ghost_pad (GstPad *pad, GstPad *ghostpad);
|
||||
|
@ -446,7 +439,6 @@ void gst_pad_push (GstPad *pad, GstBuffer *buf);
|
|||
GstBuffer* gst_pad_pull (GstPad *pad);
|
||||
gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
|
||||
gboolean gst_pad_event_default (GstPad *pad, GstEvent *event);
|
||||
GstBuffer* gst_pad_peek (GstPad *pad);
|
||||
GstPad* gst_pad_select (GList *padlist);
|
||||
GstPad* gst_pad_selectv (GstPad *pad, ...);
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ restart:
|
|||
if (queue->interrupt) {
|
||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (GST_RPAD_SCHED (queue->sinkpad), GST_ELEMENT (queue)))
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad), GST_ELEMENT (queue)))
|
||||
return;
|
||||
/* if we got here bacause we were unlocked after a flush, we don't need
|
||||
* to add the buffer to the queue again */
|
||||
|
@ -487,7 +487,7 @@ restart:
|
|||
if (queue->interrupt) {
|
||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (GST_RPAD_SCHED (queue->srcpad), GST_ELEMENT (queue)))
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad), GST_ELEMENT (queue)))
|
||||
return NULL;
|
||||
goto restart;
|
||||
}
|
||||
|
|
|
@ -211,6 +211,8 @@ gst_scheduler_add_element (GstScheduler *sched, GstElement *element)
|
|||
GST_DEBUG (GST_CAT_CLOCK, "added clock receiver %s", GST_ELEMENT_NAME (element));
|
||||
}
|
||||
|
||||
gst_element_set_scheduler (element, sched);
|
||||
|
||||
if (CLASS (sched)->add_element)
|
||||
CLASS (sched)->add_element (sched, element);
|
||||
}
|
||||
|
@ -225,24 +227,16 @@ gst_scheduler_add_element (GstScheduler *sched, GstElement *element)
|
|||
void
|
||||
gst_scheduler_remove_element (GstScheduler *sched, GstElement *element)
|
||||
{
|
||||
GList *pads;
|
||||
|
||||
g_return_if_fail (GST_IS_SCHEDULER (sched));
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
|
||||
sched->clock_providers = g_list_remove (sched->clock_providers, element);
|
||||
sched->clock_receivers = g_list_remove (sched->clock_receivers, element);
|
||||
|
||||
gst_element_set_scheduler (element, NULL);
|
||||
|
||||
if (CLASS (sched)->remove_element)
|
||||
CLASS (sched)->remove_element (sched, element);
|
||||
|
||||
for (pads = element->pads; pads; pads = pads->next) {
|
||||
GstPad *pad = GST_PAD (pads->data);
|
||||
|
||||
if (GST_IS_REAL_PAD (pad)) {
|
||||
gst_pad_unset_scheduler (GST_PAD (pads->data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
typedef struct _GstSchedulerChain GstSchedulerChain;
|
||||
|
||||
#define GST_PAD_THREADSTATE(pad) (cothread*) (GST_PAD_CAST (pad)->sched_private)
|
||||
#define GST_ELEMENT_THREADSTATE(elem) (cothread*) (GST_ELEMENT_CAST (elem)->sched_private)
|
||||
#define GST_RPAD_BUFPEN(pad) (GstBuffer*) (GST_REAL_PAD_CAST(pad)->sched_private)
|
||||
|
||||
#define GST_ELEMENT_COTHREAD_STOPPING GST_ELEMENT_SCHEDULER_PRIVATE1
|
||||
#define GST_ELEMENT_IS_COTHREAD_STOPPING(element) GST_FLAG_IS_SET((element), GST_ELEMENT_COTHREAD_STOPPING)
|
||||
|
@ -527,7 +527,7 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
|
|||
GList *elements;
|
||||
GstElement *element;
|
||||
cothread_func wrapper_function;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
GstPad *pad;
|
||||
|
||||
GST_DEBUG (GST_CAT_SCHEDULING, "chain is using COTHREADS");
|
||||
|
@ -623,7 +623,6 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain)
|
|||
GST_DEBUG_PAD_NAME (peerpad));
|
||||
GST_RPAD_GETHANDLER (peerpad) = GST_RPAD_GETFUNC (peerpad);
|
||||
}
|
||||
gst_pad_set_scheduler (peerpad, GST_SCHEDULER (chain->sched));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1058,9 +1057,6 @@ gst_basic_scheduler_add_element (GstScheduler * sched, GstElement * element)
|
|||
if (!GST_IS_REAL_PAD (pad))
|
||||
continue;
|
||||
|
||||
/* set the pad's sched pointer */
|
||||
gst_pad_set_scheduler (pad, sched);
|
||||
|
||||
/* if the peer element exists and is a candidate */
|
||||
if (GST_PAD_PEER (pad)) {
|
||||
peerelement = GST_PAD_PARENT (GST_PAD_PEER (pad));
|
||||
|
@ -1287,9 +1283,6 @@ gst_basic_scheduler_pad_select (GstScheduler * sched, GList * padlist)
|
|||
while (padlist2) {
|
||||
pad = GST_PAD (padlist2->data);
|
||||
|
||||
if (gst_pad_peek (pad)) {
|
||||
return pad;
|
||||
}
|
||||
|
||||
padlist2 = g_list_next (padlist2);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
typedef struct _GstSchedulerChain GstSchedulerChain;
|
||||
|
||||
#define GST_PAD_THREADSTATE(pad) (cothread*) (GST_PAD_CAST (pad)->sched_private)
|
||||
#define GST_ELEMENT_THREADSTATE(elem) (cothread*) (GST_ELEMENT_CAST (elem)->sched_private)
|
||||
#define GST_RPAD_BUFPEN(pad) (GstBuffer*) (GST_REAL_PAD_CAST(pad)->sched_private)
|
||||
|
||||
#define GST_ELEMENT_COTHREAD_STOPPING GST_ELEMENT_SCHEDULER_PRIVATE1
|
||||
#define GST_ELEMENT_IS_COTHREAD_STOPPING(element) GST_FLAG_IS_SET((element), GST_ELEMENT_COTHREAD_STOPPING)
|
||||
|
@ -287,7 +287,7 @@ static gboolean
|
|||
gst_fast_scheduler_cothreaded_element (GstBin * bin, GstElement *element)
|
||||
{
|
||||
cothread_func wrapper_function;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
GstFastScheduler *sched;
|
||||
|
||||
GST_DEBUG (GST_CAT_SCHEDULING, "element is using COTHREADS");
|
||||
|
@ -344,7 +344,7 @@ gst_fast_scheduler_event_proxy (GstPad *pad, GstBuffer *buf)
|
|||
|
||||
static gboolean
|
||||
gst_fast_scheduler_chained_element (GstBin *bin, GstElement *element) {
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
GstPad *pad;
|
||||
|
||||
GST_DEBUG (GST_CAT_SCHEDULING,"chain entered");
|
||||
|
@ -712,9 +712,6 @@ gst_fast_scheduler_add_element (GstScheduler * sched, GstElement * element)
|
|||
if (!GST_IS_REAL_PAD (pad))
|
||||
continue;
|
||||
|
||||
/* set the pad's sched pointer */
|
||||
gst_pad_set_scheduler (pad, sched);
|
||||
|
||||
/* if the peer element exists and is a candidate */
|
||||
if (GST_PAD_PEER (pad)) {
|
||||
peerelement = GST_PAD_PARENT (GST_PAD_PEER (pad));
|
||||
|
@ -993,7 +990,7 @@ gst_fast_scheduler_iterate (GstScheduler * sched)
|
|||
else {
|
||||
GstElement *entry = chain->entry;
|
||||
if (entry) {
|
||||
GList *pads = gst_element_get_pad_list (entry);
|
||||
const GList *pads = gst_element_get_pad_list (entry);
|
||||
|
||||
GST_DEBUG (GST_CAT_DATAFLOW, "starting chained iteration");
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ gst_aggregator_sched_get_type (void)
|
|||
static GType aggregator_sched_type = 0;
|
||||
static GEnumValue aggregator_sched[] = {
|
||||
{ AGGREGATOR_LOOP, "1", "Loop Based"},
|
||||
{ AGGREGATOR_LOOP_PEEK, "2", "Loop Based Peek"},
|
||||
{ AGGREGATOR_LOOP_SELECT, "3", "Loop Based Select"},
|
||||
{ AGGREGATOR_CHAIN, "4", "Chain Based"},
|
||||
{0, NULL, NULL},
|
||||
|
@ -286,26 +285,16 @@ gst_aggregator_loop (GstElement *element)
|
|||
|
||||
aggregator = GST_AGGREGATOR (element);
|
||||
|
||||
if (aggregator->sched == AGGREGATOR_LOOP ||
|
||||
aggregator->sched == AGGREGATOR_LOOP_PEEK) {
|
||||
if (aggregator->sched == AGGREGATOR_LOOP) {
|
||||
GList *pads = aggregator->sinkpads;
|
||||
|
||||
while (pads) {
|
||||
GstPad *pad = GST_PAD (pads->data);
|
||||
pads = g_list_next (pads);
|
||||
|
||||
if (aggregator->sched == AGGREGATOR_LOOP_PEEK) {
|
||||
buf = gst_pad_peek (pad);
|
||||
if (buf == NULL)
|
||||
continue;
|
||||
buf = gst_pad_pull (pad);
|
||||
debug = "loop";
|
||||
|
||||
g_assert (buf == gst_pad_pull (pad));
|
||||
debug = "loop_peek";
|
||||
}
|
||||
else {
|
||||
buf = gst_pad_pull (pad);
|
||||
debug = "loop";
|
||||
}
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ extern GstElementDetails gst_aggregator_details;
|
|||
|
||||
typedef enum {
|
||||
AGGREGATOR_LOOP = 1,
|
||||
AGGREGATOR_LOOP_PEEK,
|
||||
AGGREGATOR_LOOP_SELECT,
|
||||
AGGREGATOR_CHAIN,
|
||||
} GstAggregatorSchedType;
|
||||
|
|
|
@ -308,6 +308,7 @@ gst_fakesrc_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
|||
|
||||
srcpad = gst_pad_new_from_template (templ, name);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesrc), srcpad);
|
||||
gst_fakesrc_update_functions (fakesrc);
|
||||
|
||||
g_free (name);
|
||||
|
||||
|
@ -783,7 +784,7 @@ static void
|
|||
gst_fakesrc_loop(GstElement *element)
|
||||
{
|
||||
GstFakeSrc *src;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
|
||||
g_return_if_fail(element != NULL);
|
||||
g_return_if_fail(GST_IS_FAKESRC(element));
|
||||
|
|
|
@ -394,7 +394,7 @@ restart:
|
|||
if (queue->interrupt) {
|
||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (GST_RPAD_SCHED (queue->sinkpad), GST_ELEMENT (queue)))
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad), GST_ELEMENT (queue)))
|
||||
return;
|
||||
/* if we got here bacause we were unlocked after a flush, we don't need
|
||||
* to add the buffer to the queue again */
|
||||
|
@ -487,7 +487,7 @@ restart:
|
|||
if (queue->interrupt) {
|
||||
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
|
||||
g_mutex_unlock (queue->qlock);
|
||||
if (gst_scheduler_interrupt (GST_RPAD_SCHED (queue->srcpad), GST_ELEMENT (queue)))
|
||||
if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad), GST_ELEMENT (queue)))
|
||||
return NULL;
|
||||
goto restart;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ static GstPadConnectReturn
|
|||
gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
|
||||
{
|
||||
GstTee *tee;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
GstPadConnectReturn set_retval;
|
||||
|
||||
tee = GST_TEE (gst_pad_get_parent (pad));
|
||||
|
@ -177,8 +177,8 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
|
|||
gchar *name;
|
||||
GstPad *srcpad;
|
||||
GstTee *tee;
|
||||
int i = 0;
|
||||
GList *pads;
|
||||
gint i = 0;
|
||||
const GList *pads;
|
||||
|
||||
g_return_val_if_fail (GST_IS_TEE (element), NULL);
|
||||
|
||||
|
@ -196,7 +196,7 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
|
|||
while (!name)
|
||||
{
|
||||
name = g_strdup_printf ("src%d", i);
|
||||
if (g_list_find_custom (pads, (gconstpointer) name, name_pad_compare) != NULL)
|
||||
if (g_list_find_custom ((GList *)pads, (gconstpointer) name, name_pad_compare) != NULL)
|
||||
{
|
||||
/* this name is taken, use the next one */
|
||||
++i;
|
||||
|
@ -279,7 +279,7 @@ static void
|
|||
gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstTee *tee;
|
||||
GList *pads;
|
||||
const GList *pads;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
int main(int argc,char *argv[]) {
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr factorynode, padnode, argnode, optionnode;
|
||||
GList *plugins, *features, *padtemplates, *pads;
|
||||
GList *plugins, *features, *padtemplates;
|
||||
const GList *pads;
|
||||
GstElement *element;
|
||||
GstPad *pad;
|
||||
GstPadTemplate *padtemplate;
|
||||
|
|
Loading…
Reference in a new issue