From 7f6e97ebe90ebcc9f3e8a5c8ecc5ea3241bc0eaf Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 24 Mar 2004 14:06:48 +0000 Subject: [PATCH] gst/schedulers/: fix GStreamer to not have issues with lvalue casts anymore (fixes some bug, but bugzilla is down) Original commit message from CVS: * gst/schedulers/gstbasicscheduler.c: (gst_basic_scheduler_src_wrapper): * gst/schedulers/gstoptimalscheduler.c: (gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper), (pad_clear_queued), (gst_opt_scheduler_add_element), (gst_opt_scheduler_remove_element): fix GStreamer to not have issues with lvalue casts anymore (fixes some bug, but bugzilla is down) --- ChangeLog | 11 +++++++++++ gst/schedulers/gstbasicscheduler.c | 4 ++-- gst/schedulers/gstoptimalscheduler.c | 20 +++++++++++--------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4228120c7..183d33bbdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-03-24 Benjamin Otte + + * gst/schedulers/gstbasicscheduler.c: + (gst_basic_scheduler_src_wrapper): + * gst/schedulers/gstoptimalscheduler.c: + (gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper), + (pad_clear_queued), (gst_opt_scheduler_add_element), + (gst_opt_scheduler_remove_element): + fix GStreamer to not have issues with lvalue casts anymore (fixes + some bug, but bugzilla is down) + 2004-03-24 Benjamin Otte * gst/gstelement.c: diff --git a/gst/schedulers/gstbasicscheduler.c b/gst/schedulers/gstbasicscheduler.c index d0a3bcf974..d5a378f666 100644 --- a/gst/schedulers/gstbasicscheduler.c +++ b/gst/schedulers/gstbasicscheduler.c @@ -34,8 +34,8 @@ GST_DEBUG_CATEGORY_STATIC (debug_scheduler); typedef struct _GstSchedulerChain GstSchedulerChain; -#define GST_ELEMENT_THREADSTATE(elem) (cothread*) (GST_ELEMENT (elem)->sched_private) -#define GST_RPAD_BUFPEN(pad) (GstData*) (GST_REAL_PAD(pad)->sched_private) +#define GST_ELEMENT_THREADSTATE(elem) (GST_ELEMENT (elem)->sched_private) +#define GST_RPAD_BUFPEN(pad) (GST_REAL_PAD(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) diff --git a/gst/schedulers/gstoptimalscheduler.c b/gst/schedulers/gstoptimalscheduler.c index b84eca5067..b28340c69c 100644 --- a/gst/schedulers/gstoptimalscheduler.c +++ b/gst/schedulers/gstoptimalscheduler.c @@ -38,7 +38,9 @@ GST_DEBUG_CATEGORY_STATIC (debug_scheduler); #define GST_ELEMENT_SCHED_CONTEXT(elem) ((GstOptSchedulerCtx*) (GST_ELEMENT (elem)->sched_private)) #define GST_ELEMENT_SCHED_GROUP(elem) (GST_ELEMENT_SCHED_CONTEXT (elem)->group) -#define GST_PAD_BUFLIST(pad) ((GList*) (GST_REAL_PAD(pad)->sched_private)) +/* need this first macro to not run into lvalue casts */ +#define GST_PAD_BUFPEN(pad) (GST_REAL_PAD(pad)->sched_private) +#define GST_PAD_BUFLIST(pad) ((GList*) GST_PAD_BUFPEN(pad)) #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) @@ -1208,13 +1210,13 @@ gst_opt_scheduler_loop_wrapper (GstPad * sinkpad, GstData * data) } else { GST_LOG ("queueing data %p on %s:%s's bufpen", data, GST_DEBUG_PAD_NAME (peer)); - GST_PAD_BUFLIST (peer) = g_list_append (GST_PAD_BUFLIST (peer), data); + GST_PAD_BUFPEN (peer) = g_list_append (GST_PAD_BUFLIST (peer), data); schedule_group (group); } #else GST_LOG ("queueing data %p on %s:%s's bufpen", data, GST_DEBUG_PAD_NAME (peer)); - GST_PAD_BUFLIST (peer) = g_list_append (GST_PAD_BUFLIST (peer), data); + GST_PAD_BUFPEN (peer) = g_list_append (GST_PAD_BUFLIST (peer), data); if (!(group->flags & GST_OPT_SCHEDULER_GROUP_RUNNING)) { GST_LOG ("adding group %p to runqueue", group); if (!g_list_find (osched->runqueue, group)) { @@ -1244,7 +1246,7 @@ gst_opt_scheduler_get_wrapper (GstPad * srcpad) /* first try to grab a queued buffer */ if (GST_PAD_BUFLIST (srcpad)) { data = GST_PAD_BUFLIST (srcpad)->data; - GST_PAD_BUFLIST (srcpad) = g_list_remove (GST_PAD_BUFLIST (srcpad), data); + GST_PAD_BUFPEN (srcpad) = g_list_remove (GST_PAD_BUFLIST (srcpad), data); GST_LOG ("returning popped queued data %p", data); @@ -1298,7 +1300,7 @@ gst_opt_scheduler_get_wrapper (GstPad * srcpad) } else { if (GST_PAD_BUFLIST (srcpad)) { data = GST_PAD_BUFLIST (srcpad)->data; - GST_PAD_BUFLIST (srcpad) = + GST_PAD_BUFPEN (srcpad) = g_list_remove (GST_PAD_BUFLIST (srcpad), data); } else if (disabled) { /* no buffer in queue and peer group was disabled */ @@ -1341,7 +1343,7 @@ pad_clear_queued (GstPad * srcpad, gpointer user_data) GST_LOG ("need to clear some buffers"); g_list_foreach (buflist, (GFunc) clear_queued, NULL); g_list_free (buflist); - GST_PAD_BUFLIST (srcpad) = NULL; + GST_PAD_BUFPEN (srcpad) = NULL; } } @@ -1660,7 +1662,7 @@ gst_opt_scheduler_add_element (GstScheduler * sched, GstElement * element) return; ctx = g_new0 (GstOptSchedulerCtx, 1); - GST_ELEMENT_SCHED_CONTEXT (element) = ctx; + GST_ELEMENT (element)->sched_private = ctx; ctx->flags = GST_OPT_SCHEDULER_CTX_DISABLED; /* set event handler on all pads here so events work unconnected too; @@ -1713,8 +1715,8 @@ gst_opt_scheduler_remove_element (GstScheduler * sched, GstElement * element) remove_from_group (group, element); } - g_free (GST_ELEMENT_SCHED_CONTEXT (element)); - GST_ELEMENT_SCHED_CONTEXT (element) = NULL; + g_free (GST_ELEMENT (element)->sched_private); + GST_ELEMENT (element)->sched_private = NULL; } static void