diff options
Diffstat (limited to 'gst/gstthread.c')
-rw-r--r-- | gst/gstthread.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/gst/gstthread.c b/gst/gstthread.c index b06f3bcf45..e6ccdd0a10 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -21,6 +21,8 @@ * Boston, MA 02111-1307, USA. */ +#include "gst_private.h" + #include "gstthread.h" #include "gstscheduler.h" #include "gstinfo.h" @@ -175,7 +177,7 @@ gst_thread_init (GstThread *thread) { GstScheduler *scheduler; - GST_DEBUG (GST_CAT_THREAD, "initializing thread"); + GST_CAT_DEBUG (GST_CAT_THREAD, "initializing thread"); /* threads are managing bins and iterate themselves */ /* CR1: the GstBin code checks these flags */ @@ -197,7 +199,7 @@ gst_thread_dispose (GObject *object) { GstThread *thread = GST_THREAD (object); - GST_DEBUG (GST_CAT_REFCOUNTING, "GstThread: dispose"); + GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "GstThread: dispose"); G_OBJECT_CLASS (parent_class)->dispose (object); @@ -299,7 +301,7 @@ gst_thread_release_children_locks (GstThread *thread) GList *pads; g_assert (element); - GST_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (element)); elements = g_list_next (elements); if (!gst_element_release_locks (element)) @@ -324,8 +326,8 @@ gst_thread_release_children_locks (GstThread *thread) continue; /* FIXME: deal with case where there's no peer */ if (GST_ELEMENT_SCHED (peerelement) != GST_ELEMENT_SCHED (thread)) { - GST_DEBUG (GST_CAT_THREAD, "element \"%s\" has pad cross sched boundary", GST_ELEMENT_NAME (element)); - GST_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (peerelement)); + GST_CAT_DEBUG (GST_CAT_THREAD, "element \"%s\" has pad cross sched boundary", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (peerelement)); if (!gst_element_release_locks (peerelement)) g_warning ("element %s could not release locks", GST_ELEMENT_NAME (peerelement)); } @@ -343,7 +345,7 @@ gst_thread_catch (GstThread *thread) g_mutex_lock (thread->lock); GST_FLAG_SET (thread, GST_THREAD_MUTEX_LOCKED); } - GST_DEBUG (GST_CAT_THREAD, "%s is catching itself", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "%s is catching itself", GST_ELEMENT_NAME (thread)); GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING); } else { /* another thread is trying to catch us */ @@ -351,7 +353,7 @@ gst_thread_catch (GstThread *thread) wait = !GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING); while (!wait) { GTimeVal tv; - GST_DEBUG (GST_CAT_THREAD, "catching %s...", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "catching %s...", GST_ELEMENT_NAME (thread)); GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING); g_cond_signal (thread->cond); gst_thread_release_children_locks (thread); @@ -359,7 +361,7 @@ gst_thread_catch (GstThread *thread) g_time_val_add (&tv, 1000); /* wait a millisecond to catch the thread */ wait = g_cond_timed_wait (thread->cond, thread->lock, &tv); } - GST_DEBUG (GST_CAT_THREAD, "caught %s", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "caught %s", GST_ELEMENT_NAME (thread)); } g_assert (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)); } @@ -385,7 +387,7 @@ gst_thread_change_state (GstElement *element) thread = GST_THREAD (element); - GST_DEBUG (GST_CAT_STATES, "%s is changing state from %s to %s", + GST_CAT_DEBUG (GST_CAT_STATES, "%s is changing state from %s to %s", GST_ELEMENT_NAME (element), gst_element_state_get_name (GST_STATE (element)), gst_element_state_get_name (GST_STATE_PENDING (element))); @@ -406,10 +408,10 @@ gst_thread_change_state (GstElement *element) thread, STACK_SIZE, FALSE, TRUE, thread->priority, NULL); if (!thread->thread_id){ - GST_DEBUG (GST_CAT_THREAD, "g_thread_create_full for %sfailed", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "g_thread_create_full for %sfailed", GST_ELEMENT_NAME (element)); goto error_out; } - GST_DEBUG (GST_CAT_THREAD, "GThread created"); + GST_CAT_DEBUG (GST_CAT_THREAD, "GThread created"); /* wait for it to 'spin up' */ g_cond_wait (thread->cond, thread->lock); @@ -443,7 +445,7 @@ gst_thread_change_state (GstElement *element) case GST_STATE_READY_TO_NULL: /* we can't join the threads here, because this could have been triggered by ourself (ouch) */ - GST_DEBUG (GST_CAT_THREAD, "destroying GThread %p", thread->thread_id); + GST_CAT_DEBUG (GST_CAT_THREAD, "destroying GThread %p", thread->thread_id); GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING); thread->thread_id = NULL; if (thread == gst_thread_get_current()) { @@ -454,7 +456,7 @@ gst_thread_change_state (GstElement *element) /* unlock and signal - we are out */ gst_thread_release (thread); - GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", + GST_CAT_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", GST_ELEMENT_NAME (thread)); g_signal_emit (G_OBJECT (thread), gst_thread_signals[SHUTDOWN], 0); @@ -467,8 +469,8 @@ gst_thread_change_state (GstElement *element) /* it should be dead now */ break; default: - GST_DEBUG_ELEMENT (GST_CAT_THREAD, element, "UNHANDLED STATE CHANGE! %x", - GST_STATE_TRANSITION (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "[%s]: UNHANDLED STATE CHANGE! %x", + GST_ELEMENT_NAME (element), GST_STATE_TRANSITION (element)); g_assert_not_reached (); break; } @@ -483,7 +485,7 @@ gst_thread_change_state (GstElement *element) return ret; error_out: - GST_DEBUG (GST_CAT_STATES, "changing state from %s to %s failed for %s", + GST_CAT_DEBUG (GST_CAT_STATES, "changing state from %s to %s failed for %s", gst_element_state_get_name (GST_STATE (element)), gst_element_state_get_name (GST_STATE_PENDING (element)), GST_ELEMENT_NAME (element)); @@ -498,7 +500,7 @@ static void gst_thread_child_state_change (GstBin *bin, GstElementState oldstate, GstElementState newstate, GstElement *element) { - GST_DEBUG (GST_CAT_THREAD, "%s (from thread %s) child %s changed state from %s to %s", + GST_CAT_DEBUG (GST_CAT_THREAD, "%s (from thread %s) child %s changed state from %s to %s", GST_ELEMENT_NAME (bin), gst_thread_get_current() ? GST_ELEMENT_NAME (gst_thread_get_current()) : "(none)", GST_ELEMENT_NAME (element), gst_element_state_get_name (oldstate), @@ -526,7 +528,7 @@ gst_thread_main_loop (void *arg) thread = GST_THREAD (arg); g_mutex_lock (thread->lock); - GST_DEBUG (GST_CAT_THREAD, "Thread %s started main loop", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "Thread %s started main loop", GST_ELEMENT_NAME (thread)); /* initialize gst_thread_current */ g_private_set (gst_thread_current, thread); @@ -540,7 +542,7 @@ gst_thread_main_loop (void *arg) if (GST_STATE (thread) == GST_STATE_PLAYING) { GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING); status = TRUE; - GST_DEBUG (GST_CAT_THREAD, "%s starts iterating", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "%s starts iterating", GST_ELEMENT_NAME (thread)); while (status && GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) { g_mutex_unlock (thread->lock); status = gst_bin_iterate (GST_BIN (thread)); @@ -554,7 +556,7 @@ gst_thread_main_loop (void *arg) } if (GST_FLAG_IS_SET (thread, GST_THREAD_STATE_REAPING)) break; - GST_DEBUG (GST_CAT_THREAD, "%s was caught", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "%s was caught", GST_ELEMENT_NAME (thread)); g_cond_signal (thread->cond); g_cond_wait (thread->cond, thread->lock); } @@ -570,7 +572,7 @@ gst_thread_main_loop (void *arg) g_cond_signal (thread->cond); g_mutex_unlock (thread->lock); - GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", + GST_CAT_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", GST_ELEMENT_NAME (thread)); return NULL; @@ -590,7 +592,7 @@ static void gst_thread_restore_thyself (GstObject *object, xmlNodePtr self) { - GST_DEBUG (GST_CAT_THREAD,"gstthread: restore"); + GST_CAT_DEBUG (GST_CAT_THREAD,"gstthread: restore"); if (GST_OBJECT_CLASS (parent_class)->restore_thyself) GST_OBJECT_CLASS (parent_class)->restore_thyself (object, self); |