Mega update of INFO, DEBUG, and ERROR subsystems, renamed with GST_ prefix.

Original commit message from CVS:
Mega update of INFO, DEBUG, and ERROR subsystems, renamed with GST_ prefix.
GST_DEBUG now takes a category parameter, which is the same as GST_INFO
system.  They are now called GST_CAT_*.  All the GST_DEBUGs are set to 0
for now, we need to go and fix all these eventually.
This commit is contained in:
Erik Walthinsen 2001-01-01 03:14:40 +00:00
parent e154186bc4
commit 1e04cefaf2
38 changed files with 418 additions and 384 deletions

View file

@ -55,18 +55,18 @@ cothread_create (cothread_context *ctx)
{ {
cothread_state *s; cothread_state *s;
DEBUG("pthread_self() %ld\n",pthread_self()); GST_DEBUG (0,"pthread_self() %ld\n",pthread_self());
//if (0) { //if (0) {
if (pthread_self() == 0) { if (pthread_self() == 0) {
s = (cothread_state *)malloc(sizeof(int) * COTHREAD_STACKSIZE); s = (cothread_state *)malloc(sizeof(int) * COTHREAD_STACKSIZE);
DEBUG("new stack (case 1) at %p\n",s); GST_DEBUG (0,"new stack (case 1) at %p\n",s);
} else { } else {
char *sp = CURRENT_STACK_FRAME; char *sp = CURRENT_STACK_FRAME;
unsigned long *stack_end = (unsigned long *)((unsigned long)sp & unsigned long *stack_end = (unsigned long *)((unsigned long)sp &
~(STACK_SIZE - 1)); ~(STACK_SIZE - 1));
s = (cothread_state *)(stack_end + ((ctx->nthreads - 1) * s = (cothread_state *)(stack_end + ((ctx->nthreads - 1) *
COTHREAD_STACKSIZE)); COTHREAD_STACKSIZE));
DEBUG("new stack (case 2) at %p\n",s); GST_DEBUG (0,"new stack (case 2) at %p\n",s);
if (mmap((char *)s,COTHREAD_STACKSIZE*(sizeof(int)), if (mmap((char *)s,COTHREAD_STACKSIZE*(sizeof(int)),
PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS, PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS,
-1,0) < 0) { -1,0) < 0) {
@ -81,7 +81,7 @@ cothread_create (cothread_context *ctx)
s->sp = ((int *)s + COTHREAD_STACKSIZE); s->sp = ((int *)s + COTHREAD_STACKSIZE);
s->top_sp = s->sp; s->top_sp = s->sp;
INFO(GST_INFO_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", ctx->nthreads, s, s->sp);
ctx->threads[ctx->nthreads++] = s; ctx->threads[ctx->nthreads++] = s;
@ -121,7 +121,7 @@ cothread_init (void)
{ {
cothread_context *ctx = (cothread_context *)malloc(sizeof(cothread_context)); cothread_context *ctx = (cothread_context *)malloc(sizeof(cothread_context));
INFO(GST_INFO_COTHREADS,"initializing cothreads"); GST_INFO (GST_CAT_COTHREADS,"initializing cothreads");
if (_cothread_key == -1) { if (_cothread_key == -1) {
if (pthread_key_create (&_cothread_key,NULL) != 0) { if (pthread_key_create (&_cothread_key,NULL) != 0) {
@ -143,7 +143,7 @@ cothread_init (void)
ctx->threads[0]->sp = (int *)CURRENT_STACK_FRAME; ctx->threads[0]->sp = (int *)CURRENT_STACK_FRAME;
ctx->threads[0]->pc = 0; ctx->threads[0]->pc = 0;
INFO(GST_INFO_COTHREADS,"0th thread is %p at sp:%p",ctx->threads[0], ctx->threads[0]->sp); GST_INFO (GST_CAT_COTHREADS,"0th thread is %p at sp:%p",ctx->threads[0], ctx->threads[0]->sp);
// we consider the initiating process to be cothread 0 // we consider the initiating process to be cothread 0
ctx->nthreads = 1; ctx->nthreads = 1;
@ -162,7 +162,7 @@ cothread_init (void)
cothread_state* cothread_state*
cothread_main(cothread_context *ctx) cothread_main(cothread_context *ctx)
{ {
DEBUG("returning %p, the 0th cothread\n",ctx->threads[0]); GST_DEBUG (0,"returning %p, the 0th cothread\n",ctx->threads[0]);
return ctx->threads[0]; return ctx->threads[0];
} }
@ -172,14 +172,14 @@ cothread_stub (void)
cothread_context *ctx = pthread_getspecific(_cothread_key); cothread_context *ctx = pthread_getspecific(_cothread_key);
register cothread_state *thread = ctx->threads[ctx->current]; register cothread_state *thread = ctx->threads[ctx->current];
DEBUG_ENTER(""); GST_DEBUG_ENTER("");
thread->flags |= COTHREAD_STARTED; thread->flags |= COTHREAD_STARTED;
if (thread->func) if (thread->func)
thread->func(thread->argc,thread->argv); thread->func(thread->argc,thread->argv);
thread->flags &= ~COTHREAD_STARTED; thread->flags &= ~COTHREAD_STARTED;
thread->pc = 0; thread->pc = 0;
thread->sp = thread->top_sp; thread->sp = thread->top_sp;
DEBUG_LEAVE(""); GST_DEBUG_LEAVE("");
// printf("uh, yeah, we shouldn't be here, but we should deal anyway\n"); // printf("uh, yeah, we shouldn't be here, but we should deal anyway\n");
} }
@ -259,24 +259,24 @@ cothread_switch (cothread_state *thread)
// find the number of the thread to switch to // find the number of the thread to switch to
ctx->current = thread->threadnum; ctx->current = thread->threadnum;
INFO(GST_INFO_COTHREAD_SWITCH,"switching to thread #%d",ctx->current); GST_INFO (GST_CAT_COTHREAD_SWITCH,"switching to thread #%d",ctx->current);
/* save the current stack pointer, frame pointer, and pc */ /* save the current stack pointer, frame pointer, and pc */
GET_SP(current->sp); GET_SP(current->sp);
enter = setjmp(current->jmp); enter = setjmp(current->jmp);
if (enter != 0) { if (enter != 0) {
DEBUG("enter thread #%d %d %p<->%p (%d)\n",current->threadnum, enter, GST_DEBUG (0,"enter thread #%d %d %p<->%p (%d)\n",current->threadnum, enter,
current->sp, current->top_sp, current->top_sp-current->sp); current->sp, current->top_sp, current->top_sp-current->sp);
return; return;
} }
DEBUG("exit thread #%d %d %p<->%p (%d)\n",current->threadnum, enter, GST_DEBUG (0,"exit thread #%d %d %p<->%p (%d)\n",current->threadnum, enter,
current->sp, current->top_sp, current->top_sp-current->sp); current->sp, current->top_sp, current->top_sp-current->sp);
enter = 1; enter = 1;
DEBUG("set stack to %p\n", thread->sp); GST_DEBUG (0,"set stack to %p\n", thread->sp);
/* restore stack pointer and other stuff of new cothread */ /* restore stack pointer and other stuff of new cothread */
if (thread->flags & COTHREAD_STARTED) { if (thread->flags & COTHREAD_STARTED) {
DEBUG("in thread \n"); GST_DEBUG (0,"in thread \n");
SET_SP(thread->sp); SET_SP(thread->sp);
// switch to it // switch to it
longjmp(thread->jmp,1); longjmp(thread->jmp,1);
@ -285,7 +285,7 @@ cothread_switch (cothread_state *thread)
SET_SP(thread->sp); SET_SP(thread->sp);
// start it // start it
cothread_stub(); cothread_stub();
DEBUG("exit thread \n"); GST_DEBUG (0,"exit thread \n");
ctx->current = 0; ctx->current = 0;
} }

View file

@ -244,7 +244,7 @@ gst_asyncdisksrc_get (GstPad *pad)
} else } else
GST_BUFFER_SIZE (buf) = src->bytes_per_read; GST_BUFFER_SIZE (buf) = src->bytes_per_read;
DEBUG ("map %p, offset %d, size %ld\n", src->map, src->curoffset, GST_BUFFER_SIZE (buf)); GST_DEBUG (0,"map %p, offset %d, size %ld\n", src->map, src->curoffset, GST_BUFFER_SIZE (buf));
//gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); //gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
@ -252,7 +252,7 @@ gst_asyncdisksrc_get (GstPad *pad)
if (src->new_seek) { if (src->new_seek) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
DEBUG ("new seek\n"); GST_DEBUG (0,"new seek\n");
src->new_seek = FALSE; src->new_seek = FALSE;
} }
@ -303,7 +303,7 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size)
} else } else
GST_BUFFER_SIZE (buf) = size; GST_BUFFER_SIZE (buf) = size;
DEBUG ("map %p, offset %d, size %ld\n", src->map, offset, GST_BUFFER_SIZE (buf)); GST_DEBUG (0,"map %p, offset %d, size %ld\n", src->map, offset, GST_BUFFER_SIZE (buf));
/* we're done, return the buffer off now */ /* we're done, return the buffer off now */
return buf; return buf;

View file

@ -247,7 +247,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING)); // g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) { if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
DEBUG ("audiosink: flush\n"); GST_DEBUG (0,"audiosink: flush\n");
ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0); ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
} }
@ -277,7 +277,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
if (!audiosink->mute) { if (!audiosink->mute) {
gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink)); gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace); ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
DEBUG ("audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes, GST_DEBUG (0,"audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes,
audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
//write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf)); //write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));

View file

@ -273,7 +273,7 @@ gst_audiosrc_open_audio (GstAudioSrc *src)
/* set card state */ /* set card state */
gst_audiosrc_sync_parms (src); gst_audiosrc_sync_parms (src);
DEBUG("opened audio\n"); GST_DEBUG (0,"opened audio\n");
GST_FLAG_SET (src, GST_AUDIOSRC_OPEN); GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
return TRUE; return TRUE;

View file

@ -236,7 +236,7 @@ gst_disksrc_get (GstPad *pad)
/* if we didn't get as many bytes as we asked for, we're at EOF */ /* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < src->bytes_per_read) { if (readbytes < src->bytes_per_read) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
DEBUG("setting GST_BUFFER_EOS\n"); GST_DEBUG (0,"setting GST_BUFFER_EOS\n");
} }
/* if we have a new buffer from a seek, mark it */ /* if we have a new buffer from a seek, mark it */
@ -249,9 +249,9 @@ gst_disksrc_get (GstPad *pad)
GST_BUFFER_SIZE (buf) = readbytes; GST_BUFFER_SIZE (buf) = readbytes;
src->curoffset += readbytes; src->curoffset += readbytes;
DEBUG("pushing %d bytes with offset %d\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf)); GST_DEBUG (0,"pushing %d bytes with offset %d\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf));
/* we're done, push the buffer off now */ /* we're done, push the buffer off now */
DEBUG("returning %d bytes with offset %d done\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf)); GST_DEBUG (0,"returning %d bytes with offset %d done\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf));
return buf; return buf;
} }
@ -277,7 +277,7 @@ gst_disksrc_open_file (GstDiskSrc *src)
} }
else { else {
src->size = f_stat.st_size; src->size = f_stat.st_size;
DEBUG("gstdisksrc: file size %ld\n", src->size); GST_DEBUG (0,"gstdisksrc: file size %ld\n", src->size);
} }
GST_FLAG_SET (src, GST_DISKSRC_OPEN); GST_FLAG_SET (src, GST_DISKSRC_OPEN);
return TRUE; return TRUE;
@ -306,7 +306,7 @@ gst_disksrc_change_state (GstElement *element)
{ {
g_return_val_if_fail (GST_IS_DISKSRC (element), GST_STATE_FAILURE); g_return_val_if_fail (GST_IS_DISKSRC (element), GST_STATE_FAILURE);
DEBUG("gstdisksrc: state pending %d\n", GST_STATE_PENDING (element)); GST_DEBUG (0,"gstdisksrc: state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, close the file if it's open */ /* if going down into NULL state, close the file if it's open */
if (GST_STATE_PENDING (element) == GST_STATE_NULL) { if (GST_STATE_PENDING (element) == GST_STATE_NULL) {

View file

@ -118,7 +118,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (fdsink->fd >= 0); g_return_if_fail (fdsink->fd >= 0);
if (GST_BUFFER_DATA (buf)) { if (GST_BUFFER_DATA (buf)) {
DEBUG("writing %d bytes to file descriptor %d\n",GST_BUFFER_SIZE (buf), fdsink->fd); GST_DEBUG (0,"writing %d bytes to file descriptor %d\n",GST_BUFFER_SIZE (buf), fdsink->fd);
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
} }

View file

@ -139,12 +139,12 @@ static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE); g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE);
/* read it in from the file */ /* read it in from the file */
DEBUG("attemting to read %ld bytes\n", pipefilter->bytes_per_read); GST_DEBUG (0,"attemting to read %ld bytes\n", pipefilter->bytes_per_read);
readbytes = read(pipefilter->fdout[0],GST_BUFFER_DATA(newbuf),pipefilter->bytes_per_read); readbytes = read(pipefilter->fdout[0],GST_BUFFER_DATA(newbuf),pipefilter->bytes_per_read);
DEBUG("read %ld bytes\n", readbytes); GST_DEBUG (0,"read %ld bytes\n", readbytes);
if (readbytes < 0) { if (readbytes < 0) {
if (errno == EAGAIN) { if (errno == EAGAIN) {
DEBUG("no input yet\n"); GST_DEBUG (0,"no input yet\n");
gst_buffer_unref(newbuf); gst_buffer_unref(newbuf);
return FALSE; return FALSE;
} }
@ -186,9 +186,9 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
data = GST_BUFFER_DATA(buf); data = GST_BUFFER_DATA(buf);
size = GST_BUFFER_SIZE(buf); size = GST_BUFFER_SIZE(buf);
DEBUG("attemting to write %ld bytes\n", size); GST_DEBUG (0,"attemting to write %ld bytes\n", size);
writebytes = write(pipefilter->fdin[1],data,size); writebytes = write(pipefilter->fdin[1],data,size);
DEBUG("written %ld bytes\n", writebytes); GST_DEBUG (0,"written %ld bytes\n", writebytes);
if (writebytes < 0) { if (writebytes < 0) {
perror("write"); perror("write");
gst_element_error(GST_ELEMENT(pipefilter),"writing"); gst_element_error(GST_ELEMENT(pipefilter),"writing");

View file

@ -149,7 +149,7 @@ gst_queue_init (GstQueue *queue)
static void static void
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data) gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
{ {
DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data); GST_DEBUG (0,"queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
gst_buffer_unref (GST_BUFFER (data)); gst_buffer_unref (GST_BUFFER (data));
} }
@ -181,19 +181,19 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
/* we have to lock the queue since we span threads */ /* we have to lock the queue since we span threads */
DEBUG("queue: try have queue lock\n"); GST_DEBUG (0,"queue: try have queue lock\n");
GST_LOCK (queue); GST_LOCK (queue);
DEBUG("queue: %s adding buffer %p %ld\n", name, buf, pthread_self ()); GST_DEBUG (0,"queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
DEBUG("queue: have queue lock\n"); GST_DEBUG (0,"queue: have queue lock\n");
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) { if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) {
gst_queue_flush (queue); gst_queue_flush (queue);
} }
DEBUG("queue: %s: chain %d %p\n", name, queue->level_buffers, buf); GST_DEBUG (0,"queue: %s: chain %d %p\n", name, queue->level_buffers, buf);
while (queue->level_buffers >= queue->max_buffers) { while (queue->level_buffers >= queue->max_buffers) {
DEBUG("queue: %s waiting %d\n", name, queue->level_buffers); GST_DEBUG (0,"queue: %s waiting %d\n", name, queue->level_buffers);
STATUS("%s: O\n"); STATUS("%s: O\n");
GST_UNLOCK (queue); GST_UNLOCK (queue);
g_mutex_lock (queue->fulllock); g_mutex_lock (queue->fulllock);
@ -201,20 +201,20 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
g_mutex_unlock (queue->fulllock); g_mutex_unlock (queue->fulllock);
GST_LOCK (queue); GST_LOCK (queue);
STATUS("%s: O+\n"); STATUS("%s: O+\n");
DEBUG("queue: %s waiting done %d\n", name, queue->level_buffers); GST_DEBUG (0,"queue: %s waiting done %d\n", name, queue->level_buffers);
} }
/* put the buffer on the tail of the list */ /* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf); queue->queue = g_slist_append (queue->queue, buf);
// STATUS("%s: +\n"); // STATUS("%s: +\n");
DEBUG("(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
/* if we were empty, but aren't any more, signal a condition */ /* if we were empty, but aren't any more, signal a condition */
tosignal = (queue->level_buffers >= 0); tosignal = (queue->level_buffers >= 0);
queue->level_buffers++; queue->level_buffers++;
/* we can unlock now */ /* we can unlock now */
DEBUG("queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond); GST_DEBUG (0,"queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
GST_UNLOCK (queue); GST_UNLOCK (queue);
if (tosignal) { if (tosignal) {
@ -238,10 +238,10 @@ gst_queue_get (GstPad *pad)
name = gst_element_get_name (GST_ELEMENT (queue)); name = gst_element_get_name (GST_ELEMENT (queue));
/* have to lock for thread-safety */ /* have to lock for thread-safety */
DEBUG("queue: %s try have queue lock\n", name); GST_DEBUG (0,"queue: %s try have queue lock\n", name);
GST_LOCK (queue); GST_LOCK (queue);
DEBUG("queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond); GST_DEBUG (0,"queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
DEBUG("queue: %s have queue lock\n", name); GST_DEBUG (0,"queue: %s have queue lock\n", name);
// we bail if there's nothing there // we bail if there's nothing there
if (!queue->level_buffers && !queue->block) { if (!queue->level_buffers && !queue->block) {
@ -261,13 +261,13 @@ gst_queue_get (GstPad *pad)
front = queue->queue; front = queue->queue;
buf = (GstBuffer *)(front->data); buf = (GstBuffer *)(front->data);
DEBUG("retrieved buffer %p from queue\n",buf); GST_DEBUG (0,"retrieved buffer %p from queue\n",buf);
queue->queue = g_slist_remove_link (queue->queue, front); queue->queue = g_slist_remove_link (queue->queue, front);
g_slist_free (front); g_slist_free (front);
queue->level_buffers--; queue->level_buffers--;
// STATUS("%s: -\n"); // STATUS("%s: -\n");
DEBUG("(%s:%s)- ",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
tosignal = queue->level_buffers < queue->max_buffers; tosignal = queue->level_buffers < queue->max_buffers;
GST_UNLOCK(queue); GST_UNLOCK(queue);
@ -279,9 +279,9 @@ gst_queue_get (GstPad *pad)
g_mutex_unlock (queue->fulllock); g_mutex_unlock (queue->fulllock);
} }
// DEBUG("queue: %s pushing %d %p \n", name, queue->level_buffers, buf); // GST_DEBUG (0,"queue: %s pushing %d %p \n", name, queue->level_buffers, buf);
// gst_pad_push (queue->srcpad, buf); // gst_pad_push (queue->srcpad, buf);
// DEBUG("queue: %s pushing %d done \n", name, queue->level_buffers); // GST_DEBUG (0,"queue: %s pushing %d done \n", name, queue->level_buffers);
return buf; return buf;
/* unlock now */ /* unlock now */
@ -294,7 +294,7 @@ gst_queue_change_state (GstElement *element)
g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE); g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE);
queue = GST_QUEUE (element); queue = GST_QUEUE (element);
DEBUG("gstqueue: state pending %d\n", GST_STATE_PENDING (element)); GST_DEBUG (0,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, clear out buffers*/ /* if going down into NULL state, clear out buffers*/
if (GST_STATE_PENDING (element) == GST_STATE_READY) { if (GST_STATE_PENDING (element) == GST_STATE_READY) {

View file

@ -26,6 +26,7 @@
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <gstsinesrc.h> #include <gstsinesrc.h>

View file

@ -52,7 +52,7 @@ gst_init (int *argc, char **argv[])
{ {
GstTrace *gst_trace; GstTrace *gst_trace;
INFO (GST_INFO_GST_INIT, "Initializing GStreamer Core Library"); GST_INFO (GST_CAT_GST_INIT, "Initializing GStreamer Core Library");
if (!g_thread_supported ()) g_thread_init (NULL); if (!g_thread_supported ()) g_thread_init (NULL);

View file

@ -89,7 +89,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
if (srctemp->direction == GST_PAD_SRC && if (srctemp->direction == GST_PAD_SRC &&
desttemp->direction == GST_PAD_SINK) { desttemp->direction == GST_PAD_SINK) {
if (gst_caps_list_check_compatibility (srctemp->caps, desttemp->caps)) { if (gst_caps_list_check_compatibility (srctemp->caps, desttemp->caps)) {
INFO(0,"factory \"%s\" can connect with factory \"%s\"", src->name, dest->name); GST_INFO (0,"factory \"%s\" can connect with factory \"%s\"", src->name, dest->name);
return TRUE; return TRUE;
} }
} }
@ -98,7 +98,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
} }
srctemps = g_list_next (srctemps); srctemps = g_list_next (srctemps);
} }
INFO(0,"factory \"%s\" cannot connect with factory \"%s\"", src->name, dest->name); GST_INFO (0,"factory \"%s\" cannot connect with factory \"%s\"", src->name, dest->name);
return FALSE; return FALSE;
} }
@ -123,15 +123,15 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data)
if (IS_CAPS (src) && IS_CAPS (dest)) { if (IS_CAPS (src) && IS_CAPS (dest)) {
res = gst_caps_list_check_compatibility ((GList *)src, (GList *)dest); res = gst_caps_list_check_compatibility ((GList *)src, (GList *)dest);
//INFO (0,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res); //GST_INFO (0,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res);
} }
else if (IS_CAPS (src)) { else if (IS_CAPS (src)) {
res = gst_elementfactory_can_sink_caps_list ((GstElementFactory *)dest, (GList *)src); res = gst_elementfactory_can_sink_caps_list ((GstElementFactory *)dest, (GList *)src);
//INFO (0,"factory %s to src caps %d %d", ((GstElementFactory *)dest)->name, ((GstCaps *)src)->id, res); //GST_INFO (0,"factory %s to src caps %d %d", ((GstElementFactory *)dest)->name, ((GstCaps *)src)->id, res);
} }
else if (IS_CAPS (dest)) { else if (IS_CAPS (dest)) {
res = gst_elementfactory_can_src_caps_list ((GstElementFactory *)src, (GList *)dest); res = gst_elementfactory_can_src_caps_list ((GstElementFactory *)src, (GList *)dest);
//INFO (0,"factory %s to sink caps %d %d", ((GstElementFactory *)src)->name, ((GstCaps *)dest)->id, res); //GST_INFO (0,"factory %s to sink caps %d %d", ((GstElementFactory *)src)->name, ((GstCaps *)dest)->id, res);
} }
else { else {
res = gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest); res = gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest);
@ -161,7 +161,7 @@ gst_autoplug_caps (GstCaps *srccaps, GstCaps *sinkcaps)
caps.src = g_list_prepend (NULL,srccaps); caps.src = g_list_prepend (NULL,srccaps);
caps.sink = g_list_prepend (NULL,sinkcaps); caps.sink = g_list_prepend (NULL,sinkcaps);
INFO (0,"autoplugging two caps structures"); GST_INFO (0,"autoplugging two caps structures");
return gst_autoplug_func (caps.src, caps.sink, return gst_autoplug_func (caps.src, caps.sink,
gst_autoplug_elementfactory_get_list, gst_autoplug_elementfactory_get_list,
@ -187,7 +187,7 @@ gst_autoplug_caps_list (GList *srccaps, GList *sinkcaps)
caps.src = srccaps; caps.src = srccaps;
caps.sink = sinkcaps; caps.sink = sinkcaps;
INFO (0,"autoplugging two caps list structures"); GST_INFO (0,"autoplugging two caps list structures");
return gst_autoplug_func (caps.src, caps.sink, return gst_autoplug_func (caps.src, caps.sink,
gst_autoplug_elementfactory_get_list, gst_autoplug_elementfactory_get_list,
@ -213,7 +213,7 @@ gst_autoplug_pads (GstPad *srcpad, GstPad *sinkpad)
caps.src = srcpad->caps; caps.src = srcpad->caps;
caps.sink = sinkpad->caps; caps.sink = sinkpad->caps;
INFO (0,"autoplugging two caps structures"); GST_INFO (0,"autoplugging two caps structures");
return gst_autoplug_func (caps.src, caps.sink, return gst_autoplug_func (caps.src, caps.sink,
gst_autoplug_elementfactory_get_list, gst_autoplug_elementfactory_get_list,
@ -240,7 +240,7 @@ construct_path (gst_autoplug_node *rgnNodes, gpointer factory)
current = rgnNodes[find_factory(rgnNodes, factory)].iPrev; current = rgnNodes[find_factory(rgnNodes, factory)].iPrev;
INFO (0,"factories found in autoplugging (reversed order)"); GST_INFO (0,"factories found in autoplugging (reversed order)");
while (current != NULL) while (current != NULL)
{ {
@ -249,7 +249,7 @@ construct_path (gst_autoplug_node *rgnNodes, gpointer factory)
next = rgnNodes[find_factory(rgnNodes, current)].iPrev; next = rgnNodes[find_factory(rgnNodes, current)].iPrev;
if (next) { if (next) {
factories = g_list_prepend (factories, current); factories = g_list_prepend (factories, current);
INFO (0,"factory: \"%s\"", current->name); GST_INFO (0,"factory: \"%s\"", current->name);
} }
current = next; current = next;
} }

View file

@ -175,7 +175,7 @@ gst_bin_add (GstBin *bin,
bin->numchildren++; bin->numchildren++;
gst_object_set_parent (GST_OBJECT (element), GST_OBJECT (bin)); gst_object_set_parent (GST_OBJECT (element), GST_OBJECT (bin));
INFO_ELEMENT (GST_INFO_PARENTAGE, bin, "added child %s", gst_element_get_name(element)); GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "added child %s", gst_element_get_name(element));
/* we know we have at least one child, we just added one... */ /* we know we have at least one child, we just added one... */
// if (GST_STATE(element) < GST_STATE_READY) // if (GST_STATE(element) < GST_STATE_READY)
@ -207,7 +207,7 @@ gst_bin_remove (GstBin *bin,
if (g_list_find(bin->children, element) == NULL) { if (g_list_find(bin->children, element) == NULL) {
// FIXME this should be a warning!!! // FIXME this should be a warning!!!
ERROR_OBJECT(bin,element,"no such element in bin"); GST_ERROR_OBJECT(bin,element,"no such element in bin");
return; return;
} }
@ -215,7 +215,7 @@ gst_bin_remove (GstBin *bin,
bin->children = g_list_remove (bin->children, element); bin->children = g_list_remove (bin->children, element);
bin->numchildren--; bin->numchildren--;
INFO_ELEMENT (GST_INFO_PARENTAGE, bin, "removed child %s", gst_element_get_name(element)); GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", gst_element_get_name(element));
/* if we're down to zero children, force state to NULL */ /* if we're down to zero children, force state to NULL */
if (bin->numchildren == 0) if (bin->numchildren == 0)
@ -230,17 +230,17 @@ gst_bin_change_state (GstElement *element)
GList *children; GList *children;
GstElement *child; GstElement *child;
DEBUG_ENTER("(\"%s\")",gst_element_get_name (element)); GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name (element));
g_return_val_if_fail (GST_IS_BIN (element), GST_STATE_FAILURE); g_return_val_if_fail (GST_IS_BIN (element), GST_STATE_FAILURE);
bin = GST_BIN (element); bin = GST_BIN (element);
// DEBUG("currently %d(%s), %d(%s) pending\n",GST_STATE (element), // GST_DEBUG (0,"currently %d(%s), %d(%s) pending\n",GST_STATE (element),
// _gst_print_statename (GST_STATE (element)), GST_STATE_PENDING (element), // _gst_print_statename (GST_STATE (element)), GST_STATE_PENDING (element),
// _gst_print_statename (GST_STATE_PENDING (element))); // _gst_print_statename (GST_STATE_PENDING (element)));
INFO_ELEMENT (GST_INFO_STATES, element, "changing bin's state from %s to %s", GST_INFO_ELEMENT (GST_CAT_STATES, element, "changing bin's state from %s to %s",
_gst_print_statename (GST_STATE (element)), _gst_print_statename (GST_STATE (element)),
_gst_print_statename (GST_STATE_PENDING (element))); _gst_print_statename (GST_STATE_PENDING (element)));
@ -250,16 +250,16 @@ gst_bin_change_state (GstElement *element)
children = bin->children; children = bin->children;
while (children) { while (children) {
child = GST_ELEMENT (children->data); child = GST_ELEMENT (children->data);
DEBUG("setting state on '%s'\n",gst_element_get_name (child)); GST_DEBUG (0,"setting state on '%s'\n",gst_element_get_name (child));
switch (gst_element_set_state (child, GST_STATE_PENDING (element))) { switch (gst_element_set_state (child, GST_STATE_PENDING (element))) {
case GST_STATE_FAILURE: case GST_STATE_FAILURE:
GST_STATE_PENDING (element) = GST_STATE_NONE_PENDING; GST_STATE_PENDING (element) = GST_STATE_NONE_PENDING;
DEBUG("child '%s' failed to go to state %d(%s)\n", gst_element_get_name (child), GST_DEBUG (0,"child '%s' failed to go to state %d(%s)\n", gst_element_get_name (child),
GST_STATE_PENDING (element), _gst_print_statename (GST_STATE_PENDING (element))); GST_STATE_PENDING (element), _gst_print_statename (GST_STATE_PENDING (element)));
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
break; break;
case GST_STATE_ASYNC: case GST_STATE_ASYNC:
DEBUG("child '%s' is changing state asynchronously\n", gst_element_get_name (child)); GST_DEBUG (0,"child '%s' is changing state asynchronously\n", gst_element_get_name (child));
break; break;
} }
// g_print("\n"); // g_print("\n");
@ -348,7 +348,7 @@ gst_bin_set_state_type (GstBin *bin,
{ {
GstBinClass *oclass; GstBinClass *oclass;
DEBUG("gst_bin_set_state_type(\"%s\",%d,%d)\n", GST_DEBUG (0,"gst_bin_set_state_type(\"%s\",%d,%d)\n",
gst_element_get_name (GST_ELEMENT (bin)), state,type); gst_element_get_name (GST_ELEMENT (bin)), state,type);
g_return_val_if_fail (bin != NULL, FALSE); g_return_val_if_fail (bin != NULL, FALSE);
@ -368,7 +368,7 @@ gst_bin_real_destroy (GtkObject *object)
GList *children; GList *children;
GstElement *child; GstElement *child;
DEBUG("in gst_bin_real_destroy()\n"); GST_DEBUG (0,"in gst_bin_real_destroy()\n");
children = bin->children; children = bin->children;
while (children) { while (children) {
@ -400,7 +400,7 @@ gst_bin_get_by_name (GstBin *bin,
g_return_val_if_fail (GST_IS_BIN (bin), NULL); g_return_val_if_fail (GST_IS_BIN (bin), NULL);
g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (name != NULL, NULL);
INFO_ELEMENT (GST_INFO_PARENTAGE, bin, "looking up child element %s", name); GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "looking up child element %s", name);
children = bin->children; children = bin->children;
while (children) { while (children) {
@ -449,7 +449,7 @@ gst_bin_save_thyself (GstElement *element,
childlist = xmlNewChild (parent,NULL,"children",NULL); childlist = xmlNewChild (parent,NULL,"children",NULL);
INFO_ELEMENT (GST_INFO_XML, bin, "saving %d children", bin->numchildren); GST_INFO_ELEMENT (GST_CAT_XML, bin, "saving %d children", bin->numchildren);
children = bin->children; children = bin->children;
while (children) { while (children) {
@ -473,7 +473,7 @@ gst_bin_restore_thyself (GstElement *element,
while (field) { while (field) {
if (!strcmp (field->name, "children")) { if (!strcmp (field->name, "children")) {
INFO_ELEMENT (GST_INFO_XML, element, "loading children"); GST_INFO_ELEMENT (GST_CAT_XML, element, "loading children");
childlist = field->childs; childlist = field->childs;
while (childlist) { while (childlist) {
if (!strcmp (childlist->name, "element")) { if (!strcmp (childlist->name, "element")) {
@ -510,14 +510,14 @@ gst_bin_iterate (GstBin *bin)
{ {
GstBinClass *oclass; GstBinClass *oclass;
DEBUG_ENTER("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin))); GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
oclass = GST_BIN_CLASS (GTK_OBJECT (bin)->klass); oclass = GST_BIN_CLASS (GTK_OBJECT (bin)->klass);
if (oclass->iterate) if (oclass->iterate)
(oclass->iterate) (bin); (oclass->iterate) (bin);
DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin))); GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
} }
/** /**
@ -572,34 +572,34 @@ gst_bin_create_plan_func (GstBin *bin)
GSList *pending = NULL; GSList *pending = NULL;
GstBin *pending_bin; GstBin *pending_bin;
DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin))); GST_DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
DEBUG_ENTER_STRING; GST_DEBUG_ENTER_STRING;
INFO_ELEMENT (GST_INFO_PLANNING, bin, "creating plan"); GST_INFO_ELEMENT (GST_CAT_PLANNING, bin, "creating plan");
// first figure out which element is the manager of this and all child elements // first figure out which element is the manager of this and all child elements
// if we're a managing bin ourselves, that'd be us // if we're a managing bin ourselves, that'd be us
if (GST_FLAG_IS_SET (bin, GST_BIN_FLAG_MANAGER)) { if (GST_FLAG_IS_SET (bin, GST_BIN_FLAG_MANAGER)) {
manager = GST_ELEMENT (bin); manager = GST_ELEMENT (bin);
DEBUG("setting manager to self\n"); GST_DEBUG (0,"setting manager to self\n");
// otherwise, it's what our parent says it is // otherwise, it's what our parent says it is
} else { } else {
manager = gst_element_get_manager (GST_ELEMENT (bin)); manager = gst_element_get_manager (GST_ELEMENT (bin));
if (!manager) { if (!manager) {
DEBUG("manager not set for element \"%s\" assuming manager is self\n", gst_element_get_name (GST_ELEMENT (bin))); GST_DEBUG (0,"manager not set for element \"%s\" assuming manager is self\n", gst_element_get_name (GST_ELEMENT (bin)));
manager = GST_ELEMENT (bin); manager = GST_ELEMENT (bin);
GST_FLAG_SET (bin, GST_BIN_FLAG_MANAGER); GST_FLAG_SET (bin, GST_BIN_FLAG_MANAGER);
} }
DEBUG("setting manager to \"%s\"\n", gst_element_get_name (manager)); GST_DEBUG (0,"setting manager to \"%s\"\n", gst_element_get_name (manager));
} }
// perform the first recursive pass of plan generation // perform the first recursive pass of plan generation
// we set the manager of every element but those who manage themselves // we set the manager of every element but those who manage themselves
// the need for cothreads is also determined recursively // the need for cothreads is also determined recursively
DEBUG("performing first-phase recursion\n"); GST_DEBUG (0,"performing first-phase recursion\n");
bin->need_cothreads = bin->use_cothreads; bin->need_cothreads = bin->use_cothreads;
if (bin->need_cothreads) if (bin->need_cothreads)
DEBUG("requiring cothreads because we're forced to\n"); GST_DEBUG (0,"requiring cothreads because we're forced to\n");
elements = bin->children; elements = bin->children;
while (elements) { while (elements) {
@ -608,35 +608,35 @@ gst_bin_create_plan_func (GstBin *bin)
#ifdef GST_DEBUG_ENABLED #ifdef GST_DEBUG_ENABLED
elementname = gst_element_get_name (element); elementname = gst_element_get_name (element);
#endif #endif
DEBUG("have element \"%s\"\n",elementname); GST_DEBUG (0,"have element \"%s\"\n",elementname);
// first set their manager // first set their manager
DEBUG("setting manager of \"%s\" to \"%s\"\n",elementname,gst_element_get_name(manager)); GST_DEBUG (0,"setting manager of \"%s\" to \"%s\"\n",elementname,gst_element_get_name(manager));
gst_element_set_manager (element, manager); gst_element_set_manager (element, manager);
// we do recursion and such for Bins // we do recursion and such for Bins
if (GST_IS_BIN (element)) { if (GST_IS_BIN (element)) {
// recurse into the child Bin // recurse into the child Bin
DEBUG("recursing into child Bin \"%s\"\n",elementname); GST_DEBUG (0,"recursing into child Bin \"%s\"\n",elementname);
gst_bin_create_plan (GST_BIN (element)); gst_bin_create_plan (GST_BIN (element));
// check to see if it needs cothreads and isn't self-managing // check to see if it needs cothreads and isn't self-managing
if (((GST_BIN (element))->need_cothreads) && !GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) { if (((GST_BIN (element))->need_cothreads) && !GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
DEBUG("requiring cothreads because child bin \"%s\" does\n",elementname); GST_DEBUG (0,"requiring cothreads because child bin \"%s\" does\n",elementname);
bin->need_cothreads = TRUE; bin->need_cothreads = TRUE;
} }
} else { } else {
// then we need to determine whether they need cothreads // then we need to determine whether they need cothreads
// if it's a loop-based element, use cothreads // if it's a loop-based element, use cothreads
if (element->loopfunc != NULL) { if (element->loopfunc != NULL) {
DEBUG("requiring cothreads because \"%s\" is a loop-based element\n",elementname); GST_DEBUG (0,"requiring cothreads because \"%s\" is a loop-based element\n",elementname);
GST_FLAG_SET (element, GST_ELEMENT_USE_COTHREAD); GST_FLAG_SET (element, GST_ELEMENT_USE_COTHREAD);
// if it's a 'complex' element, use cothreads // if it's a 'complex' element, use cothreads
} else if (GST_FLAG_IS_SET (element, GST_ELEMENT_COMPLEX)) { } else if (GST_FLAG_IS_SET (element, GST_ELEMENT_COMPLEX)) {
DEBUG("requiring cothreads because \"%s\" is complex\n",elementname); GST_DEBUG (0,"requiring cothreads because \"%s\" is complex\n",elementname);
GST_FLAG_SET (element, GST_ELEMENT_USE_COTHREAD); GST_FLAG_SET (element, GST_ELEMENT_USE_COTHREAD);
// if the element has more than one sink pad, use cothreads // if the element has more than one sink pad, use cothreads
} else if (element->numsinkpads > 1) { } else if (element->numsinkpads > 1) {
DEBUG("requiring cothreads because \"%s\" has more than one sink pad\n",elementname); GST_DEBUG (0,"requiring cothreads because \"%s\" has more than one sink pad\n",elementname);
GST_FLAG_SET (element, GST_ELEMENT_USE_COTHREAD); GST_FLAG_SET (element, GST_ELEMENT_USE_COTHREAD);
} }
if (GST_FLAG_IS_SET (element, GST_ELEMENT_USE_COTHREAD)) if (GST_FLAG_IS_SET (element, GST_ELEMENT_USE_COTHREAD))
@ -647,7 +647,7 @@ gst_bin_create_plan_func (GstBin *bin)
// if we're not a manager thread, we're done. // if we're not a manager thread, we're done.
if (!GST_FLAG_IS_SET (bin, GST_BIN_FLAG_MANAGER)) { if (!GST_FLAG_IS_SET (bin, GST_BIN_FLAG_MANAGER)) {
DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin))); GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
return; return;
} }
@ -658,7 +658,7 @@ gst_bin_create_plan_func (GstBin *bin)
// find all the managed children // find all the managed children
// here we pull off the trick of walking an entire arbitrary tree without recursion // here we pull off the trick of walking an entire arbitrary tree without recursion
DEBUG("attempting to find all the elements to manage\n"); GST_DEBUG (0,"attempting to find all the elements to manage\n");
pending = g_slist_prepend (pending, bin); pending = g_slist_prepend (pending, bin);
do { do {
// retrieve the top of the stack and pop it // retrieve the top of the stack and pop it
@ -666,7 +666,7 @@ gst_bin_create_plan_func (GstBin *bin)
pending = g_slist_remove (pending, pending_bin); pending = g_slist_remove (pending, pending_bin);
// walk the list of elements, find bins, and do stuff // walk the list of elements, find bins, and do stuff
DEBUG("checking Bin \"%s\" for managed elements\n", GST_DEBUG (0,"checking Bin \"%s\" for managed elements\n",
gst_element_get_name (GST_ELEMENT (pending_bin))); gst_element_get_name (GST_ELEMENT (pending_bin)));
elements = pending_bin->children; elements = pending_bin->children;
while (elements) { while (elements) {
@ -680,11 +680,11 @@ gst_bin_create_plan_func (GstBin *bin)
if (element->manager == GST_ELEMENT(bin)) { if (element->manager == GST_ELEMENT(bin)) {
// if it's a Bin, add it to the list of Bins to check // if it's a Bin, add it to the list of Bins to check
if (GST_IS_BIN (element)) { if (GST_IS_BIN (element)) {
DEBUG("flattened recurse into \"%s\"\n",elementname); GST_DEBUG (0,"flattened recurse into \"%s\"\n",elementname);
pending = g_slist_prepend (pending, element); pending = g_slist_prepend (pending, element);
// otherwise add it to the list of elements // otherwise add it to the list of elements
} else { } else {
DEBUG("found element \"%s\" that I manage\n",elementname); GST_DEBUG (0,"found element \"%s\" that I manage\n",elementname);
bin->managed_elements = g_list_prepend (bin->managed_elements, element); bin->managed_elements = g_list_prepend (bin->managed_elements, element);
bin->num_managed_elements++; bin->num_managed_elements++;
} }
@ -692,11 +692,11 @@ gst_bin_create_plan_func (GstBin *bin)
} }
} while (pending); } while (pending);
DEBUG("have %d elements to manage, implementing plan\n",bin->num_managed_elements); GST_DEBUG (0,"have %d elements to manage, implementing plan\n",bin->num_managed_elements);
gst_bin_schedule(bin); gst_bin_schedule(bin);
DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin))); GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
} }
static void static void
@ -710,8 +710,8 @@ gst_bin_iterate_func (GstBin *bin)
GstPad *pad; GstPad *pad;
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
DEBUG_SET_STRING("(\"%s\")", gst_element_get_name (GST_ELEMENT (bin))); GST_DEBUG_SET_STRING("(\"%s\")", gst_element_get_name (GST_ELEMENT (bin)));
DEBUG_ENTER_STRING; GST_DEBUG_ENTER_STRING;
g_return_if_fail (bin != NULL); g_return_if_fail (bin != NULL);
g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (GST_IS_BIN (bin));
@ -726,16 +726,16 @@ gst_bin_iterate_func (GstBin *bin)
if (chain->need_cothreads) { if (chain->need_cothreads) {
// all we really have to do is switch to the first child // all we really have to do is switch to the first child
// FIXME this should be lots more intelligent about where to start // FIXME this should be lots more intelligent about where to start
DEBUG("starting iteration via cothreads\n"); GST_DEBUG (0,"starting iteration via cothreads\n");
entry = GST_ELEMENT (chain->elements->data); entry = GST_ELEMENT (chain->elements->data);
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING); GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
DEBUG("set COTHREAD_STOPPING flag on \"%s\"(@%p)\n", GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
gst_element_get_name(entry),entry); gst_element_get_name(entry),entry);
cothread_switch (entry->threadstate); cothread_switch (entry->threadstate);
} else { } else {
DEBUG("starting iteration via chain-functions\n"); GST_DEBUG (0,"starting iteration via chain-functions\n");
entries = chain->entries; entries = chain->entries;
@ -745,7 +745,7 @@ gst_bin_iterate_func (GstBin *bin)
entry = GST_ELEMENT (entries->data); entry = GST_ELEMENT (entries->data);
entries = g_list_next (entries); entries = g_list_next (entries);
DEBUG("have entry \"%s\"\n",gst_element_get_name(entry)); GST_DEBUG (0,"have entry \"%s\"\n",gst_element_get_name(entry));
if (GST_IS_BIN (entry)) { if (GST_IS_BIN (entry)) {
gst_bin_iterate (GST_BIN (entry)); gst_bin_iterate (GST_BIN (entry));
@ -754,7 +754,7 @@ gst_bin_iterate_func (GstBin *bin)
while (pads) { while (pads) {
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
if (pad->direction == GST_PAD_SRC) { if (pad->direction == GST_PAD_SRC) {
DEBUG("calling getfunc of %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"calling getfunc of %s:%s\n",GST_DEBUG_PAD_NAME(pad));
if (pad->getfunc == NULL) if (pad->getfunc == NULL)
fprintf(stderr, "error, no getfunc in \"%s\"\n", gst_element_get_name (entry)); fprintf(stderr, "error, no getfunc in \"%s\"\n", gst_element_get_name (entry));
else else
@ -768,5 +768,5 @@ gst_bin_iterate_func (GstBin *bin)
} }
} }
DEBUG_LEAVE("(%s)", gst_element_get_name (GST_ELEMENT (bin))); GST_DEBUG_LEAVE("(%s)", gst_element_get_name (GST_ELEMENT (bin)));
} }

View file

@ -49,7 +49,7 @@ gst_buffer_new(void)
GstBuffer *buffer; GstBuffer *buffer;
buffer = g_mem_chunk_alloc (_gst_buffer_chunk); buffer = g_mem_chunk_alloc (_gst_buffer_chunk);
INFO(GST_INFO_BUFFER,"creating new buffer %p",buffer); GST_INFO (GST_CAT_BUFFER,"creating new buffer %p",buffer);
// g_print("allocating new mutex\n"); // g_print("allocating new mutex\n");
buffer->lock = g_mutex_new (); buffer->lock = g_mutex_new ();
@ -108,7 +108,7 @@ gst_buffer_create_sub (GstBuffer *parent,
g_return_val_if_fail ((offset+size) <= parent->size, NULL); g_return_val_if_fail ((offset+size) <= parent->size, NULL);
buffer = g_mem_chunk_alloc (_gst_buffer_chunk); buffer = g_mem_chunk_alloc (_gst_buffer_chunk);
INFO(GST_INFO_BUFFER,"creating new subbuffer %p from parent %p", buffer, parent); GST_INFO (GST_CAT_BUFFER,"creating new subbuffer %p from parent %p", buffer, parent);
buffer->lock = g_mutex_new (); buffer->lock = g_mutex_new ();
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
@ -163,7 +163,7 @@ gst_buffer_append (GstBuffer *buffer,
g_return_val_if_fail (append != NULL, NULL); g_return_val_if_fail (append != NULL, NULL);
g_return_val_if_fail (buffer->pool == NULL, NULL); g_return_val_if_fail (buffer->pool == NULL, NULL);
INFO(GST_INFO_BUFFER,"appending buffers %p and %p",buffer,append); GST_INFO (GST_CAT_BUFFER,"appending buffers %p and %p",buffer,append);
GST_BUFFER_LOCK (buffer); GST_BUFFER_LOCK (buffer);
// the buffer is not used by anyone else // the buffer is not used by anyone else
@ -202,7 +202,7 @@ void gst_buffer_destroy (GstBuffer *buffer)
g_return_if_fail (buffer != NULL); g_return_if_fail (buffer != NULL);
INFO(GST_INFO_BUFFER,"freeing %sbuffer %p", (buffer->parent?"sub":""),buffer); GST_INFO (GST_CAT_BUFFER,"freeing %sbuffer %p", (buffer->parent?"sub":""),buffer);
// free the data only if there is some, DONTFREE isn't set, and not sub // free the data only if there is some, DONTFREE isn't set, and not sub
if (GST_BUFFER_DATA (buffer) && if (GST_BUFFER_DATA (buffer) &&
@ -242,7 +242,7 @@ gst_buffer_ref (GstBuffer *buffer)
{ {
g_return_if_fail (buffer != NULL); g_return_if_fail (buffer != NULL);
DEBUG("referencing buffer %p\n", buffer); GST_DEBUG (0,"referencing buffer %p\n", buffer);
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
//g_return_if_fail(atomic_read(&(buffer->refcount)) > 0); //g_return_if_fail(atomic_read(&(buffer->refcount)) > 0);
@ -293,7 +293,7 @@ gst_buffer_unref (GstBuffer *buffer)
g_return_if_fail (buffer != NULL); g_return_if_fail (buffer != NULL);
DEBUG("unreferencing buffer %p\n", buffer); GST_DEBUG (0,"unreferencing buffer %p\n", buffer);
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
g_return_if_fail (atomic_read (&(buffer->refcount)) > 0); g_return_if_fail (atomic_read (&(buffer->refcount)) > 0);

View file

@ -39,7 +39,7 @@ gst_buffer_pool_new (void)
GstBufferPool *pool; GstBufferPool *pool;
pool = g_malloc (sizeof(GstBufferPool)); pool = g_malloc (sizeof(GstBufferPool));
DEBUG("BUF: allocating new buffer pool %p\n", pool); GST_DEBUG (0,"BUF: allocating new buffer pool %p\n", pool);
pool->new_buffer = NULL; pool->new_buffer = NULL;
pool->destroy_buffer = NULL; pool->destroy_buffer = NULL;

View file

@ -209,7 +209,7 @@ gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
g_return_val_if_fail (tocaps != NULL, FALSE); g_return_val_if_fail (tocaps != NULL, FALSE);
if (fromcaps->id != tocaps->id) { if (fromcaps->id != tocaps->id) {
DEBUG ("gstcaps: mime types wrong\n"); GST_DEBUG (0,"gstcaps: mime types wrong\n");
return FALSE; return FALSE;
} }
@ -218,13 +218,13 @@ gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
return gst_props_check_compatibility (fromcaps->properties, tocaps->properties); return gst_props_check_compatibility (fromcaps->properties, tocaps->properties);
} }
else { else {
DEBUG ("gstcaps: no source caps\n"); GST_DEBUG (0,"gstcaps: no source caps\n");
return FALSE; return FALSE;
} }
} }
else { else {
// assume it accepts everything // assume it accepts everything
DEBUG ("gstcaps: no caps\n"); GST_DEBUG (0,"gstcaps: no caps\n");
return TRUE; return TRUE;
} }
} }

View file

@ -71,7 +71,7 @@ void
gst_clock_register (GstClock *clock, GstObject *obj) gst_clock_register (GstClock *clock, GstObject *obj)
{ {
if ((GST_ELEMENT(obj))->numsrcpads == 0) { if ((GST_ELEMENT(obj))->numsrcpads == 0) {
DEBUG("gst_clock: setting registered sink object 0x%p\n", obj); GST_DEBUG (0,"gst_clock: setting registered sink object 0x%p\n", obj);
clock->sinkobjects = g_list_append (clock->sinkobjects, obj); clock->sinkobjects = g_list_append (clock->sinkobjects, obj);
clock->num++; clock->num++;
} }
@ -88,7 +88,7 @@ gst_clock_set (GstClock *clock, GstClockTime time)
g_mutex_lock (clock->lock); g_mutex_lock (clock->lock);
clock->start_time = now - time; clock->start_time = now - time;
g_mutex_unlock (clock->lock); g_mutex_unlock (clock->lock);
DEBUG("gst_clock: setting clock to %llu %llu %llu\n", time, now, clock->start_time); GST_DEBUG (0,"gst_clock: setting clock to %llu %llu %llu\n", time, now, clock->start_time);
} }
GstClockTimeDiff GstClockTimeDiff
@ -115,7 +115,7 @@ gst_clock_reset (GstClock *clock)
clock->start_time = ((guint64)tfnow.tv_sec)*1000000LL+tfnow.tv_usec; clock->start_time = ((guint64)tfnow.tv_sec)*1000000LL+tfnow.tv_usec;
clock->current_time = clock->start_time; clock->current_time = clock->start_time;
clock->adjust = 0LL; clock->adjust = 0LL;
DEBUG("gst_clock: setting start clock %llu\n", clock->start_time); GST_DEBUG (0,"gst_clock: setting start clock %llu\n", clock->start_time);
g_mutex_unlock (clock->lock); g_mutex_unlock (clock->lock);
} }
@ -133,7 +133,7 @@ gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
diff = GST_CLOCK_DIFF (time, now); diff = GST_CLOCK_DIFF (time, now);
// if we are not behind wait a bit // if we are not behind wait a bit
DEBUG("gst_clock: %s waiting for time %08llu %08llu %08lld\n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff); GST_DEBUG (0,"gst_clock: %s waiting for time %08llu %08llu %08lld\n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff);
g_mutex_unlock (clock->lock); g_mutex_unlock (clock->lock);
if (diff > 10000 ) { if (diff > 10000 ) {
@ -143,8 +143,8 @@ gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
if (!tfnow.tv_sec) { if (!tfnow.tv_sec) {
select(0, NULL, NULL, NULL, &tfnow); select(0, NULL, NULL, NULL, &tfnow);
} }
else DEBUG("gst_clock: %s waiting %u %llu %llu %llu seconds\n", gst_element_get_name(GST_ELEMENT(obj)), else GST_DEBUG (0,"gst_clock: %s waiting %u %llu %llu %llu seconds\n", gst_element_get_name(GST_ELEMENT(obj)),
(int)tfnow.tv_sec, now, diff, time); (int)tfnow.tv_sec, now, diff, time);
} }
DEBUG("gst_clock: %s waiting for time %08llu %08llu %08lld done \n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff); GST_DEBUG (0,"gst_clock: %s waiting for time %08llu %08llu %08lld done \n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff);
} }

View file

@ -69,7 +69,7 @@ _gst_cpu_initialize (void)
featurelist = stringcat(featurelist,"NONE"); featurelist = stringcat(featurelist,"NONE");
} }
GST_INFO (GST_INFO_GST_INIT, "CPU features: %s",featurelist); GST_INFO (GST_CAT_GST_INIT, "CPU features: %s",featurelist);
} }
GstCPUFlags GstCPUFlags

View file

@ -158,7 +158,7 @@ gst_element_add_pad (GstElement *element, GstPad *pad)
g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (GST_IS_PAD (pad));
/* set the pad's parent */ /* set the pad's parent */
DEBUG("setting parent of pad '%s'(%p) to '%s'(%p)\n", GST_DEBUG (0,"setting parent of pad '%s'(%p) to '%s'(%p)\n",
gst_pad_get_name(pad),pad,gst_element_get_name(element),element); gst_pad_get_name(pad),pad,gst_element_get_name(element),element);
gst_pad_set_parent (pad,GST_OBJECT (element)); gst_pad_set_parent (pad,GST_OBJECT (element));
@ -317,12 +317,12 @@ gst_element_connect (GstElement *src, gchar *srcpadname,
/* obtain the pads requested */ /* obtain the pads requested */
srcpad = gst_element_get_pad (src, srcpadname); srcpad = gst_element_get_pad (src, srcpadname);
if (srcpad == NULL) { if (srcpad == NULL) {
ERROR(src,"source element has no pad \"%s\"",srcpadname); GST_ERROR(src,"source element has no pad \"%s\"",srcpadname);
return; return;
} }
destpad = gst_element_get_pad (dest, destpadname); destpad = gst_element_get_pad (dest, destpadname);
if (srcpad == NULL) { if (srcpad == NULL) {
ERROR(dest,"destination element has no pad \"%s\"",destpadname); GST_ERROR(dest,"destination element has no pad \"%s\"",destpadname);
return; return;
} }
@ -332,7 +332,7 @@ gst_element_connect (GstElement *src, gchar *srcpadname,
/* have to make sure that they have the same parents... */ /* have to make sure that they have the same parents... */
if (srcparent != destparent) { if (srcparent != destparent) {
ERROR_OBJECT(srcparent,destparent,"%s and %s have different parents", GST_ERROR_OBJECT(srcparent,destparent,"%s and %s have different parents",
gst_element_get_name(src),gst_element_get_name(dest)); gst_element_get_name(src),gst_element_get_name(dest));
return; return;
} }
@ -404,7 +404,7 @@ gst_element_set_state (GstElement *element, GstElementState state)
/* if that outright didn't work, we need to bail right away */ /* if that outright didn't work, we need to bail right away */
/* NOTE: this will bail on ASYNC as well! */ /* NOTE: this will bail on ASYNC as well! */
if (return_val == GST_STATE_FAILURE) { if (return_val == GST_STATE_FAILURE) {
// DEBUG("have async return from '%s'\n",gst_element_get_name(element)); // GST_DEBUG (0,"have async return from '%s'\n",gst_element_get_name(element));
return return_val; return return_val;
} }
} }
@ -682,7 +682,7 @@ gst_element_load_thyself (xmlNodePtr parent,
g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (type != NULL, NULL); g_return_val_if_fail (type != NULL, NULL);
INFO(GST_INFO_XML,"loading \"%s\" of type \"%s\"\n", name, type); GST_INFO (GST_CAT_XML,"loading \"%s\" of type \"%s\"\n", name, type);
element = gst_elementfactory_make (type, name); element = gst_elementfactory_make (type, name);

View file

@ -68,7 +68,7 @@ gst_elementfactory_find (gchar *name)
g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail(name != NULL, NULL);
DEBUG("gstelementfactory: find \"%s\"\n", name); GST_DEBUG (0,"gstelementfactory: find \"%s\"\n", name);
walk = _gst_elementfactories; walk = _gst_elementfactories;
while (walk) { while (walk) {
@ -145,7 +145,7 @@ gst_elementfactory_create (GstElementFactory *factory,
g_return_val_if_fail(factory != NULL, NULL); g_return_val_if_fail(factory != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail(name != NULL, NULL);
DEBUG("gstelementfactory: create \"%s\" \"%s\"\n", factory->name, name); GST_DEBUG (0,"gstelementfactory: create \"%s\" \"%s\"\n", factory->name, name);
// it's not loaded, try to load the plugin // it's not loaded, try to load the plugin
if (factory->type == 0) { if (factory->type == 0) {
@ -162,7 +162,7 @@ gst_elementfactory_create (GstElementFactory *factory,
// attempt to set the elemenfactory class pointer if necessary // attempt to set the elemenfactory class pointer if necessary
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass); oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass);
if (oclass->elementfactory == NULL) { if (oclass->elementfactory == NULL) {
DEBUG ("gstelementfactory: class %s\n", factory->name); GST_DEBUG (0,"gstelementfactory: class %s\n", factory->name);
oclass->elementfactory = factory; oclass->elementfactory = factory;
} }
@ -191,7 +191,7 @@ gst_elementfactory_make (gchar *factoryname, gchar *name)
g_return_val_if_fail(factoryname != NULL, NULL); g_return_val_if_fail(factoryname != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail(name != NULL, NULL);
DEBUG("gstelementfactory: make \"%s\" \"%s\"\n", factoryname, name); GST_DEBUG (0,"gstelementfactory: make \"%s\" \"%s\"\n", factoryname, name);
//gst_plugin_load_elementfactory(factoryname); //gst_plugin_load_elementfactory(factoryname);
factory = gst_elementfactory_find(factoryname); factory = gst_elementfactory_find(factoryname);

View file

@ -74,7 +74,7 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
gchar *elementname = empty,*location = empty; gchar *elementname = empty,*location = empty;
if (debug_string == NULL) debug_string = ""; if (debug_string == NULL) debug_string = "";
if (category != GST_INFO_GST_INIT) if (category != GST_CAT_GST_INIT)
location = g_strdup_printf("%s:%d%s:",function,line,debug_string); location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
if (element && GST_IS_ELEMENT (element)) if (element && GST_IS_ELEMENT (element))
elementname = g_strdup_printf (" [%s]",gst_element_get_name (element)); elementname = g_strdup_printf (" [%s]",gst_element_get_name (element));
@ -98,8 +98,11 @@ gst_info_get_categories () {
} }
const gchar * const gchar *
gst_info_get_category_name (gint category) { gst_get_category_name (gint category) {
return _gst_info_category_strings[category]; if ((category >= 0) && (category < GST_CAT_MAX_CATEGORY))
return _gst_info_category_strings[category];
else
return NULL;
} }
void void

View file

@ -38,6 +38,8 @@
* DEBUG system * DEBUG system
**********************************************************************/ **********************************************************************/
extern guint32 _gst_debug_categories;
/* for include files that make too much noise normally */ /* for include files that make too much noise normally */
#ifdef GST_DEBUG_FORCE_DISABLE #ifdef GST_DEBUG_FORCE_DISABLE
#undef GST_DEBUG_ENABLED #undef GST_DEBUG_ENABLED
@ -47,6 +49,10 @@
#define GST_DEBUG_ENABLED #define GST_DEBUG_ENABLED
#endif #endif
#ifndef GST_DEBUG_ENABLE_CATEGORIES
#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000
#endif
/* fallback, this should probably be a 'weak' symbol or something */ /* fallback, this should probably be a 'weak' symbol or something */
G_GNUC_UNUSED static gchar *_debug_string = NULL; G_GNUC_UNUSED static gchar *_debug_string = NULL;
@ -54,27 +60,47 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
"DEBUG(%d:%d)" __PRETTY_FUNCTION__ ":%d" format , getpid() , cothread_getcurrent() , __LINE__ , ## args "DEBUG(%d:%d)" __PRETTY_FUNCTION__ ":%d" format , getpid() , cothread_getcurrent() , __LINE__ , ## args
#ifdef GST_DEBUG_ENABLED #ifdef GST_DEBUG_ENABLED
#define DEBUG(format,args...) \ #define GST_DEBUG(cat,format,args...) G_STMT_START{ \
(_debug_string != NULL) ? \ if (((1<<cat) & GST_DEBUG_ENABLE_CATEGORIES) && \
fprintf(stderr,GST_DEBUG_PREFIX("%s: "format , _debug_string , ## args )) : \ ((1<<cat) & _gst_debug_categories)) \
fprintf(stderr,GST_DEBUG_PREFIX(": "format , ## args )) (_debug_string != NULL) ? \
#define DEBUG_NOPREFIX(format,args...) fprintf(stderr,format , ## args ) fprintf(stderr,GST_DEBUG_PREFIX("%s: "format , _debug_string , ## args )) : \
#define DEBUG_ENTER(format, args...) \ fprintf(stderr,GST_DEBUG_PREFIX(": "format , ## args )); \
fprintf(stderr,GST_DEBUG_PREFIX(format": entering\n" , ## args )) }G_STMT_END
#define DEBUG_SET_STRING(format, args...) \
#define GST_DEBUG_NOPREFIX(cat,format,args...) G_STMT_START{ \
if (((1<<cat) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<cat) & _gst_debug_categories)) \
fprintf(stderr,format , ## args ); \
}G_STMT_END
#define GST_DEBUG_ENTER(format, args...) G_STMT_START{ \
if (((1<<31) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<31) & _gst_debug_categories)) \
fprintf(stderr,GST_DEBUG_PREFIX(format": entering\n" , ## args )); \
}G_STMT_END
#define GST_DEBUG_SET_STRING(format, args...) \
gchar *_debug_string = g_strdup_printf(format , ## args ) gchar *_debug_string = g_strdup_printf(format , ## args )
#define DEBUG_ENTER_STRING DEBUG_ENTER("%s",_debug_string)
#define DEBUG_LEAVE(format, args...) \ #define GST_DEBUG_ENTER_STRING GST_DEBUG_ENTER("%s",_debug_string)
if (_debug_string != NULL) g_free(_debug_string),\
fprintf(stderr,GST_DEBUG_PREFIX(format": leaving\n" , ## args )) #define GST_DEBUG_LEAVE(format, args...) G_STMT_START{ \
#define DEBUG_LEAVE_STRING DEBUG_LEAVE("%s",_debug_string) if (((1<<31) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<31) & _gst_debug_categories)) \
if (_debug_string != NULL) g_free(_debug_string),\
fprintf(stderr,GST_DEBUG_PREFIX(format": leaving\n" , ## args )); \
}G_STMT_END
#define GST_DEBUG_LEAVE_STRING GST_DEBUG_LEAVE("%s",_debug_string)
#else #else
#define DEBUG(format, args...) #define GST_DEBUG(format, args...)
#define DEBUG_NOPREFIX(format, args...) #define GST_DEBUG_NOPREFIX(format, args...)
#define DEBUG_ENTER(format, args...) #define GST_DEBUG_ENTER(format, args...)
#define DEBUG_LEAVE(format, args...) #define GST_DEBUG_LEAVE(format, args...)
#define DEBUG_SET_STRING(format, args...) #define GST_DEBUG_SET_STRING(format, args...)
#define DEBUG_ENTER_STRING #define GST_DEBUG_ENTER_STRING
#endif #endif
@ -189,53 +215,56 @@ extern guint32 _gst_info_categories;
#endif #endif
#ifdef GST_INFO_ENABLED #ifdef GST_INFO_ENABLED
#define INFO(cat,format,args...) G_STMT_START{ \ #define GST_INFO(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \ if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \ NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END }G_STMT_END
#define INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \ #define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \ if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \ element,g_strdup_printf( format , ## args )); \
}G_STMT_END }G_STMT_END
#else #else
#define INFO(cat,format,args...) #define GST_INFO(cat,format,args...)
#define INFO_ELEMENT(cat,element,format,args...) #define GST_INFO_ELEMENT(cat,element,format,args...)
#endif #endif
void gst_info_set_categories (guint32 categories); void gst_info_set_categories (guint32 categories);
guint32 gst_info_get_categories (void); guint32 gst_info_get_categories (void);
const gchar * gst_info_get_category_name (gint category);
void gst_info_enable_category (gint category); void gst_info_enable_category (gint category);
void gst_info_disable_category (gint category); void gst_info_disable_category (gint category);
const gchar * gst_get_category_name (gint category);
enum { enum {
GST_INFO_GST_INIT = 0, // Library initialization GST_CAT_GST_INIT = 0, // Library initialization
GST_INFO_COTHREADS, // Cothread creation, etc. GST_CAT_COTHREADS, // Cothread creation, etc.
GST_INFO_COTHREAD_SWITCH, // Cothread switching GST_CAT_COTHREAD_SWITCH, // Cothread switching
GST_INFO_AUTOPLUG, // Successful autoplug results GST_CAT_AUTOPLUG, // Successful autoplug results
GST_INFO_AUTOPLUG_ATTEMPT, // Attempted autoplug operations GST_CAT_AUTOPLUG_ATTEMPT, // Attempted autoplug operations
GST_INFO_PARENTAGE, // GstBin parentage issues GST_CAT_PARENTAGE, // GstBin parentage issues
GST_INFO_STATES, // State changes and such GST_CAT_STATES, // State changes and such
GST_INFO_PLANNING, // Plan generation GST_CAT_PLANNING, // Plan generation
GST_INFO_SCHEDULING, // Schedule construction GST_CAT_SCHEDULING, // Schedule construction
GST_INFO_OPERATION, // Events during actual data movement GST_CAT_OPERATION, // Events during actual data movement
GST_INFO_BUFFER, // Buffer creation/destruction GST_CAT_BUFFER, // Buffer creation/destruction
GST_INFO_CAPS, // Capabilities matching GST_CAT_CAPS, // Capabilities matching
GST_INFO_CLOCK, // Clocking GST_CAT_CLOCK, // Clocking
GST_INFO_ELEMENT_PADS, // Element pad management GST_CAT_ELEMENT_PADS, // Element pad management
GST_INFO_ELEMENTFACTORY, // Elementfactory stuff GST_CAT_ELEMENTFACTORY, // Elementfactory stuff
GST_INFO_PADS, // Pad creation/connection GST_CAT_PADS, // Pad creation/connection
GST_INFO_PIPELINE, // Pipeline stuff GST_CAT_PIPELINE, // Pipeline stuff
GST_INFO_PLUGIN_LOADING, // Plugin loading GST_CAT_PLUGIN_LOADING, // Plugin loading
GST_INFO_PLUGIN_ERRORS, // Errors during plugin loading GST_CAT_PLUGIN_ERRORS, // Errors during plugin loading
GST_INFO_PROPERTIES, // Properties GST_CAT_PROPERTIES, // Properties
GST_INFO_THREAD, // Thread creation/management GST_CAT_THREAD, // Thread creation/management
GST_INFO_TYPES, // Typing GST_CAT_TYPES, // Typing
GST_INFO_XML, // XML load/save of everything GST_CAT_XML, // XML load/save of everything
GST_CAT_MAX_CATEGORY,
}; };
@ -255,11 +284,11 @@ void gst_default_error_handler (gchar *file,gchar *function,
extern GstErrorHandler _gst_error_handler; extern GstErrorHandler _gst_error_handler;
#define ERROR(element,format,args...) \ #define GST_ERROR(element,format,args...) \
_gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
element,NULL,g_strdup_printf( format , ## args )) element,NULL,g_strdup_printf( format , ## args ))
#define ERROR_OBJECT(element,object,format,args...) \ #define GST_ERROR_OBJECT(element,object,format,args...) \
_gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
element,object,g_strdup_printf( format , ## args )) element,object,g_strdup_printf( format , ## args ))

View file

@ -117,7 +117,7 @@ void gst_object_set_parent(GstObject *object,GstObject *parent) {
g_return_if_fail(object != parent); g_return_if_fail(object != parent);
if (object->parent != NULL) { if (object->parent != NULL) {
ERROR_OBJECT(object,object->parent,"object's parent is already set, must unparent first"); GST_ERROR_OBJECT(object,object->parent,"object's parent is already set, must unparent first");
return; return;
} }

View file

@ -302,10 +302,10 @@ gst_pad_set_get_function (GstPad *pad,
g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (GST_IS_PAD (pad));
// the if and such should optimize out when DEBUG is off // the if and such should optimize out when DEBUG is off
DEBUG("setting get function for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"setting get function for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->getfunc = get; pad->getfunc = get;
DEBUG("getfunc for %s:%s(@%p) at %p is set to %p\n",GST_DEBUG_PAD_NAME(pad),pad,&pad->getfunc,get); GST_DEBUG (0,"getfunc for %s:%s(@%p) at %p is set to %p\n",GST_DEBUG_PAD_NAME(pad),pad,&pad->getfunc,get);
} }
/** /**
@ -322,7 +322,7 @@ gst_pad_set_getregion_function (GstPad *pad,
g_return_if_fail (pad != NULL); g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (GST_IS_PAD (pad));
DEBUG("gstpad: pad setting getregion function\n"); GST_DEBUG (0,"gstpad: pad setting getregion function\n");
pad->getregionfunc = getregion; pad->getregionfunc = getregion;
} }
@ -367,10 +367,10 @@ static void
gst_pad_push_func(GstPad *pad, GstBuffer *buf) gst_pad_push_func(GstPad *pad, GstBuffer *buf)
{ {
if (pad->peer->chainfunc != NULL) { if (pad->peer->chainfunc != NULL) {
DEBUG("calling chain function\n"); GST_DEBUG (0,"calling chain function\n");
(pad->peer->chainfunc)(pad,buf); (pad->peer->chainfunc)(pad,buf);
} else { } else {
DEBUG("got a problem here: default pad_push handler in place, no chain function\n"); GST_DEBUG (0,"got a problem here: default pad_push handler in place, no chain function\n");
} }
} }
@ -408,7 +408,7 @@ gst_pad_handle_qos(GstPad *pad,
GList *pads; GList *pads;
GstPad *target_pad; GstPad *target_pad;
DEBUG("gst_pad_handle_qos(\"%s\",%08ld)\n", GST_ELEMENT(pad->parent)->name,qos_message); GST_DEBUG (0,"gst_pad_handle_qos(\"%s\",%08ld)\n", GST_ELEMENT(pad->parent)->name,qos_message);
if (pad->qosfunc) { if (pad->qosfunc) {
(pad->qosfunc) (pad,qos_message); (pad->qosfunc) (pad,qos_message);
@ -417,7 +417,7 @@ gst_pad_handle_qos(GstPad *pad,
element = GST_ELEMENT (pad->peer->parent); element = GST_ELEMENT (pad->peer->parent);
pads = element->pads; pads = element->pads;
DEBUG("gst_pad_handle_qos recurse(\"%s\",%08ld)\n", element->name,qos_message); GST_DEBUG (0,"gst_pad_handle_qos recurse(\"%s\",%08ld)\n", element->name,qos_message);
while (pads) { while (pads) {
target_pad = GST_PAD (pads->data); target_pad = GST_PAD (pads->data);
if (target_pad->direction == GST_PAD_SINK) { if (target_pad->direction == GST_PAD_SINK) {
@ -495,7 +495,7 @@ gst_pad_connect (GstPad *srcpad,
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
} }
else { else {
DEBUG ("gstpad: connecting compatible pads (%s:%s) and (%s:%s)\n", GST_DEBUG (0,"gstpad: connecting compatible pads (%s:%s) and (%s:%s)\n",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
} }
@ -700,7 +700,7 @@ gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad)
} }
} }
else { else {
DEBUG ("gstpad: could not check capabilities of pads (%s:%s) and (%s:%s)\n", GST_DEBUG (0,"gstpad: could not check capabilities of pads (%s:%s) and (%s:%s)\n",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
return TRUE; return TRUE;
} }
@ -844,26 +844,26 @@ gst_pad_ghost_save_thyself (GstPad *pad,
#ifndef gst_pad_push #ifndef gst_pad_push
void gst_pad_push(GstPad *pad,GstBuffer *buf) { void gst_pad_push(GstPad *pad,GstBuffer *buf) {
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
if (pad->peer->pushfunc) { if (pad->peer->pushfunc) {
DEBUG("calling pushfunc &%s of peer pad %s:%s\n", GST_DEBUG (0,"calling pushfunc &%s of peer pad %s:%s\n",
GST_DEBUG_FUNCPTR_NAME(pad->peer->pushfunc),GST_DEBUG_PAD_NAME(pad->peer)); GST_DEBUG_FUNCPTR_NAME(pad->peer->pushfunc),GST_DEBUG_PAD_NAME(pad->peer));
(pad->peer->pushfunc)(pad->peer,buf); (pad->peer->pushfunc)(pad->peer,buf);
} else } else
DEBUG("no pushfunc\n"); GST_DEBUG (0,"no pushfunc\n");
} }
#endif #endif
#ifndef gst_pad_pull #ifndef gst_pad_pull
GstBuffer *gst_pad_pull(GstPad *pad) { GstBuffer *gst_pad_pull(GstPad *pad) {
GstPad *peer = pad->peer; GstPad *peer = pad->peer;
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
if (peer->pullfunc) { if (peer->pullfunc) {
DEBUG("calling pullfunc &%s (@%p) of peer pad %s:%s\n", GST_DEBUG (0,"calling pullfunc &%s (@%p) of peer pad %s:%s\n",
GST_DEBUG_FUNCPTR_NAME(peer->pullfunc),&peer->pullfunc,GST_DEBUG_PAD_NAME(peer)); GST_DEBUG_FUNCPTR_NAME(peer->pullfunc),&peer->pullfunc,GST_DEBUG_PAD_NAME(peer));
return (peer->pullfunc)(peer); return (peer->pullfunc)(peer);
} else { } else {
DEBUG("no pullfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(peer),&peer->pullfunc); GST_DEBUG (0,"no pullfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(peer),&peer->pullfunc);
return NULL; return NULL;
} }
} }
@ -871,13 +871,13 @@ GstBuffer *gst_pad_pull(GstPad *pad) {
#ifndef gst_pad_pullregion #ifndef gst_pad_pullregion
GstBuffer *gst_pad_pullregion(GstPad *pad,gulong offset,gulong size) { GstBuffer *gst_pad_pullregion(GstPad *pad,gulong offset,gulong size) {
DEBUG_ENTER("(%s:%s,%ld,%ld)",GST_DEBUG_PAD_NAME(pad),offset,size); GST_DEBUG_ENTER("(%s:%s,%ld,%ld)",GST_DEBUG_PAD_NAME(pad),offset,size);
if (pad->peer->pullregionfunc) { if (pad->peer->pullregionfunc) {
DEBUG("calling pullregionfunc &%s of peer pad %s:%s\n", GST_DEBUG (0,"calling pullregionfunc &%s of peer pad %s:%s\n",
GST_DEBUG_FUNCPTR_NAME(pad->peer->pullregionfunc),GST_DEBUG_PAD_NAME(pad->peer)); GST_DEBUG_FUNCPTR_NAME(pad->peer->pullregionfunc),GST_DEBUG_PAD_NAME(pad->peer));
return (pad->peer->pullregionfunc)(pad->peer,offset,size); return (pad->peer->pullregionfunc)(pad->peer,offset,size);
} else { } else {
DEBUG("no pullregionfunc\n"); GST_DEBUG (0,"no pullregionfunc\n");
return NULL; return NULL;
} }
} }
@ -1050,7 +1050,7 @@ gst_pad_eos_func(GstPad *pad)
g_return_val_if_fail (pad != NULL, FALSE); g_return_val_if_fail (pad != NULL, FALSE);
g_return_val_if_fail (GST_IS_PAD(pad), FALSE); g_return_val_if_fail (GST_IS_PAD(pad), FALSE);
INFO(GST_INFO_PADS,"attempting to set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_INFO (GST_CAT_PADS,"attempting to set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad));
element = GST_ELEMENT(gst_pad_get_parent (pad)); element = GST_ELEMENT(gst_pad_get_parent (pad));
// g_return_val_if_fail (element != NULL, FALSE); // g_return_val_if_fail (element != NULL, FALSE);
@ -1069,7 +1069,7 @@ gst_pad_eos_func(GstPad *pad)
if (result == FALSE) return FALSE; if (result == FALSE) return FALSE;
INFO(GST_INFO_PADS,"set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_INFO (GST_CAT_PADS,"set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad));
GST_FLAG_SET (pad, GST_PAD_EOS); GST_FLAG_SET (pad, GST_PAD_EOS);
return TRUE; return TRUE;
@ -1082,11 +1082,11 @@ gst_pad_set_eos(GstPad *pad)
g_return_val_if_fail (GST_IS_PAD(pad), FALSE); g_return_val_if_fail (GST_IS_PAD(pad), FALSE);
g_return_val_if_fail (GST_PAD_CONNECTED(pad), FALSE); g_return_val_if_fail (GST_PAD_CONNECTED(pad), FALSE);
INFO(GST_INFO_PADS,"attempting to set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_INFO (GST_CAT_PADS,"attempting to set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad));
if (!gst_pad_eos(pad)) return FALSE; if (!gst_pad_eos(pad)) return FALSE;
INFO(GST_INFO_PADS,"set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_INFO (GST_CAT_PADS,"set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad));
GST_FLAG_SET (pad, GST_PAD_EOS); GST_FLAG_SET (pad, GST_PAD_EOS);
return TRUE; return TRUE;

View file

@ -125,14 +125,14 @@ gst_pipeline_new (guchar *name)
static void static void
gst_pipeline_prepare (GstPipeline *pipeline) gst_pipeline_prepare (GstPipeline *pipeline)
{ {
DEBUG("GstPipeline: preparing pipeline \"%s\" for playing\n", GST_DEBUG (0,"GstPipeline: preparing pipeline \"%s\" for playing\n",
gst_element_get_name(GST_ELEMENT(pipeline))); gst_element_get_name(GST_ELEMENT(pipeline)));
} }
static void static void
gst_pipeline_have_type (GstElement *sink, GstElement *sink2, gpointer data) gst_pipeline_have_type (GstElement *sink, GstElement *sink2, gpointer data)
{ {
DEBUG("GstPipeline: pipeline have type %p\n", (gboolean *)data); GST_DEBUG (0,"GstPipeline: pipeline have type %p\n", (gboolean *)data);
*(gboolean *)data = TRUE; *(gboolean *)data = TRUE;
} }
@ -144,7 +144,7 @@ gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
GstElement *typefind; GstElement *typefind;
GstCaps *caps = NULL; GstCaps *caps = NULL;
DEBUG("GstPipeline: typefind for element \"%s\" %p\n", GST_DEBUG (0,"GstPipeline: typefind for element \"%s\" %p\n",
gst_element_get_name(element), &found); gst_element_get_name(element), &found);
typefind = gst_elementfactory_make ("typefind", "typefind"); typefind = gst_elementfactory_make ("typefind", "typefind");
@ -189,7 +189,7 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
GList *sinkpads; GList *sinkpads;
gboolean connected = FALSE; gboolean connected = FALSE;
DEBUG("gstpipeline: autoplug pad connect function for \"%s\" to \"%s\"\n", GST_DEBUG (0,"gstpipeline: autoplug pad connect function for \"%s\" to \"%s\"\n",
gst_element_get_name(src), gst_element_get_name(sink)); gst_element_get_name(src), gst_element_get_name(sink));
sinkpads = gst_element_get_pad_list(sink); sinkpads = gst_element_get_pad_list(sink);
@ -202,9 +202,9 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
{ {
if (gst_caps_list_check_compatibility (pad->caps, sinkpad->caps)) { if (gst_caps_list_check_compatibility (pad->caps, sinkpad->caps)) {
gst_pad_connect(pad, sinkpad); gst_pad_connect(pad, sinkpad);
DEBUG("gstpipeline: autoconnect pad \"%s\" in element %s <-> ", pad->name, GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", pad->name,
gst_element_get_name(src)); gst_element_get_name(src));
DEBUG("pad \"%s\" in element %s\n", sinkpad->name, GST_DEBUG (0,"pad \"%s\" in element %s\n", sinkpad->name,
gst_element_get_name(sink)); gst_element_get_name(sink));
connected = TRUE; connected = TRUE;
break; break;
@ -214,7 +214,7 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
} }
if (!connected) { if (!connected) {
DEBUG("gstpipeline: no path to sinks for type\n"); GST_DEBUG (0,"gstpipeline: no path to sinks for type\n");
} }
return connected; return connected;
} }
@ -237,7 +237,7 @@ gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink)
} }
if (!connected) { if (!connected) {
DEBUG("gstpipeline: delaying pad connections for \"%s\" to \"%s\"\n", GST_DEBUG (0,"gstpipeline: delaying pad connections for \"%s\" to \"%s\"\n",
gst_element_get_name(src), gst_element_get_name(sink)); gst_element_get_name(src), gst_element_get_name(sink));
gtk_signal_connect(GTK_OBJECT(src),"new_pad", gtk_signal_connect(GTK_OBJECT(src),"new_pad",
GTK_SIGNAL_FUNC(gst_pipeline_pads_autoplug_func), sink); GTK_SIGNAL_FUNC(gst_pipeline_pads_autoplug_func), sink);
@ -315,28 +315,28 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
g_return_val_if_fail(pipeline != NULL, FALSE); g_return_val_if_fail(pipeline != NULL, FALSE);
g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE); g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE);
DEBUG("GstPipeline: autopluging pipeline \"%s\"\n", GST_DEBUG (0,"GstPipeline: autopluging pipeline \"%s\"\n",
gst_element_get_name(GST_ELEMENT(pipeline))); gst_element_get_name(GST_ELEMENT(pipeline)));
// fase 1, run typedetect on the source if needed... // fase 1, run typedetect on the source if needed...
if (!pipeline->src) { if (!pipeline->src) {
DEBUG("GstPipeline: no source detected, can't autoplug pipeline \"%s\"\n", GST_DEBUG (0,"GstPipeline: no source detected, can't autoplug pipeline \"%s\"\n",
gst_element_get_name(GST_ELEMENT(pipeline))); gst_element_get_name(GST_ELEMENT(pipeline)));
return FALSE; return FALSE;
} }
DEBUG("GstPipeline: source \"%s\" has no MIME type, running typefind...\n", GST_DEBUG (0,"GstPipeline: source \"%s\" has no MIME type, running typefind...\n",
gst_element_get_name(pipeline->src)); gst_element_get_name(pipeline->src));
src_caps = gst_pipeline_typefind(pipeline, pipeline->src); src_caps = gst_pipeline_typefind(pipeline, pipeline->src);
if (src_caps) { if (src_caps) {
DEBUG("GstPipeline: source \"%s\" type found %d\n", gst_element_get_name(pipeline->src), GST_DEBUG (0,"GstPipeline: source \"%s\" type found %d\n", gst_element_get_name(pipeline->src),
src_caps->id); src_caps->id);
} }
else { else {
DEBUG("GstPipeline: source \"%s\" has no type\n", gst_element_get_name(pipeline->src)); GST_DEBUG (0,"GstPipeline: source \"%s\" has no type\n", gst_element_get_name(pipeline->src));
return FALSE; return FALSE;
} }
@ -378,7 +378,7 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
} }
factory = (GstElementFactory *)(factories[0]->data); factory = (GstElementFactory *)(factories[0]->data);
DEBUG("common factory \"%s\"\n", factory->name); GST_DEBUG (0,"common factory \"%s\"\n", factory->name);
element = gst_elementfactory_create(factory, factory->name); element = gst_elementfactory_create(factory, factory->name);
gst_bin_add(GST_BIN(pipeline), element); gst_bin_add(GST_BIN(pipeline), element);
@ -412,7 +412,7 @@ differ:
if (factories[i]) { if (factories[i]) {
factory = (GstElementFactory *)(factories[i]->data); factory = (GstElementFactory *)(factories[i]->data);
DEBUG("factory \"%s\"\n", factory->name); GST_DEBUG (0,"factory \"%s\"\n", factory->name);
element = gst_elementfactory_create(factory, factory->name); element = gst_elementfactory_create(factory, factory->name);
factories[i] = g_list_next(factories[i]); factories[i] = g_list_next(factories[i]);
} }
@ -430,11 +430,11 @@ differ:
use_thread = FALSE; use_thread = FALSE;
DEBUG("sugest new thread for \"%s\" %08x\n", element->name, GST_FLAGS(element)); GST_DEBUG (0,"sugest new thread for \"%s\" %08x\n", element->name, GST_FLAGS(element));
// create a new queue and add to the previous bin // create a new queue and add to the previous bin
queue = gst_elementfactory_make("queue", g_strconcat("queue_", gst_element_get_name(element), NULL)); queue = gst_elementfactory_make("queue", g_strconcat("queue_", gst_element_get_name(element), NULL));
DEBUG("adding element \"%s\"\n", element->name); GST_DEBUG (0,"adding element \"%s\"\n", element->name);
gst_bin_add(GST_BIN(thebin), queue); gst_bin_add(GST_BIN(thebin), queue);
// this will be the new bin for all following elements // this will be the new bin for all following elements
@ -460,15 +460,15 @@ differ:
} }
gst_pipeline_pads_autoplug(thesrcelement, queue); gst_pipeline_pads_autoplug(thesrcelement, queue);
DEBUG("adding element %s\n", gst_element_get_name (element)); GST_DEBUG (0,"adding element %s\n", gst_element_get_name (element));
gst_bin_add(GST_BIN(thebin), element); gst_bin_add(GST_BIN(thebin), element);
DEBUG("adding element %s\n", gst_element_get_name (thebin)); GST_DEBUG (0,"adding element %s\n", gst_element_get_name (thebin));
gst_bin_add(GST_BIN(pipeline), thebin); gst_bin_add(GST_BIN(pipeline), thebin);
thesrcelement = queue; thesrcelement = queue;
} }
// no thread needed, easy case // no thread needed, easy case
else { else {
DEBUG("adding element %s\n", gst_element_get_name (element)); GST_DEBUG (0,"adding element %s\n", gst_element_get_name (element));
gst_bin_add(GST_BIN(thebin), element); gst_bin_add(GST_BIN(thebin), element);
} }
gst_pipeline_pads_autoplug(thesrcelement, element); gst_pipeline_pads_autoplug(thesrcelement, element);
@ -482,7 +482,7 @@ next:
} }
return TRUE; return TRUE;
DEBUG("GstPipeline: unable to autoplug pipeline \"%s\"\n", GST_DEBUG (0,"GstPipeline: unable to autoplug pipeline \"%s\"\n",
gst_element_get_name(GST_ELEMENT(pipeline))); gst_element_get_name(GST_ELEMENT(pipeline)));
return FALSE; return FALSE;
} }

View file

@ -143,7 +143,7 @@ gst_plugin_load_all(void)
gst_plugin_load_recurse(path->data,NULL); gst_plugin_load_recurse(path->data,NULL);
path = g_list_next(path); path = g_list_next(path);
} }
INFO(GST_INFO_PLUGIN_LOADING,"loaded %d plugins with %d elements and %d types", GST_INFO (GST_CAT_PLUGIN_LOADING,"loaded %d plugins with %d elements and %d types",
_gst_plugins_seqno,_gst_plugin_elementfactories,_gst_plugin_types); _gst_plugins_seqno,_gst_plugin_elementfactories,_gst_plugin_types);
} }
@ -264,7 +264,7 @@ gst_plugin_load_absolute (gchar *name)
if (module != NULL) { if (module != NULL) {
if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) { if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) {
if ((plugin = (initfunc)(module))) { if ((plugin = (initfunc)(module))) {
INFO(GST_INFO_PLUGIN_LOADING,"plugin \"%s\" loaded: %d elements, %d types", GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" loaded: %d elements, %d types",
plugin->name,plugin->numelements,plugin->numtypes); plugin->name,plugin->numelements,plugin->numtypes);
plugin->filename = g_strdup(name); plugin->filename = g_strdup(name);
plugin->loaded = TRUE; plugin->loaded = TRUE;
@ -420,10 +420,10 @@ gst_plugin_load_elementfactory (gchar *name)
gchar *filename = g_strdup (plugin->filename); gchar *filename = g_strdup (plugin->filename);
gchar *pluginname = g_strdup (plugin->name); gchar *pluginname = g_strdup (plugin->name);
INFO(GST_INFO_PLUGIN_LOADING,"loaded elementfactory %s from plugin %s",name,plugin->name); GST_INFO (GST_CAT_PLUGIN_LOADING,"loaded elementfactory %s from plugin %s",name,plugin->name);
gst_plugin_remove(plugin); gst_plugin_remove(plugin);
if (!gst_plugin_load_absolute(filename)) { if (!gst_plugin_load_absolute(filename)) {
DEBUG("gstplugin: error loading element factory %s from plugin %s\n", name, pluginname); GST_DEBUG (0,"gstplugin: error loading element factory %s from plugin %s\n", name, pluginname);
} }
g_free (pluginname); g_free (pluginname);
g_free (filename); g_free (filename);
@ -467,11 +467,11 @@ gst_plugin_load_typefactory (gchar *mime)
gchar *filename = g_strdup (plugin->filename); gchar *filename = g_strdup (plugin->filename);
gchar *pluginname = g_strdup (plugin->name); gchar *pluginname = g_strdup (plugin->name);
INFO(GST_INFO_PLUGIN_LOADING,"loading type factory for \"%s\" from plugin %s",mime,plugin->name); GST_INFO (GST_CAT_PLUGIN_LOADING,"loading type factory for \"%s\" from plugin %s",mime,plugin->name);
plugin->loaded = TRUE; plugin->loaded = TRUE;
gst_plugin_remove(plugin); gst_plugin_remove(plugin);
if (!gst_plugin_load_absolute(filename)) { if (!gst_plugin_load_absolute(filename)) {
DEBUG("gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, pluginname); GST_DEBUG (0,"gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, pluginname);
} }
g_free (filename); g_free (filename);
g_free (pluginname); g_free (pluginname);
@ -644,6 +644,6 @@ gst_plugin_load_thyself (xmlNodePtr parent)
kinderen = kinderen->next; kinderen = kinderen->next;
} }
INFO(GST_INFO_PLUGIN_LOADING,"added %d registered factories and %d types",elementcount,typecount); GST_INFO (GST_CAT_PLUGIN_LOADING,"added %d registered factories and %d types",elementcount,typecount);
} }

View file

@ -216,7 +216,7 @@ gst_props_new (GstPropsFactoryEntry entry, ...)
GstProps *props; GstProps *props;
#define add_value(value) {\ #define add_value(value) {\
DEBUG ("%d %p\n", i, value);\ GST_DEBUG (0,"%d %p\n", i, value);\
factory[i++] = value; \ factory[i++] = value; \
if (i >= size) { \ if (i >= size) { \
size += 16; \ size += 16; \
@ -325,7 +325,7 @@ gst_props_entry_check_list_compatibility (GstPropsEntry *entry1, GstPropsEntry *
static gboolean static gboolean
gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2) gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2)
{ {
DEBUG ("compare: %s %s\n", g_quark_to_string (entry1->propid), GST_DEBUG (0,"compare: %s %s\n", g_quark_to_string (entry1->propid),
g_quark_to_string (entry2->propid)); g_quark_to_string (entry2->propid));
switch (entry1->propstype) { switch (entry1->propstype) {
case GST_PROPS_LIST_ID_NUM: case GST_PROPS_LIST_ID_NUM:
@ -432,14 +432,14 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops)
entry2 = (GstPropsEntry *)sinklist->data; entry2 = (GstPropsEntry *)sinklist->data;
while (entry1->propid < entry2->propid) { while (entry1->propid < entry2->propid) {
DEBUG ("source is more specific in \"%s\"\n", g_quark_to_string (entry1->propid)); GST_DEBUG (0,"source is more specific in \"%s\"\n", g_quark_to_string (entry1->propid));
more++; more++;
sourcelist = g_slist_next (sourcelist); sourcelist = g_slist_next (sourcelist);
if (sourcelist) entry1 = (GstPropsEntry *)sourcelist->data; if (sourcelist) entry1 = (GstPropsEntry *)sourcelist->data;
else goto end; else goto end;
} }
while (entry1->propid > entry2->propid) { while (entry1->propid > entry2->propid) {
DEBUG ("source has missing property \"%s\"\n", g_quark_to_string (entry2->propid)); GST_DEBUG (0,"source has missing property \"%s\"\n", g_quark_to_string (entry2->propid));
missing++; missing++;
sinklist = g_slist_next (sinklist); sinklist = g_slist_next (sinklist);
if (sinklist) entry2 = (GstPropsEntry *)sinklist->data; if (sinklist) entry2 = (GstPropsEntry *)sinklist->data;
@ -455,7 +455,7 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops)
GstPropsEntry *entry2; GstPropsEntry *entry2;
entry2 = (GstPropsEntry *)sinklist->data; entry2 = (GstPropsEntry *)sinklist->data;
missing++; missing++;
DEBUG ("source has missing property \"%s\"\n", g_quark_to_string (entry2->propid)); GST_DEBUG (0,"source has missing property \"%s\"\n", g_quark_to_string (entry2->propid));
} }
end: end:

View file

@ -32,17 +32,17 @@ gst_bin_loopfunc_wrapper (int argc,char *argv[])
GstElement *element = GST_ELEMENT (argv); GstElement *element = GST_ELEMENT (argv);
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element); G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
DEBUG_ENTER("(%d,'%s')",argc,name); GST_DEBUG_ENTER("(%d,'%s')",argc,name);
do { do {
DEBUG("calling loopfunc %s for element %s\n", GST_DEBUG (0,"calling loopfunc %s for element %s\n",
GST_DEBUG_FUNCPTR_NAME (element->loopfunc),name); GST_DEBUG_FUNCPTR_NAME (element->loopfunc),name);
(element->loopfunc) (element); (element->loopfunc) (element);
DEBUG("element %s ended loop function\n", name); GST_DEBUG (0,"element %s ended loop function\n", name);
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING); GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
DEBUG_LEAVE("(%d,'%s')",argc,name); GST_DEBUG_LEAVE("(%d,'%s')",argc,name);
return 0; return 0;
} }
@ -55,25 +55,25 @@ gst_bin_chain_wrapper (int argc,char *argv[])
GstPad *pad; GstPad *pad;
GstBuffer *buf; GstBuffer *buf;
DEBUG_ENTER("(\"%s\")",name); GST_DEBUG_ENTER("(\"%s\")",name);
DEBUG("stepping through pads\n"); GST_DEBUG (0,"stepping through pads\n");
do { do {
pads = element->pads; pads = element->pads;
while (pads) { while (pads) {
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
pads = g_list_next (pads); pads = g_list_next (pads);
if (pad->direction == GST_PAD_SINK) { if (pad->direction == GST_PAD_SINK) {
DEBUG("pulling a buffer from %s:%s\n", name, gst_pad_get_name (pad)); GST_DEBUG (0,"pulling a buffer from %s:%s\n", name, gst_pad_get_name (pad));
buf = gst_pad_pull (pad); buf = gst_pad_pull (pad);
DEBUG("calling chain function of %s:%s\n", name, gst_pad_get_name (pad)); GST_DEBUG (0,"calling chain function of %s:%s\n", name, gst_pad_get_name (pad));
(pad->chainfunc) (pad,buf); (pad->chainfunc) (pad,buf);
DEBUG("calling chain function of %s:%s done\n", name, gst_pad_get_name (pad)); GST_DEBUG (0,"calling chain function of %s:%s done\n", name, gst_pad_get_name (pad));
} }
} }
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING); GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
DEBUG_LEAVE("(%d,'%s')",argc,name); GST_DEBUG_LEAVE("(%d,'%s')",argc,name);
return 0; return 0;
} }
@ -86,7 +86,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
GstBuffer *buf; GstBuffer *buf;
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element); G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
DEBUG_ENTER("(%d,\"%s\")",argc,name); GST_DEBUG_ENTER("(%d,\"%s\")",argc,name);
do { do {
pads = element->pads; pads = element->pads;
@ -94,7 +94,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
if (pad->direction == GST_PAD_SRC) { if (pad->direction == GST_PAD_SRC) {
// region_struct *region = cothread_get_data (element->threadstate, "region"); // region_struct *region = cothread_get_data (element->threadstate, "region");
DEBUG("calling _getfunc for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"calling _getfunc for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
// if (region) { // if (region) {
//gst_src_push_region (GST_SRC (element), region->offset, region->size); //gst_src_push_region (GST_SRC (element), region->offset, region->size);
// if (pad->getregionfunc == NULL) // if (pad->getregionfunc == NULL)
@ -106,7 +106,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
buf = (pad->getfunc)(pad); buf = (pad->getfunc)(pad);
// } // }
DEBUG("calling gst_pad_push on pad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"calling gst_pad_push on pad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
gst_pad_push (pad, buf); gst_pad_push (pad, buf);
} }
pads = g_list_next(pads); pads = g_list_next(pads);
@ -114,7 +114,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING); GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
DEBUG_LEAVE(""); GST_DEBUG_LEAVE("");
return 0; return 0;
} }
@ -122,12 +122,12 @@ static void
gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf) gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
{ {
cothread_state *threadstate = GST_ELEMENT(pad->parent)->threadstate; cothread_state *threadstate = GST_ELEMENT(pad->parent)->threadstate;
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
DEBUG("putting buffer %p in peer's pen\n",buf); GST_DEBUG (0,"putting buffer %p in peer's pen\n",buf);
pad->peer->bufpen = buf; pad->peer->bufpen = buf;
DEBUG("switching to %p (@%p)\n",threadstate,&(GST_ELEMENT(pad->parent)->threadstate)); GST_DEBUG (0,"switching to %p (@%p)\n",threadstate,&(GST_ELEMENT(pad->parent)->threadstate));
cothread_switch (threadstate); cothread_switch (threadstate);
DEBUG("done switching\n"); GST_DEBUG (0,"done switching\n");
} }
static GstBuffer* static GstBuffer*
@ -136,12 +136,12 @@ gst_bin_pullfunc_proxy (GstPad *pad)
GstBuffer *buf; GstBuffer *buf;
cothread_state *threadstate = GST_ELEMENT(pad->parent)->threadstate; cothread_state *threadstate = GST_ELEMENT(pad->parent)->threadstate;
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
if (pad->bufpen == NULL) { if (pad->bufpen == NULL) {
DEBUG("switching to %p (@%p)\n",threadstate,&(GST_ELEMENT(pad->parent)->threadstate)); GST_DEBUG (0,"switching to %p (@%p)\n",threadstate,&(GST_ELEMENT(pad->parent)->threadstate));
cothread_switch (threadstate); cothread_switch (threadstate);
} }
DEBUG("done switching\n"); GST_DEBUG (0,"done switching\n");
buf = pad->bufpen; buf = pad->bufpen;
pad->bufpen = NULL; pad->bufpen = NULL;
return buf; return buf;
@ -164,7 +164,7 @@ gst_bin_pullregionfunc_proxy (GstPad *pad,
// region_struct region; // region_struct region;
cothread_state *threadstate; cothread_state *threadstate;
DEBUG_ENTER("%s:%s,%ld,%ld",GST_DEBUG_PAD_NAME(pad),offset,size); GST_DEBUG_ENTER("%s:%s,%ld,%ld",GST_DEBUG_PAD_NAME(pad),offset,size);
// region.offset = offset; // region.offset = offset;
// region.size = size; // region.size = size;
@ -184,11 +184,11 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
DEBUG("chain is using cothreads\n"); GST_DEBUG (0,"chain is using cothreads\n");
// first create thread context // first create thread context
if (bin->threadcontext == NULL) { if (bin->threadcontext == NULL) {
DEBUG("initializing cothread context\n"); GST_DEBUG (0,"initializing cothread context\n");
bin->threadcontext = cothread_init (); bin->threadcontext = cothread_init ();
} }
@ -204,7 +204,7 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if the element has a loopfunc... // if the element has a loopfunc...
if (element->loopfunc != NULL) { if (element->loopfunc != NULL) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
DEBUG("\nelement '%s' is a loop-based\n",gst_element_get_name(element)); GST_DEBUG (0,"\nelement '%s' is a loop-based\n",gst_element_get_name(element));
} else { } else {
// otherwise we need to decide what kind of cothread // otherwise we need to decide what kind of cothread
// if it's not DECOUPLED, we decide based on whether it's a source or not // if it's not DECOUPLED, we decide based on whether it's a source or not
@ -212,10 +212,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if it doesn't have any sinks, it must be a source (duh) // if it doesn't have any sinks, it must be a source (duh)
if (element->numsinkpads == 0) { if (element->numsinkpads == 0) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper);
DEBUG("\nelement '%s' is a source, using _src_wrapper\n",gst_element_get_name(element)); GST_DEBUG (0,"\nelement '%s' is a source, using _src_wrapper\n",gst_element_get_name(element));
} else { } else {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper);
DEBUG("\nelement '%s' is a filter, using _chain_wrapper\n",gst_element_get_name(element)); GST_DEBUG (0,"\nelement '%s' is a filter, using _chain_wrapper\n",gst_element_get_name(element));
} }
} }
} }
@ -231,10 +231,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
(GST_ELEMENT(pad->peer->parent)->manager != GST_ELEMENT(bin))) { (GST_ELEMENT(pad->peer->parent)->manager != GST_ELEMENT(bin))) {
// set the chain proxies // set the chain proxies
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pushfunc = pad->chainfunc; pad->pushfunc = pad->chainfunc;
} else { } else {
DEBUG("copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pullfunc = pad->getfunc; pad->pullfunc = pad->getfunc;
pad->pullregionfunc = pad->getregionfunc; pad->pullregionfunc = pad->getregionfunc;
} }
@ -242,10 +242,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// otherwise we really are a cothread // otherwise we really are a cothread
} else { } else {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("setting cothreaded push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"setting cothreaded push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy); pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy);
} else { } else {
DEBUG("setting cothreaded pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"setting cothreaded pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy); pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
} }
} }
@ -255,10 +255,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
if (wrapper_function != NULL) { if (wrapper_function != NULL) {
if (element->threadstate == NULL) { if (element->threadstate == NULL) {
element->threadstate = cothread_create (bin->threadcontext); element->threadstate = cothread_create (bin->threadcontext);
DEBUG("created cothread %p for '%s'\n",element->threadstate,gst_element_get_name(element)); GST_DEBUG (0,"created cothread %p for '%s'\n",element->threadstate,gst_element_get_name(element));
} }
cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element); cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element);
DEBUG("set wrapper function for '%s' to &%s\n",gst_element_get_name(element), GST_DEBUG (0,"set wrapper function for '%s' to &%s\n",gst_element_get_name(element),
GST_DEBUG_FUNCPTR_NAME(wrapper_function)); GST_DEBUG_FUNCPTR_NAME(wrapper_function));
} }
} }
@ -271,7 +271,7 @@ gst_schedule_chained_chain (GstBin *bin, _GstBinChain *chain) {
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
DEBUG("chain entered\n"); GST_DEBUG (0,"chain entered\n");
// walk through all the elements // walk through all the elements
elements = chain->elements; elements = chain->elements;
while (elements) { while (elements) {
@ -285,10 +285,10 @@ gst_schedule_chained_chain (GstBin *bin, _GstBinChain *chain) {
pads = g_list_next (pads); pads = g_list_next (pads);
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pushfunc = pad->chainfunc; pad->pushfunc = pad->chainfunc;
} else { } else {
DEBUG("copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pullfunc = pad->getfunc; pad->pullfunc = pad->getfunc;
pad->pullregionfunc = pad->getregionfunc; pad->pullregionfunc = pad->getregionfunc;
} }
@ -328,13 +328,13 @@ void gst_bin_schedule_func(GstBin *bin) {
GList *chains; GList *chains;
_GstBinChain *chain; _GstBinChain *chain;
DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin))); GST_DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
DEBUG_ENTER_STRING; GST_DEBUG_ENTER_STRING;
gst_bin_schedule_cleanup(bin); gst_bin_schedule_cleanup(bin);
// next we have to find all the separate scheduling chains // next we have to find all the separate scheduling chains
DEBUG("\nattempting to find scheduling chains...\n"); GST_DEBUG (0,"\nattempting to find scheduling chains...\n");
// first make a copy of the managed_elements we can mess with // first make a copy of the managed_elements we can mess with
elements = g_list_copy (bin->managed_elements); elements = g_list_copy (bin->managed_elements);
// we have to repeat until the list is empty to get all chains // we have to repeat until the list is empty to get all chains
@ -344,12 +344,12 @@ void gst_bin_schedule_func(GstBin *bin) {
// if this is a DECOUPLED element // if this is a DECOUPLED element
if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) { if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// skip this element entirely // skip this element entirely
DEBUG("skipping '%s' because it's decoupled\n",gst_element_get_name(element)); GST_DEBUG (0,"skipping '%s' because it's decoupled\n",gst_element_get_name(element));
elements = g_list_next (elements); elements = g_list_next (elements);
continue; continue;
} }
DEBUG("starting with element '%s'\n",gst_element_get_name(element)); GST_DEBUG (0,"starting with element '%s'\n",gst_element_get_name(element));
// prime the pending list with the first element off the top // prime the pending list with the first element off the top
pending = g_slist_prepend (NULL, element); pending = g_slist_prepend (NULL, element);
@ -366,7 +366,7 @@ void gst_bin_schedule_func(GstBin *bin) {
pending = g_slist_remove (pending, element); pending = g_slist_remove (pending, element);
// add ourselves to the chain's list of elements // add ourselves to the chain's list of elements
DEBUG("adding '%s' to chain\n",gst_element_get_name(element)); GST_DEBUG (0,"adding '%s' to chain\n",gst_element_get_name(element));
chain->elements = g_list_prepend (chain->elements, element); chain->elements = g_list_prepend (chain->elements, element);
chain->num_elements++; chain->num_elements++;
// set the cothreads flag as appropriate // set the cothreads flag as appropriate
@ -380,13 +380,13 @@ void gst_bin_schedule_func(GstBin *bin) {
if ((element->manager == GST_ELEMENT(bin)) && if ((element->manager == GST_ELEMENT(bin)) &&
!GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) { !GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// remove ourselves from the outer list of all managed elements // remove ourselves from the outer list of all managed elements
// DEBUG("removing '%s' from list of possible elements\n",gst_element_get_name(element)); // GST_DEBUG (0,"removing '%s' from list of possible elements\n",gst_element_get_name(element));
elements = g_list_remove (elements, element); elements = g_list_remove (elements, element);
// if this element is a source, add it as an entry // if this element is a source, add it as an entry
if (element->numsinkpads == 0) { if (element->numsinkpads == 0) {
chain->entries = g_list_prepend (chain->entries, element); chain->entries = g_list_prepend (chain->entries, element);
DEBUG("added '%s' as SRC entry into the chain\n",gst_element_get_name(element)); GST_DEBUG (0,"added '%s' as SRC entry into the chain\n",gst_element_get_name(element));
} }
// now we have to walk the pads to find peers // now we have to walk the pads to find peers
@ -394,51 +394,51 @@ void gst_bin_schedule_func(GstBin *bin) {
while (pads) { while (pads) {
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
pads = g_list_next (pads); pads = g_list_next (pads);
DEBUG("have pad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"have pad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
if (pad->peer == NULL) ERROR(pad,"peer is null!"); if (pad->peer == NULL) GST_ERROR(pad,"peer is null!");
g_assert(pad->peer != NULL); g_assert(pad->peer != NULL);
g_assert(pad->peer->parent != NULL); g_assert(pad->peer->parent != NULL);
//g_assert(GST_ELEMENT(pad->peer->parent)->manager != NULL); //g_assert(GST_ELEMENT(pad->peer->parent)->manager != NULL);
DEBUG("peer pad %p\n", pad->peer); GST_DEBUG (0,"peer pad %p\n", pad->peer);
// only bother with if the pad's peer's parent is this bin or it's DECOUPLED // only bother with if the pad's peer's parent is this bin or it's DECOUPLED
// only add it if it's in the list of un-visited elements still // only add it if it's in the list of un-visited elements still
if ((g_list_find (elements, pad->peer->parent) != NULL) || if ((g_list_find (elements, pad->peer->parent) != NULL) ||
GST_FLAG_IS_SET (pad->peer->parent, GST_ELEMENT_DECOUPLED)) { GST_FLAG_IS_SET (pad->peer->parent, GST_ELEMENT_DECOUPLED)) {
// add the peer element to the pending list // add the peer element to the pending list
DEBUG("adding '%s' to list of pending elements\n",gst_element_get_name(GST_ELEMENT(pad->peer->parent))); GST_DEBUG (0,"adding '%s' to list of pending elements\n",gst_element_get_name(GST_ELEMENT(pad->peer->parent)));
pending = g_slist_prepend (pending, GST_ELEMENT(pad->peer->parent)); pending = g_slist_prepend (pending, GST_ELEMENT(pad->peer->parent));
// if this is a sink pad, then the element on the other side is an entry // if this is a sink pad, then the element on the other side is an entry
if ((gst_pad_get_direction (pad) == GST_PAD_SINK) && if ((gst_pad_get_direction (pad) == GST_PAD_SINK) &&
(GST_FLAG_IS_SET (pad->peer->parent, GST_ELEMENT_DECOUPLED))) { (GST_FLAG_IS_SET (pad->peer->parent, GST_ELEMENT_DECOUPLED))) {
chain->entries = g_list_prepend (chain->entries, pad->peer->parent); chain->entries = g_list_prepend (chain->entries, pad->peer->parent);
DEBUG("added '%s' as DECOUPLED entry into the chain\n",gst_element_get_name(GST_ELEMENT(pad->peer->parent))); GST_DEBUG (0,"added '%s' as DECOUPLED entry into the chain\n",gst_element_get_name(GST_ELEMENT(pad->peer->parent)));
} }
} else } else
DEBUG("element '%s' has already been dealt with\n",gst_element_get_name(GST_ELEMENT(pad->peer->parent))); GST_DEBUG (0,"element '%s' has already been dealt with\n",gst_element_get_name(GST_ELEMENT(pad->peer->parent)));
} }
} }
} while (pending); } while (pending);
// add the chain to the bin // add the chain to the bin
DEBUG("have chain with %d elements: ",chain->num_elements); GST_DEBUG (0,"have chain with %d elements: ",chain->num_elements);
{ GList *elements = chain->elements; { GList *elements = chain->elements;
while (elements) { while (elements) {
element = GST_ELEMENT (elements->data); element = GST_ELEMENT (elements->data);
elements = g_list_next(elements); elements = g_list_next(elements);
DEBUG_NOPREFIX("%s, ",gst_element_get_name(element)); GST_DEBUG_NOPREFIX(0,"%s, ",gst_element_get_name(element));
} }
} }
DEBUG_NOPREFIX("\n"); GST_DEBUG_NOPREFIX(0,"\n");
bin->chains = g_list_prepend (bin->chains, chain); bin->chains = g_list_prepend (bin->chains, chain);
bin->num_chains++; bin->num_chains++;
} }
// free up the list in case it's full of DECOUPLED elements // free up the list in case it's full of DECOUPLED elements
g_list_free (elements); g_list_free (elements);
DEBUG("\nwe have %d chains to schedule\n",bin->num_chains); GST_DEBUG (0,"\nwe have %d chains to schedule\n",bin->num_chains);
// now we have to go through all the chains and schedule them // now we have to go through all the chains and schedule them
chains = bin->chains; chains = bin->chains;
@ -454,7 +454,7 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
} }
} }
DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin))); GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
} }
@ -472,11 +472,11 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
if ((GST_IS_SRC (outside) || GST_IS_CONNECTION (outside)) && if ((GST_IS_SRC (outside) || GST_IS_CONNECTION (outside)) &&
(gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) { (gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("dealing with outside source element %s\n",gst_element_get_name(outside)); GST_DEBUG (0,"dealing with outside source element %s\n",gst_element_get_name(outside));
// DEBUG("PUNT: copying pullfunc ptr from %s:%s to %s:%s (@ %p)\n", // GST_DEBUG (0,"PUNT: copying pullfunc ptr from %s:%s to %s:%s (@ %p)\n",
//GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->pullfunc); //GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->pullfunc);
// pad->pullfunc = pad->peer->pullfunc; // pad->pullfunc = pad->peer->pullfunc;
// DEBUG("PUNT: setting pushfunc proxy to fake proxy on %s:%s\n",GST_DEBUG_PAD_NAME(pad->peer)); // GST_DEBUG (0,"PUNT: setting pushfunc proxy to fake proxy on %s:%s\n",GST_DEBUG_PAD_NAME(pad->peer));
// pad->peer->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_fake_proxy); // pad->peer->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_fake_proxy);
pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy); pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
} }
@ -489,7 +489,7 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
/* /*
} else if (GST_IS_SRC (element)) { } else if (GST_IS_SRC (element)) {
DEBUG("adding '%s' as entry point, because it's a source\n",gst_element_get_name (element)); GST_DEBUG (0,"adding '%s' as entry point, because it's a source\n",gst_element_get_name (element));
bin->entries = g_list_prepend (bin->entries,element); bin->entries = g_list_prepend (bin->entries,element);
bin->num_entries++; bin->num_entries++;
cothread_setfunc(element->threadstate,gst_bin_src_wrapper,0,(char **)element); cothread_setfunc(element->threadstate,gst_bin_src_wrapper,0,(char **)element);
@ -500,15 +500,15 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
pad = GST_PAD(pads->data); pad = GST_PAD(pads->data);
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("setting push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"setting push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
// set the proxy functions // set the proxy functions
pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy); pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy);
DEBUG("pushfunc %p = gst_bin_pushfunc_proxy %p\n",&pad->pushfunc,gst_bin_pushfunc_proxy); GST_DEBUG (0,"pushfunc %p = gst_bin_pushfunc_proxy %p\n",&pad->pushfunc,gst_bin_pushfunc_proxy);
} else if (gst_pad_get_direction (pad) == GST_PAD_SRC) { } else if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
DEBUG("setting pull proxies for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"setting pull proxies for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
// set the proxy functions // set the proxy functions
pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy); pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
DEBUG("pad->pullfunc(@%p) = gst_bin_pullfunc_proxy(@%p)\n", GST_DEBUG (0,"pad->pullfunc(@%p) = gst_bin_pullfunc_proxy(@%p)\n",
&pad->pullfunc,gst_bin_pullfunc_proxy); &pad->pullfunc,gst_bin_pullfunc_proxy);
pad->pullregionfunc = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy); pad->pullregionfunc = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy);
} }
@ -521,17 +521,17 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
bin->entries = g_list_prepend (bin->entries, GST_ELEMENT(bin->children->data)); bin->entries = g_list_prepend (bin->entries, GST_ELEMENT(bin->children->data));
} }
} else { } else {
DEBUG("don't need cothreads, looking for entry points\n"); GST_DEBUG (0,"don't need cothreads, looking for entry points\n");
// we have to find which elements will drive an iteration // we have to find which elements will drive an iteration
elements = bin->children; elements = bin->children;
while (elements) { while (elements) {
element = GST_ELEMENT (elements->data); element = GST_ELEMENT (elements->data);
DEBUG("found element \"%s\"\n", gst_element_get_name (element)); GST_DEBUG (0,"found element \"%s\"\n", gst_element_get_name (element));
if (GST_IS_BIN (element)) { if (GST_IS_BIN (element)) {
gst_bin_create_plan (GST_BIN (element)); gst_bin_create_plan (GST_BIN (element));
} }
if (GST_IS_SRC (element)) { if (GST_IS_SRC (element)) {
DEBUG("adding '%s' as entry point, because it's a source\n",gst_element_get_name (element)); GST_DEBUG (0,"adding '%s' as entry point, because it's a source\n",gst_element_get_name (element));
bin->entries = g_list_prepend (bin->entries, element); bin->entries = g_list_prepend (bin->entries, element);
bin->num_entries++; bin->num_entries++;
} }
@ -542,10 +542,10 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("found SINK pad %s:%s\n", GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"found SINK pad %s:%s\n", GST_DEBUG_PAD_NAME(pad));
// copy the peer's chain function, easy enough // copy the peer's chain function, easy enough
DEBUG("copying peer's chainfunc to %s:%s's pushfunc\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying peer's chainfunc to %s:%s's pushfunc\n",GST_DEBUG_PAD_NAME(pad));
pad->pushfunc = GST_DEBUG_FUNCPTR(pad->peer->chainfunc); pad->pushfunc = GST_DEBUG_FUNCPTR(pad->peer->chainfunc);
// need to walk through and check for outside connections // need to walk through and check for outside connections
@ -553,7 +553,7 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
// get the pad's peer // get the pad's peer
peer = gst_pad_get_peer (pad); peer = gst_pad_get_peer (pad);
if (!peer) { if (!peer) {
DEBUG("found SINK pad %s has no peer\n", gst_pad_get_name (pad)); GST_DEBUG (0,"found SINK pad %s has no peer\n", gst_pad_get_name (pad));
break; break;
} }
// get the parent of the peer of the pad // get the parent of the peer of the pad
@ -571,7 +571,7 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
} }
} }
else { else {
DEBUG("found pad %s\n", gst_pad_get_name (pad)); GST_DEBUG (0,"found pad %s\n", gst_pad_get_name (pad));
} }
pads = g_list_next (pads); pads = g_list_next (pads);
@ -587,11 +587,11 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
// If cothreads are needed, we need to not only find elements but // If cothreads are needed, we need to not only find elements but
// set up cothread states and various proxy functions. // set up cothread states and various proxy functions.
if (bin->need_cothreads) { if (bin->need_cothreads) {
DEBUG("bin is using cothreads\n"); GST_DEBUG (0,"bin is using cothreads\n");
// first create thread context // first create thread context
if (bin->threadcontext == NULL) { if (bin->threadcontext == NULL) {
DEBUG("initializing cothread context\n"); GST_DEBUG (0,"initializing cothread context\n");
bin->threadcontext = cothread_init (); bin->threadcontext = cothread_init ();
} }
@ -608,7 +608,7 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
// first of all, if there's a loopfunc, the decision's already made // first of all, if there's a loopfunc, the decision's already made
if (element->loopfunc != NULL) { if (element->loopfunc != NULL) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
DEBUG("element %s is a loopfunc, must use a cothread\n",gst_element_get_name(element)); GST_DEBUG (0,"element %s is a loopfunc, must use a cothread\n",gst_element_get_name(element));
} else { } else {
// otherwise we need to decide if it needs a cothread // otherwise we need to decide if it needs a cothread
// if it's complex, or cothreads are preferred and it's *not* decoupled, cothread it // if it's complex, or cothreads are preferred and it's *not* decoupled, cothread it
@ -633,29 +633,29 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
// check to see if someone else gets to set up the element // check to see if someone else gets to set up the element
peer_manager = GST_ELEMENT((pad)->peer->parent)->manager; peer_manager = GST_ELEMENT((pad)->peer->parent)->manager;
if (peer_manager != GST_ELEMENT(bin)) { if (peer_manager != GST_ELEMENT(bin)) {
DEBUG("WARNING: pad %s:%s is connected outside of bin\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"WARNING: pad %s:%s is connected outside of bin\n",GST_DEBUG_PAD_NAME(pad));
} }
// if the wrapper_function is set, we need to use the proxy functions // if the wrapper_function is set, we need to use the proxy functions
if (wrapper_function != NULL) { if (wrapper_function != NULL) {
// set up proxy functions // set up proxy functions
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("setting push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"setting push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy); pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy);
} else if (gst_pad_get_direction (pad) == GST_PAD_SRC) { } else if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
DEBUG("setting pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"setting pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy); pad->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
} }
} else { } else {
// otherwise we need to set up for 'traditional' chaining // otherwise we need to set up for 'traditional' chaining
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
// we can just copy the chain function, since it shares the prototype // we can just copy the chain function, since it shares the prototype
DEBUG("copying chain function into push proxy for %s:%s\n", GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",
GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_PAD_NAME(pad));
pad->pushfunc = pad->chainfunc; pad->pushfunc = pad->chainfunc;
} else if (gst_pad_get_direction (pad) == GST_PAD_SRC) { } else if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
// we can just copy the get function, since it shares the prototype // we can just copy the get function, since it shares the prototype
DEBUG("copying get function into pull proxy for %s:%s\n", GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",
GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_PAD_NAME(pad));
pad->pullfunc = pad->getfunc; pad->pullfunc = pad->getfunc;
} }
@ -666,11 +666,11 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
if (wrapper_function != NULL) { if (wrapper_function != NULL) {
if (element->threadstate == NULL) { if (element->threadstate == NULL) {
element->threadstate = cothread_create (bin->threadcontext); element->threadstate = cothread_create (bin->threadcontext);
DEBUG("created cothread %p (@%p) for \"%s\"\n",element->threadstate, GST_DEBUG (0,"created cothread %p (@%p) for \"%s\"\n",element->threadstate,
&element->threadstate,gst_element_get_name(element)); &element->threadstate,gst_element_get_name(element));
} }
cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element); cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element);
DEBUG("set wrapper function for \"%s\" to &%s\n",gst_element_get_name(element), GST_DEBUG (0,"set wrapper function for \"%s\" to &%s\n",gst_element_get_name(element),
GST_DEBUG_FUNCPTR_NAME(wrapper_function)); GST_DEBUG_FUNCPTR_NAME(wrapper_function));
} }
@ -681,7 +681,7 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
// otherwise, cothreads are not needed // otherwise, cothreads are not needed
} else { } else {
DEBUG("bin is chained, no cothreads needed\n"); GST_DEBUG (0,"bin is chained, no cothreads needed\n");
elements = bin->managed_elements; elements = bin->managed_elements;
while (elements) { while (elements) {
@ -694,10 +694,10 @@ if (pad->peer == NULL) ERROR(pad,"peer is null!");
pads = g_list_next (pads); pads = g_list_next (pads);
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
DEBUG("copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pushfunc = pad->chainfunc; pad->pushfunc = pad->chainfunc;
} else { } else {
DEBUG("copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
pad->pullfunc = pad->getfunc; pad->pullfunc = pad->getfunc;
} }
} }

View file

@ -123,7 +123,7 @@ gst_thread_class_init (GstThreadClass *klass)
static void static void
gst_thread_init (GstThread *thread) gst_thread_init (GstThread *thread)
{ {
DEBUG("initializing thread '%s'\n",gst_element_get_name(GST_ELEMENT(thread))); GST_DEBUG (0,"initializing thread '%s'\n",gst_element_get_name(GST_ELEMENT(thread)));
// we're a manager by default // we're a manager by default
GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER); GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
@ -142,7 +142,7 @@ gst_thread_create_plan_dummy (GstBin *bin)
g_return_if_fail (GST_IS_THREAD (bin)); g_return_if_fail (GST_IS_THREAD (bin));
if (!GST_FLAG_IS_SET (GST_THREAD (bin), GST_THREAD_STATE_SPINNING)) if (!GST_FLAG_IS_SET (GST_THREAD (bin), GST_THREAD_STATE_SPINNING))
INFO(GST_INFO_THREAD,"gstthread: create plan delayed until thread starts"); GST_INFO (GST_CAT_THREAD,"gstthread: create plan delayed until thread starts");
} }
static void static void
@ -156,13 +156,13 @@ gst_thread_set_arg (GtkObject *object,
switch(id) { switch(id) {
case ARG_CREATE_THREAD: case ARG_CREATE_THREAD:
if (GTK_VALUE_BOOL (*arg)) { if (GTK_VALUE_BOOL (*arg)) {
INFO(GST_INFO_THREAD,"gstthread: turning ON the creation of the thread"); GST_INFO (GST_CAT_THREAD,"gstthread: turning ON the creation of the thread");
GST_FLAG_SET (object, GST_THREAD_CREATE); GST_FLAG_SET (object, GST_THREAD_CREATE);
DEBUG("gstthread: flags are 0x%08x\n", GST_FLAGS (object)); GST_DEBUG (0,"gstthread: flags are 0x%08x\n", GST_FLAGS (object));
} else { } else {
INFO(GST_INFO_THREAD,"gstthread: turning OFF the creation of the thread"); GST_INFO (GST_CAT_THREAD,"gstthread: turning OFF the creation of the thread");
GST_FLAG_UNSET (object, GST_THREAD_CREATE); GST_FLAG_UNSET (object, GST_THREAD_CREATE);
DEBUG("gstthread: flags are 0x%08x\n", GST_FLAGS (object)); GST_DEBUG (0,"gstthread: flags are 0x%08x\n", GST_FLAGS (object));
} }
break; break;
default: default:
@ -212,11 +212,11 @@ gst_thread_change_state (GstElement *element)
gint pending, transition; gint pending, transition;
g_return_val_if_fail (GST_IS_THREAD(element), FALSE); g_return_val_if_fail (GST_IS_THREAD(element), FALSE);
DEBUG_ENTER("(\"%s\")",gst_element_get_name(element)); GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name(element));
thread = GST_THREAD (element); thread = GST_THREAD (element);
INFO (GST_INFO_THREAD,"gstthread: thread \"%s\" change state %d", GST_INFO (GST_CAT_THREAD,"gstthread: thread \"%s\" change state %d",
gst_element_get_name (GST_ELEMENT (element)), gst_element_get_name (GST_ELEMENT (element)),
GST_STATE_PENDING (element)); GST_STATE_PENDING (element));
@ -230,23 +230,23 @@ gst_thread_change_state (GstElement *element)
if (GST_ELEMENT_CLASS (parent_class)->change_state) if (GST_ELEMENT_CLASS (parent_class)->change_state)
stateset = GST_ELEMENT_CLASS (parent_class)->change_state (element); stateset = GST_ELEMENT_CLASS (parent_class)->change_state (element);
INFO (GST_INFO_THREAD, "gstthread: stateset %d %d %d %02x", GST_STATE (element), stateset, GST_INFO (GST_CAT_THREAD, "gstthread: stateset %d %d %d %02x", GST_STATE (element), stateset,
GST_STATE_PENDING (element), GST_STATE_TRANSITION (element)); GST_STATE_PENDING (element), GST_STATE_TRANSITION (element));
switch (transition) { switch (transition) {
case GST_STATE_NULL_TO_READY: case GST_STATE_NULL_TO_READY:
// if (!stateset) return FALSE; // if (!stateset) return FALSE;
// we want to prepare our internal state for doing the iterations // we want to prepare our internal state for doing the iterations
INFO(GST_INFO_THREAD, "gstthread: preparing thread \"%s\" for iterations:", GST_INFO (GST_CAT_THREAD, "gstthread: preparing thread \"%s\" for iterations:",
gst_element_get_name (GST_ELEMENT (element))); gst_element_get_name (GST_ELEMENT (element)));
// set the state to idle // set the state to idle
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING); GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
// create the thread if that's what we're supposed to do // create the thread if that's what we're supposed to do
INFO(GST_INFO_THREAD, "gstthread: flags are 0x%08x", GST_FLAGS (thread)); GST_INFO (GST_CAT_THREAD, "gstthread: flags are 0x%08x", GST_FLAGS (thread));
if (GST_FLAG_IS_SET (thread, GST_THREAD_CREATE)) { if (GST_FLAG_IS_SET (thread, GST_THREAD_CREATE)) {
INFO(GST_INFO_THREAD, "gstthread: starting thread \"%s\"", GST_INFO (GST_CAT_THREAD, "gstthread: starting thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element))); gst_element_get_name (GST_ELEMENT (element)));
// create the thread // create the thread
@ -256,28 +256,28 @@ gst_thread_change_state (GstElement *element)
// wait for it to 'spin up' // wait for it to 'spin up'
// gst_thread_wait_thread (thread); // gst_thread_wait_thread (thread);
} else { } else {
INFO(GST_INFO_THREAD, "gstthread: NOT starting thread \"%s\"", GST_INFO (GST_CAT_THREAD, "gstthread: NOT starting thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element))); gst_element_get_name (GST_ELEMENT (element)));
} }
break; break;
case GST_STATE_PAUSED_TO_PLAYING: case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_READY_TO_PLAYING: case GST_STATE_READY_TO_PLAYING:
if (!stateset) return FALSE; if (!stateset) return FALSE;
INFO(GST_INFO_THREAD, "gstthread: starting thread \"%s\"", GST_INFO (GST_CAT_THREAD, "gstthread: starting thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element))); gst_element_get_name (GST_ELEMENT (element)));
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING); GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
gst_thread_signal_thread (thread); gst_thread_signal_thread (thread);
break; break;
case GST_STATE_PLAYING_TO_PAUSED: case GST_STATE_PLAYING_TO_PAUSED:
INFO(GST_INFO_THREAD,"gstthread: pausing thread \"%s\"", GST_INFO (GST_CAT_THREAD,"gstthread: pausing thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element))); gst_element_get_name (GST_ELEMENT (element)));
//GST_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING); //GST_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING);
gst_thread_signal_thread (thread); gst_thread_signal_thread (thread);
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_READY_TO_NULL:
INFO(GST_INFO_THREAD,"gstthread: stopping thread \"%s\"", GST_INFO (GST_CAT_THREAD,"gstthread: stopping thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element))); gst_element_get_name (GST_ELEMENT (element)));
GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING); GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
@ -302,7 +302,7 @@ gst_thread_main_loop (void *arg)
{ {
GstThread *thread = GST_THREAD (arg); GstThread *thread = GST_THREAD (arg);
INFO(GST_INFO_THREAD,"gstthread: thread \"%s\" is running with PID %d", GST_INFO (GST_CAT_THREAD,"gstthread: thread \"%s\" is running with PID %d",
gst_element_get_name (GST_ELEMENT (thread)), getpid ()); gst_element_get_name (GST_ELEMENT (thread)), getpid ());
// construct the plan and signal back // construct the plan and signal back
@ -321,7 +321,7 @@ gst_thread_main_loop (void *arg)
GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING); GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING);
// pthread_join (thread->thread_id, 0); // pthread_join (thread->thread_id, 0);
INFO(GST_INFO_THREAD, "gstthread: thread \"%s\" is stopped", GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped",
gst_element_get_name (GST_ELEMENT (thread))); gst_element_get_name (GST_ELEMENT (thread)));
return NULL; return NULL;
} }
@ -329,7 +329,7 @@ gst_thread_main_loop (void *arg)
static void static void
gst_thread_signal_thread (GstThread *thread) gst_thread_signal_thread (GstThread *thread)
{ {
DEBUG("signaling thread\n"); GST_DEBUG (0,"signaling thread\n");
g_mutex_lock (thread->lock); g_mutex_lock (thread->lock);
g_cond_signal (thread->cond); g_cond_signal (thread->cond);
g_mutex_unlock (thread->lock); g_mutex_unlock (thread->lock);
@ -338,7 +338,7 @@ gst_thread_signal_thread (GstThread *thread)
static void static void
gst_thread_wait_thread (GstThread *thread) gst_thread_wait_thread (GstThread *thread)
{ {
DEBUG("waiting for thread\n"); GST_DEBUG (0,"waiting for thread\n");
g_mutex_lock (thread->lock); g_mutex_lock (thread->lock);
g_cond_wait (thread->cond, thread->lock); g_cond_wait (thread->cond, thread->lock);
g_mutex_unlock (thread->lock); g_mutex_unlock (thread->lock);
@ -350,7 +350,7 @@ gst_thread_restore_thyself (GstElement *element,
xmlNodePtr parent, xmlNodePtr parent,
GHashTable *elements) GHashTable *elements)
{ {
DEBUG("gstthread: restore\n"); GST_DEBUG (0,"gstthread: restore\n");
if (GST_ELEMENT_CLASS (parent_class)->restore_thyself) if (GST_ELEMENT_CLASS (parent_class)->restore_thyself)
GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements); GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements);

View file

@ -68,7 +68,7 @@ gst_type_register (GstTypeFactory *factory)
g_return_val_if_fail (factory != NULL, 0); g_return_val_if_fail (factory != NULL, 0);
// INFO(GST_INFO_TYPES,"type register %s", factory->mime); // GST_INFO (GST_CAT_TYPES,"type register %s", factory->mime);
id = gst_type_find_by_mime (factory->mime); id = gst_type_find_by_mime (factory->mime);
if (!id) { if (!id) {
@ -107,12 +107,12 @@ guint16 gst_type_find_by_mime_func (gchar *mime)
g_return_val_if_fail (mime != NULL, 0); g_return_val_if_fail (mime != NULL, 0);
walk = _gst_types; walk = _gst_types;
// DEBUG("searching for '%s'\n",mime); // GST_DEBUG (0,"searching for '%s'\n",mime);
mimelen = strlen (mime); mimelen = strlen (mime);
while (walk) { while (walk) {
type = (GstType *)walk->data; type = (GstType *)walk->data;
search = type->mime; search = type->mime;
// DEBUG("checking against '%s'\n",search); // GST_DEBUG (0,"checking against '%s'\n",search);
typelen = strlen (search); typelen = strlen (search);
while ((search - type->mime) < typelen) { while ((search - type->mime) < typelen) {
found = strstr (search, mime); found = strstr (search, mime);
@ -231,7 +231,7 @@ gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv)
guint16 typeid; guint16 typeid;
GSList *funcs; GSList *funcs;
DEBUG ("gsttype: need to load typefind function for %s\n", type->mime); GST_DEBUG (0,"gsttype: need to load typefind function for %s\n", type->mime);
type->typefindfuncs = NULL; type->typefindfuncs = NULL;
gst_plugin_load_typefactory (type->mime); gst_plugin_load_typefactory (type->mime);

View file

@ -179,7 +179,7 @@ gst_xml_get_element (GstXML *xml, const guchar *name)
g_return_val_if_fail(xml != NULL, NULL); g_return_val_if_fail(xml != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail(name != NULL, NULL);
DEBUG ("gstxml: getting element \"%s\"\n", name); GST_DEBUG (0,"gstxml: getting element \"%s\"\n", name);
element = g_hash_table_lookup(xml->elements, name); element = g_hash_table_lookup(xml->elements, name);

View file

@ -244,7 +244,7 @@ gst_asyncdisksrc_get (GstPad *pad)
} else } else
GST_BUFFER_SIZE (buf) = src->bytes_per_read; GST_BUFFER_SIZE (buf) = src->bytes_per_read;
DEBUG ("map %p, offset %d, size %ld\n", src->map, src->curoffset, GST_BUFFER_SIZE (buf)); GST_DEBUG (0,"map %p, offset %d, size %ld\n", src->map, src->curoffset, GST_BUFFER_SIZE (buf));
//gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); //gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
@ -252,7 +252,7 @@ gst_asyncdisksrc_get (GstPad *pad)
if (src->new_seek) { if (src->new_seek) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
DEBUG ("new seek\n"); GST_DEBUG (0,"new seek\n");
src->new_seek = FALSE; src->new_seek = FALSE;
} }
@ -303,7 +303,7 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size)
} else } else
GST_BUFFER_SIZE (buf) = size; GST_BUFFER_SIZE (buf) = size;
DEBUG ("map %p, offset %d, size %ld\n", src->map, offset, GST_BUFFER_SIZE (buf)); GST_DEBUG (0,"map %p, offset %d, size %ld\n", src->map, offset, GST_BUFFER_SIZE (buf));
/* we're done, return the buffer off now */ /* we're done, return the buffer off now */
return buf; return buf;

View file

@ -247,7 +247,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING)); // g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) { if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
DEBUG ("audiosink: flush\n"); GST_DEBUG (0,"audiosink: flush\n");
ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0); ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
} }
@ -277,7 +277,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
if (!audiosink->mute) { if (!audiosink->mute) {
gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink)); gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace); ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
DEBUG ("audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes, GST_DEBUG (0,"audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes,
audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
//write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf)); //write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));

View file

@ -273,7 +273,7 @@ gst_audiosrc_open_audio (GstAudioSrc *src)
/* set card state */ /* set card state */
gst_audiosrc_sync_parms (src); gst_audiosrc_sync_parms (src);
DEBUG("opened audio\n"); GST_DEBUG (0,"opened audio\n");
GST_FLAG_SET (src, GST_AUDIOSRC_OPEN); GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
return TRUE; return TRUE;

View file

@ -236,7 +236,7 @@ gst_disksrc_get (GstPad *pad)
/* if we didn't get as many bytes as we asked for, we're at EOF */ /* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < src->bytes_per_read) { if (readbytes < src->bytes_per_read) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
DEBUG("setting GST_BUFFER_EOS\n"); GST_DEBUG (0,"setting GST_BUFFER_EOS\n");
} }
/* if we have a new buffer from a seek, mark it */ /* if we have a new buffer from a seek, mark it */
@ -249,9 +249,9 @@ gst_disksrc_get (GstPad *pad)
GST_BUFFER_SIZE (buf) = readbytes; GST_BUFFER_SIZE (buf) = readbytes;
src->curoffset += readbytes; src->curoffset += readbytes;
DEBUG("pushing %d bytes with offset %d\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf)); GST_DEBUG (0,"pushing %d bytes with offset %d\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf));
/* we're done, push the buffer off now */ /* we're done, push the buffer off now */
DEBUG("returning %d bytes with offset %d done\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf)); GST_DEBUG (0,"returning %d bytes with offset %d done\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf));
return buf; return buf;
} }
@ -277,7 +277,7 @@ gst_disksrc_open_file (GstDiskSrc *src)
} }
else { else {
src->size = f_stat.st_size; src->size = f_stat.st_size;
DEBUG("gstdisksrc: file size %ld\n", src->size); GST_DEBUG (0,"gstdisksrc: file size %ld\n", src->size);
} }
GST_FLAG_SET (src, GST_DISKSRC_OPEN); GST_FLAG_SET (src, GST_DISKSRC_OPEN);
return TRUE; return TRUE;
@ -306,7 +306,7 @@ gst_disksrc_change_state (GstElement *element)
{ {
g_return_val_if_fail (GST_IS_DISKSRC (element), GST_STATE_FAILURE); g_return_val_if_fail (GST_IS_DISKSRC (element), GST_STATE_FAILURE);
DEBUG("gstdisksrc: state pending %d\n", GST_STATE_PENDING (element)); GST_DEBUG (0,"gstdisksrc: state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, close the file if it's open */ /* if going down into NULL state, close the file if it's open */
if (GST_STATE_PENDING (element) == GST_STATE_NULL) { if (GST_STATE_PENDING (element) == GST_STATE_NULL) {

View file

@ -118,7 +118,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (fdsink->fd >= 0); g_return_if_fail (fdsink->fd >= 0);
if (GST_BUFFER_DATA (buf)) { if (GST_BUFFER_DATA (buf)) {
DEBUG("writing %d bytes to file descriptor %d\n",GST_BUFFER_SIZE (buf), fdsink->fd); GST_DEBUG (0,"writing %d bytes to file descriptor %d\n",GST_BUFFER_SIZE (buf), fdsink->fd);
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
} }

View file

@ -139,12 +139,12 @@ static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE); g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE);
/* read it in from the file */ /* read it in from the file */
DEBUG("attemting to read %ld bytes\n", pipefilter->bytes_per_read); GST_DEBUG (0,"attemting to read %ld bytes\n", pipefilter->bytes_per_read);
readbytes = read(pipefilter->fdout[0],GST_BUFFER_DATA(newbuf),pipefilter->bytes_per_read); readbytes = read(pipefilter->fdout[0],GST_BUFFER_DATA(newbuf),pipefilter->bytes_per_read);
DEBUG("read %ld bytes\n", readbytes); GST_DEBUG (0,"read %ld bytes\n", readbytes);
if (readbytes < 0) { if (readbytes < 0) {
if (errno == EAGAIN) { if (errno == EAGAIN) {
DEBUG("no input yet\n"); GST_DEBUG (0,"no input yet\n");
gst_buffer_unref(newbuf); gst_buffer_unref(newbuf);
return FALSE; return FALSE;
} }
@ -186,9 +186,9 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
data = GST_BUFFER_DATA(buf); data = GST_BUFFER_DATA(buf);
size = GST_BUFFER_SIZE(buf); size = GST_BUFFER_SIZE(buf);
DEBUG("attemting to write %ld bytes\n", size); GST_DEBUG (0,"attemting to write %ld bytes\n", size);
writebytes = write(pipefilter->fdin[1],data,size); writebytes = write(pipefilter->fdin[1],data,size);
DEBUG("written %ld bytes\n", writebytes); GST_DEBUG (0,"written %ld bytes\n", writebytes);
if (writebytes < 0) { if (writebytes < 0) {
perror("write"); perror("write");
gst_element_error(GST_ELEMENT(pipefilter),"writing"); gst_element_error(GST_ELEMENT(pipefilter),"writing");

View file

@ -149,7 +149,7 @@ gst_queue_init (GstQueue *queue)
static void static void
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data) gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
{ {
DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data); GST_DEBUG (0,"queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
gst_buffer_unref (GST_BUFFER (data)); gst_buffer_unref (GST_BUFFER (data));
} }
@ -181,19 +181,19 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
/* we have to lock the queue since we span threads */ /* we have to lock the queue since we span threads */
DEBUG("queue: try have queue lock\n"); GST_DEBUG (0,"queue: try have queue lock\n");
GST_LOCK (queue); GST_LOCK (queue);
DEBUG("queue: %s adding buffer %p %ld\n", name, buf, pthread_self ()); GST_DEBUG (0,"queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
DEBUG("queue: have queue lock\n"); GST_DEBUG (0,"queue: have queue lock\n");
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) { if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) {
gst_queue_flush (queue); gst_queue_flush (queue);
} }
DEBUG("queue: %s: chain %d %p\n", name, queue->level_buffers, buf); GST_DEBUG (0,"queue: %s: chain %d %p\n", name, queue->level_buffers, buf);
while (queue->level_buffers >= queue->max_buffers) { while (queue->level_buffers >= queue->max_buffers) {
DEBUG("queue: %s waiting %d\n", name, queue->level_buffers); GST_DEBUG (0,"queue: %s waiting %d\n", name, queue->level_buffers);
STATUS("%s: O\n"); STATUS("%s: O\n");
GST_UNLOCK (queue); GST_UNLOCK (queue);
g_mutex_lock (queue->fulllock); g_mutex_lock (queue->fulllock);
@ -201,20 +201,20 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
g_mutex_unlock (queue->fulllock); g_mutex_unlock (queue->fulllock);
GST_LOCK (queue); GST_LOCK (queue);
STATUS("%s: O+\n"); STATUS("%s: O+\n");
DEBUG("queue: %s waiting done %d\n", name, queue->level_buffers); GST_DEBUG (0,"queue: %s waiting done %d\n", name, queue->level_buffers);
} }
/* put the buffer on the tail of the list */ /* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf); queue->queue = g_slist_append (queue->queue, buf);
// STATUS("%s: +\n"); // STATUS("%s: +\n");
DEBUG("(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
/* if we were empty, but aren't any more, signal a condition */ /* if we were empty, but aren't any more, signal a condition */
tosignal = (queue->level_buffers >= 0); tosignal = (queue->level_buffers >= 0);
queue->level_buffers++; queue->level_buffers++;
/* we can unlock now */ /* we can unlock now */
DEBUG("queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond); GST_DEBUG (0,"queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
GST_UNLOCK (queue); GST_UNLOCK (queue);
if (tosignal) { if (tosignal) {
@ -238,10 +238,10 @@ gst_queue_get (GstPad *pad)
name = gst_element_get_name (GST_ELEMENT (queue)); name = gst_element_get_name (GST_ELEMENT (queue));
/* have to lock for thread-safety */ /* have to lock for thread-safety */
DEBUG("queue: %s try have queue lock\n", name); GST_DEBUG (0,"queue: %s try have queue lock\n", name);
GST_LOCK (queue); GST_LOCK (queue);
DEBUG("queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond); GST_DEBUG (0,"queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
DEBUG("queue: %s have queue lock\n", name); GST_DEBUG (0,"queue: %s have queue lock\n", name);
// we bail if there's nothing there // we bail if there's nothing there
if (!queue->level_buffers && !queue->block) { if (!queue->level_buffers && !queue->block) {
@ -261,13 +261,13 @@ gst_queue_get (GstPad *pad)
front = queue->queue; front = queue->queue;
buf = (GstBuffer *)(front->data); buf = (GstBuffer *)(front->data);
DEBUG("retrieved buffer %p from queue\n",buf); GST_DEBUG (0,"retrieved buffer %p from queue\n",buf);
queue->queue = g_slist_remove_link (queue->queue, front); queue->queue = g_slist_remove_link (queue->queue, front);
g_slist_free (front); g_slist_free (front);
queue->level_buffers--; queue->level_buffers--;
// STATUS("%s: -\n"); // STATUS("%s: -\n");
DEBUG("(%s:%s)- ",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
tosignal = queue->level_buffers < queue->max_buffers; tosignal = queue->level_buffers < queue->max_buffers;
GST_UNLOCK(queue); GST_UNLOCK(queue);
@ -279,9 +279,9 @@ gst_queue_get (GstPad *pad)
g_mutex_unlock (queue->fulllock); g_mutex_unlock (queue->fulllock);
} }
// DEBUG("queue: %s pushing %d %p \n", name, queue->level_buffers, buf); // GST_DEBUG (0,"queue: %s pushing %d %p \n", name, queue->level_buffers, buf);
// gst_pad_push (queue->srcpad, buf); // gst_pad_push (queue->srcpad, buf);
// DEBUG("queue: %s pushing %d done \n", name, queue->level_buffers); // GST_DEBUG (0,"queue: %s pushing %d done \n", name, queue->level_buffers);
return buf; return buf;
/* unlock now */ /* unlock now */
@ -294,7 +294,7 @@ gst_queue_change_state (GstElement *element)
g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE); g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE);
queue = GST_QUEUE (element); queue = GST_QUEUE (element);
DEBUG("gstqueue: state pending %d\n", GST_STATE_PENDING (element)); GST_DEBUG (0,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, clear out buffers*/ /* if going down into NULL state, clear out buffers*/
if (GST_STATE_PENDING (element) == GST_STATE_READY) { if (GST_STATE_PENDING (element) == GST_STATE_READY) {

View file

@ -26,6 +26,7 @@
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <gstsinesrc.h> #include <gstsinesrc.h>