{
cothread_state *s;
- DEBUG("pthread_self() %ld\n",pthread_self());
+ GST_DEBUG (0,"pthread_self() %ld\n",pthread_self());
//if (0) {
if (pthread_self() == 0) {
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 {
char *sp = CURRENT_STACK_FRAME;
unsigned long *stack_end = (unsigned long *)((unsigned long)sp &
~(STACK_SIZE - 1));
s = (cothread_state *)(stack_end + ((ctx->nthreads - 1) *
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)),
PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS,
-1,0) < 0) {
s->sp = ((int *)s + COTHREAD_STACKSIZE);
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;
{
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 (pthread_key_create (&_cothread_key,NULL) != 0) {
ctx->threads[0]->sp = (int *)CURRENT_STACK_FRAME;
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
ctx->nthreads = 1;
cothread_state*
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];
}
cothread_context *ctx = pthread_getspecific(_cothread_key);
register cothread_state *thread = ctx->threads[ctx->current];
- DEBUG_ENTER("");
+ GST_DEBUG_ENTER("");
thread->flags |= COTHREAD_STARTED;
if (thread->func)
thread->func(thread->argc,thread->argv);
thread->flags &= ~COTHREAD_STARTED;
thread->pc = 0;
thread->sp = thread->top_sp;
- DEBUG_LEAVE("");
+ GST_DEBUG_LEAVE("");
// printf("uh, yeah, we shouldn't be here, but we should deal anyway\n");
}
// find the number of the thread to switch to
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 */
GET_SP(current->sp);
enter = setjmp(current->jmp);
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);
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);
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 */
if (thread->flags & COTHREAD_STARTED) {
- DEBUG("in thread \n");
+ GST_DEBUG (0,"in thread \n");
SET_SP(thread->sp);
// switch to it
longjmp(thread->jmp,1);
SET_SP(thread->sp);
// start it
cothread_stub();
- DEBUG("exit thread \n");
+ GST_DEBUG (0,"exit thread \n");
ctx->current = 0;
}
} else
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));
if (src->new_seek) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
- DEBUG ("new seek\n");
+ GST_DEBUG (0,"new seek\n");
src->new_seek = FALSE;
}
} else
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 */
return buf;
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
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);
}
if (!audiosink->mute) {
gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
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));
write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
//write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));
/* set card state */
gst_audiosrc_sync_parms (src);
- DEBUG("opened audio\n");
+ GST_DEBUG (0,"opened audio\n");
GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
return TRUE;
/* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < src->bytes_per_read) {
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 */
GST_BUFFER_SIZE (buf) = 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 */
- 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;
}
}
else {
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);
return TRUE;
{
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 (GST_STATE_PENDING (element) == GST_STATE_NULL) {
g_return_if_fail (fdsink->fd >= 0);
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));
}
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE);
/* 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);
- DEBUG("read %ld bytes\n", readbytes);
+ GST_DEBUG (0,"read %ld bytes\n", readbytes);
if (readbytes < 0) {
if (errno == EAGAIN) {
- DEBUG("no input yet\n");
+ GST_DEBUG (0,"no input yet\n");
gst_buffer_unref(newbuf);
return FALSE;
}
data = GST_BUFFER_DATA(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);
- DEBUG("written %ld bytes\n", writebytes);
+ GST_DEBUG (0,"written %ld bytes\n", writebytes);
if (writebytes < 0) {
perror("write");
gst_element_error(GST_ELEMENT(pipefilter),"writing");
static void
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));
}
/* 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);
- DEBUG("queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
- DEBUG("queue: have queue lock\n");
+ GST_DEBUG (0,"queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
+ GST_DEBUG (0,"queue: have queue lock\n");
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) {
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) {
- 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");
GST_UNLOCK (queue);
g_mutex_lock (queue->fulllock);
g_mutex_unlock (queue->fulllock);
GST_LOCK (queue);
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 */
queue->queue = g_slist_append (queue->queue, buf);
// 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 */
tosignal = (queue->level_buffers >= 0);
queue->level_buffers++;
/* 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);
if (tosignal) {
name = gst_element_get_name (GST_ELEMENT (queue));
/* 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);
- DEBUG("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 push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
+ GST_DEBUG (0,"queue: %s have queue lock\n", name);
// we bail if there's nothing there
if (!queue->level_buffers && !queue->block) {
front = queue->queue;
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);
g_slist_free (front);
queue->level_buffers--;
// 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;
GST_UNLOCK(queue);
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);
-// 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;
/* unlock now */
g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE);
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 (GST_STATE_PENDING (element) == GST_STATE_READY) {
#include <sys/soundcard.h>
#include <math.h>
#include <stdlib.h>
+#include <string.h>
#include <gstsinesrc.h>
{
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 (srctemp->direction == GST_PAD_SRC &&
desttemp->direction == GST_PAD_SINK) {
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;
}
}
}
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;
}
if (IS_CAPS (src) && IS_CAPS (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)) {
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)) {
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 {
res = gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest);
caps.src = g_list_prepend (NULL,srccaps);
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,
gst_autoplug_elementfactory_get_list,
caps.src = srccaps;
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,
gst_autoplug_elementfactory_get_list,
caps.src = srcpad->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,
gst_autoplug_elementfactory_get_list,
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)
{
next = rgnNodes[find_factory(rgnNodes, current)].iPrev;
if (next) {
factories = g_list_prepend (factories, current);
- INFO (0,"factory: \"%s\"", current->name);
+ GST_INFO (0,"factory: \"%s\"", current->name);
}
current = next;
}
bin->numchildren++;
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... */
// if (GST_STATE(element) < GST_STATE_READY)
if (g_list_find(bin->children, element) == NULL) {
// 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;
}
bin->children = g_list_remove (bin->children, element);
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 (bin->numchildren == 0)
GList *children;
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);
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_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_PENDING (element)));
children = bin->children;
while (children) {
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))) {
case GST_STATE_FAILURE:
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)));
return GST_STATE_FAILURE;
break;
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;
}
// g_print("\n");
{
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);
g_return_val_if_fail (bin != NULL, FALSE);
GList *children;
GstElement *child;
- DEBUG("in gst_bin_real_destroy()\n");
+ GST_DEBUG (0,"in gst_bin_real_destroy()\n");
children = bin->children;
while (children) {
g_return_val_if_fail (GST_IS_BIN (bin), 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;
while (children) {
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;
while (children) {
while (field) {
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;
while (childlist) {
if (!strcmp (childlist->name, "element")) {
{
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);
if (oclass->iterate)
(oclass->iterate) (bin);
- DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
+ GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
}
/**
GSList *pending = NULL;
GstBin *pending_bin;
- DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
- DEBUG_ENTER_STRING;
+ GST_DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
+ 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
// if we're a managing bin ourselves, that'd be us
if (GST_FLAG_IS_SET (bin, GST_BIN_FLAG_MANAGER)) {
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
} else {
manager = gst_element_get_manager (GST_ELEMENT (bin));
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);
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
// we set the manager of every element but those who manage themselves
// 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;
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;
while (elements) {
#ifdef GST_DEBUG_ENABLED
elementname = gst_element_get_name (element);
#endif
- DEBUG("have element \"%s\"\n",elementname);
+ GST_DEBUG (0,"have element \"%s\"\n",elementname);
// 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);
// we do recursion and such for Bins
if (GST_IS_BIN (element)) {
// 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));
// 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)) {
- 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;
}
} else {
// then we need to determine whether they need cothreads
// if it's a loop-based element, use cothreads
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);
// if it's a 'complex' element, use cothreads
} 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);
// if the element has more than one sink pad, use cothreads
} 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);
}
if (GST_FLAG_IS_SET (element, GST_ELEMENT_USE_COTHREAD))
// if we're not a manager thread, we're done.
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;
}
// find all the managed children
// 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);
do {
// retrieve the top of the stack and pop it
pending = g_slist_remove (pending, pending_bin);
// 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)));
elements = pending_bin->children;
while (elements) {
if (element->manager == GST_ELEMENT(bin)) {
// if it's a Bin, add it to the list of Bins to check
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);
// otherwise add it to the list of elements
} 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->num_managed_elements++;
}
}
} 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);
- DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
+ GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
}
static void
GstPad *pad;
GstBuffer *buf = NULL;
- DEBUG_SET_STRING("(\"%s\")", gst_element_get_name (GST_ELEMENT (bin)));
- DEBUG_ENTER_STRING;
+ GST_DEBUG_SET_STRING("(\"%s\")", gst_element_get_name (GST_ELEMENT (bin)));
+ GST_DEBUG_ENTER_STRING;
g_return_if_fail (bin != NULL);
g_return_if_fail (GST_IS_BIN (bin));
if (chain->need_cothreads) {
// all we really have to do is switch to the first child
// 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);
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);
cothread_switch (entry->threadstate);
} else {
- DEBUG("starting iteration via chain-functions\n");
+ GST_DEBUG (0,"starting iteration via chain-functions\n");
entries = chain->entries;
entry = GST_ELEMENT (entries->data);
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)) {
gst_bin_iterate (GST_BIN (entry));
while (pads) {
pad = GST_PAD (pads->data);
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)
fprintf(stderr, "error, no getfunc in \"%s\"\n", gst_element_get_name (entry));
else
}
}
- DEBUG_LEAVE("(%s)", gst_element_get_name (GST_ELEMENT (bin)));
+ GST_DEBUG_LEAVE("(%s)", gst_element_get_name (GST_ELEMENT (bin)));
}
GstBuffer *buffer;
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");
buffer->lock = g_mutex_new ();
g_return_val_if_fail ((offset+size) <= parent->size, NULL);
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 ();
#ifdef HAVE_ATOMIC_H
g_return_val_if_fail (append != 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);
// the buffer is not used by anyone else
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
if (GST_BUFFER_DATA (buffer) &&
{
g_return_if_fail (buffer != NULL);
- DEBUG("referencing buffer %p\n", buffer);
+ GST_DEBUG (0,"referencing buffer %p\n", buffer);
#ifdef HAVE_ATOMIC_H
//g_return_if_fail(atomic_read(&(buffer->refcount)) > 0);
g_return_if_fail (buffer != NULL);
- DEBUG("unreferencing buffer %p\n", buffer);
+ GST_DEBUG (0,"unreferencing buffer %p\n", buffer);
#ifdef HAVE_ATOMIC_H
g_return_if_fail (atomic_read (&(buffer->refcount)) > 0);
GstBufferPool *pool;
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->destroy_buffer = NULL;
g_return_val_if_fail (tocaps != NULL, FALSE);
if (fromcaps->id != tocaps->id) {
- DEBUG ("gstcaps: mime types wrong\n");
+ GST_DEBUG (0,"gstcaps: mime types wrong\n");
return FALSE;
}
return gst_props_check_compatibility (fromcaps->properties, tocaps->properties);
}
else {
- DEBUG ("gstcaps: no source caps\n");
+ GST_DEBUG (0,"gstcaps: no source caps\n");
return FALSE;
}
}
else {
// assume it accepts everything
- DEBUG ("gstcaps: no caps\n");
+ GST_DEBUG (0,"gstcaps: no caps\n");
return TRUE;
}
}
gst_clock_register (GstClock *clock, GstObject *obj)
{
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->num++;
}
g_mutex_lock (clock->lock);
clock->start_time = now - time;
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
clock->start_time = ((guint64)tfnow.tv_sec)*1000000LL+tfnow.tv_usec;
clock->current_time = clock->start_time;
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);
}
diff = GST_CLOCK_DIFF (time, now);
// 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);
if (diff > 10000 ) {
if (!tfnow.tv_sec) {
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);
}
- 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);
}
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
g_return_if_fail (GST_IS_PAD (pad));
/* 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_set_parent (pad,GST_OBJECT (element));
/* obtain the pads requested */
srcpad = gst_element_get_pad (src, srcpadname);
if (srcpad == NULL) {
- ERROR(src,"source element has no pad \"%s\"",srcpadname);
+ GST_ERROR(src,"source element has no pad \"%s\"",srcpadname);
return;
}
destpad = gst_element_get_pad (dest, destpadname);
if (srcpad == NULL) {
- ERROR(dest,"destination element has no pad \"%s\"",destpadname);
+ GST_ERROR(dest,"destination element has no pad \"%s\"",destpadname);
return;
}
/* have to make sure that they have the same parents... */
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));
return;
}
/* if that outright didn't work, we need to bail right away */
/* NOTE: this will bail on ASYNC as well! */
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;
}
}
g_return_val_if_fail (name != 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);
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;
while (walk) {
g_return_val_if_fail(factory != 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
if (factory->type == 0) {
// attempt to set the elemenfactory class pointer if necessary
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass);
if (oclass->elementfactory == NULL) {
- DEBUG ("gstelementfactory: class %s\n", factory->name);
+ GST_DEBUG (0,"gstelementfactory: class %s\n", factory->name);
oclass->elementfactory = factory;
}
g_return_val_if_fail(factoryname != 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);
factory = gst_elementfactory_find(factoryname);
gchar *elementname = empty,*location = empty;
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);
if (element && GST_IS_ELEMENT (element))
elementname = g_strdup_printf (" [%s]",gst_element_get_name (element));
}
const gchar *
-gst_info_get_category_name (gint category) {
- return _gst_info_category_strings[category];
+gst_get_category_name (gint category) {
+ if ((category >= 0) && (category < GST_CAT_MAX_CATEGORY))
+ return _gst_info_category_strings[category];
+ else
+ return NULL;
}
void
* DEBUG system
**********************************************************************/
+extern guint32 _gst_debug_categories;
+
/* for include files that make too much noise normally */
#ifdef GST_DEBUG_FORCE_DISABLE
#undef GST_DEBUG_ENABLED
#define GST_DEBUG_ENABLED
#endif
+#ifndef GST_DEBUG_ENABLE_CATEGORIES
+#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000
+#endif
+
/* fallback, this should probably be a 'weak' symbol or something */
G_GNUC_UNUSED static gchar *_debug_string = NULL;
"DEBUG(%d:%d)" __PRETTY_FUNCTION__ ":%d" format , getpid() , cothread_getcurrent() , __LINE__ , ## args
#ifdef GST_DEBUG_ENABLED
-#define DEBUG(format,args...) \
- (_debug_string != NULL) ? \
- fprintf(stderr,GST_DEBUG_PREFIX("%s: "format , _debug_string , ## args )) : \
- fprintf(stderr,GST_DEBUG_PREFIX(": "format , ## args ))
-#define DEBUG_NOPREFIX(format,args...) fprintf(stderr,format , ## args )
-#define DEBUG_ENTER(format, args...) \
- fprintf(stderr,GST_DEBUG_PREFIX(format": entering\n" , ## args ))
-#define DEBUG_SET_STRING(format, args...) \
+#define GST_DEBUG(cat,format,args...) G_STMT_START{ \
+ if (((1<<cat) & GST_DEBUG_ENABLE_CATEGORIES) && \
+ ((1<<cat) & _gst_debug_categories)) \
+ (_debug_string != NULL) ? \
+ fprintf(stderr,GST_DEBUG_PREFIX("%s: "format , _debug_string , ## args )) : \
+ fprintf(stderr,GST_DEBUG_PREFIX(": "format , ## args )); \
+}G_STMT_END
+
+#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 )
-#define DEBUG_ENTER_STRING DEBUG_ENTER("%s",_debug_string)
-#define DEBUG_LEAVE(format, args...) \
- if (_debug_string != NULL) g_free(_debug_string),\
- fprintf(stderr,GST_DEBUG_PREFIX(format": leaving\n" , ## args ))
-#define DEBUG_LEAVE_STRING DEBUG_LEAVE("%s",_debug_string)
+
+#define GST_DEBUG_ENTER_STRING GST_DEBUG_ENTER("%s",_debug_string)
+
+#define GST_DEBUG_LEAVE(format, args...) G_STMT_START{ \
+ 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
-#define DEBUG(format, args...)
-#define DEBUG_NOPREFIX(format, args...)
-#define DEBUG_ENTER(format, args...)
-#define DEBUG_LEAVE(format, args...)
-#define DEBUG_SET_STRING(format, args...)
-#define DEBUG_ENTER_STRING
+#define GST_DEBUG(format, args...)
+#define GST_DEBUG_NOPREFIX(format, args...)
+#define GST_DEBUG_ENTER(format, args...)
+#define GST_DEBUG_LEAVE(format, args...)
+#define GST_DEBUG_SET_STRING(format, args...)
+#define GST_DEBUG_ENTER_STRING
#endif
#endif
#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) \
_gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \
}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) \
_gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
#else
-#define INFO(cat,format,args...)
-#define INFO_ELEMENT(cat,element,format,args...)
+#define GST_INFO(cat,format,args...)
+#define GST_INFO_ELEMENT(cat,element,format,args...)
#endif
+
void gst_info_set_categories (guint32 categories);
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_disable_category (gint category);
+const gchar * gst_get_category_name (gint category);
enum {
- GST_INFO_GST_INIT = 0, // Library initialization
- GST_INFO_COTHREADS, // Cothread creation, etc.
- GST_INFO_COTHREAD_SWITCH, // Cothread switching
- GST_INFO_AUTOPLUG, // Successful autoplug results
- GST_INFO_AUTOPLUG_ATTEMPT, // Attempted autoplug operations
- GST_INFO_PARENTAGE, // GstBin parentage issues
- GST_INFO_STATES, // State changes and such
- GST_INFO_PLANNING, // Plan generation
- GST_INFO_SCHEDULING, // Schedule construction
- GST_INFO_OPERATION, // Events during actual data movement
- GST_INFO_BUFFER, // Buffer creation/destruction
- GST_INFO_CAPS, // Capabilities matching
- GST_INFO_CLOCK, // Clocking
- GST_INFO_ELEMENT_PADS, // Element pad management
- GST_INFO_ELEMENTFACTORY, // Elementfactory stuff
- GST_INFO_PADS, // Pad creation/connection
- GST_INFO_PIPELINE, // Pipeline stuff
- GST_INFO_PLUGIN_LOADING, // Plugin loading
- GST_INFO_PLUGIN_ERRORS, // Errors during plugin loading
- GST_INFO_PROPERTIES, // Properties
- GST_INFO_THREAD, // Thread creation/management
- GST_INFO_TYPES, // Typing
- GST_INFO_XML, // XML load/save of everything
+ GST_CAT_GST_INIT = 0, // Library initialization
+ GST_CAT_COTHREADS, // Cothread creation, etc.
+ GST_CAT_COTHREAD_SWITCH, // Cothread switching
+ GST_CAT_AUTOPLUG, // Successful autoplug results
+ GST_CAT_AUTOPLUG_ATTEMPT, // Attempted autoplug operations
+ GST_CAT_PARENTAGE, // GstBin parentage issues
+ GST_CAT_STATES, // State changes and such
+ GST_CAT_PLANNING, // Plan generation
+ GST_CAT_SCHEDULING, // Schedule construction
+ GST_CAT_OPERATION, // Events during actual data movement
+ GST_CAT_BUFFER, // Buffer creation/destruction
+ GST_CAT_CAPS, // Capabilities matching
+ GST_CAT_CLOCK, // Clocking
+ GST_CAT_ELEMENT_PADS, // Element pad management
+ GST_CAT_ELEMENTFACTORY, // Elementfactory stuff
+ GST_CAT_PADS, // Pad creation/connection
+ GST_CAT_PIPELINE, // Pipeline stuff
+ GST_CAT_PLUGIN_LOADING, // Plugin loading
+ GST_CAT_PLUGIN_ERRORS, // Errors during plugin loading
+ GST_CAT_PROPERTIES, // Properties
+ GST_CAT_THREAD, // Thread creation/management
+ GST_CAT_TYPES, // Typing
+ GST_CAT_XML, // XML load/save of everything
+
+ GST_CAT_MAX_CATEGORY,
};
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, \
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, \
element,object,g_strdup_printf( format , ## args ))
g_return_if_fail(object != parent);
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;
}
g_return_if_fail (GST_IS_PAD (pad));
// 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;
- 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);
}
/**
g_return_if_fail (pad != NULL);
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;
}
gst_pad_push_func(GstPad *pad, GstBuffer *buf)
{
if (pad->peer->chainfunc != NULL) {
- DEBUG("calling chain function\n");
+ GST_DEBUG (0,"calling chain function\n");
(pad->peer->chainfunc)(pad,buf);
} 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");
}
}
GList *pads;
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) {
(pad->qosfunc) (pad,qos_message);
element = GST_ELEMENT (pad->peer->parent);
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) {
target_pad = GST_PAD (pads->data);
if (target_pad->direction == GST_PAD_SINK) {
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
}
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));
}
}
}
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));
return TRUE;
}
#ifndef gst_pad_push
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) {
- 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));
(pad->peer->pushfunc)(pad->peer,buf);
} else
- DEBUG("no pushfunc\n");
+ GST_DEBUG (0,"no pushfunc\n");
}
#endif
#ifndef gst_pad_pull
GstBuffer *gst_pad_pull(GstPad *pad) {
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) {
- 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));
return (peer->pullfunc)(peer);
} 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;
}
}
#ifndef gst_pad_pullregion
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) {
- 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));
return (pad->peer->pullregionfunc)(pad->peer,offset,size);
} else {
- DEBUG("no pullregionfunc\n");
+ GST_DEBUG (0,"no pullregionfunc\n");
return NULL;
}
}
g_return_val_if_fail (pad != NULL, 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));
// g_return_val_if_fail (element != NULL, 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);
return TRUE;
g_return_val_if_fail (GST_IS_PAD(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;
- 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);
return TRUE;
static void
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)));
}
static void
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;
}
GstElement *typefind;
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);
typefind = gst_elementfactory_make ("typefind", "typefind");
GList *sinkpads;
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));
sinkpads = gst_element_get_pad_list(sink);
{
if (gst_caps_list_check_compatibility (pad->caps, sinkpad->caps)) {
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));
- 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));
connected = TRUE;
break;
}
if (!connected) {
- DEBUG("gstpipeline: no path to sinks for type\n");
+ GST_DEBUG (0,"gstpipeline: no path to sinks for type\n");
}
return 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));
gtk_signal_connect(GTK_OBJECT(src),"new_pad",
GTK_SIGNAL_FUNC(gst_pipeline_pads_autoplug_func), sink);
g_return_val_if_fail(pipeline != NULL, 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)));
// fase 1, run typedetect on the source if needed...
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)));
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));
src_caps = gst_pipeline_typefind(pipeline, pipeline->src);
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);
}
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;
}
}
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);
gst_bin_add(GST_BIN(pipeline), element);
if (factories[i]) {
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);
factories[i] = g_list_next(factories[i]);
}
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
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);
// this will be the new bin for all following elements
}
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);
- 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);
thesrcelement = queue;
}
// no thread needed, easy case
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_pipeline_pads_autoplug(thesrcelement, element);
}
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)));
return FALSE;
}
gst_plugin_load_recurse(path->data,NULL);
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);
}
if (module != NULL) {
if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) {
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->filename = g_strdup(name);
plugin->loaded = TRUE;
gchar *filename = g_strdup (plugin->filename);
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);
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 (filename);
gchar *filename = g_strdup (plugin->filename);
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;
gst_plugin_remove(plugin);
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 (pluginname);
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);
}
GstProps *props;
#define add_value(value) {\
- DEBUG ("%d %p\n", i, value);\
+ GST_DEBUG (0,"%d %p\n", i, value);\
factory[i++] = value; \
if (i >= size) { \
size += 16; \
static gboolean
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));
switch (entry1->propstype) {
case GST_PROPS_LIST_ID_NUM:
entry2 = (GstPropsEntry *)sinklist->data;
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++;
sourcelist = g_slist_next (sourcelist);
if (sourcelist) entry1 = (GstPropsEntry *)sourcelist->data;
else goto end;
}
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++;
sinklist = g_slist_next (sinklist);
if (sinklist) entry2 = (GstPropsEntry *)sinklist->data;
GstPropsEntry *entry2;
entry2 = (GstPropsEntry *)sinklist->data;
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:
GstElement *element = GST_ELEMENT (argv);
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 {
- 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);
(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));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
- DEBUG_LEAVE("(%d,'%s')",argc,name);
+ GST_DEBUG_LEAVE("(%d,'%s')",argc,name);
return 0;
}
GstPad *pad;
GstBuffer *buf;
- DEBUG_ENTER("(\"%s\")",name);
- DEBUG("stepping through pads\n");
+ GST_DEBUG_ENTER("(\"%s\")",name);
+ GST_DEBUG (0,"stepping through pads\n");
do {
pads = element->pads;
while (pads) {
pad = GST_PAD (pads->data);
pads = g_list_next (pads);
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);
- 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);
- 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));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
- DEBUG_LEAVE("(%d,'%s')",argc,name);
+ GST_DEBUG_LEAVE("(%d,'%s')",argc,name);
return 0;
}
GstBuffer *buf;
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 {
pads = element->pads;
pad = GST_PAD (pads->data);
if (pad->direction == GST_PAD_SRC) {
// 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) {
//gst_src_push_region (GST_SRC (element), region->offset, region->size);
// if (pad->getregionfunc == NULL)
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);
}
pads = g_list_next(pads);
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
- DEBUG_LEAVE("");
+ GST_DEBUG_LEAVE("");
return 0;
}
gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
{
cothread_state *threadstate = GST_ELEMENT(pad->parent)->threadstate;
- DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
- DEBUG("putting buffer %p in peer's pen\n",buf);
+ GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
+ GST_DEBUG (0,"putting buffer %p in peer's pen\n",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);
- DEBUG("done switching\n");
+ GST_DEBUG (0,"done switching\n");
}
static GstBuffer*
GstBuffer *buf;
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) {
- 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);
}
- DEBUG("done switching\n");
+ GST_DEBUG (0,"done switching\n");
buf = pad->bufpen;
pad->bufpen = NULL;
return buf;
// region_struct region;
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.size = size;
GList *pads;
GstPad *pad;
- DEBUG("chain is using cothreads\n");
+ GST_DEBUG (0,"chain is using cothreads\n");
// first create thread context
if (bin->threadcontext == NULL) {
- DEBUG("initializing cothread context\n");
+ GST_DEBUG (0,"initializing cothread context\n");
bin->threadcontext = cothread_init ();
}
// if the element has a loopfunc...
if (element->loopfunc != NULL) {
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 {
// 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 doesn't have any sinks, it must be a source (duh)
if (element->numsinkpads == 0) {
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 {
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));
}
}
}
(GST_ELEMENT(pad->peer->parent)->manager != GST_ELEMENT(bin))) {
// set the chain proxies
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;
} 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->pullregionfunc = pad->getregionfunc;
}
// otherwise we really are a cothread
} else {
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);
} 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);
}
}
if (wrapper_function != NULL) {
if (element->threadstate == NULL) {
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);
- 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));
}
}
GList *pads;
GstPad *pad;
- DEBUG("chain entered\n");
+ GST_DEBUG (0,"chain entered\n");
// walk through all the elements
elements = chain->elements;
while (elements) {
pads = g_list_next (pads);
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;
} 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->pullregionfunc = pad->getregionfunc;
}
GList *chains;
_GstBinChain *chain;
- DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
- DEBUG_ENTER_STRING;
+ GST_DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
+ GST_DEBUG_ENTER_STRING;
gst_bin_schedule_cleanup(bin);
// 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
elements = g_list_copy (bin->managed_elements);
// we have to repeat until the list is empty to get all chains
// if this is a DECOUPLED element
if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// 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);
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
pending = g_slist_prepend (NULL, element);
pending = g_slist_remove (pending, element);
// 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->num_elements++;
// set the cothreads flag as appropriate
if ((element->manager == GST_ELEMENT(bin)) &&
!GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// 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);
// if this element is a source, add it as an entry
if (element->numsinkpads == 0) {
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
while (pads) {
pad = GST_PAD (pads->data);
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->parent != 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 add it if it's in the list of un-visited elements still
if ((g_list_find (elements, pad->peer->parent) != NULL) ||
GST_FLAG_IS_SET (pad->peer->parent, GST_ELEMENT_DECOUPLED)) {
// 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));
// 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) &&
(GST_FLAG_IS_SET (pad->peer->parent, GST_ELEMENT_DECOUPLED))) {
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
- 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);
// 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;
while (elements) {
element = GST_ELEMENT (elements->data);
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->num_chains++;
}
// free up the list in case it's full of DECOUPLED 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
chains = bin->chains;
}
}
- DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
+ GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
}
if ((GST_IS_SRC (outside) || GST_IS_CONNECTION (outside)) &&
(gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
- DEBUG("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,"dealing with outside source element %s\n",gst_element_get_name(outside));
+// 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);
// 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->pullfunc = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
}
/*
} 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->num_entries++;
cothread_setfunc(element->threadstate,gst_bin_src_wrapper,0,(char **)element);
pad = GST_PAD(pads->data);
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
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) {
- 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
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->pullregionfunc = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy);
}
bin->entries = g_list_prepend (bin->entries, GST_ELEMENT(bin->children->data));
}
} 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
elements = bin->children;
while (elements) {
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)) {
gst_bin_create_plan (GST_BIN (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->num_entries++;
}
pad = GST_PAD (pads->data);
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
- 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);
// need to walk through and check for outside connections
// get the pad's peer
peer = gst_pad_get_peer (pad);
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;
}
// get the parent of the peer of the pad
}
}
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);
// If cothreads are needed, we need to not only find elements but
// set up cothread states and various proxy functions.
if (bin->need_cothreads) {
- DEBUG("bin is using cothreads\n");
+ GST_DEBUG (0,"bin is using cothreads\n");
// first create thread context
if (bin->threadcontext == NULL) {
- DEBUG("initializing cothread context\n");
+ GST_DEBUG (0,"initializing cothread context\n");
bin->threadcontext = cothread_init ();
}
// first of all, if there's a loopfunc, the decision's already made
if (element->loopfunc != NULL) {
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 {
// 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
// check to see if someone else gets to set up the element
peer_manager = GST_ELEMENT((pad)->peer->parent)->manager;
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 (wrapper_function != NULL) {
// set up proxy functions
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);
} 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);
}
} else {
// otherwise we need to set up for 'traditional' chaining
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
// 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));
pad->pushfunc = pad->chainfunc;
} else if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
// 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));
pad->pullfunc = pad->getfunc;
}
if (wrapper_function != NULL) {
if (element->threadstate == NULL) {
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));
}
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));
}
// otherwise, cothreads are not needed
} else {
- DEBUG("bin is chained, no cothreads needed\n");
+ GST_DEBUG (0,"bin is chained, no cothreads needed\n");
elements = bin->managed_elements;
while (elements) {
pads = g_list_next (pads);
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;
} 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;
}
}
static void
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
GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
g_return_if_fail (GST_IS_THREAD (bin));
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
switch(id) {
case ARG_CREATE_THREAD:
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);
- DEBUG("gstthread: flags are 0x%08x\n", GST_FLAGS (object));
+ GST_DEBUG (0,"gstthread: flags are 0x%08x\n", GST_FLAGS (object));
} 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);
- DEBUG("gstthread: flags are 0x%08x\n", GST_FLAGS (object));
+ GST_DEBUG (0,"gstthread: flags are 0x%08x\n", GST_FLAGS (object));
}
break;
default:
gint pending, transition;
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);
- 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_STATE_PENDING (element));
if (GST_ELEMENT_CLASS (parent_class)->change_state)
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));
switch (transition) {
case GST_STATE_NULL_TO_READY:
// if (!stateset) return FALSE;
// 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)));
// set the state to idle
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
// 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)) {
- INFO(GST_INFO_THREAD, "gstthread: starting thread \"%s\"",
+ GST_INFO (GST_CAT_THREAD, "gstthread: starting thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element)));
// create the thread
// wait for it to 'spin up'
// gst_thread_wait_thread (thread);
} 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)));
}
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_READY_TO_PLAYING:
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_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
gst_thread_signal_thread (thread);
break;
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_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING);
gst_thread_signal_thread (thread);
break;
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_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
{
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 ());
// construct the plan and signal back
GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING);
// 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)));
return NULL;
}
static void
gst_thread_signal_thread (GstThread *thread)
{
- DEBUG("signaling thread\n");
+ GST_DEBUG (0,"signaling thread\n");
g_mutex_lock (thread->lock);
g_cond_signal (thread->cond);
g_mutex_unlock (thread->lock);
static void
gst_thread_wait_thread (GstThread *thread)
{
- DEBUG("waiting for thread\n");
+ GST_DEBUG (0,"waiting for thread\n");
g_mutex_lock (thread->lock);
g_cond_wait (thread->cond, thread->lock);
g_mutex_unlock (thread->lock);
xmlNodePtr parent,
GHashTable *elements)
{
- DEBUG("gstthread: restore\n");
+ GST_DEBUG (0,"gstthread: restore\n");
if (GST_ELEMENT_CLASS (parent_class)->restore_thyself)
GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements);
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);
if (!id) {
g_return_val_if_fail (mime != NULL, 0);
walk = _gst_types;
-// DEBUG("searching for '%s'\n",mime);
+// GST_DEBUG (0,"searching for '%s'\n",mime);
mimelen = strlen (mime);
while (walk) {
type = (GstType *)walk->data;
search = type->mime;
-// DEBUG("checking against '%s'\n",search);
+// GST_DEBUG (0,"checking against '%s'\n",search);
typelen = strlen (search);
while ((search - type->mime) < typelen) {
found = strstr (search, mime);
guint16 typeid;
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;
gst_plugin_load_typefactory (type->mime);
g_return_val_if_fail(xml != 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);
} else
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));
if (src->new_seek) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
- DEBUG ("new seek\n");
+ GST_DEBUG (0,"new seek\n");
src->new_seek = FALSE;
}
} else
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 */
return buf;
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
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);
}
if (!audiosink->mute) {
gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
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));
write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
//write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));
/* set card state */
gst_audiosrc_sync_parms (src);
- DEBUG("opened audio\n");
+ GST_DEBUG (0,"opened audio\n");
GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
return TRUE;
/* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < src->bytes_per_read) {
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 */
GST_BUFFER_SIZE (buf) = 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 */
- 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;
}
}
else {
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);
return TRUE;
{
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 (GST_STATE_PENDING (element) == GST_STATE_NULL) {
g_return_if_fail (fdsink->fd >= 0);
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));
}
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE);
/* 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);
- DEBUG("read %ld bytes\n", readbytes);
+ GST_DEBUG (0,"read %ld bytes\n", readbytes);
if (readbytes < 0) {
if (errno == EAGAIN) {
- DEBUG("no input yet\n");
+ GST_DEBUG (0,"no input yet\n");
gst_buffer_unref(newbuf);
return FALSE;
}
data = GST_BUFFER_DATA(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);
- DEBUG("written %ld bytes\n", writebytes);
+ GST_DEBUG (0,"written %ld bytes\n", writebytes);
if (writebytes < 0) {
perror("write");
gst_element_error(GST_ELEMENT(pipefilter),"writing");
static void
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));
}
/* 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);
- DEBUG("queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
- DEBUG("queue: have queue lock\n");
+ GST_DEBUG (0,"queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
+ GST_DEBUG (0,"queue: have queue lock\n");
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) {
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) {
- 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");
GST_UNLOCK (queue);
g_mutex_lock (queue->fulllock);
g_mutex_unlock (queue->fulllock);
GST_LOCK (queue);
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 */
queue->queue = g_slist_append (queue->queue, buf);
// 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 */
tosignal = (queue->level_buffers >= 0);
queue->level_buffers++;
/* 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);
if (tosignal) {
name = gst_element_get_name (GST_ELEMENT (queue));
/* 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);
- DEBUG("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 push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
+ GST_DEBUG (0,"queue: %s have queue lock\n", name);
// we bail if there's nothing there
if (!queue->level_buffers && !queue->block) {
front = queue->queue;
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);
g_slist_free (front);
queue->level_buffers--;
// 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;
GST_UNLOCK(queue);
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);
-// 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;
/* unlock now */
g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE);
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 (GST_STATE_PENDING (element) == GST_STATE_READY) {
#include <sys/soundcard.h>
#include <math.h>
#include <stdlib.h>
+#include <string.h>
#include <gstsinesrc.h>