From 71454fa19ca6471f75774814ee3e05377445e24d Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 2 Dec 2003 04:39:00 +0000 Subject: [PATCH] change gst_pad_select() to gst_pad_selectv(), and add/fix gst_pad_select() and gst_pad_select_valist() Original commit message from CVS: change gst_pad_select() to gst_pad_selectv(), and add/fix gst_pad_select() and gst_pad_select_valist() --- gst/elements/gstaggregator.c | 2 +- gst/gstpad.c | 39 +++++++++++++++++++++++++++++++-------- gst/gstpad.h | 5 +++-- plugins/elements/gstaggregator.c | 2 +- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/gst/elements/gstaggregator.c b/gst/elements/gstaggregator.c index f5e6e31..a31036b 100644 --- a/gst/elements/gstaggregator.c +++ b/gst/elements/gstaggregator.c @@ -334,7 +334,7 @@ gst_aggregator_loop (GstElement *element) debug = "loop_select"; - pad = gst_pad_select (aggregator->sinkpads); + pad = gst_pad_selectv (aggregator->sinkpads); buf = GST_BUFFER (gst_pad_pull (pad)); gst_aggregator_push (aggregator, pad, buf, debug); diff --git a/gst/gstpad.c b/gst/gstpad.c index 446b068..b41899d 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2422,7 +2422,7 @@ restart: } /** - * gst_pad_select: + * gst_pad_selectv: * @padlist: a #GList of pads. * * Waits for a buffer on any of the list of pads. @@ -2431,7 +2431,7 @@ restart: * Use #gst_pad_pull() to get the buffer. */ GstPad* -gst_pad_select (GList *padlist) +gst_pad_selectv (GList *padlist) { GstPad *pad; @@ -2441,7 +2441,7 @@ gst_pad_select (GList *padlist) } /** - * gst_pad_selectv: + * gst_pad_select: * @pad: a first #GstPad to perform the select on. * @...: A NULL-terminated list of more pads to select on. * @@ -2451,10 +2451,9 @@ gst_pad_select (GList *padlist) * Use #gst_pad_pull() to get the buffer. */ GstPad* -gst_pad_selectv (GstPad *pad, ...) +gst_pad_select (GstPad *pad, ...) { GstPad *result; - GList *padlist = NULL; va_list var_args; if (pad == NULL) @@ -2462,15 +2461,39 @@ gst_pad_selectv (GstPad *pad, ...) va_start (var_args, pad); + result = gst_pad_select_valist (pad, var_args); + + va_end (var_args); + + return result; +} + +/** + * gst_pad_select_valist: + * @pad: a first #GstPad to perform the select on. + * @varargs: A va_list of more pads to select on. + * + * Waits for a buffer on the given set of pads. + * + * Returns: the #GstPad that has a buffer available. + * Use #gst_pad_pull() to get the buffer. + */ +GstPad* +gst_pad_select_valist (GstPad *pad, va_list var_args) +{ + GstPad *result; + GList *padlist = NULL; + + if (pad == NULL) + return NULL; + while (pad) { padlist = g_list_prepend (padlist, pad); pad = va_arg (var_args, GstPad *); } - result = gst_pad_select (padlist); + result = gst_pad_selectv (padlist); g_list_free (padlist); - va_end (var_args); - return result; } diff --git a/gst/gstpad.h b/gst/gstpad.h index db0a22c..d50f5b6 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -476,8 +476,9 @@ void gst_pad_push (GstPad *pad, GstData *data); GstData* gst_pad_pull (GstPad *pad); gboolean gst_pad_send_event (GstPad *pad, GstEvent *event); gboolean gst_pad_event_default (GstPad *pad, GstEvent *event); -GstPad* gst_pad_select (GList *padlist); -GstPad* gst_pad_selectv (GstPad *pad, ...); +GstPad* gst_pad_selectv (GList *padlist); +GstPad* gst_pad_select (GstPad *pad, ...); +GstPad* gst_pad_select_valist (GstPad *pad, va_list varargs); /* convert/query/format functions */ diff --git a/plugins/elements/gstaggregator.c b/plugins/elements/gstaggregator.c index f5e6e31..a31036b 100644 --- a/plugins/elements/gstaggregator.c +++ b/plugins/elements/gstaggregator.c @@ -334,7 +334,7 @@ gst_aggregator_loop (GstElement *element) debug = "loop_select"; - pad = gst_pad_select (aggregator->sinkpads); + pad = gst_pad_selectv (aggregator->sinkpads); buf = GST_BUFFER (gst_pad_pull (pad)); gst_aggregator_push (aggregator, pad, buf, debug); -- 2.7.4