From b93de9e922aeed5ff26a4278cb3bb562656ef2d7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 27 May 2001 14:37:29 +0000 Subject: [PATCH] Docs updates Original commit message from CVS: Docs updates Changed the cothread to use sigjmp_buf removed some unused methods. Some code cleanups. --- gst/cothreads.c | 30 +++++++++++++++++++++++++----- gst/cothreads.h | 2 +- gst/gstbin.c | 10 ---------- gst/gstbin.h | 9 --------- gst/gstinfo.c | 2 ++ gst/gstobject.c | 12 +++++++++--- gst/gstpad.c | 45 ++++++++++++++++++++++++++++++--------------- gst/gstplugin.c | 2 ++ gst/gstscheduler.h | 22 ++++++++++------------ 9 files changed, 79 insertions(+), 55 deletions(-) diff --git a/gst/cothreads.c b/gst/cothreads.c index 855df5f148..304749e212 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -159,7 +159,8 @@ cothread_create (cothread_context *ctx) s->lock = g_mutex_new(); #endif - GST_INFO (GST_CAT_COTHREADS,"created cothread #%d: %p at sp:%p", ctx->nthreads, s, s->sp); + GST_INFO (GST_CAT_COTHREADS,"created cothread #%d: %p at sp:%p lock:%p", ctx->nthreads, + s, s->sp, s->lock); ctx->threads[ctx->nthreads++] = s; @@ -201,7 +202,7 @@ cothread_main(cothread_context *ctx) } /** - * cothread_current)main: + * cothread_current_main: * * Returns: the #cothread_state of the main (0th) thread in the current pthread */ @@ -335,7 +336,7 @@ cothread_switch (cothread_state *thread) #ifdef GST_ARCH_PRESETJMP GST_ARCH_PRESETJMP(); #endif - enter = setjmp(current->jmp); + enter = sigsetjmp(current->jmp, 1); if (enter != 0) { GST_DEBUG (0,"enter thread #%d %d %p<->%p (%d)\n",current->threadnum, enter, current->sp, current->top_sp, current->top_sp-current->sp); @@ -350,7 +351,7 @@ cothread_switch (cothread_state *thread) if (thread->flags & COTHREAD_STARTED) { GST_DEBUG (0,"in thread \n"); // switch to it - longjmp(thread->jmp,1); + siglongjmp(thread->jmp,1); } else { GST_ARCH_SETUP_STACK(thread->sp); GST_ARCH_SET_SP(thread->sp); @@ -378,7 +379,12 @@ selfswitch: return; } - +/** + * cothread_lock: + * @thread: cothread state to lock + * + * Locks the cothread state. + */ void cothread_lock (cothread_state *thread) { @@ -390,6 +396,14 @@ cothread_lock (cothread_state *thread) #endif } +/** + * cothread_trylock: + * @thread: 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 *thread) { @@ -403,6 +417,12 @@ cothread_trylock (cothread_state *thread) #endif } +/** + * cothread_unlock: + * @thread: cothread state to unlock + * + * Unlock the cothread state. + */ void cothread_unlock (cothread_state *thread) { diff --git a/gst/cothreads.h b/gst/cothreads.h index d95d7cf736..d33a45f7e2 100644 --- a/gst/cothreads.h +++ b/gst/cothreads.h @@ -53,7 +53,7 @@ struct _cothread_state { int flags; void *sp; - jmp_buf jmp; + sigjmp_buf jmp; /* is this needed any more? */ void *top_sp; void *pc; diff --git a/gst/gstbin.c b/gst/gstbin.c index a45f134896..1a61097b72 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -134,8 +134,6 @@ gst_bin_init (GstBin *bin) bin->num_eos_providers = 0; bin->chains = NULL; bin->eoscond = g_cond_new (); -// FIXME temporary testing measure -// bin->use_cothreads = TRUE; } /** @@ -644,14 +642,6 @@ gst_bin_restore_thyself (GstObject *object, } } -void -gst_bin_use_cothreads (GstBin *bin, - gboolean enabled) -{ - g_return_if_fail (GST_IS_BIN (bin)); - - bin->use_cothreads = enabled; -} /** * gst_bin_iterate: diff --git a/gst/gstbin.h b/gst/gstbin.h index da5d8aa83d..e18ad0e070 100644 --- a/gst/gstbin.h +++ b/gst/gstbin.h @@ -82,7 +82,6 @@ struct _GstBin { gint num_entries; cothread_context *threadcontext; - gboolean use_cothreads; }; struct _GstBinClass { @@ -115,10 +114,6 @@ GtkType gst_bin_get_type (void); GstElement* gst_bin_new (const gchar *name); #define gst_bin_destroy(bin) gst_object_destroy(GST_OBJECT(bin)) -void gst_bin_set_element_manager (GstElement *element, GstElement *manager); -void gst_bin_add_managed_element (GstBin *bin, GstElement *element); -void gst_bin_remove_managed_element (GstBin *bin, GstElement *element); - /* add and remove elements from the bin */ void gst_bin_add (GstBin *bin, GstElement *element); @@ -138,10 +133,6 @@ gboolean gst_bin_set_state_type (GstBin *bin, gboolean gst_bin_iterate (GstBin *bin); -/* hack FIXME */ -void gst_bin_use_cothreads (GstBin *bin, - gboolean enabled); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 46ccbde76b..a962462866 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -129,6 +129,7 @@ guint32 _gst_debug_categories = 0x00000000; /** * gst_default_debug_handler: * @category: category of the DEBUG message + * @incore: if the debug handler is for core code. * @file: the file the DEBUG occurs in * @function: the function the DEBUG occurs in * @line: the line number in the file @@ -247,6 +248,7 @@ guint32 _gst_info_categories = 0x00000001; /** * gst_default_info_handler: * @category: category of the INFO message + * @incore: if the info handler is for core code. * @file: the file the INFO occurs in * @function: the function the INFO occurs in * @line: the line number in the file diff --git a/gst/gstobject.c b/gst/gstobject.c index 82c7e2b0f5..d693a5fea0 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -152,6 +152,8 @@ gst_object_new (void) * @object: GstObject to reference * * Increments the refence count on the object. + * + * Returns: A pointer to the object */ GstObject* gst_object_ref (GstObject *object) @@ -370,13 +372,15 @@ gst_object_unparent (GstObject *object) * @object: GstObject to reference * * Increments the refence count on the object. + * + * Returns: Apointer to the Object */ #ifndef gst_object_ref -void +GstObject* gst_object_ref (GstObject *object) { - g_return_if_fail (object != NULL); - g_return_if_fail (GST_IS_OBJECT (object)); + g_return_if_fail (object != NULL, NULL); + g_return_if_fail (GST_IS_OBJECT (object), NULL); #ifdef HAVE_ATOMIC_H g_return_if_fail (atomic_read (&(object->refcount)) > 0); @@ -387,6 +391,8 @@ gst_object_ref (GstObject *object) object->refcount++; GST_UNLOCK (object); #endif + + return object; } #endif /* gst_object_ref */ diff --git a/gst/gstpad.c b/gst/gstpad.c index 69913d25ce..16cae99d10 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -703,6 +703,23 @@ gst_pad_set_parent (GstPad *pad, gst_object_set_parent (GST_OBJECT (pad), parent); } +/** + * gst_pad_get_parent: + * @pad: the pad to get the parent from + * + * Get the parent object of this pad. + * + * Returns: the parent object + */ +GstElement* +gst_pad_get_parent (GstPad *pad) +{ + g_return_val_if_fail (pad != NULL, NULL); + g_return_val_if_fail (GST_IS_PAD (pad), NULL); + + return GST_PAD_PARENT (pad); +} + /** * gst_pad_get_padtemplate: * @pad: the pad to get the padtemplate from @@ -721,22 +738,12 @@ gst_pad_get_padtemplate (GstPad *pad) } /** - * gst_pad_get_parent: - * @pad: the pad to get the parent from + * gst_pad_set_sched: + * @pad: the pad to set the scheduler for + * @sched: The scheduler to set * - * Get the parent object of this pad. - * - * Returns: the parent object + * Set the sceduler for the pad */ -GstElement* -gst_pad_get_parent (GstPad *pad) -{ - g_return_val_if_fail (pad != NULL, NULL); - g_return_val_if_fail (GST_IS_PAD (pad), NULL); - - return GST_PAD_PARENT (pad); -} - void gst_pad_set_sched (GstPad *pad, GstSchedule *sched) { @@ -746,6 +753,14 @@ gst_pad_set_sched (GstPad *pad, GstSchedule *sched) GST_RPAD_SCHED(pad) = sched; } +/** + * gst_pad_get_sched: + * @pad: the pad to get the scheduler from + * + * Get the scheduler of the pad + * + * Returns: the scheduler of the pad. + */ GstSchedule* gst_pad_get_sched (GstPad *pad) { @@ -761,7 +776,7 @@ gst_pad_get_sched (GstPad *pad) * * Get the real parent object of this pad. If the pad * is a ghostpad, the actual owner of the real pad is - * returned, as opposed to the gst_pad_get_parent. + * returned, as opposed to the gst_pad_get_parent(). * * Returns: the parent object */ diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 0e4389254d..d957049d91 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -25,6 +25,8 @@ #include #include +#undef RTLD_GLOBAL + #include "gst_private.h" #include "gstplugin.h" #include "gstversion.h" diff --git a/gst/gstscheduler.h b/gst/gstscheduler.h index c10b7009a5..39699dabb9 100644 --- a/gst/gstscheduler.h +++ b/gst/gstscheduler.h @@ -126,20 +126,18 @@ struct _GstScheduleChain { }; -void gst_bin_schedule_func(GstBin *bin); +GtkType gst_schedule_get_type (void); +GstSchedule* gst_schedule_new (GstElement *parent); -GtkType gst_schedule_get_type (void); -GstSchedule * gst_schedule_new (GstElement *parent); +void gst_schedule_add_element (GstSchedule *sched, GstElement *element); +void gst_schedule_remove_element (GstSchedule *sched, GstElement *element); +void gst_schedule_enable_element (GstSchedule *sched, GstElement *element); +void gst_schedule_disable_element (GstSchedule *sched, GstElement *element); +void gst_schedule_pad_connect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad); +void gst_schedule_pad_disconnect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad); +gboolean gst_schedule_iterate (GstSchedule *sched); -void gst_schedule_add_element (GstSchedule *sched, GstElement *element); -void gst_schedule_remove_element (GstSchedule *sched, GstElement *element); -void gst_schedule_enable_element (GstSchedule *sched, GstElement *element); -void gst_schedule_disable_element (GstSchedule *sched, GstElement *element); -void gst_schedule_pad_connect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad); -void gst_schedule_pad_disconnect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad); -gboolean gst_schedule_iterate (GstSchedule *sched); - -void gst_schedule_show (GstSchedule *sched); +void gst_schedule_show (GstSchedule *sched); #ifdef __cplusplus