mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
gst/: implement gst_pad_collect as replacement for gst_pad_select.
Original commit message from CVS: * gst/gstpad.c: (gst_pad_collect_array), (gst_pad_collectv), (gst_pad_collect), (gst_pad_collect_valist), (gst_pad_selectv), (gst_pad_select): * gst/gstpad.h: * gst/gstscheduler.c: (gst_scheduler_pad_select), (gst_scheduler_lock_element), (gst_scheduler_unlock_element): * gst/gstscheduler.h: implement gst_pad_collect as replacement for gst_pad_select. deprecate gst_pad_select and gst_scheduler_(un)lock_element add new flag GST_SCHEDULER_FLAG_NEW_API for API that implements the new pad_select, lock and unlock calls. * gst/cothreads.c: (cothread_destroy), (cothread_switch): * gst/cothreads.h: * gst/schedulers/cothreads_compat.h: * gst/schedulers/gthread-cothreads.h: remove unused cothread_lock and cothread_unlock calls * gst/schedulers/entryscheduler.c: (gst_entry_scheduler_class_init), (gst_entry_scheduler_init), (_can_schedule_loop), (gst_entry_scheduler_get_handler), (gst_entry_scheduler_pad_select): update to new API * gst/schedulers/gstbasicscheduler.c: (gst_basic_scheduler_class_init), (gst_basic_scheduler_init), (gst_basic_scheduler_pad_select): remove useless lock and unlock calls, update pad_select to new API (untested) * gst/schedulers/gstoptimalscheduler.c: (gst_opt_scheduler_class_init): remove useless select, lock and unlock function calls * gst/elements/gstaggregator.c: (gst_aggregator_loop): use gst_pad_collect instead of gst_pad_select
This commit is contained in:
parent
343d14cf0e
commit
ac5674b03b
14 changed files with 248 additions and 227 deletions
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
2004-04-04 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* gst/gstpad.c: (gst_pad_collect_array), (gst_pad_collectv),
|
||||
(gst_pad_collect), (gst_pad_collect_valist), (gst_pad_selectv),
|
||||
(gst_pad_select):
|
||||
* gst/gstpad.h:
|
||||
* gst/gstscheduler.c: (gst_scheduler_pad_select),
|
||||
(gst_scheduler_lock_element), (gst_scheduler_unlock_element):
|
||||
* gst/gstscheduler.h:
|
||||
implement gst_pad_collect as replacement for gst_pad_select.
|
||||
deprecate gst_pad_select and gst_scheduler_(un)lock_element
|
||||
add new flag GST_SCHEDULER_FLAG_NEW_API for API that implements the
|
||||
new pad_select, lock and unlock calls.
|
||||
* gst/cothreads.c: (cothread_destroy), (cothread_switch):
|
||||
* gst/cothreads.h:
|
||||
* gst/schedulers/cothreads_compat.h:
|
||||
* gst/schedulers/gthread-cothreads.h:
|
||||
remove unused cothread_lock and cothread_unlock calls
|
||||
* gst/schedulers/entryscheduler.c:
|
||||
(gst_entry_scheduler_class_init), (gst_entry_scheduler_init),
|
||||
(_can_schedule_loop), (gst_entry_scheduler_get_handler),
|
||||
(gst_entry_scheduler_pad_select):
|
||||
update to new API
|
||||
* gst/schedulers/gstbasicscheduler.c:
|
||||
(gst_basic_scheduler_class_init), (gst_basic_scheduler_init),
|
||||
(gst_basic_scheduler_pad_select):
|
||||
remove useless lock and unlock calls, update pad_select to new API
|
||||
(untested)
|
||||
* gst/schedulers/gstoptimalscheduler.c:
|
||||
(gst_opt_scheduler_class_init):
|
||||
remove useless select, lock and unlock function calls
|
||||
* gst/elements/gstaggregator.c: (gst_aggregator_loop):
|
||||
use gst_pad_collect instead of gst_pad_select
|
||||
|
||||
2004-04-04 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* gst/schedulers/entryscheduler.c: (_can_schedule_get),
|
||||
|
|
|
@ -363,10 +363,6 @@ cothread_destroy (cothread_state * cothread)
|
|||
/* cothread 0 needs to be destroyed specially */
|
||||
g_assert (cothreadnum != 0);
|
||||
|
||||
/* we have to unlock here because we might be switched out
|
||||
* with the lock held */
|
||||
cothread_unlock (cothread);
|
||||
|
||||
/* doing cleanups of the cothread create */
|
||||
GST_CAT_DEBUG (GST_CAT_COTHREADS,
|
||||
"destroy cothread %d with magic number 0x%x", cothreadnum,
|
||||
|
@ -679,43 +675,5 @@ nocurrent:
|
|||
exit (2);
|
||||
#endif /* COTHREAD_PARANOID */
|
||||
selfswitch:
|
||||
g_warning
|
||||
("cothread: trying to switch to same thread, legal but not necessary");
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_lock:
|
||||
* @cothread: cothread state to lock
|
||||
*
|
||||
* Locks the cothread state.
|
||||
*/
|
||||
void
|
||||
cothread_lock (cothread_state * cothread)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_trylock:
|
||||
* @cothread: cothread state to try to lock
|
||||
*
|
||||
* Try to lock the cothread state
|
||||
*
|
||||
* Returns: TRUE if the cothread could be locked.
|
||||
*/
|
||||
gboolean
|
||||
cothread_trylock (cothread_state * cothread)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* cothread_unlock:
|
||||
* @cothread: cothread state to unlock
|
||||
*
|
||||
* Unlock the cothread state.
|
||||
*/
|
||||
void
|
||||
cothread_unlock (cothread_state * cothread)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -70,10 +70,6 @@ void cothread_set_private (cothread_state *cothread,
|
|||
gpointer data);
|
||||
gpointer cothread_get_private (cothread_state *cothread);
|
||||
|
||||
void cothread_lock (cothread_state *cothread);
|
||||
gboolean cothread_trylock (cothread_state *cothread);
|
||||
void cothread_unlock (cothread_state *cothread);
|
||||
|
||||
cothread_state* cothread_main (cothread_context *ctx);
|
||||
cothread_state* cothread_current_main (void);
|
||||
cothread_state* cothread_current (void);
|
||||
|
|
|
@ -336,8 +336,7 @@ gst_aggregator_loop (GstElement * element)
|
|||
|
||||
debug = "loop_select";
|
||||
|
||||
pad = gst_pad_selectv (aggregator->sinkpads);
|
||||
buf = GST_BUFFER (gst_pad_pull (pad));
|
||||
buf = GST_BUFFER (gst_pad_collectv (&pad, aggregator->sinkpads));
|
||||
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
} else {
|
||||
|
|
182
gst/gstpad.c
182
gst/gstpad.c
|
@ -3116,6 +3116,125 @@ gst_pad_pull (GstPad * pad)
|
|||
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
|
||||
}
|
||||
|
||||
GstData *
|
||||
gst_pad_collect_array (GstScheduler * scheduler, GstPad ** selected,
|
||||
GstPad ** padlist)
|
||||
{
|
||||
GstSchedulerClass *klass = GST_SCHEDULER_GET_CLASS (scheduler);
|
||||
|
||||
if (!GST_FLAG_IS_SET (scheduler, GST_SCHEDULER_FLAG_NEW_API) ||
|
||||
!klass->pad_select) {
|
||||
/* better randomness? */
|
||||
if (selected)
|
||||
*selected = padlist[0];
|
||||
return gst_pad_pull (padlist[0]);
|
||||
} else {
|
||||
GstPad *select;
|
||||
|
||||
return klass->pad_select (scheduler, selected ? selected : &select,
|
||||
padlist);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_collectv:
|
||||
* @selected: set to the pad the buffer comes from if not NULL
|
||||
* @padlist: a #GList of sink pads.
|
||||
*
|
||||
* Waits for a buffer on any of the list of pads. Each #GstPad in @padlist must
|
||||
* belong to the same element and be owned by the caller.
|
||||
*
|
||||
* Returns: the #GstData that was available
|
||||
*/
|
||||
GstData *
|
||||
gst_pad_collectv (GstPad ** selected, const GList * padlist)
|
||||
{
|
||||
/* need to use alloca here because we must not leak data */
|
||||
GstPad **pads;
|
||||
GstPad *test;
|
||||
GstElement *element = NULL;
|
||||
int i = 0;
|
||||
|
||||
g_return_val_if_fail (padlist != NULL, NULL);
|
||||
pads = g_alloca (sizeof (gpointer) * (g_list_length ((GList *) padlist) + 1));
|
||||
for (; padlist; padlist = g_list_next (padlist)) {
|
||||
test = GST_PAD (padlist->data);
|
||||
g_return_val_if_fail (GST_IS_PAD (test), NULL);
|
||||
g_return_val_if_fail (GST_PAD_IS_SINK (test), NULL);
|
||||
if (element) {
|
||||
g_return_val_if_fail (element == gst_pad_get_parent (test), NULL);
|
||||
} else {
|
||||
element = gst_pad_get_parent (test);
|
||||
}
|
||||
pads[i++] = test;
|
||||
}
|
||||
pads[i] = NULL;
|
||||
|
||||
return gst_pad_collect_array (GST_SCHEDULER (element), selected, pads);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_collect:
|
||||
* @selected: set to the pad the buffer comes from if not NULL
|
||||
* @pad: first pad
|
||||
* @...: more sink pads.
|
||||
*
|
||||
* Waits for a buffer on the given set of pads.
|
||||
*
|
||||
* Returns: the #GstData that was available.
|
||||
*/
|
||||
GstData *
|
||||
gst_pad_collect (GstPad ** selected, GstPad * pad, ...)
|
||||
{
|
||||
GstData *result;
|
||||
va_list var_args;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||
|
||||
va_start (var_args, pad);
|
||||
|
||||
result = gst_pad_collect_valist (selected, pad, var_args);
|
||||
|
||||
va_end (var_args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_collect_valist:
|
||||
* @selected: set to the pad the buffer comes from if not NULL
|
||||
* @pad: first pad
|
||||
* @...: more sink pads.
|
||||
*
|
||||
* Waits for a buffer on the given set of pads.
|
||||
*
|
||||
* Returns: the #GstData that was available.
|
||||
*/
|
||||
GstData *
|
||||
gst_pad_collect_valist (GstPad ** selected, GstPad * pad, va_list var_args)
|
||||
{
|
||||
GstPad **padlist;
|
||||
GstElement *element = NULL;
|
||||
gint i = 0, maxlength;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||
|
||||
while (pad) {
|
||||
g_return_val_if_fail (i < maxlength, NULL);
|
||||
if (element) {
|
||||
g_return_val_if_fail (element == gst_pad_get_parent (pad), NULL);
|
||||
} else {
|
||||
element = gst_pad_get_parent (pad);
|
||||
maxlength = element->numsinkpads;
|
||||
/* can we make this list a bit smaller than this upper limit? */
|
||||
padlist = g_alloca (sizeof (gpointer) * (maxlength + 1));
|
||||
}
|
||||
padlist[i++] = pad;
|
||||
pad = va_arg (var_args, GstPad *);
|
||||
}
|
||||
return gst_pad_collect_array (GST_SCHEDULER (element), selected, padlist);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_selectv:
|
||||
* @padlist: a #GList of sink pads.
|
||||
|
@ -3129,40 +3248,7 @@ gst_pad_pull (GstPad * pad)
|
|||
GstPad *
|
||||
gst_pad_selectv (GList * padlist)
|
||||
{
|
||||
GstPad *pad;
|
||||
|
||||
pad = gst_scheduler_pad_select (GST_PAD_PARENT (padlist->data)->sched,
|
||||
padlist);
|
||||
return pad;
|
||||
}
|
||||
|
||||
/* FIXME 0.9: Don't allow the first pad to be NULL */
|
||||
/**
|
||||
* gst_pad_select:
|
||||
* @pad: a first sink #GstPad to perform the select on.
|
||||
* @...: A NULL-terminated 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 (GstPad * pad, ...)
|
||||
{
|
||||
GstPad *result;
|
||||
va_list var_args;
|
||||
|
||||
if (pad == NULL)
|
||||
return NULL;
|
||||
|
||||
va_start (var_args, pad);
|
||||
|
||||
result = gst_pad_select_valist (pad, var_args);
|
||||
|
||||
va_end (var_args);
|
||||
|
||||
return result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3194,6 +3280,34 @@ gst_pad_select_valist (GstPad * pad, va_list var_args)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_select:
|
||||
* @pad: a first sink #GstPad to perform the select on.
|
||||
* @...: A NULL-terminated 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 (GstPad * pad, ...)
|
||||
{
|
||||
GstPad *result;
|
||||
va_list var_args;
|
||||
|
||||
if (pad == NULL)
|
||||
return NULL;
|
||||
|
||||
va_start (var_args, pad);
|
||||
|
||||
result = gst_pad_select_valist (pad, var_args);
|
||||
|
||||
va_end (var_args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* templates
|
||||
|
|
|
@ -443,10 +443,15 @@ 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);
|
||||
#ifndef GST_DISABLE_DEPRECATED
|
||||
GstPad* gst_pad_selectv (GList *padlist);
|
||||
GstPad* gst_pad_select (GstPad *pad, ...);
|
||||
GstPad* gst_pad_select_valist (GstPad *pad, va_list varargs);
|
||||
|
||||
#endif
|
||||
/* FIXME 0.9: rename to _select? Otherwise rename SchedulerClass pointer */
|
||||
GstData * gst_pad_collectv (GstPad **selected, const GList *padlist);
|
||||
GstData * gst_pad_collect (GstPad **selected, GstPad *pad, ...);
|
||||
GstData * gst_pad_collect_valist (GstPad **selected, GstPad *pad, va_list varargs);
|
||||
|
||||
/* convert/query/format functions */
|
||||
void gst_pad_set_formats_function (GstPad *pad,
|
||||
|
|
|
@ -198,16 +198,9 @@ gst_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad,
|
|||
GstPad *
|
||||
gst_scheduler_pad_select (GstScheduler * sched, GList * padlist)
|
||||
{
|
||||
GstSchedulerClass *sclass;
|
||||
|
||||
g_return_val_if_fail (GST_IS_SCHEDULER (sched), NULL);
|
||||
g_return_val_if_fail (padlist != NULL, NULL);
|
||||
|
||||
sclass = GST_SCHEDULER_GET_CLASS (sched);
|
||||
|
||||
if (sclass->pad_select)
|
||||
sclass->pad_select (sched, padlist);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -418,15 +411,8 @@ gst_scheduler_remove_scheduler (GstScheduler * sched, GstScheduler * sched2)
|
|||
void
|
||||
gst_scheduler_lock_element (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
GstSchedulerClass *sclass;
|
||||
|
||||
g_return_if_fail (GST_IS_SCHEDULER (sched));
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
|
||||
sclass = GST_SCHEDULER_GET_CLASS (sched);
|
||||
|
||||
if (sclass->lock_element)
|
||||
sclass->lock_element (sched, element);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -445,9 +431,6 @@ gst_scheduler_unlock_element (GstScheduler * sched, GstElement * element)
|
|||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
|
||||
sclass = GST_SCHEDULER_GET_CLASS (sched);
|
||||
|
||||
if (sclass->unlock_element)
|
||||
sclass->unlock_element (sched, element);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,8 @@ G_BEGIN_DECLS
|
|||
typedef enum {
|
||||
/* this scheduler works with a fixed clock */
|
||||
GST_SCHEDULER_FLAG_FIXED_CLOCK = GST_OBJECT_FLAG_LAST,
|
||||
/* this scheduler supports select and lock calls */
|
||||
GST_SCHEDULER_FLAG_NEW_API,
|
||||
|
||||
/* padding */
|
||||
GST_SCHEDULER_FLAG_LAST = GST_OBJECT_FLAG_LAST + 4
|
||||
|
@ -87,14 +89,17 @@ struct _GstSchedulerClass {
|
|||
void (*remove_scheduler) (GstScheduler *sched, GstScheduler *sched2);
|
||||
GstElementStateReturn (*state_transition) (GstScheduler *sched, GstElement *element, gint transition);
|
||||
void (*scheduling_change) (GstScheduler *sched, GstElement *element);
|
||||
void (*lock_element) (GstScheduler *sched, GstElement *element);
|
||||
void (*unlock_element) (GstScheduler *sched, GstElement *element);
|
||||
/* next two are optional, require NEW_API flag */
|
||||
/* FIXME 0.9: rename to (un)lock_object */
|
||||
void (*lock_element) (GstScheduler *sched, GstObject *object);
|
||||
void (*unlock_element) (GstScheduler *sched, GstObject *object);
|
||||
gboolean (*yield) (GstScheduler *sched, GstElement *element);
|
||||
gboolean (*interrupt) (GstScheduler *sched, GstElement *element);
|
||||
void (*error) (GstScheduler *sched, GstElement *element);
|
||||
void (*pad_link) (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
void (*pad_unlink) (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
void (*pad_select) (GstScheduler *sched, GList *padlist);
|
||||
/* optional, requires NEW_API flag */
|
||||
GstData * (*pad_select) (GstScheduler *sched, GstPad **selected, GstPad **pads);
|
||||
GstClockReturn (*clock_wait) (GstScheduler *sched, GstElement *element,
|
||||
GstClockID id, GstClockTimeDiff *jitter);
|
||||
GstSchedulerState (*iterate) (GstScheduler *sched);
|
||||
|
@ -119,14 +124,18 @@ void gst_scheduler_add_scheduler (GstScheduler *sched, GstScheduler *sched2);
|
|||
void gst_scheduler_remove_scheduler (GstScheduler *sched, GstScheduler *sched2);
|
||||
GstElementStateReturn gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint transition);
|
||||
void gst_scheduler_scheduling_change (GstScheduler *sched, GstElement *element);
|
||||
#ifndef GST_DISABLE_DEPRECATED
|
||||
void gst_scheduler_lock_element (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_unlock_element (GstScheduler *sched, GstElement *element);
|
||||
#endif
|
||||
gboolean gst_scheduler_yield (GstScheduler *sched, GstElement *element);
|
||||
gboolean gst_scheduler_interrupt (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_error (GstScheduler *sched, GstElement *element);
|
||||
void gst_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
void gst_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||
#ifndef GST_DISABLE_DEPRECATED
|
||||
GstPad* gst_scheduler_pad_select (GstScheduler *sched, GList *padlist);
|
||||
#endif
|
||||
GstClockReturn gst_scheduler_clock_wait (GstScheduler *sched, GstElement *element,
|
||||
GstClockID id, GstClockTimeDiff *jitter);
|
||||
gboolean gst_scheduler_iterate (GstScheduler *sched);
|
||||
|
|
|
@ -61,9 +61,6 @@ typedef cothread_state cothread;
|
|||
#define do_cothread_context_init() (cothread_context_init ())
|
||||
#define do_cothread_context_destroy(context) cothread_context_free (context)
|
||||
|
||||
#define do_cothread_lock(cothread) cothread_lock(cothread)
|
||||
#define do_cothread_unlock(cothread) cothread_unlock(cothread)
|
||||
|
||||
#define do_cothread_get_current(context) (cothread_current())
|
||||
#define do_cothread_get_main(context) (cothread_current_main())
|
||||
|
||||
|
|
|
@ -179,10 +179,6 @@ static void gst_entry_scheduler_remove_element (GstScheduler * sched,
|
|||
GstElement * element);
|
||||
static GstElementStateReturn gst_entry_scheduler_state_transition (GstScheduler
|
||||
* sched, GstElement * element, gint transition);
|
||||
static void gst_entry_scheduler_lock_element (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static void gst_entry_scheduler_unlock_element (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static gboolean gst_entry_scheduler_yield (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static gboolean gst_entry_scheduler_interrupt (GstScheduler * sched,
|
||||
|
@ -193,8 +189,8 @@ static void gst_entry_scheduler_pad_link (GstScheduler * sched, GstPad * srcpad,
|
|||
GstPad * sinkpad);
|
||||
static void gst_entry_scheduler_pad_unlink (GstScheduler * sched,
|
||||
GstPad * srcpad, GstPad * sinkpad);
|
||||
static GstData *gst_entry_scheduler_select (GstScheduler * sched,
|
||||
GstPad ** pulled_from, GList * list);
|
||||
static GstData *gst_entry_scheduler_pad_select (GstScheduler * sched,
|
||||
GstPad ** pulled_from, GstPad ** pads);
|
||||
static GstSchedulerState gst_entry_scheduler_iterate (GstScheduler * sched);
|
||||
static void gst_entry_scheduler_show (GstScheduler * scheduler);
|
||||
|
||||
|
@ -211,14 +207,12 @@ gst_entry_scheduler_class_init (gpointer klass, gpointer class_data)
|
|||
scheduler->add_element = gst_entry_scheduler_add_element;
|
||||
scheduler->remove_element = gst_entry_scheduler_remove_element;
|
||||
scheduler->state_transition = gst_entry_scheduler_state_transition;
|
||||
scheduler->lock_element = gst_entry_scheduler_lock_element;
|
||||
scheduler->unlock_element = gst_entry_scheduler_unlock_element;
|
||||
scheduler->yield = gst_entry_scheduler_yield;
|
||||
scheduler->interrupt = gst_entry_scheduler_interrupt;
|
||||
scheduler->error = gst_entry_scheduler_error;
|
||||
scheduler->pad_link = gst_entry_scheduler_pad_link;
|
||||
scheduler->pad_unlink = gst_entry_scheduler_pad_unlink;
|
||||
//scheduler->pad_select = gst_entry_scheduler_pad_select;
|
||||
scheduler->pad_select = gst_entry_scheduler_pad_select;
|
||||
scheduler->clock_wait = NULL;
|
||||
scheduler->iterate = gst_entry_scheduler_iterate;
|
||||
scheduler->show = gst_entry_scheduler_show;
|
||||
|
@ -229,6 +223,7 @@ gst_entry_scheduler_class_init (gpointer klass, gpointer class_data)
|
|||
static void
|
||||
gst_entry_scheduler_init (GstEntryScheduler * scheduler)
|
||||
{
|
||||
GST_FLAG_SET (scheduler, GST_SCHEDULER_FLAG_NEW_API);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -247,7 +242,7 @@ gst_entry_scheduler_init (GstEntryScheduler * scheduler)
|
|||
typedef struct
|
||||
{
|
||||
CothreadPrivate element;
|
||||
GList *sinkpads;
|
||||
GstPad **sinkpads;
|
||||
}
|
||||
LoopPrivate;
|
||||
|
||||
|
@ -257,6 +252,7 @@ static gboolean
|
|||
_can_schedule_loop (GstRealPad * pad)
|
||||
{
|
||||
LoopPrivate *priv;
|
||||
gint i = 0;
|
||||
|
||||
g_assert (PAD_PRIVATE (pad));
|
||||
|
||||
|
@ -268,7 +264,11 @@ _can_schedule_loop (GstRealPad * pad)
|
|||
if (!priv->sinkpads)
|
||||
return FALSE;
|
||||
|
||||
return g_list_find (priv->sinkpads, pad) != NULL;
|
||||
while (priv->sinkpads[i]) {
|
||||
if (pad == GST_REAL_PAD (priv->sinkpads[i++]))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -709,14 +709,14 @@ gst_entry_scheduler_get_handler (GstPad * pad)
|
|||
{
|
||||
GstData *data;
|
||||
GstEntryScheduler *sched = GST_ENTRY_SCHEDULER (gst_pad_get_scheduler (pad));
|
||||
GList list = { NULL, NULL, NULL };
|
||||
GstPad *pads[2] = { NULL, NULL };
|
||||
GstPad *ret;
|
||||
|
||||
pad = GST_PAD_PEER (pad);
|
||||
list.data = pad;
|
||||
pads[0] = pad;
|
||||
GST_LOG_OBJECT (sched, "pad %s:%s pulls", GST_DEBUG_PAD_NAME (pad));
|
||||
|
||||
data = gst_entry_scheduler_select (GST_SCHEDULER (sched), &ret, &list);
|
||||
data = gst_entry_scheduler_pad_select (GST_SCHEDULER (sched), &ret, pads);
|
||||
g_assert (pad == ret);
|
||||
|
||||
GST_LOG_OBJECT (sched, "done with %s:%s", GST_DEBUG_PAD_NAME (pad));
|
||||
|
@ -735,30 +735,29 @@ gst_entry_scheduler_event_handler (GstPad * srcpad, GstEvent * event)
|
|||
*/
|
||||
|
||||
static GstData *
|
||||
gst_entry_scheduler_select (GstScheduler * scheduler, GstPad ** pulled_from,
|
||||
GList * list)
|
||||
gst_entry_scheduler_pad_select (GstScheduler * scheduler, GstPad ** pulled_from,
|
||||
GstPad ** pads)
|
||||
{
|
||||
GstData *data;
|
||||
GstRealPad *pad;
|
||||
GList *walk;
|
||||
GstElement *element = NULL;
|
||||
GstEntryScheduler *sched = GST_ENTRY_SCHEDULER (scheduler);
|
||||
gint i = 0;
|
||||
|
||||
/* sanity check */
|
||||
for (walk = list; walk; walk = g_list_next (walk)) {
|
||||
pad = GST_REAL_PAD (walk->data);
|
||||
g_assert (!element || element == gst_pad_get_parent (GST_PAD (pad)));
|
||||
while (pads[i]) {
|
||||
pad = GST_REAL_PAD (pads[i++]);
|
||||
if (PAD_PRIVATE (pad)->bufpen) {
|
||||
sched->schedule_now =
|
||||
g_list_remove (sched->schedule_now, PAD_PRIVATE (pad));
|
||||
goto found;
|
||||
}
|
||||
element = gst_pad_get_parent (GST_PAD (pad));
|
||||
}
|
||||
element = gst_pad_get_parent (GST_PAD (pad));
|
||||
g_assert (element);
|
||||
g_assert (ELEMENT_PRIVATE (element)->main ==
|
||||
gst_entry_scheduler_loop_wrapper);
|
||||
LOOP_PRIVATE (element)->sinkpads = list;
|
||||
LOOP_PRIVATE (element)->sinkpads = pads;
|
||||
ELEMENT_PRIVATE (element)->wait = WAIT_FOR_PADS;
|
||||
schedule_next_element (SCHED (element));
|
||||
LOOP_PRIVATE (element)->sinkpads = NULL;
|
||||
|
@ -937,18 +936,6 @@ gst_entry_scheduler_state_transition (GstScheduler * scheduler,
|
|||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_entry_scheduler_lock_element (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
g_warning ("What's this?");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_entry_scheduler_unlock_element (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
g_warning ("What's this?");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_entry_scheduler_yield (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
|
|
|
@ -129,10 +129,6 @@ static void gst_basic_scheduler_remove_element (GstScheduler * sched,
|
|||
GstElement * element);
|
||||
static GstElementStateReturn gst_basic_scheduler_state_transition (GstScheduler
|
||||
* sched, GstElement * element, gint transition);
|
||||
static void gst_basic_scheduler_lock_element (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static void gst_basic_scheduler_unlock_element (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static gboolean gst_basic_scheduler_yield (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static gboolean gst_basic_scheduler_interrupt (GstScheduler * sched,
|
||||
|
@ -143,8 +139,8 @@ static void gst_basic_scheduler_pad_link (GstScheduler * sched, GstPad * srcpad,
|
|||
GstPad * sinkpad);
|
||||
static void gst_basic_scheduler_pad_unlink (GstScheduler * sched,
|
||||
GstPad * srcpad, GstPad * sinkpad);
|
||||
static void gst_basic_scheduler_pad_select (GstScheduler * sched,
|
||||
GList * padlist);
|
||||
static GstData *gst_basic_scheduler_pad_select (GstScheduler * sched,
|
||||
GstPad ** selected, GstPad ** padlist);
|
||||
static GstSchedulerState gst_basic_scheduler_iterate (GstScheduler * sched);
|
||||
|
||||
static void gst_basic_scheduler_show (GstScheduler * sched);
|
||||
|
@ -229,10 +225,6 @@ gst_basic_scheduler_class_init (GstBasicSchedulerClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_remove_element);
|
||||
gstscheduler_class->state_transition =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_state_transition);
|
||||
gstscheduler_class->lock_element =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_lock_element);
|
||||
gstscheduler_class->unlock_element =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_unlock_element);
|
||||
gstscheduler_class->yield = GST_DEBUG_FUNCPTR (gst_basic_scheduler_yield);
|
||||
gstscheduler_class->interrupt =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_interrupt);
|
||||
|
@ -258,6 +250,8 @@ gst_basic_scheduler_init (GstBasicScheduler * scheduler)
|
|||
scheduler->num_elements = 0;
|
||||
scheduler->chains = NULL;
|
||||
scheduler->num_chains = 0;
|
||||
|
||||
GST_FLAG_SET (scheduler, GST_SCHEDULER_FLAG_NEW_API);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1197,20 +1191,6 @@ gst_basic_scheduler_state_transition (GstScheduler * sched,
|
|||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_basic_scheduler_lock_element (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
if (GST_ELEMENT_THREADSTATE (element))
|
||||
do_cothread_lock (GST_ELEMENT_THREADSTATE (element));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_basic_scheduler_unlock_element (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
if (GST_ELEMENT_THREADSTATE (element))
|
||||
do_cothread_unlock (GST_ELEMENT_THREADSTATE (element));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_basic_scheduler_yield (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
|
@ -1336,40 +1316,39 @@ gst_basic_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad,
|
|||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
gst_basic_scheduler_pad_select (GstScheduler * sched, GList * padlist)
|
||||
static GstData *
|
||||
gst_basic_scheduler_pad_select (GstScheduler * sched, GstPad ** selected,
|
||||
GstPad ** padlist)
|
||||
{
|
||||
GstPad *pad = NULL;
|
||||
GList *padlist2 = padlist;
|
||||
GstData *data;
|
||||
GstPad *pad;
|
||||
gint i;
|
||||
|
||||
GST_INFO ("performing select");
|
||||
|
||||
while (padlist2) {
|
||||
pad = GST_PAD (padlist2->data);
|
||||
|
||||
|
||||
padlist2 = g_list_next (padlist2);
|
||||
}
|
||||
|
||||
/* else there is nothing ready to consume, set up the select functions */
|
||||
while (padlist) {
|
||||
pad = GST_PAD (padlist->data);
|
||||
while (padlist[i]) {
|
||||
pad = padlist[i];
|
||||
|
||||
GST_RPAD_CHAINHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_select_proxy);
|
||||
|
||||
padlist = g_list_next (padlist);
|
||||
}
|
||||
if (pad != NULL) {
|
||||
GstRealPad *peer = GST_RPAD_PEER (pad);
|
||||
|
||||
do_element_switch (GST_PAD_PARENT (peer));
|
||||
do_element_switch (GST_PAD_PARENT (GST_PAD_PEER (pad)));
|
||||
|
||||
/* FIXME disabled for now */
|
||||
/* pad = GST_ELEMENT (GST_PAD_PARENT (pad))->select_pad; */
|
||||
while (padlist[i]) {
|
||||
pad = padlist[i];
|
||||
|
||||
g_assert (pad != NULL);
|
||||
if (GST_RPAD_BUFPEN (pad)) {
|
||||
*selected = pad;
|
||||
data = GST_RPAD_BUFPEN (pad);
|
||||
GST_RPAD_BUFPEN (pad) = NULL;
|
||||
}
|
||||
|
||||
GST_RPAD_CHAINHANDLER (pad) =
|
||||
GST_DEBUG_FUNCPTR (gst_basic_scheduler_chainhandler_proxy);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static GstSchedulerState
|
||||
|
|
|
@ -323,10 +323,6 @@ static GstElementStateReturn gst_opt_scheduler_state_transition (GstScheduler *
|
|||
sched, GstElement * element, gint transition);
|
||||
static void gst_opt_scheduler_scheduling_change (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static void gst_opt_scheduler_lock_element (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static void gst_opt_scheduler_unlock_element (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static gboolean gst_opt_scheduler_yield (GstScheduler * sched,
|
||||
GstElement * element);
|
||||
static gboolean gst_opt_scheduler_interrupt (GstScheduler * sched,
|
||||
|
@ -337,8 +333,6 @@ static void gst_opt_scheduler_pad_link (GstScheduler * sched, GstPad * srcpad,
|
|||
GstPad * sinkpad);
|
||||
static void gst_opt_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad,
|
||||
GstPad * sinkpad);
|
||||
static void gst_opt_scheduler_pad_select (GstScheduler * sched,
|
||||
GList * padlist);
|
||||
static GstSchedulerState gst_opt_scheduler_iterate (GstScheduler * sched);
|
||||
|
||||
static void gst_opt_scheduler_show (GstScheduler * sched);
|
||||
|
@ -407,10 +401,6 @@ gst_opt_scheduler_class_init (GstOptSchedulerClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_opt_scheduler_state_transition);
|
||||
gstscheduler_class->scheduling_change =
|
||||
GST_DEBUG_FUNCPTR (gst_opt_scheduler_scheduling_change);
|
||||
gstscheduler_class->lock_element =
|
||||
GST_DEBUG_FUNCPTR (gst_opt_scheduler_lock_element);
|
||||
gstscheduler_class->unlock_element =
|
||||
GST_DEBUG_FUNCPTR (gst_opt_scheduler_unlock_element);
|
||||
gstscheduler_class->yield = GST_DEBUG_FUNCPTR (gst_opt_scheduler_yield);
|
||||
gstscheduler_class->interrupt =
|
||||
GST_DEBUG_FUNCPTR (gst_opt_scheduler_interrupt);
|
||||
|
@ -418,8 +408,6 @@ gst_opt_scheduler_class_init (GstOptSchedulerClass * klass)
|
|||
gstscheduler_class->pad_link = GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_link);
|
||||
gstscheduler_class->pad_unlink =
|
||||
GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_unlink);
|
||||
gstscheduler_class->pad_select =
|
||||
GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_select);
|
||||
gstscheduler_class->clock_wait = NULL;
|
||||
gstscheduler_class->iterate = GST_DEBUG_FUNCPTR (gst_opt_scheduler_iterate);
|
||||
gstscheduler_class->show = GST_DEBUG_FUNCPTR (gst_opt_scheduler_show);
|
||||
|
@ -1787,20 +1775,6 @@ gst_opt_scheduler_remove_element (GstScheduler * sched, GstElement * element)
|
|||
GST_ELEMENT (element)->sched_private = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_opt_scheduler_lock_element (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
//GstOptScheduler *osched = GST_OPT_SCHEDULER (sched);
|
||||
g_warning ("lock element, implement me");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_opt_scheduler_unlock_element (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
//GstOptScheduler *osched = GST_OPT_SCHEDULER (sched);
|
||||
g_warning ("unlock element, implement me");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_opt_scheduler_yield (GstScheduler * sched, GstElement * element)
|
||||
{
|
||||
|
@ -2315,14 +2289,6 @@ gst_opt_scheduler_pad_unlink (GstScheduler * sched,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_opt_scheduler_pad_select (GstScheduler * sched, GList * padlist)
|
||||
{
|
||||
//GstOptScheduler *osched = GST_OPT_SCHEDULER (sched);
|
||||
|
||||
g_warning ("pad select, implement me");
|
||||
}
|
||||
|
||||
/* a scheduler iteration is done by looping and scheduling the active chains */
|
||||
static GstSchedulerState
|
||||
gst_opt_scheduler_iterate (GstScheduler * sched)
|
||||
|
|
|
@ -76,8 +76,6 @@ static cothread * cothread_create (cothread_context *conte
|
|||
}G_STMT_END
|
||||
static void do_cothread_switch (cothread *to);
|
||||
static void do_cothread_destroy (cothread *thread);
|
||||
#define do_cothread_lock(cothread) /* FIXME */
|
||||
#define do_cothread_unlock(cothread) /* FIXME */
|
||||
#define do_cothread_get_current(context) ((context)->current)
|
||||
#define do_cothread_get_main(context) ((context)->main)
|
||||
|
||||
|
@ -210,8 +208,5 @@ do_cothread_destroy (cothread *thread)
|
|||
/* the mutex was locked by the thread that we joined, no need to lock again */
|
||||
}
|
||||
|
||||
#define do_cothread_lock(cothread) /* FIXME */
|
||||
#define do_cothread_unlock(cothread) /* FIXME */
|
||||
|
||||
#define do_cothread_get_current(context) ((context)->current)
|
||||
#define do_cothread_get_main(context) ((context)->main)
|
||||
|
|
|
@ -336,8 +336,7 @@ gst_aggregator_loop (GstElement * element)
|
|||
|
||||
debug = "loop_select";
|
||||
|
||||
pad = gst_pad_selectv (aggregator->sinkpads);
|
||||
buf = GST_BUFFER (gst_pad_pull (pad));
|
||||
buf = GST_BUFFER (gst_pad_collectv (&pad, aggregator->sinkpads));
|
||||
|
||||
gst_aggregator_push (aggregator, pad, buf, debug);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue