#include <sys/mman.h>
/* we make too much noise for normal debugging... */
-//#define GST_DEBUG_FORCE_DISABLE
+/* #define GST_DEBUG_FORCE_DISABLE */
#include "gst_private.h"
#include "cothreads.h"
{
cothread_context *ctx = (cothread_context *)malloc(sizeof(cothread_context));
- // we consider the initiating process to be cothread 0
+ /* we consider the initiating process to be cothread 0 */
ctx->nthreads = 1;
ctx->current = 0;
ctx->data = g_hash_table_new(g_str_hash, g_str_equal);
ctx->threads[0]->sp = (void *)CURRENT_STACK_FRAME;
ctx->threads[0]->pc = 0;
- // initialize the lock
+ /* initialize the lock */
#ifdef COTHREAD_ATOMIC
atomic_set (&ctx->threads[0]->lock, 0);
#else
return NULL;
}
GST_DEBUG (0,"pthread_self() %ld\n",pthread_self());
- //if (0) {
- if (pthread_self() == 0) { // FIXME uh, what does this test really do?
+ /* if (0) { */
+ if (pthread_self() == 0) { /* FIXME uh, what does this test really do? */
s = (cothread_state *)malloc(COTHREAD_STACKSIZE);
GST_DEBUG (0,"new stack (case 1) at %p\n",s);
} else {
void *sp = CURRENT_STACK_FRAME;
- // FIXME this may not be 64bit clean
- // could use casts to uintptr_t from inttypes.h
- // if only all platforms had inttypes.h
+ /* FIXME this may not be 64bit clean
+ * could use casts to uintptr_t from inttypes.h
+ * if only all platforms had inttypes.h
+ */
guchar *stack_end = (guchar *)((unsigned long)sp & ~(STACK_SIZE - 1));
s = (cothread_state *)(stack_end + ((ctx->nthreads - 1) *
COTHREAD_STACKSIZE));
s->threadnum = ctx->nthreads;
s->flags = 0;
s->sp = ((guchar *)s + COTHREAD_STACKSIZE);
- // is this needed anymore?
+ /* is this needed anymore? */
s->top_sp = s->sp;
- // initialize the lock
+ /* initialize the lock */
#ifdef COTHREAD_ATOMIC
atomic_set (s->lock, 0);
#else
GST_DEBUG_ENTER("");
thread->flags |= COTHREAD_STARTED;
-//#ifdef COTHREAD_ATOMIC
-// // do something here to lock
-//#else
-// g_mutex_lock(thread->lock);
-//#endif
+/* #ifdef COTHREAD_ATOMIC
+ * do something here to lock
+ * #else
+ * g_mutex_lock(thread->lock);
+ * #endif
+ */
while (1) {
thread->func(thread->argc,thread->argv);
- // we do this to avoid ever returning, we just switch to 0th thread
+ /* we do this to avoid ever returning, we just switch to 0th thread */
cothread_switch(cothread_main(ctx));
}
thread->flags &= ~COTHREAD_STARTED;
#endif
if (current == thread) goto selfswitch;
- // unlock the current thread, we're out of that context now
+ /* unlock the current thread, we're out of that context now */
#ifdef COTHREAD_ATOMIC
- // do something to unlock the cothread
+ /* do something to unlock the cothread */
#else
g_mutex_unlock(current->lock);
#endif
- // lock the next cothread before we even switch to it
+ /* lock the next cothread before we even switch to it */
#ifdef COTHREAD_ATOMIC
- // do something to lock the cothread
+ /* do something to lock the cothread */
#else
g_mutex_lock(thread->lock);
#endif
- // find the number of the thread to switch to
+ /* find the number of the thread to switch to */
GST_INFO (GST_CAT_COTHREAD_SWITCH,"switching from cothread #%d to cothread #%d",
ctx->current,thread->threadnum);
ctx->current = thread->threadnum;
/* restore stack pointer and other stuff of new cothread */
if (thread->flags & COTHREAD_STARTED) {
GST_DEBUG (0,"in thread \n");
- // switch to it
+ /* switch to it */
siglongjmp(thread->jmp,1);
} else {
GST_ARCH_SETUP_STACK(thread->sp);
GST_ARCH_SET_SP(thread->sp);
- // start it
+ /* start it */
GST_ARCH_CALL(cothread_stub);
GST_DEBUG (0,"exit thread \n");
ctx->current = 0;
cothread_lock (cothread_state *thread)
{
#ifdef COTHREAD_ATOMIC
- // do something to lock the cothread
+ /* do something to lock the cothread */
#else
if (thread->lock)
g_mutex_lock(thread->lock);
cothread_trylock (cothread_state *thread)
{
#ifdef COTHREAD_ATOMIC
- // do something to try to lock the cothread
+ /* do something to try to lock the cothread */
#else
if (thread->lock)
return g_mutex_trylock(thread->lock);
cothread_unlock (cothread_state *thread)
{
#ifdef COTHREAD_ATOMIC
- // do something to unlock the cothread
+ /* do something to unlock the cothread */
#else
if (thread->lock)
g_mutex_unlock(thread->lock);
#include "gobject2gtk.h"
-// list functions not in glib 1.2
+/* list functions not in glib 1.2 */
GList *
g_list_delete_link (GList *list, GList *llink)
{
return temp;
}
-// string helper functions not in glib 1.2
+/* string helper functions not in glib 1.2 */
gchar*
g_strcanon (gchar *string,
return string;
}
-// GObject dummy implementation
+/* GObject dummy implementation */
static void
g_object_set_arg(GtkObject *object, GtkArg *arg, guint id)
{
gchar *arg_fullname;
arg_fullname = g_strdup_printf("%s::%s",gtk_type_name(oclass->type),pspec->name);
- //fprintf(stderr,"installing arg \"%s\" into class \"%s\"\n",arg_fullname,"");
+ /* fprintf(stderr,"installing arg \"%s\" into class \"%s\"\n",arg_fullname,""); */
gtk_object_add_arg_type(arg_fullname,pspec->value_type,pspec->flags,property_id);
g_free(pspec);
}
GtkArgInfo *info;
GParamSpec *spec;
- //fprintf(stderr,"class name is %s\n",gtk_type_name(class->type));
+ /* fprintf(stderr,"class name is %s\n",gtk_type_name(class->type)); */
- // the return value NULL if no error
+ /* the return value NULL if no error */
if (gtk_object_arg_get_info(class->type,name,&info) != NULL) {
return NULL;
}
int i;
args = gtk_object_query_args (type, &flags, &num_args);
- // FIXME: args and flags need to be freed.
+ /* FIXME: args and flags need to be freed. */
params = g_new0(GParamSpec *,num_args);
for (i=0;i<num_args;i++) {
GtkType object_type,
GtkSignalRunType signal_flags,
guint function_offset,
- gpointer accumulator, // GSignalAccumulator
+ gpointer accumulator, /* GSignalAccumulator */
gpointer accu_data,
GtkSignalMarshaller marshaller,
GType return_val,
if (strcmp (name, "destroy") == 0)
name = "g2gdestroy";
-#define MAX_SIGNAL_PARAMS (31) // from gtksignal.c
+#define MAX_SIGNAL_PARAMS (31) /* from gtksignal.c */
g_return_val_if_fail (nparams < MAX_SIGNAL_PARAMS, 0);
if (nparams > 0)
g_free (params);
- // now register it.
+ /* now register it. */
gtk_object_class_add_signals(gtk_type_class(object_type), &signal_id, 1);
return signal_id;
#endif
if (!gst_init_check (argc,argv)) {
- exit (0); // FIXME!
+ exit (0); /* FIXME! */
}
llf = G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL;
gst_trace = gst_trace_new ("gst.trace",1024);
gst_trace_set_default (gst_trace);
}
-#endif // GST_DISABLE_TRACE
+#endif /* GST_DISABLE_TRACE */
}
static void
if (!strncmp ("--gst-info-mask=", (*argv)[i], 16)) {
guint32 val;
- // handle either 0xHEX or dec
+ /* handle either 0xHEX or dec */
if (*((*argv)[i]+17) == 'x') {
sscanf ((*argv)[i]+18, "%08x", &val);
} else {
else if (!strncmp ("--gst-debug-mask=", (*argv)[i], 17)) {
guint32 val;
- // handle either 0xHEX or dec
+ /* handle either 0xHEX or dec */
if (*((*argv)[i]+18) == 'x') {
sscanf ((*argv)[i]+19, "%08x", &val);
} else {
else if (!strncmp ("--gst-mask=", (*argv)[i], 11)) {
guint32 val;
- // handle either 0xHEX or dec
+ /* handle either 0xHEX or dec */
if (*((*argv)[i]+12) == 'x') {
sscanf ((*argv)[i]+13, "%08x", &val);
} else {
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include <gst/gstconfig.h>
#endif
static GstPluginFeatureClass *factory_parent_class = NULL;
-//static guint gst_autoplugfactory_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_autoplugfactory_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_autoplugfactory_get_type (void)
_gst_autoplugfactories = g_list_remove (_gst_autoplugfactories, factory);
- // we don't free the struct bacause someone might have a handle to it..
+ /* we don't free the struct bacause someone might have a handle to it.. */
}
/**
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include "gst_private.h"
#include "gstbin.h"
static void
gst_bin_init (GstBin *bin)
{
- // in general, we prefer to use cothreads for most things
+ /* in general, we prefer to use cothreads for most things */
GST_FLAG_SET (bin, GST_BIN_FLAG_PREFER_COTHREADS);
bin->numchildren = 0;
GST_INFO (GST_CAT_SCHEDULING, "setting element \"%s\" sched to %p",GST_ELEMENT_NAME(element),
sched);
- // if it's actually a Bin
+ /* if it's actually a Bin */
if (GST_IS_BIN(element)) {
if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is already a manager, not resetting");
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to parent's");
gst_scheduler_add_element (sched, element);
- // set the children's schedule
+ /* set the children's schedule */
children = GST_BIN(element)->children;
while (children) {
child = GST_ELEMENT (children->data);
gst_bin_set_element_sched (child, sched);
}
- // otherwise, if it's just a regular old element
+ /* otherwise, if it's just a regular old element */
} else {
gst_scheduler_add_element (sched, element);
}
GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from it sched %p",
GST_ELEMENT_NAME(element),GST_ELEMENT_SCHED(element));
- // if it's actually a Bin
+ /* if it's actually a Bin */
if (GST_IS_BIN(element)) {
if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
return;
}
- // FIXME this check should be irrelevant
+ /* FIXME this check should be irrelevant */
if (GST_ELEMENT_SCHED (element))
gst_scheduler_remove_element (GST_ELEMENT_SCHED(element), element);
- // for each child, remove them from their schedule
+ /* for each child, remove them from their schedule */
children = GST_BIN(element)->children;
while (children) {
child = GST_ELEMENT (children->data);
gst_bin_unset_element_sched (child);
}
- // otherwise, if it's just a regular old element
+ /* otherwise, if it's just a regular old element */
} else {
- // FIXME this check should be irrelevant
+ /* FIXME this check should be irrelevant */
if (GST_ELEMENT_SCHED (element))
gst_scheduler_remove_element (GST_ELEMENT_SCHED(element), element);
}
GST_DEBUG (GST_CAT_PARENTAGE, "adding element \"%s\" to bin \"%s\"\n",
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin));
- // must be not be in PLAYING state in order to modify bin
+ /* must be not be in PLAYING state in order to modify bin */
g_return_if_fail (GST_STATE (bin) != GST_STATE_PLAYING);
- // the element must not already have a parent
+ /* the element must not already have a parent */
g_return_if_fail (GST_ELEMENT_PARENT (element) == NULL);
- // then check to see if the element's name is already taken in the bin
+ /* then check to see if the element's name is already taken in the bin */
g_return_if_fail (gst_object_check_uniqueness (bin->children, GST_ELEMENT_NAME (element)) == TRUE);
- // set the element's parent and add the element to the bin's list of children
+ /* set the element's parent and add the element to the bin's list of children */
gst_object_set_parent (GST_OBJECT (element), GST_OBJECT (bin));
g_signal_connect_swapped (G_OBJECT (element), "state_change", gst_bin_child_state_change, G_OBJECT (bin));
bin->children = g_list_append (bin->children, element);
bin->numchildren++;
- // bump our internal state counter
+ /* bump our internal state counter */
state = GST_STATE (element);
while (state>>=1) state_idx++;
bin->child_states[state_idx]++;
- ///// now we have to deal with manager stuff
- // we can only do this if there's a scheduler:
- // if we're not a manager, and aren't attached to anything, we have no sched (yet)
+ /* now we have to deal with manager stuff */
+ /* we can only do this if there's a scheduler: */
+ /* if we're not a manager, and aren't attached to anything, we have no sched (yet) */
if (GST_IS_BIN(element) && GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is a manager");
}
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (bin->children != NULL);
- // must not be in PLAYING state in order to modify bin
+ /* must not be in PLAYING state in order to modify bin */
g_return_if_fail (GST_STATE (bin) != GST_STATE_PLAYING);
- // the element must have its parent set to the current bin
+ /* the element must have its parent set to the current bin */
g_return_if_fail (GST_ELEMENT_PARENT(element) == (GstObject *)bin);
- // the element must be in the bin's list of children
+ /* the element must be in the bin's list of children */
if (g_list_find(bin->children, element) == NULL) {
- // FIXME this should be a warning!!!
+ /* FIXME this should be a warning!!! */
GST_ERROR_OBJECT(bin,element,"no such element in bin");
return;
}
- // remove this element from the list of managed elements
+ /* remove this element from the list of managed elements */
gst_bin_unset_element_sched (element);
- // now remove the element from the list of elements
+ /* now remove the element from the list of elements */
bin->children = g_list_remove (bin->children, element);
bin->numchildren--;
- // bump our internal state counter
+ /* bump our internal state counter */
state = GST_STATE (element);
while (state>>=1) state_idx++;
bin->child_states[state_idx]--;
orig = children = g_list_copy (bin->children);
while (children) {
child = GST_ELEMENT (children->data);
- //gst_object_unref (GST_OBJECT (child));
- //gst_object_unparent (GST_OBJECT (child));
+ /* gst_object_unref (GST_OBJECT (child)); */
+ /* gst_object_unparent (GST_OBJECT (child)); */
gst_bin_remove (bin, child);
children = g_list_next (children);
}
static gboolean
gst_bin_iterate_func (GstBin *bin)
{
- // only iterate if this is the manager bin
+ /* only iterate if this is the manager bin */
if (GST_ELEMENT_SCHED(bin)->parent == GST_ELEMENT (bin)) {
return gst_scheduler_iterate (GST_ELEMENT_SCHED(bin));
} else {
if (!running) {
if (GST_STATE (bin) == GST_STATE_PLAYING && GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, bin, "waiting for child shutdown after useless iteration\n");
- //gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
+ /* gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); */
gst_element_wait_state_change (GST_ELEMENT (bin));
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, bin, "child shutdown\n");
}
{
int buffersize = sizeof(GstBuffer);
static const GTypeInfo buffer_info = {
- 0, // sizeof(class),
+ 0, /* sizeof(class), */
NULL,
NULL,
NULL,
NULL,
NULL,
- 0, // sizeof(object),
+ 0, /* sizeof(object), */
0,
NULL,
NULL,
};
- // round up to the nearest 32 bytes for cache-line and other efficiencies
+ /* round up to the nearest 32 bytes for cache-line and other efficiencies */
buffersize = (((buffersize-1) / 32) + 1) * 32;
_gst_buffer_chunk = g_mem_chunk_new ("GstBuffer", buffersize,
buffer->refcount = 1;
#endif
- // copy flags and type from parent, for lack of better
+ /* copy flags and type from parent, for lack of better */
buffer->flags = parent->flags;
- // set the data pointer, size, offset, and maxsize
+ /* set the data pointer, size, offset, and maxsize */
buffer->data = parent->data + offset;
buffer->size = size;
buffer->maxsize = parent->size - offset;
- // deal with bogus/unknown offsets
+ /* deal with bogus/unknown offsets */
if (parent->offset != (guint32)-1)
buffer->offset = parent->offset + offset;
else
buffer->offset = (guint32)-1;
- // again, for lack of better, copy parent's timestamp
+ /* again, for lack of better, copy parent's timestamp */
buffer->timestamp = parent->timestamp;
buffer->maxage = parent->maxage;
- // if the parent buffer is a subbuffer itself, use its parent, a real buffer
+ /* if the parent buffer is a subbuffer itself, use its parent, a real buffer */
if (parent->parent != NULL)
parent = parent->parent;
- // set parentage and reference the parent
+ /* set parentage and reference the parent */
buffer->parent = parent;
gst_buffer_ref (parent);
}
-// FIXME FIXME: how does this overlap with the newly-added gst_buffer_span() ???
+/* FIXME FIXME: how does this overlap with the newly-added gst_buffer_span() ??? */
/**
* gst_buffer_append:
* @buffer: a buffer
GST_INFO (GST_CAT_BUFFER,"appending buffers %p and %p",buffer,append);
GST_BUFFER_LOCK (buffer);
- // the buffer is not used by anyone else
+ /* the buffer is not used by anyone else */
if (GST_BUFFER_REFCOUNT (buffer) == 1 && buffer->parent == NULL
&& !GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE)) {
- // save the old size
+ /* save the old size */
size = buffer->size;
buffer->size += append->size;
buffer->data = g_realloc (buffer->data, buffer->size);
memcpy(buffer->data + size, append->data, append->size);
GST_BUFFER_UNLOCK (buffer);
}
- // the buffer is used, create a new one
+ /* the buffer is used, create a new one */
else {
newbuf = gst_buffer_new ();
newbuf->size = buffer->size+append->size;
(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) &&
!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE) &&
(buffer->parent == NULL)) {
- // if there's a free function, use it
+ /* if there's a free function, use it */
if (buffer->free != NULL) {
(buffer->free)(buffer);
} else {
}
}
- // unreference the parent if there is one
+ /* unreference the parent if there is one */
if (buffer->parent != NULL)
gst_buffer_unref (buffer->parent);
g_mutex_free (buffer->lock);
- //g_print("freed mutex\n");
+ /* g_print("freed mutex\n"); */
#ifdef GST_DEBUG_ENABLED
- // make it hard to reuse by mistake
+ /* make it hard to reuse by mistake */
memset (buffer, 0, sizeof (GstBuffer));
#endif
- // remove it entirely from memory
+ /* remove it entirely from memory */
g_mutex_lock (_gst_buffer_chunk_lock);
g_mem_chunk_free (_gst_buffer_chunk,buffer);
g_mutex_unlock (_gst_buffer_chunk_lock);
g_return_val_if_fail (GST_BUFFER_REFCOUNT(buffer) > 0, NULL);
- // if a copy function exists, use it, else copy the bytes
+ /* if a copy function exists, use it, else copy the bytes */
if (buffer->copy != NULL) {
newbuf = (buffer->copy)(buffer);
} else {
- // allocate a new buffer
+ /* allocate a new buffer */
newbuf = gst_buffer_new();
- // copy the absolute size
+ /* copy the absolute size */
newbuf->size = buffer->size;
- // allocate space for the copy
+ /* allocate space for the copy */
newbuf->data = (guchar *)g_malloc (buffer->size);
- // copy the data straight across
+ /* copy the data straight across */
memcpy(newbuf->data,buffer->data,buffer->size);
- // the new maxsize is the same as the size, since we just malloc'd it
+ /* the new maxsize is the same as the size, since we just malloc'd it */
newbuf->maxsize = newbuf->size;
}
newbuf->offset = buffer->offset;
newbuf->timestamp = buffer->timestamp;
newbuf->maxage = buffer->maxage;
- // since we just created a new buffer, so we have no ties to old stuff
+ /* since we just created a new buffer, so we have no ties to old stuff */
newbuf->parent = NULL;
newbuf->pool = NULL;
*
* Returns: new buffer that spans the two source buffers
*/
-// FIXME need to think about CoW and such...
+/* FIXME need to think about CoW and such... */
GstBuffer *
gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len)
{
g_return_val_if_fail (GST_BUFFER_REFCOUNT(buf1) > 0, NULL);
g_return_val_if_fail (GST_BUFFER_REFCOUNT(buf2) > 0, NULL);
- // make sure buf1 has a lower address than buf2
+ /* make sure buf1 has a lower address than buf2 */
if (buf1->data > buf2->data) {
GstBuffer *tmp = buf1;
- //g_print ("swapping buffers\n");
+ /* g_print ("swapping buffers\n"); */
buf1 = buf2;
buf2 = tmp;
}
- // if the two buffers have the same parent and are adjacent
+ /* if the two buffers have the same parent and are adjacent */
if (gst_buffer_is_span_fast(buf1,buf2)) {
- // we simply create a subbuffer of the common parent
+ /* we simply create a subbuffer of the common parent */
newbuf = gst_buffer_create_sub (buf1->parent, buf1->data - (buf1->parent->data) + offset, len);
}
else {
- //g_print ("slow path taken in buffer_span\n");
- // otherwise we simply have to brute-force copy the buffers
+ /* g_print ("slow path taken in buffer_span\n"); */
+ /* otherwise we simply have to brute-force copy the buffers */
newbuf = gst_buffer_new ();
- // put in new size
+ /* put in new size */
newbuf->size = len;
- // allocate space for the copy
+ /* allocate space for the copy */
newbuf->data = (guchar *)g_malloc(len);
- // copy the first buffer's data across
+ /* copy the first buffer's data across */
memcpy(newbuf->data, buf1->data + offset, buf1->size - offset);
- // copy the second buffer's data across
+ /* copy the second buffer's data across */
memcpy(newbuf->data + (buf1->size - offset), buf2->data, len - (buf1->size - offset));
if (newbuf->offset != (guint32)-1)
gst_buffer_merge (GstBuffer *buf1, GstBuffer *buf2)
{
GstBuffer *result;
- // we're just a specific case of the more general gst_buffer_span()
+ /* we're just a specific case of the more general gst_buffer_span() */
result = gst_buffer_span (buf1, 0, buf2, buf1->size + buf2->size);
GST_BUFFER_TIMESTAMP (result) = GST_BUFFER_TIMESTAMP (buf1);
g_free(pool);
}
-//
-// This is so we don't get messed up by GST_BUFFER_WHERE.
-//
+/*
+ * This is so we don't get messed up by GST_BUFFER_WHERE.
+ */
static GstBuffer *
_pool_gst_buffer_copy (GstBuffer *buffer)
{ return gst_buffer_copy (buffer); }
guint real_buffer_size;
GstBufferPoolDefault *def;
- // round up to the nearest 32 bytes for cache-line and other efficiencies
+ /* round up to the nearest 32 bytes for cache-line and other efficiencies */
real_buffer_size = (((buffer_size-1) / 32) + 1) * 32;
- // check for an existing GstBufferPool with the same real_buffer_size
- // (we won't worry about the pool_size)
+ /* check for an existing GstBufferPool with the same real_buffer_size */
+ /* (we won't worry about the pool_size) */
g_mutex_lock (_default_pool_lock);
pool = (GstBufferPool*)g_hash_table_lookup(_default_pools,GINT_TO_POINTER(real_buffer_size));
g_mutex_unlock (_default_pool_lock);
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include "gst_private.h"
#include "gstcaps.h"
}
}
else {
- // assume it accepts everything
+ /* assume it accepts everything */
GST_DEBUG (GST_CAT_CAPS,"no caps\n");
return TRUE;
}
#include <sys/time.h>
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include "gst_private.h"
#include "gstelement.h"
now = tfnow.tv_sec*1000000LL+tfnow.tv_usec - clock->start_time;
diff = GST_CLOCK_DIFF (time, now);
- // if we are not behind wait a bit
+ /* if we are not behind wait a bit */
GST_DEBUG (GST_CAT_CLOCK,"gst_clock: %s waiting for time %08llu %08llu %08lld\n",
GST_OBJECT_NAME (obj), time, now, diff);
if (diff > 10000 ) {
tfnow.tv_usec = (diff % 1000000);
tfnow.tv_sec = diff / 1000000;
- // FIXME, this piece of code does not work with egcs optimisations on, had to use the following line
+ /* FIXME, this piece of code does not work with egcs optimisations on, had to use the following line */
if (!tfnow.tv_sec) {
select(0, NULL, NULL, NULL, &tfnow);
}
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include <glib.h>
#include <stdarg.h>
#include "gst_private.h"
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
- // first check to make sure the pad's parent is already set
+ /* first check to make sure the pad's parent is already set */
g_return_if_fail (GST_PAD_PARENT (pad) == NULL);
- // then check to see if there's already a pad by that name here
+ /* then check to see if there's already a pad by that name here */
g_return_if_fail (gst_object_check_uniqueness (element->pads, GST_PAD_NAME(pad)) == TRUE);
/* set the pad's parent */
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
- // then check to see if there's already a pad by that name here
+ /* then check to see if there's already a pad by that name here */
g_return_if_fail (gst_object_check_uniqueness (element->pads, name) == TRUE);
GST_DEBUG(GST_CAT_ELEMENT_PADS,"creating new ghost pad called %s, from pad %s:%s\n",
name, GST_ELEMENT_NAME (element));
element->pads = g_list_append (element->pads, ghostpad);
element->numpads++;
- // set the parent of the ghostpad
+ /* set the parent of the ghostpad */
gst_object_set_parent (GST_OBJECT (ghostpad), GST_OBJECT (element));
GST_DEBUG(GST_CAT_ELEMENT_PADS,"added ghostpad %s:%s\n",GST_DEBUG_PAD_NAME(ghostpad));
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_GHOST_PAD (pad));
- // FIXME this is redundant?
- // wingo 10-july-2001: I don't think so, you have to actually remove the pad
- // from the element. gst_pad_remove_ghost_pad just removes the ghostpad from
- // the real pad's ghost pad list
+ /* FIXME this is redundant?
+ * wingo 10-july-2001: I don't think so, you have to actually remove the pad
+ * from the element. gst_pad_remove_ghost_pad just removes the ghostpad from
+ * the real pad's ghost pad list
+ */
gst_pad_remove_ghost_pad (GST_PAD (GST_PAD_REALIZE (pad)), pad);
gst_element_remove_pad (element, pad);
}
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
g_return_val_if_fail (name != NULL, NULL);
- // if there aren't any pads, well, we're not likely to find one
+ /* if there aren't any pads, well, we're not likely to find one */
if (!element->numpads)
return NULL;
- // look through the list, matching by name
+ /* look through the list, matching by name */
walk = element->pads;
while (walk) {
GstPad *pad = GST_PAD(walk->data);
GstPadTemplate *padtempl = (GstPadTemplate*) padlist->data;
gboolean compat = FALSE;
- // Ignore name
- // Ignore presence
- // Check direction (must be opposite)
- // Check caps
-
+ /* Ignore name
+ * Ignore presence
+ * Check direction (must be opposite)
+ * Check caps
+ */
GST_DEBUG(GST_CAT_CAPS,"checking direction and caps\n");
if (padtempl->direction == GST_PAD_SRC &&
compattempl->direction == GST_PAD_SINK) {
GstElementState curpending;
GstElementStateReturn return_val = GST_STATE_SUCCESS;
-// g_print("gst_element_set_state(\"%s\",%08lx)\n",
-// element->name,state);
+/* g_print("gst_element_set_state(\"%s\",%08lx)\n", */
+/* element->name,state); */
g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
else curpending>>=1;
/* set the pending state variable */
- // FIXME: should probably check to see that we don't already have one
+ /* FIXME: should probably check to see that we don't already have one */
GST_STATE_PENDING (element) = curpending;
if (curpending != state)
GST_DEBUG_ELEMENT (GST_CAT_STATES,element,"intermediate: setting state to %s\n",
GST_STATE (element) = GST_STATE_PENDING (element);
GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING;
- // note: queues' state_change is a special case because it needs to lock
- // for synchronization (from another thread). since this signal may block
- // or (worse) make another state change, the queue needs to unlock before
- // calling. thus, gstqueue.c::gst_queue_state_change() blocks, unblocks,
- // unlocks, then emits this.
+ /* note: queues' state_change is a special case because it needs to lock
+ * for synchronization (from another thread). since this signal may block
+ * or (worse) make another state change, the queue needs to unlock before
+ * calling. thus, gstqueue.c::gst_queue_state_change() blocks, unblocks,
+ * unlocks, then emits this.
+ */
g_signal_emit (G_OBJECT (element), gst_element_signals[STATE_CHANGE], 0,
old_state, GST_STATE (element));
orig = pads = g_list_copy (element->pads);
while (pads) {
pad = GST_PAD (pads->data);
- // the gst_object_unparent will do the unreffing
+ /* the gst_object_unparent will do the unreffing */
gst_element_remove_pad(element, pad);
pads = g_list_next (pads);
}
{
GList *pads;
GstElementClass *oclass;
-// GType type;
+/* GType type; */
GstElement *element;
g_return_val_if_fail (GST_IS_ELEMENT (object), parent);
xmlNewChild (parent, NULL, "version", factory->details->version);
}
-// if (element->manager)
-// xmlNewChild(parent, NULL, "manager", GST_ELEMENT_NAME(element->manager));
+/* if (element->manager) */
+/* xmlNewChild(parent, NULL, "manager", GST_ELEMENT_NAME(element->manager)); */
-/* FIXME FIXME FIXME!
- // output all args to the element
+/* FIXME FIXME FIXME! */
+ /* output all args to the element */
type = G_OBJECT_TYPE (element);
while (type != G_TYPE_INVALID) {
GtkArg *args;
while (pads) {
GstPad *pad = GST_PAD (pads->data);
- // figure out if it's a direct pad or a ghostpad
+ /* figure out if it's a direct pad or a ghostpad */
if (GST_ELEMENT (GST_OBJECT_PARENT (pad)) == element) {
xmlNodePtr padtag = xmlNewChild (parent, NULL, "pad", NULL);
gst_object_save_thyself (GST_OBJECT (pad), padtag);
guchar *value = NULL;
guchar *type = NULL;
- // first get the needed tags to construct the element
+ /* first get the needed tags to construct the element */
while (children) {
if (!strcmp (children->name, "name")) {
name = xmlNodeGetContent (children);
g_return_val_if_fail (element != NULL, NULL);
- // ne need to set the parent on this object bacause the pads
- // will go through the hierarchy to connect to thier peers
+ /* ne need to set the parent on this object bacause the pads */
+ /* will go through the hierarchy to connect to thier peers */
if (parent)
gst_object_set_parent (GST_OBJECT (element), parent);
- // we have the element now, set the arguments
+ /* we have the element now, set the arguments */
children = self->xmlChildrenNode;
while (children) {
}
children = children->next;
}
- // we have the element now, set the pads
+ /* we have the element now, set the pads */
children = self->xmlChildrenNode;
while (children) {
* Boston, MA 02111-1307, USA.
*/
-//#define DEBUG_ENABLED
+/* #define DEBUG_ENABLED */
#include "gst_private.h"
#include "gstelement.h"
static GList* _gst_elementfactories;
static GstPluginFeatureClass *parent_class = NULL;
-//static guint gst_elementfactory_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_elementfactory_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_elementfactory_get_type (void)
walk = g_list_next(walk);
}
- // this should be an ERROR
+ /* this should be an ERROR */
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"no such elementfactory \"%s\"\n", name);
return NULL;
}
return NULL;
}
- // create an instance of the element
+ /* create an instance of the element */
element = GST_ELEMENT(g_object_new(factory->type,NULL));
g_assert(element != NULL);
- // attempt to set the elemenfactory class pointer if necessary
+ /* attempt to set the elemenfactory class pointer if necessary */
oclass = GST_ELEMENT_CLASS(G_OBJECT_GET_CLASS(element));
if (oclass->elementfactory == NULL) {
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"class %s\n", GST_OBJECT_NAME (factory));
oclass->elementfactory = factory;
}
- // copy pad template pointers to the element class
+ /* copy pad template pointers to the element class */
oclass->padtemplates = g_list_copy(factory->padtemplates);
oclass->numpadtemplates = factory->numpadtemplates;
GST_DEBUG (GST_CAT_ELEMENTFACTORY, "gstelementfactory: make \"%s\" \"%s\"\n", factoryname, name);
- //gst_plugin_load_elementfactory(factoryname);
+ /* gst_plugin_load_elementfactory(factoryname); */
factory = gst_elementfactory_find(factoryname);
if (factory == NULL) {
GST_INFO (GST_CAT_ELEMENTFACTORY,"no such elementfactory \"%s\"!",factoryname);
NULL,
};
- // round up to the nearest 32 bytes for cache-line and other efficiencies
+ /* round up to the nearest 32 bytes for cache-line and other efficiencies */
eventsize = (((eventsize-1) / 32) + 1) * 32;
_gst_event_chunk = g_mem_chunk_new ("GstEvent", eventsize,
eventsize * 32, G_ALLOC_AND_FREE);
_gst_event_chunk_lock = g_mutex_new ();
- // register the type
+ /* register the type */
_gst_event_type = g_type_register_static (G_TYPE_INT, "GstEvent", &event_info, 0);
}
if (!filename_type) {
static const GTypeInfo filename_info = {
- 0, //sizeof(GstElementClass),
+ 0, /* sizeof(GstElementClass), */
NULL,
NULL,
NULL,
NULL,
NULL,
- 0, //sizeof(GstElement),
+ 0, /* sizeof(GstElement), */
0,
NULL,
NULL
[GST_CAT_COTHREAD_SWITCH] = "00;37;42",
[GST_CAT_AUTOPLUG] = "00;34",
[GST_CAT_AUTOPLUG_ATTEMPT] = "00;36;44",
- [GST_CAT_PARENTAGE] = "01;37;41", // !!
+ [GST_CAT_PARENTAGE] = "01;37;41", /* !! */
[GST_CAT_STATES] = "00;31",
[GST_CAT_PLANNING] = "07;35",
[GST_CAT_SCHEDULING] = "00;35",
[GST_CAT_DATAFLOW] = "00;32",
[GST_CAT_BUFFER] = "00;32",
[GST_CAT_CAPS] = "04;34",
- [GST_CAT_CLOCK] = "00;33", // !!
- [GST_CAT_ELEMENT_PADS] = "01;37;41", // !!
- [GST_CAT_ELEMENTFACTORY] = "01;37;41", // !!
- [GST_CAT_PADS] = "01;37;41", // !!
- [GST_CAT_PIPELINE] = "01;37;41", // !!
+ [GST_CAT_CLOCK] = "00;33", /* !! */
+ [GST_CAT_ELEMENT_PADS] = "01;37;41", /* !! */
+ [GST_CAT_ELEMENTFACTORY] = "01;37;41", /* !! */
+ [GST_CAT_PADS] = "01;37;41", /* !! */
+ [GST_CAT_PIPELINE] = "01;37;41", /* !! */
[GST_CAT_PLUGIN_LOADING] = "00;36",
[GST_CAT_PLUGIN_ERRORS] = "05;31",
[GST_CAT_PLUGIN_INFO] = "00;36",
- [GST_CAT_PROPERTIES] = "00;37;44", // !!
+ [GST_CAT_PROPERTIES] = "00;37;44", /* !! */
[GST_CAT_THREAD] = "00;31",
- [GST_CAT_TYPES] = "01;37;41", // !!
- [GST_CAT_XML] = "01;37;41", // !!
+ [GST_CAT_TYPES] = "01;37;41", /* !! */
+ [GST_CAT_XML] = "01;37;41", /* !! */
[GST_CAT_NEGOTIATION] = "07;34",
[GST_CAT_REFCOUNTING] = "00;34:42",
- [GST_CAT_EVENT] = "01;37;41", // !!
- [GST_CAT_PARAMS] = "00;30;43", // !!
+ [GST_CAT_EVENT] = "01;37;41", /* !! */
+ [GST_CAT_PARAMS] = "00;30;43", /* !! */
[GST_CAT_CALL_TRACE] = "",
[31] = "05;31",
#endif
if (debug_string == NULL) debug_string = "";
-// if (category != GST_CAT_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))
#ifdef GST_DEBUG_COLOR
#else
fprintf(stderr,"INFO (%5d:%2d)%s%s %s\n",
pthread_id,cothread_id,location,elementname,string);
- #endif // GST_DEBUG_COLOR
+ #endif /* GST_DEBUG_COLOR */
/*
#else
#ifdef GST_DEBUG_COLOR
#else
fprintf(stderr,"INFO:%s%s %s\n",
location,elementname,string);
- #endif // GST_DEBUG_COLOR
+ #endif /* GST_DEBUG_COLOR */
#endif
*/
gchar *path;
int i;
- // if there are NULL pointers, point them to null strings to clean up output
+ /* if there are NULL pointers, point them to null strings to clean up output */
if (!debug_string) debug_string = "";
if (!string) string = "";
- // print out a preamble
+ /* print out a preamble */
fprintf(stderr,"***** GStreamer ERROR ***** in file %s at %s:%d%s\n",
file,function,line,debug_string);
- // if there's an element, print out the pertinent information
+ /* if there's an element, print out the pertinent information */
if (element) {
if (GST_IS_OBJECT(element)) {
path = gst_object_get_path_string(element);
}
}
- // if there's an object, print it out as well
+ /* if there's an object, print it out as well */
if (object) {
- // attempt to pad the line, or create a new one
+ /* attempt to pad the line, or create a new one */
if (chars < 40)
for (i=0;i<(40-chars)/8+1;i++) fprintf(stderr,"\t");
else
/***** DEBUG system *****/
GHashTable *__gst_function_pointers = NULL;
-// FIXME make this thread specific
+/* FIXME make this thread specific */
static GSList *stack_trace = NULL;
gchar *_gst_debug_nameof_funcptr (void *ptr) __attribute__ ((no_instrument_function));
void
gst_debug_print_stack_trace (void)
{
- //nothing because it's compiled out
+ /* nothing because it's compiled out */
}
#endif /* GST_ENABLE_FUNC_INTSTRUMENTATION */
#endif
klass->path_string_separator = "/";
-// FIXME!!!
-// klass->signal_object = g_object_new(gst_signal_object_get_type (,NULL));
+/* FIXME!!! */
+/* klass->signal_object = g_object_new(gst_signal_object_get_type (,NULL)); */
gobject_class->dispose = gst_object_dispose;
gobject_class->finalize = gst_object_finalize;
g_return_if_fail (object != NULL, NULL);
g_return_if_fail (GST_IS_OBJECT (object), NULL);
-//#ifdef HAVE_ATOMIC_H
-// g_return_if_fail (atomic_read (&(object->refcount)) > 0);
-// atomic_inc (&(object->refcount))
-//#else
+/* #ifdef HAVE_ATOMIC_H */
+/* g_return_if_fail (atomic_read (&(object->refcount)) > 0); */
+/* atomic_inc (&(object->refcount)) */
+/* #else */
g_return_if_fail (object->refcount > 0);
GST_LOCK (object);
-// object->refcount++;
+/* object->refcount++; */
g_object_ref((GObject *)object);
GST_UNLOCK (object);
-//#endif
+/* #endif */
return object;
}
object->refcount = 0;
#endif
/* finalize the object */
- // FIXME this is an evil hack that should be killed
-// FIXMEFIXMEFIXMEFIXME
-// gtk_object_finalize(G_OBJECT(object));
+ /* FIXME this is an evil hack that should be killed */
+/* FIXMEFIXMEFIXMEFIXME */
+/* gtk_object_finalize(G_OBJECT(object)); */
}
}
#endif /* gst_object_unref */
path = g_strdup ("");
- // first walk the object hierarchy to build a list of the parents
+ /* first walk the object hierarchy to build a list of the parents */
do {
if (GST_IS_OBJECT (object)) {
parent = gst_object_get_parent (object);
object = parent;
} while (object != NULL);
- // then walk the parent list and print them out
+ /* then walk the parent list and print them out */
parents = parentage;
while (parents) {
if (GST_IS_OBJECT (parents->data)) {
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include "gst_private.h"
#include "gstpad.h"
gst_marshal_VOID__POINTER, G_TYPE_NONE, 1,
G_TYPE_POINTER);
-// gtk_object_add_arg_type ("GstRealPad::active", G_TYPE_BOOLEAN,
-// GTK_ARG_READWRITE, REAL_ARG_ACTIVE);
+/* gtk_object_add_arg_type ("GstRealPad::active", G_TYPE_BOOLEAN, */
+/* GTK_ARG_READWRITE, REAL_ARG_ACTIVE); */
g_object_class_install_property (G_OBJECT_CLASS(klass), REAL_ARG_ACTIVE,
g_param_spec_boolean("active","Active","Whether the pad is active.",
TRUE,G_PARAM_READWRITE));
GST_INFO (GST_CAT_ELEMENT_PADS, "disconnecting %s:%s(%p) and %s:%s(%p)",
GST_DEBUG_PAD_NAME(srcpad), srcpad, GST_DEBUG_PAD_NAME(sinkpad), sinkpad);
- // now we need to deal with the real/ghost stuff
+ /* now we need to deal with the real/ghost stuff */
realsrc = GST_PAD_REALIZE(srcpad);
realsink = GST_PAD_REALIZE(sinkpad);
g_signal_emit(G_OBJECT(realsrc), gst_real_pad_signals[REAL_DISCONNECTED], 0, realsink);
g_signal_emit(G_OBJECT(realsink), gst_real_pad_signals[REAL_DISCONNECTED], 0, realsrc);
- // now tell the scheduler
+ /* now tell the scheduler */
if (realsrc->sched)
gst_scheduler_pad_connect (realsrc->sched, (GstPad *)realsrc, (GstPad *)realsink);
GST_INFO (GST_CAT_PADS, "connecting %s:%s and %s:%s",
GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
- // now we need to deal with the real/ghost stuff
+ /* now we need to deal with the real/ghost stuff */
realsrc = GST_PAD_REALIZE(srcpad);
realsink = GST_PAD_REALIZE(sinkpad);
g_signal_emit(G_OBJECT(realsrc), gst_real_pad_signals[REAL_CONNECTED], 0, realsink);
g_signal_emit(G_OBJECT(realsink), gst_real_pad_signals[REAL_CONNECTED], 0, realsrc);
- // now tell the scheduler(s)
+ /* now tell the scheduler(s) */
if (realsrc->sched)
gst_scheduler_pad_connect (realsrc->sched, (GstPad *)realsrc, (GstPad *)realsink);
else if (realsink->sched)
GstCaps *oldcaps;
g_return_val_if_fail (pad != NULL, FALSE);
- g_return_val_if_fail (GST_IS_REAL_PAD (pad), FALSE); // NOTE this restriction
+ g_return_val_if_fail (GST_IS_REAL_PAD (pad), FALSE); /* NOTE this restriction */
GST_INFO (GST_CAT_CAPS, "setting caps %p on pad %s:%s",
caps, GST_DEBUG_PAD_NAME(pad));
if (!gst_caps_check_compatibility (caps, gst_pad_get_padtemplate_caps (pad))) {
g_warning ("pad %s:%s tried to set caps incompatible with its padtemplate\n",
GST_DEBUG_PAD_NAME (pad));
- //return FALSE;
+ /* return FALSE; */
}
oldcaps = GST_PAD_CAPS (pad);
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad);
}
- // FIXME we should destroy the ghostpads, because they are nothing without the real pad
+ /* FIXME we should destroy the ghostpads, because they are nothing without the real pad */
if (GST_REAL_PAD (pad)->ghostpads) {
GList *orig, *ghostpads;
cleanup:
g_strfreev (split);
}
-#endif // GST_DISABLE_LOADSAVE
+#endif /* GST_DISABLE_LOADSAVE */
static gboolean
gst_pad_renegotiate_func (GstPad *pad, gpointer *data1, GstPad *peerpad, gpointer *data2, GstCaps **newcaps)
GST_DEBUG (GST_CAT_NEGOTIATION, "pads aggreed on caps :)\n");
newcaps = GST_PAD_CAPS (pad);
- //g_return_val_if_fail(newcaps != NULL, FALSE); // FIXME is this valid?
+ /* g_return_val_if_fail(newcaps != NULL, FALSE); FIXME is this valid? */
/* here we have some sort of aggreement of the caps */
GST_PAD_CAPS (currentpad) = gst_caps_ref (newcaps);
xmlNewChild(parent,NULL,"name", GST_PAD_NAME (realpad));
if (GST_RPAD_PEER(realpad) != NULL) {
peer = GST_PAD(GST_RPAD_PEER(realpad));
- // first check to see if the peer's parent's parent is the same
- // we just save it off
+ /* first check to see if the peer's parent's parent is the same */
+ /* we just save it off */
xmlNewChild(parent,NULL,"peer",g_strdup_printf("%s.%s",
GST_OBJECT_NAME (GST_PAD_PARENT (peer)), GST_PAD_NAME (peer)));
} else
xmlNewChild(self,NULL,"name", GST_PAD_NAME (pad));
xmlNewChild(self,NULL,"parent", GST_OBJECT_NAME (GST_PAD_PARENT (pad)));
- // FIXME FIXME FIXME!
+ /* FIXME FIXME FIXME! */
return self;
}
static void gst_ghost_pad_init (GstGhostPad *pad);
static GstPad *ghost_pad_parent_class = NULL;
-//static guint gst_ghost_pad_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_ghost_pad_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_ghost_pad_get_type(void) {
GST_GPAD_REALPAD(ghostpad) = GST_PAD_REALIZE(pad);
GST_PAD_PADTEMPLATE(ghostpad) = GST_PAD_PADTEMPLATE(pad);
- // add ourselves to the real pad's list of ghostpads
+ /* add ourselves to the real pad's list of ghostpads */
gst_pad_add_ghost_pad (pad, GST_PAD(ghostpad));
- // FIXME need to ref the real pad here... ?
+ /* FIXME need to ref the real pad here... ? */
GST_DEBUG(GST_CAT_PADS,"created ghost pad \"%s\"\n",name);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
-// gst_element_signal_eos (element);
+/* gst_element_signal_eos (element); */
gst_element_set_state (element, GST_STATE_PAUSED);
{
GList *pads = element->pads;
while (i < argc) {
arg = argv[i];
- // FIXME this is a lame solution for problems with the first parser
+ /* FIXME this is a lame solution for problems with the first parser */
if (arg == NULL) {
i++;
continue;
element = NULL;
DEBUG ("** ARGUMENT is '%s'\n", arg);
- // a null that slipped through the reconstruction
+ /* a null that slipped through the reconstruction */
if (len == 0) {
DEBUG ("random arg, FIXME\n");
i++;
continue;
- // end of the container
+ /* end of the container */
}
else if (arg[0] == closingchar) {
- // time to finish off this bin
+ /* time to finish off this bin */
DEBUG ("exiting container %s\n", GST_ELEMENT_NAME (GST_ELEMENT (parent)));
retval = i + 1;
break;
- // a pad connection
+ /* a pad connection */
}
else if ((ptr = strchr (arg, '!'))) {
DEBUG ("attempting to connect pads together....\n");
- // if it starts with the !
+ /* if it starts with the ! */
if (arg[0] == '!') {
srcpadname = NULL;
- // if there's a sinkpad...
+ /* if there's a sinkpad... */
if (len > 1)
sinkpadname = &arg[1];
else
}
else {
srcpadname = g_strndup (arg, (ptr - arg));
- // if there's a sinkpad
+ /* if there's a sinkpad */
if (len > (ptr - arg) + 1)
sinkpadname = &ptr[1];
else
numsrcpads = 0;
tempname = NULL;
- // find src pads
+ /* find src pads */
if (srcpadname != NULL) {
while (1) {
- // split name at commas
+ /* split name at commas */
if ((ptr = strchr (srcpadname, ','))) {
tempname = g_strndup (srcpadname, (ptr - srcpadname));
srcpadname = &ptr[1];
tempname = srcpadname;
}
- // look for pad with that name
+ /* look for pad with that name */
if ((temppad = gst_element_get_pad (previous, tempname))) {
srcpads = g_slist_append (srcpads, temppad);
numsrcpads++;
}
- // try to create a pad using that padtemplate name
+ /* try to create a pad using that padtemplate name */
else if ((temppad = gst_element_request_pad_by_name (previous, tempname))) {
srcpads = g_slist_append (srcpads, temppad);
numsrcpads++;
GST_DEBUG (0, "have src pad %s:%s\n", GST_DEBUG_PAD_NAME (temppad));
}
- // if there is no more commas in srcpadname then we're done
+ /* if there is no more commas in srcpadname then we're done */
if (tempname == srcpadname)
break;
g_free (tempname);
}
}
else {
- // check through the list to find the first sink pad
+ /* check through the list to find the first sink pad */
GST_DEBUG (0, "CHECKING through element %s for pad named %s\n", GST_ELEMENT_NAME (previous),
srcpadname);
pads = gst_element_get_pad_list (previous);
GST_DEBUG (0, "have src pad %s:%s\n", GST_DEBUG_PAD_NAME (GST_PARSE_LISTPAD (srcpads)));
}
- // argument with = in it
+ /* argument with = in it */
}
else if (strstr (arg, "=")) {
gchar *argname;
gchar *argval;
gchar *pos = strstr (arg, "=");
- // we have an argument
+ /* we have an argument */
argname = arg;
pos[0] = '\0';
argval = pos + 1;
gst_util_set_object_arg (G_OBJECT (previous), argname, argval);
g_free (argname);
- // element or argument, or beginning of bin or thread
+ /* element or argument, or beginning of bin or thread */
}
else if (arg[0] == '[') {
- // we have the start of a name of the preceding element.
- // rename previous element to next arg.
+ /* we have the start of a name of the preceding element. */
+ /* rename previous element to next arg. */
if (arg[1] != '\0') {
fprintf (stderr, "error, unexpected junk after [\n");
return GST_PARSE_ERROR_SYNTAX;
}
else {
DEBUG ("have element or bin/thread\n");
- // if we have a bin or thread starting
+ /* if we have a bin or thread starting */
if (strchr ("({", arg[0])) {
if (arg[0] == '(') {
- // create a bin and add it to the current parent
+ /* create a bin and add it to the current parent */
element = gst_bin_new (g_strdup_printf ("bin%d", priv->bincount++));
if (!element) {
fprintf (stderr, "Couldn't create a bin!\n");
GST_DEBUG (0, "CREATED bin %s\n", GST_ELEMENT_NAME (element));
}
else if (arg[0] == '{') {
- // create a thread and add it to the current parent
+ /* create a thread and add it to the current parent */
element = gst_thread_new (g_strdup_printf ("thread%d", priv->threadcount++));
if (!element) {
fprintf (stderr, "Couldn't create a thread!\n");
}
j = gst_parse_launch_cmdline (argc - i, argv + i + 1, GST_BIN (element), priv);
- //check for parse error
+ /* check for parse error */
if (j < 0)
return j;
i += j;
}
else {
- // we have an element
+ /* we have an element */
DEBUG ("attempting to create element '%s'\n", arg);
ptr = gst_parse_unique_name (arg, priv);
element = gst_elementfactory_make (arg, ptr);
numsinkpads = 0;
tempname = NULL;
- // find sink pads
+ /
+ find sink pads
if (sinkpadname != NULL) {
while (1) {
- // split name at commas
+ /* split name at commas */
if ((ptr = strchr (sinkpadname, ','))) {
tempname = g_strndup (sinkpadname, (ptr - sinkpadname));
sinkpadname = &ptr[1];
tempname = sinkpadname;
}
- // look for pad with that name
+ /* look for pad with that name */
if ((temppad = gst_element_get_pad (element, tempname))) {
sinkpads = g_slist_append (sinkpads, temppad);
numsinkpads++;
}
- // try to create a pad using that padtemplate name
+ /* try to create a pad using that padtemplate name */
else if ((temppad = gst_element_request_pad_by_name (element, tempname))) {
sinkpads = g_slist_append (sinkpads, temppad);
numsinkpads++;
GST_DEBUG (0, "have sink pad %s:%s\n", GST_DEBUG_PAD_NAME (temppad));
}
- // if there is no more commas in sinkpadname then we're done
+ /* if there is no more commas in sinkpadname then we're done */
if (tempname == sinkpadname)
break;
g_free (tempname);
}
}
else {
- // check through the list to find the first sink pad
+ /* check through the list to find the first sink pad */
pads = gst_element_get_pad_list (element);
while (pads) {
temppad = GST_PAD (pads->data);
g_slist_free (sinkpads);
sinkpads = NULL;
- // if we're the first element, ghost all the sinkpads
+ /* if we're the first element, ghost all the sinkpads */
if (elementcount == 1) {
DEBUG ("first element, ghosting all of %s's sink pads to parent %s\n",
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (GST_ELEMENT (parent)));
i++;
}
- // ghost all the src pads of the bin
+ /* ghost all the src pads of the bin */
if (prevelement != NULL) {
DEBUG ("last element, ghosting all of %s's src pads to parent %s\n",
GST_ELEMENT_NAME (prevelement), GST_ELEMENT_NAME (GST_ELEMENT (parent)));
temp = "";
- // Extract the arguments to a gslist in reverse order
+ /* Extract the arguments to a gslist in reverse order */
for (cp = cmdline; cp < end;) {
i = strcspn (cp, "([{}]) \"\\");
if (i > 0) {
temp = g_strconcat (temp, g_strndup (cp, i), NULL);
- // see if we have an escape char
+ /* see if we have an escape char */
if (cp[i] != '\\') {
- // normal argument - copy and add to the list
+ /* normal argument - copy and add to the list */
string_list = g_slist_prepend (string_list, temp);
newargc++;
temp = "";
cp += i;
}
- // skip spaces
+ /* skip spaces */
while (cp < end && *cp == ' ') {
cp++;
}
- // handle quoted arguments
+ /* handle quoted arguments */
if (*cp == '"') {
start = ++cp;
- // find matching quote
+ /* find matching quote */
while (cp < end && *cp != '"')
cp++;
- // make sure we got it
+ /* make sure we got it */
if (cp == end) {
g_warning ("gst_parse_launch: Unbalanced quote in command line");
- // FIXME: The list leaks here
+ /* FIXME: The list leaks here */
return 0;
}
- // copy the string sans quotes
+ /* copy the string sans quotes */
string_list = g_slist_prepend (string_list, g_strndup (start, cp - start));
newargc++;
- cp += 2; // skip the quote aswell
+ cp += 2; /* skip the quote aswell */
}
- // brackets exist in a separate argument slot
+ /* brackets exist in a separate argument slot */
if (*cp && strchr ("([{}])", *cp)) {
string_list = g_slist_prepend (string_list, g_strndup (cp, 1));
newargc++;
}
}
- // now allocate the new argv array
+ /* now allocate the new argv array */
argvn = g_new0 (char *, newargc);
GST_DEBUG (0, "got %d args\n", newargc);
- // reverse the list and put the strings in the new array
+ /* reverse the list and put the strings in the new array */
i = newargc;
for (slist = string_list; slist; slist = slist->next)
g_slist_free (string_list);
- // print them out
+ /* print them out */
for (i = 0; i < newargc; i++) {
GST_DEBUG (0, "arg %d is: %s\n", i, argvn[i]);
}
- // set up the elementcounts hash
+ /* set up the elementcounts hash */
priv.elementcounts = g_hash_table_new (g_str_hash, g_str_equal);
- // do it!
+ /* do it! */
i = gst_parse_launch_cmdline (newargc, argvn, parent, &priv);
-// GST_DEBUG(0, "Finished - freeing temporary argument array");
-// g_strfreev(argvn);
+/* GST_DEBUG(0, "Finished - freeing temporary argument array"); */
+/* g_strfreev(argvn); */
return i;
}
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include "gst_private.h"
#include "gstpipeline.h"
static GstElementStateReturn gst_pipeline_change_state (GstElement *element);
static GstBinClass *parent_class = NULL;
-//static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_pipeline_get_type (void) {
static void
gst_pipeline_init (GstPipeline *pipeline)
{
- // we're a manager by default
+ /* we're a manager by default */
GST_FLAG_SET (pipeline, GST_BIN_FLAG_MANAGER);
GST_ELEMENT_SCHED (pipeline) = gst_schedulerfactory_make ("basic", GST_ELEMENT (pipeline));
if (_gst_warn_old_registry)
g_error ("gstplugin: registry needs rebuild: run gstreamer-register\n");
gst_plugin_load_all ();
- //gst_plugin_unload_all ();
+ /
+gst_plugin_unload_all ();
return;
}
gst_plugin_load_thyself (doc->xmlRootNode);
static gboolean
plugin_times_older_than(time_t regtime)
{
- // return true iff regtime is more recent than the times of all the files
- // in the plugin dirs.
+ /* return true iff regtime is more recent than the times of all the files
+ * in the plugin dirs.
+ */
+
GList *path;
path = _gst_plugin_paths;
while (path != NULL) {
gboolean loaded = FALSE;
gchar *dirname;
- //g_print("recursive load of '%s' in '%s'\n", name, directory);
+ /* g_print("recursive load of '%s' in '%s'\n", name, directory); */
dir = opendir(directory);
if (dir) {
while ((dirent = readdir(dir))) {
libraries = g_list_next(libraries);
}
- // for now this is the same
+ /* for now this is the same */
res = gst_plugin_load(name);
if (res) {
}
g_free(pluginname);
libspath = g_strconcat(path->data,"/.libs",NULL);
- //g_print("trying to load '%s'\n",g_module_build_path(libspath,name));
+ /* g_print("trying to load '%s'\n",g_module_build_path(libspath,name)); */
pluginname = g_module_build_path(libspath,name);
g_free(libspath);
if (gst_plugin_load_absolute(pluginname)) {
return TRUE;
}
g_free(pluginname);
- //g_print("trying to load '%s' from '%s'\n",name,path->data);
+ /* g_print("trying to load '%s' from '%s'\n",name,path->data); */
pluginname = g_module_build_path("",name);
if (gst_plugin_load_recurse(path->data,pluginname)) {
g_free(pluginname);
static gboolean
gst_plugin_check_version (gint major, gint minor)
{
- // return NULL if the major and minor version numbers are not compatible
- // with ours.
+ /* return NULL if the major and minor version numbers are not compatible */
+ /* with ours. */
if (major != GST_VERSION_MAJOR || minor != GST_VERSION_MINOR)
return FALSE;
}
if (stat (filename, &file_status)) {
- //g_print("problem opening file %s\n",filename);
+ /* g_print("problem opening file %s\n",filename); */
return FALSE;
}
}
return TRUE;
} else if (_gst_plugin_spew) {
- // FIXME this should be some standard gst mechanism!!!
+ /* FIXME this should be some standard gst mechanism!!! */
g_printerr ("error loading plugin %s, reason: %s\n", filename, g_module_error());
}
else {
gint featurecount = 0;
gchar *pluginname;
- kinderen = parent->xmlChildrenNode; // Dutch invasion :-)
+ kinderen = parent->xmlChildrenNode; /* Dutch invasion :-) */
while (kinderen) {
if (!strcmp (kinderen->name, "plugin")) {
xmlNodePtr field = kinderen->xmlChildrenNode;
#endif /* GST_DISABLE_REGISTRY */
static GstObjectClass *parent_class = NULL;
-//static guint gst_plugin_feature_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_plugin_feature_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_plugin_feature_get_type (void)
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include "gst_private.h"
#include "gstlog.h"
old_max = oldentry->data.int_range_data.max;
}
- // Put range which starts lower into (new_min, new_max)
+ /* Put range which starts lower into (new_min, new_max) */
if (old_min < new_min) {
gint tmp;
tmp = old_min;
new_max = tmp;
}
- // new_min is min of either entry - second half of the following conditional
- // is to avoid overflow problems.
+ /* new_min is min of either entry - second half of the following conditional */
+ /* is to avoid overflow problems. */
if (new_max >= old_min - 1 && old_min - 1 < old_min) {
- // ranges overlap, or are adjacent. Pick biggest maximum.
+ /* ranges overlap, or are adjacent. Pick biggest maximum. */
can_merge = TRUE;
if (old_max > new_max) new_max = old_max;
}
gboolean merged = gst_props_merge_int_entries(newentry, oldentry);
if (merged) {
- // replace the existing one with the merged one
+ /* replace the existing one with the merged one */
g_mutex_lock (_gst_props_entries_chunk_lock);
g_mem_chunk_free (_gst_props_entries_chunk, oldentry);
g_mutex_unlock (_gst_props_entries_chunk_lock);
entries = g_list_remove_link (entries, i);
g_list_free_1 (i);
- // start again: it's possible that this change made an earlier entry
- // mergeable, and the pointer is now invalid anyway.
+ /* start again: it's possible that this change made an earlier entry */
+ /* mergeable, and the pointer is now invalid anyway. */
i = entries;
}
GST_PROPS_LIST_T_MISC,
} list_types;
- // type of the list
+ /* type of the list */
list_types list_type = GST_PROPS_LIST_T_UNSET;
- // type of current item
+ /* type of current item */
list_types entry_type = GST_PROPS_LIST_T_UNSET;
if (firstname == NULL)
prop_name = firstname;
- // properties
+ /* properties */
while (prop_name) {
GstPropsEntry *entry;
case GST_PROPS_END_ID:
g_return_val_if_fail (inlist == TRUE, NULL);
- // if list was of size 1, replace the list by a the item it contains
+ /* if list was of size 1, replace the list by a the item it contains */
if (g_list_length(list_entry->data.list_data.entries) == 1) {
GstPropsEntry * subentry = (GstPropsEntry *)(list_entry->data.list_data.entries->data);
list_entry->propstype = subentry->propstype;
while (entries) {
GstPropsEntry *entry = (GstPropsEntry *)entries->data;
- // FIXME also free the lists
+ /* FIXME also free the lists */
g_mutex_lock (_gst_props_entries_chunk_lock);
g_mem_chunk_free (_gst_props_entries_chunk, entry);
g_mutex_unlock (_gst_props_entries_chunk_lock);
newentry = g_mem_chunk_alloc (_gst_props_entries_chunk);
g_mutex_unlock (_gst_props_entries_chunk_lock);
- // FIXME copy lists too
+ /* FIXME copy lists too */
memcpy (newentry, entry, sizeof (GstPropsEntry));
new->properties = g_list_prepend (new->properties, newentry);
merge_props = tomerge->properties;
- // FIXME do proper merging here...
+ /* FIXME do proper merging here... */
while (merge_props) {
GstPropsEntry *entry = (GstPropsEntry *)merge_props->data;
case GST_PROPS_LIST_ID:
{
GList *entrylist = entry1->data.list_data.entries;
- gboolean valid = TRUE; // innocent until proven guilty
+ gboolean valid = TRUE; /* innocent until proven guilty */
while (entrylist && valid) {
GstPropsEntry *entry = (GstPropsEntry *) entrylist->data;
}
case GST_PROPS_INT_RANGE_ID:
switch (entry2->propstype) {
- // a - b <---> a - c
+ /* a - b <---> a - c */
case GST_PROPS_INT_RANGE_ID:
return (entry2->data.int_range_data.min <= entry1->data.int_range_data.min &&
entry2->data.int_range_data.max >= entry1->data.int_range_data.max);
break;
case GST_PROPS_FLOAT_RANGE_ID:
switch (entry2->propstype) {
- // a - b <---> a - c
+ /* a - b <---> a - c */
case GST_PROPS_FLOAT_RANGE_ID:
return (entry2->data.float_range_data.min <= entry1->data.float_range_data.min &&
entry2->data.float_range_data.max >= entry1->data.float_range_data.max);
break;
case GST_PROPS_FOURCC_ID:
switch (entry2->propstype) {
- // b <---> a
+ /* b <---> a */
case GST_PROPS_FOURCC_ID:
return (entry2->data.fourcc_data == entry1->data.fourcc_data);
- // b <---> a,b,c
+ /* b <---> a,b,c */
case GST_PROPS_LIST_ID:
return gst_props_entry_check_list_compatibility (entry1, entry2);
default:
break;
case GST_PROPS_INT_ID:
switch (entry2->propstype) {
- // b <---> a - d
+ /* b <---> a - d */
case GST_PROPS_INT_RANGE_ID:
GST_DEBUG(GST_CAT_PROPERTIES,"%d <= %d <= %d ?\n",entry2->data.int_range_data.min,
entry1->data.int_data,entry2->data.int_range_data.max);
return (entry2->data.int_range_data.min <= entry1->data.int_data &&
entry2->data.int_range_data.max >= entry1->data.int_data);
- // b <---> a
+ /* b <---> a */
case GST_PROPS_INT_ID:
GST_DEBUG(GST_CAT_PROPERTIES,"%d == %d ?\n",entry1->data.int_data,entry2->data.int_data);
return (entry2->data.int_data == entry1->data.int_data);
- // b <---> a,b,c
+ /* b <---> a,b,c */
case GST_PROPS_LIST_ID:
return gst_props_entry_check_list_compatibility (entry1, entry2);
default:
break;
case GST_PROPS_FLOAT_ID:
switch (entry2->propstype) {
- // b <---> a - d
+ /* b <---> a - d */
case GST_PROPS_FLOAT_RANGE_ID:
return (entry2->data.float_range_data.min <= entry1->data.float_data &&
entry2->data.float_range_data.max >= entry1->data.float_data);
- // b <---> a
+ /* b <---> a */
case GST_PROPS_FLOAT_ID:
return (entry2->data.float_data == entry1->data.float_data);
- // b <---> a,b,c
+ /* b <---> a,b,c */
case GST_PROPS_LIST_ID:
return gst_props_entry_check_list_compatibility (entry1, entry2);
default:
break;
case GST_PROPS_BOOL_ID:
switch (entry2->propstype) {
- // t <---> t
+ /* t <---> t */
case GST_PROPS_BOOL_ID:
return (entry2->data.bool_data == entry1->data.bool_data);
case GST_PROPS_LIST_ID:
}
case GST_PROPS_STRING_ID:
switch (entry2->propstype) {
- // t <---> t
+ /* t <---> t */
case GST_PROPS_STRING_ID:
return (!strcmp (entry2->data.string_data.string, entry1->data.string_data.string));
case GST_PROPS_LIST_ID:
* Boston, MA 02111-1307, USA.
*/
-//#define DEBUG_ENABLED
-//#define STATUS_ENABLED
+/* #define DEBUG_ENABLED */
+/* #define STATUS_ENABLED */
#ifdef STATUS_ENABLED
#define STATUS(A) GST_DEBUG(GST_CAT_DATAFLOW, A, GST_ELEMENT_NAME(queue))
#else
}
static GstElementClass *parent_class = NULL;
-//static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_queue_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_queue_get_type(void)
static void
gst_queue_init (GstQueue *queue)
{
- // scheduling on this kind of element is, well, interesting
+ /* scheduling on this kind of element is, well, interesting */
GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE);
queue->level_buffers = 0;
queue->level_bytes = 0;
queue->level_time = 0LL;
- queue->size_buffers = 100; // 100 buffers
- queue->size_bytes = 100 * 1024; // 100KB
- queue->size_time = 1000000000LL; // 1sec
+ queue->size_buffers = 100; /* 100 buffers */
+ queue->size_bytes = 100 * 1024; /* 100KB */
+ queue->size_time = 1000000000LL; /* 1sec */
queue->qlock = g_mutex_new ();
queue->reader = FALSE;
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d\n",buf,GST_BUFFER_SIZE(buf));
if (queue->level_buffers == queue->size_buffers) {
- // if this is a leaky queue...
+ /* if this is a leaky queue... */
if (queue->leaky) {
- // FIXME don't want to leak events!
- // if we leak on the upstream side, drop the current buffer
+ /* FIXME don't want to leak events! */
+ /* if we leak on the upstream side, drop the current buffer */
if (queue->leaky == GST_QUEUE_LEAK_UPSTREAM) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
if (GST_IS_EVENT (buf))
GST_EVENT_TYPE(GST_EVENT(buf)));
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
gst_buffer_unref(buf);
- // now we have to clean up and exit right away
+ /* now we have to clean up and exit right away */
g_mutex_unlock (queue->qlock);
return;
}
- // otherwise we have to push a buffer off the other end
+ /* otherwise we have to push a buffer off the other end */
else {
GSList *front;
GstBuffer *leakbuf;
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d\n",
queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == queue->size_buffers) {
- // if there's a pending state change for this queue or its manager, switch
- // back to iterator so bottom half of state change executes
+ /* if there's a pending state change for this queue or its manager, switch */
+ /* back to iterator so bottom half of state change executes */
while (GST_STATE (queue) != GST_STATE_PLAYING) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
g_mutex_unlock (queue->qlock);
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == 0) {
- // if there's a pending state change for this queue or its manager, switch
- // back to iterator so bottom half of state change executes
+ /* if there's a pending state change for this queue or its manager, switch
+ * back to iterator so bottom half of state change executes
+ */
while (GST_STATE (queue) != GST_STATE_PLAYING) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
g_mutex_unlock (queue->qlock);
g_cond_signal (queue->not_full);
}
- // FIXME where should this be? locked?
+ /* FIXME where should this be? locked? */
if (GST_IS_EVENT(buf)) {
GstEvent *event = GST_EVENT(buf);
switch (GST_EVENT_TYPE(event)) {
GST_DEBUG_ENTER("('%s')", GST_ELEMENT_NAME (element));
- // lock the queue so another thread (not in sync with this thread's state)
- // can't call this queue's _get (or whatever)
+ /* lock the queue so another thread (not in sync with this thread's state)
+ * can't call this queue's _get (or whatever)
+ */
g_mutex_lock (queue->qlock);
new_state = GST_STATE_PENDING (element);
}
else if (new_state == GST_STATE_PLAYING) {
if (!GST_PAD_CONNECTED (queue->sinkpad)) {
- // FIXME can this be?
+ /* FIXME can this be? */
if (queue->reader)
g_cond_signal (queue->not_empty);
g_mutex_unlock (queue->qlock);
#endif
static GstPluginFeatureClass *factory_parent_class = NULL;
-//static guint gst_schedulerfactory_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_schedulerfactory_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_schedulerfactory_get_type (void)
_gst_schedulerfactories = g_list_remove (_gst_schedulerfactories, factory);
- // we don't free the struct bacause someone might have a handle to it..
+ /* we don't free the struct bacause someone might have a handle to it.. */
}
/**
#include <unistd.h>
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
#include "gst_private.h"
#include "gstthread.h"
static void* gst_thread_main_loop (void *arg);
static GstBinClass *parent_class = NULL;
-//static guint gst_thread_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_thread_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_thread_get_type(void) {
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_thread_change_state);
-// gstbin_class->schedule = gst_thread_schedule_dummy;
+/* gstbin_class->schedule = gst_thread_schedule_dummy; */
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_thread_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_thread_get_property);
GST_DEBUG (GST_CAT_THREAD,"initializing thread\n");
- // we're a manager by default
+ /* we're a manager by default */
GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
thread->lock = g_mutex_new();
thread->ppid = getpid();
thread->thread_id = -1;
-// gst_element_set_manager(GST_ELEMENT(thread),GST_ELEMENT(thread));
+/* gst_element_set_manager(GST_ELEMENT(thread),GST_ELEMENT(thread)); */
}
static void
static GstElementStateReturn
gst_thread_update_state (GstThread *thread)
{
- // check for state change
+ /* check for state change */
if (GST_STATE_PENDING(thread) != GST_STATE_VOID_PENDING) {
- // punt and change state on all the children
+ /* punt and change state on all the children */
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT(thread));
}
switch (transition) {
case GST_STATE_NULL_TO_READY:
- // set the state to idle
+ /* set the state to idle */
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
THR_DEBUG ("creating thread \"%s\"\n", GST_ELEMENT_NAME (element));
g_mutex_lock (thread->lock);
- // create the thread
+ /* create the thread */
pthread_create (&thread->thread_id, NULL, gst_thread_main_loop, thread);
- // wait for it to 'spin up'
+ /* wait for it to 'spin up' */
THR_DEBUG ("waiting for child thread spinup\n");
g_cond_wait (thread->cond, thread->lock);
THR_DEBUG ("thread claims to be up\n");
THR_INFO ("pausing thread");
- // the following code ensures that the bottom half of thread will run
- // to perform each elements' change_state() (by calling gstbin.c::
- // change_state()).
- // + the pending state was already set by gstelement.c::set_state()
- // + find every queue we manage, and signal its empty and full conditions
- g_mutex_lock (thread->lock);
+ /* the following code ensures that the bottom half of thread will run
+ * to perform each elements' change_state() (by calling gstbin.c::
+ * change_state()).
+ * + the pending state was already set by gstelement.c::set_state()
+ * + find every queue we manage, and signal its empty and full conditions
+ */
+ g_mutex_lock (thread->lock);
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
THR_DEBUG (" element \"%s\"\n", GST_ELEMENT_NAME (e));
elements = g_list_next (elements);
if (GST_IS_QUEUE (e)) {
- //FIXME make this more efficient by only waking queues that are asleep
- //FIXME and only waking the appropriate condition (depending on if it's
- //FIXME on up- or down-stream side)
- //
- //FIXME also make this more efficient by keeping list of managed queues
+ /* FIXME make this more efficient by only waking queues that are asleep */
+ * FIXME and only waking the appropriate condition (depending on if it's
+ * FIXME on up- or down-stream side)
+ * FIXME also make this more efficient by keeping list of managed queues
+ */
THR_DEBUG ("waking queue \"%s\"\n", GST_ELEMENT_NAME (e));
gst_element_set_state (e, GST_STATE_PAUSED);
}
peerelement = GST_PAD_PARENT (peer);
if (!peerelement)
- continue; // deal with case where there's no peer
+ continue; /* deal with case where there's no peer */
if (!GST_FLAG_IS_SET (peerelement, GST_ELEMENT_DECOUPLED)) {
GST_DEBUG (GST_CAT_THREAD, "peer element isn't DECOUPLED\n");
continue;
}
- // FIXME this needs to go away eventually
+ /* FIXME this needs to go away eventually */
if (!GST_IS_QUEUE (peerelement)) {
GST_DEBUG (GST_CAT_THREAD, "peer element isn't a Queue\n");
continue;
GstQueue *queue = GST_QUEUE (peerelement);
THR_DEBUG (" element \"%s\" has pad cross sched boundary\n", GST_ELEMENT_NAME (e));
- // FIXME!!
+ /* FIXME!! */
g_mutex_lock (queue->qlock);
g_cond_signal (queue->not_full);
g_cond_signal (queue->not_empty);
}
case GST_STATE_READY_TO_NULL:
THR_DEBUG ("telling thread to pause (null) - and joining\n");
- //MattH FIXME revisit
+ /* MattH FIXME revisit */
g_mutex_lock (thread->lock);
THR_DEBUG ("signaling\n");
g_cond_signal (thread->cond);
thread->pid = getpid();
THR_INFO_MAIN("thread is running");
- // first we need to change the state of all the children
+ /* first we need to change the state of all the children */
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
stateset = GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT(thread));
THR_DEBUG_MAIN ("indicating spinup\n");
g_cond_signal (thread->cond);
- // don't unlock the mutex because we hold it into the top of the while loop
+ /* don't unlock the mutex because we hold it into the top of the while loop */
THR_DEBUG_MAIN ("thread has indicated spinup to parent process\n");
/***** THREAD IS NOW IN READY STATE *****/
while (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_REAPING)) {
- // NOTE we hold the thread lock at this point
- // what we do depends on what state we're in
+ /* NOTE we hold the thread lock at this point */
+ /* what we do depends on what state we're in */
switch (GST_STATE (thread)) {
- // NOTE: cannot be in NULL, we're not running in that state at all
+ /* NOTE: cannot be in NULL, we're not running in that state at all */
case GST_STATE_READY:
- // wait to be set to either the NULL or PAUSED states
+ /* wait to be set to either the NULL or PAUSED states */
THR_DEBUG_MAIN ("thread in %s state, waiting for either %s or %s\n",
gst_element_statename (GST_STATE_READY),
gst_element_statename (GST_STATE_NULL),
g_assert (GST_STATE_PENDING (thread) == GST_STATE_NULL ||
GST_STATE_PENDING (thread) == GST_STATE_PAUSED);
- // been signaled, we need to state transition now and signal back
+ /* been signaled, we need to state transition now and signal back */
gst_thread_update_state (thread);
THR_DEBUG_MAIN ("done with state transition, signaling back to parent process\n");
g_cond_signal (thread->cond);
- // now we decide what to do next
+ /* now we decide what to do next */
if (GST_STATE (thread) == GST_STATE_NULL) {
- // REAPING must be set, we can simply break this iteration
+ /* REAPING must be set, we can simply break this iteration */
GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
}
continue;
case GST_STATE_PAUSED:
- // wait to be set to either the READY or PLAYING states
+ /* wait to be set to either the READY or PLAYING states */
THR_DEBUG_MAIN("thread in %s state, waiting for either %s or %s\n",
gst_element_statename (GST_STATE_PAUSED),
gst_element_statename (GST_STATE_READY),
g_assert (GST_STATE_PENDING (thread) == GST_STATE_READY ||
GST_STATE_PENDING (thread) == GST_STATE_PLAYING);
- // been signaled, we need to state transition now and signal back
+ /* been signaled, we need to state transition now and signal back */
gst_thread_update_state (thread);
- // now we decide what to do next
+ /* now we decide what to do next */
if (GST_STATE (thread) != GST_STATE_PLAYING) {
- // either READY or the state change failed for some reason
+ /* either READY or the state change failed for some reason */
g_cond_signal (thread->cond);
continue;
}
else {
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
- // PLAYING is coming up, so we can now start spinning
+ /* PLAYING is coming up, so we can now start spinning */
while (GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) {
gboolean status;
g_mutex_unlock (thread->lock);
status = gst_bin_iterate (GST_BIN (thread));
g_mutex_lock (thread->lock);
- //g_cond_signal(thread->cond);
+ /* g_cond_signal(thread->cond); */
if (!status || GST_STATE_PENDING (thread) != GST_STATE_VOID_PENDING)
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
}
- // looks like we were stopped because of a statechange
+ /* looks like we were stopped because of a statechange */
if (GST_STATE_PENDING (thread)) {
gst_thread_update_state (thread);
}
- // once we're here, SPINNING has stopped, we should signal that we're done
+ /* once we're here, SPINNING has stopped, we should signal that we're done */
THR_DEBUG_MAIN ("SPINNING stopped, signaling back to parent process\n");
g_cond_signal (thread->cond);
- // now we can wait for PAUSED
+ /* now we can wait for PAUSED */
continue;
}
case GST_STATE_PLAYING:
- // wait to be set to PAUSED
+ /* wait to be set to PAUSED */
THR_DEBUG_MAIN ("thread in %s state, waiting for %s\n",
gst_element_statename(GST_STATE_PLAYING),
gst_element_statename(GST_STATE_PAUSED));
g_cond_wait (thread->cond,thread->lock);
- // been signaled, we need to state transition now and signal back
+ /* been signaled, we need to state transition now and signal back */
gst_thread_update_state (thread);
g_cond_signal (thread->cond);
- // now we decide what to do next
- // there's only PAUSED, we we just wait for it
+ /* now we decide what to do next */
+ /* there's only PAUSED, we we just wait for it */
continue;
case GST_STATE_NULL:
THR_DEBUG_MAIN ("thread in %s state, preparing to die\n",
break;
}
}
- // since we don't unlock at the end of the while loop, do it here
+ /* since we don't unlock at the end of the while loop, do it here */
g_mutex_unlock (thread->lock);
GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped",
if (GST_OBJECT_CLASS (parent_class)->restore_thyself)
GST_OBJECT_CLASS (parent_class)->restore_thyself (object, self);
}
-#endif // GST_DISABLE_LOADSAVE
+#endif /* GST_DISABLE_LOADSAVE */
GList *list;
GstTimeCacheGroup *tcgroup;
- // first check for null change
+ /* first check for null change */
if (groupnum == tc->curgroup->groupnum)
return TRUE;
- // else search for the proper group
+ /* else search for the proper group */
list = tc->groups;
while (list) {
tcgroup = (GstTimeCacheGroup *)(list->data);
}
}
- // couldn't find the group in question
+ /* couldn't find the group in question */
GST_DEBUG(0, "couldn't find timecache group %d\n",groupnum);
return FALSE;
}
entry->location = location;
entry->timestamp = timestamp;
- // add the entry to the list
+ /* add the entry to the list */
tc->curgroup->entries = g_list_prepend(tc->curgroup->entries,entry);
- // update the bounds
+ /* update the bounds */
if (tc->curgroup->mintimestamp > timestamp) tc->curgroup->mintimestamp = timestamp;
if (tc->curgroup->maxtimestamp < timestamp) tc->curgroup->maxtimestamp = timestamp;
if (tc->curgroup->minlocation > location) tc->curgroup->minlocation = location;
GList *list;
GstTimeCacheEntry *entry = NULL;
- // first check to see if it's in the current group
+ /* first check to see if it's in the current group */
if ((tc->curgroup->minlocation <= location) && (location <= tc->curgroup->maxlocation)) {
GST_DEBUG(0, "location %Ld is in group %d\n",location,tc->curgroup->groupnum);
list = g_list_find_custom(tc->curgroup->entries,&location,(GCompareFunc)_gst_timecache_find_location);
return TRUE;
}
- // TODO: search other groups
+ /* TODO: search other groups */
- // failure
+ /* failure */
return FALSE;
}
GstTimeCacheEntry *entry = NULL;
GstTimeCacheGroup *group;
- // first check to see if it's in the current group
+ /* first check to see if it's in the current group */
if ((tc->curgroup->mintimestamp <= timestamp) && (timestamp <= tc->curgroup->maxtimestamp)) {
GST_DEBUG(0, "timestamp %Ld may be in group %d\n",timestamp,tc->curgroup->groupnum);
entries = g_list_find_custom(tc->curgroup->entries,×tamp,(GCompareFunc)_gst_timecache_find_timestamp);
}
}
- // failure
+ /* failure */
return FALSE;
}
static void gst_typefactory_unload_thyself (GstPluginFeature *feature);
static GstPluginFeatureClass *parent_class = NULL;
-//static guint gst_typefactory_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_typefactory_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_typefactory_get_type (void)
g_return_val_if_fail (factory != NULL, 0);
-// GST_INFO (GST_CAT_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;
-// GST_DEBUG (GST_CAT_TYPES,"searching for '%s'\n",mime);
+/* GST_DEBUG (GST_CAT_TYPES,"searching for '%s'\n",mime); */
mimelen = strlen (mime);
while (walk) {
type = (GstType *)walk->data;
search = type->mime;
-// GST_DEBUG (GST_CAT_TYPES,"checking against '%s'\n",search);
+/* GST_DEBUG (GST_CAT_TYPES,"checking against '%s'\n",search); */
typelen = strlen (search);
while ((search - type->mime) < typelen) {
found = strstr (search, mime);
guint16
gst_type_find_by_ext (const gchar *ext)
{
- //FIXME
+ /* FIXME */
g_warning ("gsttype: find_by_ext not implemented");
return 0;
}
#include "gsttypefind.h"
-//#define GST_DEBUG_ENABLED
+/* #define GST_DEBUG_ENABLED */
GstElementDetails gst_typefind_details = {
"TypeFind",
g_value_init (&value, G_TYPE_STRING);
g_object_get_property (G_OBJECT (object), argname, &value);
- return g_value_get_string (&value); // memleak?
+ return g_value_get_string (&value); /* memleak? */
}
/**
}
}
-// -----------------------------------------------------
-//
-// The following code will be moved out of the main
-// gstreamer library someday.
-//
+/* -----------------------------------------------------
+ *
+ * The following code will be moved out of the main
+ * gstreamer library someday.
+ */
#include "gstpad.h"
#include "gsttype.h"
{
GstXML *xml = GST_XML (data);
- // FIXME check that this element was created from the same xmlDocPtr...
+ /* FIXME check that this element was created from the same xmlDocPtr...*/
g_signal_emit (G_OBJECT (xml), gst_xml_signals[OBJECT_LOADED], 0, object, self);
}
* Boston, MA 02111-1307, USA.
*/
-//#define DEBUG_ENABLED
-//#define STATUS_ENABLED
+/* #define DEBUG_ENABLED */
+/* #define STATUS_ENABLED */
#ifdef STATUS_ENABLED
#define STATUS(A) GST_DEBUG(GST_CAT_DATAFLOW, A, GST_ELEMENT_NAME(queue))
#else
}
static GstElementClass *parent_class = NULL;
-//static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
+/* static guint gst_queue_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_queue_get_type(void)
static void
gst_queue_init (GstQueue *queue)
{
- // scheduling on this kind of element is, well, interesting
+ /* scheduling on this kind of element is, well, interesting */
GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE);
queue->level_buffers = 0;
queue->level_bytes = 0;
queue->level_time = 0LL;
- queue->size_buffers = 100; // 100 buffers
- queue->size_bytes = 100 * 1024; // 100KB
- queue->size_time = 1000000000LL; // 1sec
+ queue->size_buffers = 100; /* 100 buffers */
+ queue->size_bytes = 100 * 1024; /* 100KB */
+ queue->size_time = 1000000000LL; /* 1sec */
queue->qlock = g_mutex_new ();
queue->reader = FALSE;
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d\n",buf,GST_BUFFER_SIZE(buf));
if (queue->level_buffers == queue->size_buffers) {
- // if this is a leaky queue...
+ /* if this is a leaky queue... */
if (queue->leaky) {
- // FIXME don't want to leak events!
- // if we leak on the upstream side, drop the current buffer
+ /* FIXME don't want to leak events! */
+ /* if we leak on the upstream side, drop the current buffer */
if (queue->leaky == GST_QUEUE_LEAK_UPSTREAM) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
if (GST_IS_EVENT (buf))
GST_EVENT_TYPE(GST_EVENT(buf)));
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
gst_buffer_unref(buf);
- // now we have to clean up and exit right away
+ /* now we have to clean up and exit right away */
g_mutex_unlock (queue->qlock);
return;
}
- // otherwise we have to push a buffer off the other end
+ /* otherwise we have to push a buffer off the other end */
else {
GSList *front;
GstBuffer *leakbuf;
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d\n",
queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == queue->size_buffers) {
- // if there's a pending state change for this queue or its manager, switch
- // back to iterator so bottom half of state change executes
+ /* if there's a pending state change for this queue or its manager, switch */
+ /* back to iterator so bottom half of state change executes */
while (GST_STATE (queue) != GST_STATE_PLAYING) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
g_mutex_unlock (queue->qlock);
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == 0) {
- // if there's a pending state change for this queue or its manager, switch
- // back to iterator so bottom half of state change executes
+ /* if there's a pending state change for this queue or its manager, switch
+ * back to iterator so bottom half of state change executes
+ */
while (GST_STATE (queue) != GST_STATE_PLAYING) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
g_mutex_unlock (queue->qlock);
g_cond_signal (queue->not_full);
}
- // FIXME where should this be? locked?
+ /* FIXME where should this be? locked? */
if (GST_IS_EVENT(buf)) {
GstEvent *event = GST_EVENT(buf);
switch (GST_EVENT_TYPE(event)) {
GST_DEBUG_ENTER("('%s')", GST_ELEMENT_NAME (element));
- // lock the queue so another thread (not in sync with this thread's state)
- // can't call this queue's _get (or whatever)
+ /* lock the queue so another thread (not in sync with this thread's state)
+ * can't call this queue's _get (or whatever)
+ */
g_mutex_lock (queue->qlock);
new_state = GST_STATE_PENDING (element);
}
else if (new_state == GST_STATE_PLAYING) {
if (!GST_PAD_CONNECTED (queue->sinkpad)) {
- // FIXME can this be?
+ /* FIXME can this be? */
if (queue->reader)
g_cond_signal (queue->not_empty);
g_mutex_unlock (queue->qlock);