mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
Updated more files to use INFO.
Original commit message from CVS: Updated more files to use INFO.
This commit is contained in:
parent
be6f808666
commit
9813b0ca37
11 changed files with 124 additions and 53 deletions
|
@ -81,9 +81,9 @@ cothread_create (cothread_context *ctx)
|
|||
s->sp = ((int *)s + COTHREAD_STACKSIZE);
|
||||
s->top_sp = s->sp;
|
||||
|
||||
ctx->threads[ctx->nthreads++] = s;
|
||||
INFO(GST_INFO_COTHREADS,"created cothread #%d: %p at sp:%p\n", ctx->nthreads, s, s->sp);
|
||||
|
||||
DEBUG("created cothread at %p %p\n",s, s->sp);
|
||||
ctx->threads[ctx->nthreads++] = s;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -121,6 +121,8 @@ cothread_init (void)
|
|||
{
|
||||
cothread_context *ctx = (cothread_context *)malloc(sizeof(cothread_context));
|
||||
|
||||
INFO(GST_INFO_COTHREADS,"initializing cothreads\n");
|
||||
|
||||
if (_cothread_key == -1) {
|
||||
if (pthread_key_create (&_cothread_key,NULL) != 0) {
|
||||
perror ("pthread_key_create");
|
||||
|
@ -141,7 +143,7 @@ cothread_init (void)
|
|||
ctx->threads[0]->sp = (int *)CURRENT_STACK_FRAME;
|
||||
ctx->threads[0]->pc = 0;
|
||||
|
||||
DEBUG("0th thread is at %p, sp %p\n",ctx->threads[0], ctx->threads[0]->sp);
|
||||
INFO(GST_INFO_COTHREADS,"0th thread is %p at sp:%p\n",ctx->threads[0], ctx->threads[0]->sp);
|
||||
|
||||
// we consider the initiating process to be cothread 0
|
||||
ctx->nthreads = 1;
|
||||
|
@ -257,7 +259,7 @@ cothread_switch (cothread_state *thread)
|
|||
|
||||
// find the number of the thread to switch to
|
||||
ctx->current = thread->threadnum;
|
||||
DEBUG("about to switch to thread #%d\n",ctx->current);
|
||||
INFO(GST_INFO_COTHREAD_SWITCH,"switching to thread #%d\n",ctx->current);
|
||||
|
||||
/* save the current stack pointer, frame pointer, and pc */
|
||||
GET_SP(current->sp);
|
||||
|
|
|
@ -52,6 +52,8 @@ gst_init (int *argc, char **argv[])
|
|||
{
|
||||
GstTrace *gst_trace;
|
||||
|
||||
INFO (GST_INFO_GST_INIT, "Initializing GStreamer Core Library\n");
|
||||
|
||||
if (!g_thread_supported ()) g_thread_init (NULL);
|
||||
|
||||
_gst_progname = g_strdup(*argv[0]);
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gst/gstinfo.h>
|
||||
|
||||
#endif /* __GST_PRIVATE_H__ */
|
||||
|
|
32
gst/gstbin.c
32
gst/gstbin.c
|
@ -175,6 +175,8 @@ gst_bin_add (GstBin *bin,
|
|||
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));
|
||||
|
||||
/* we know we have at least one child, we just added one... */
|
||||
// if (GST_STATE(element) < GST_STATE_READY)
|
||||
// gst_bin_change_state_norecurse(bin,GST_STATE_READY);
|
||||
|
@ -203,10 +205,18 @@ gst_bin_remove (GstBin *bin,
|
|||
g_return_if_fail ((GST_STATE (bin) == GST_STATE_NULL) ||
|
||||
(GST_STATE (bin) == GST_STATE_PAUSED));
|
||||
|
||||
if (g_list_find(bin->children, element) == NULL) {
|
||||
// FIXME this should be a warning!!!
|
||||
ERROR_OBJECT(bin,element,"no such element in bin");
|
||||
return;
|
||||
}
|
||||
|
||||
gst_object_unparent (GST_OBJECT (element));
|
||||
bin->children = g_list_remove (bin->children, element);
|
||||
bin->numchildren--;
|
||||
|
||||
INFO_ELEMENT (GST_INFO_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)
|
||||
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
|
||||
|
@ -226,9 +236,13 @@ gst_bin_change_state (GstElement *element)
|
|||
|
||||
bin = GST_BIN (element);
|
||||
|
||||
DEBUG("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)));
|
||||
// DEBUG("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_print_statename (GST_STATE (element)),
|
||||
_gst_print_statename (GST_STATE_PENDING (element)));
|
||||
|
||||
// g_return_val_if_fail(bin->numchildren != 0, GST_STATE_FAILURE);
|
||||
|
||||
|
@ -386,9 +400,8 @@ gst_bin_get_by_name (GstBin *bin,
|
|||
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
g_print("gstbin: lookup element \"%s\" in \"%s\"\n", name,
|
||||
gst_element_get_name (GST_ELEMENT (bin)));
|
||||
|
||||
INFO_ELEMENT (GST_INFO_PARENTAGE, bin, "looking up child element %s", name);
|
||||
|
||||
children = bin->children;
|
||||
while (children) {
|
||||
child = GST_ELEMENT (children->data);
|
||||
|
@ -436,6 +449,8 @@ gst_bin_save_thyself (GstElement *element,
|
|||
|
||||
childlist = xmlNewChild (parent,NULL,"children",NULL);
|
||||
|
||||
INFO_ELEMENT (GST_INFO_XML, bin, "saving %d children", bin->numchildren);
|
||||
|
||||
children = bin->children;
|
||||
while (children) {
|
||||
child = GST_ELEMENT (children->data);
|
||||
|
@ -454,10 +469,11 @@ gst_bin_restore_thyself (GstElement *element,
|
|||
xmlNodePtr field = parent->childs;
|
||||
xmlNodePtr childlist;
|
||||
|
||||
g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element));
|
||||
// g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element));
|
||||
|
||||
while (field) {
|
||||
if (!strcmp (field->name, "children")) {
|
||||
INFO_ELEMENT (GST_INFO_XML, element, "loading children");
|
||||
childlist = field->childs;
|
||||
while (childlist) {
|
||||
if (!strcmp (childlist->name, "element")) {
|
||||
|
@ -557,6 +573,8 @@ gst_bin_create_plan_func (GstBin *bin)
|
|||
DEBUG_SET_STRING("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
|
||||
DEBUG_ENTER_STRING;
|
||||
|
||||
INFO_ELEMENT (GST_INFO_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)) {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* this file makes too much noise for most debugging sessions */
|
||||
#define GST_DEBUG_FORCE_DISABLE
|
||||
#include "gst_private.h"
|
||||
|
@ -50,7 +49,7 @@ gst_buffer_new(void)
|
|||
GstBuffer *buffer;
|
||||
|
||||
buffer = g_mem_chunk_alloc (_gst_buffer_chunk);
|
||||
DEBUG("allocating new buffer %p\n",buffer);
|
||||
INFO(GST_INFO_BUFFER,"creating new buffer %p",buffer);
|
||||
|
||||
// g_print("allocating new mutex\n");
|
||||
buffer->lock = g_mutex_new ();
|
||||
|
@ -109,7 +108,7 @@ gst_buffer_create_sub (GstBuffer *parent,
|
|||
g_return_val_if_fail ((offset+size) <= parent->size, NULL);
|
||||
|
||||
buffer = g_mem_chunk_alloc (_gst_buffer_chunk);
|
||||
DEBUG("allocating new subbuffer %p, parent %p\n", buffer, parent);
|
||||
INFO(GST_INFO_BUFFER,"creating new subbuffer %p from parent %p", buffer, parent);
|
||||
|
||||
buffer->lock = g_mutex_new ();
|
||||
#ifdef HAVE_ATOMIC_H
|
||||
|
@ -164,6 +163,8 @@ gst_buffer_append (GstBuffer *buffer,
|
|||
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_BUFFER_LOCK (buffer);
|
||||
// the buffer is not used by anyone else
|
||||
if (GST_BUFFER_REFCOUNT (buffer) == 1 && buffer->parent == NULL
|
||||
|
@ -201,12 +202,7 @@ void gst_buffer_destroy (GstBuffer *buffer)
|
|||
|
||||
g_return_if_fail (buffer != NULL);
|
||||
|
||||
if (buffer->parent != NULL) {
|
||||
DEBUG("freeing subbuffer %p\n", buffer);
|
||||
}
|
||||
else {
|
||||
DEBUG("freeing buffer %p\n", buffer);
|
||||
}
|
||||
INFO(GST_INFO_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) &&
|
||||
|
|
|
@ -670,7 +670,7 @@ gst_element_load_thyself (xmlNodePtr parent,
|
|||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (type != NULL, NULL);
|
||||
|
||||
INFO(0,NULL,"loading \"%s\" of type \"%s\"\n", name, type);
|
||||
INFO(GST_INFO_XML,"loading \"%s\" of type \"%s\"\n", name, type);
|
||||
|
||||
element = gst_elementfactory_make (type, name);
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gst_private.h"
|
||||
#include "gst.h"
|
||||
|
||||
|
||||
extern gchar *_gst_progname;
|
||||
|
||||
|
||||
|
@ -33,26 +33,53 @@ GHashTable *__gst_function_pointers = NULL;
|
|||
|
||||
/***** INFO system *****/
|
||||
GstInfoHandler _gst_info_handler = gst_default_info_handler;
|
||||
guint32 _gst_info_categories = 0xffffffff;
|
||||
|
||||
static gchar *_gst_info_category_strings[] = {
|
||||
"GST_INIT",
|
||||
"COTHREADS",
|
||||
"COTHREAD_SWITCH",
|
||||
"AUTOPLUG",
|
||||
"AUTOPLUG_ATTEMPT",
|
||||
"PARENTAGE",
|
||||
"STATES",
|
||||
"PLANING",
|
||||
"SCHEDULING",
|
||||
"OPERATION",
|
||||
"BUFFER",
|
||||
"CAPS",
|
||||
"CLOCK",
|
||||
"ELEMENT_PADS",
|
||||
"ELEMENTFACTORY",
|
||||
"PADS",
|
||||
"PIPELINE",
|
||||
"PLUGIN_LOADING",
|
||||
"PLUGIN_ERRORS",
|
||||
"PROPERTIES",
|
||||
"THREAD",
|
||||
"TYPES",
|
||||
"XML",
|
||||
};
|
||||
|
||||
void
|
||||
gst_default_info_handler (gint level, gchar *file, gchar *function,
|
||||
gst_default_info_handler (gint category, gchar *file, gchar *function,
|
||||
gint line, gchar *debug_string,
|
||||
void *element, gchar *string)
|
||||
{
|
||||
if (element) {
|
||||
if (debug_string)
|
||||
fprintf(stderr,"INFO:%d:%s:%d%s: [%s] %s\n",
|
||||
level,function,line,debug_string,gst_element_get_name(element),string);
|
||||
fprintf(stderr,"INFO:%s:%d%s: [%s] %s\n",
|
||||
function,line,debug_string,gst_element_get_name(element),string);
|
||||
else
|
||||
fprintf(stderr,"INFO:%d:%s:%d: [%s] %s\n",
|
||||
level,function,line,gst_element_get_name(element),string);
|
||||
fprintf(stderr,"INFO:%s:%d: [%s] %s\n",
|
||||
function,line,gst_element_get_name(element),string);
|
||||
} else {
|
||||
if (debug_string)
|
||||
fprintf(stderr,"INFO:%d:%s:%d%s: %s\n",
|
||||
level,function,line,debug_string,string);
|
||||
fprintf(stderr,"INFO:%s:%d%s: %s\n",
|
||||
function,line,debug_string,string);
|
||||
else
|
||||
fprintf(stderr,"INFO:%d:%s:%d: %s\n",
|
||||
level,function,line,string);
|
||||
fprintf(stderr,"INFO:%s:%d: %s\n",
|
||||
function,line,string);
|
||||
}
|
||||
|
||||
g_free(string);
|
||||
|
@ -141,8 +168,6 @@ gst_default_error_handler (gchar *file, gchar *function,
|
|||
void *element, void *object, gchar *string)
|
||||
{
|
||||
int chars = 0;
|
||||
GSList *parentage;
|
||||
GstObject *parent;
|
||||
gchar *path;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "cothreads.h"
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* DEBUG system
|
||||
|
@ -166,28 +168,57 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
|
|||
* INFO system
|
||||
**********************************************************************/
|
||||
|
||||
typedef void (*GstInfoHandler) (gint level,gchar *file,gchar *function,
|
||||
typedef void (*GstInfoHandler) (gint category,gchar *file,gchar *function,
|
||||
gint line,gchar *debug_string,
|
||||
void *element,gchar *string);
|
||||
|
||||
void gst_default_info_handler (gint level,gchar *file,gchar *function,
|
||||
void gst_default_info_handler (gint category,gchar *file,gchar *function,
|
||||
gint line,gchar *debug_string,
|
||||
void *element,gchar *string);
|
||||
|
||||
extern GstInfoHandler _gst_info_handler;
|
||||
extern guint32 _gst_info_categories;
|
||||
|
||||
|
||||
#define INFO(lvl,format,args...) \
|
||||
_gst_info_handler(lvl,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
|
||||
NULL,g_strdup_printf( format , ## args ))
|
||||
#define 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(lvl,element,object,format,args...) \
|
||||
_gst_info_handler(lvl,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
|
||||
element,g_strdup_printf( format , ## args ))
|
||||
#define 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
|
||||
|
||||
|
||||
#define GST_INFO_PLUGIN_LOAD 0
|
||||
|
||||
//#define GST_INFO_PLUGIN_LOAD 0
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -215,7 +246,5 @@ extern GstErrorHandler _gst_error_handler;
|
|||
element,object,g_strdup_printf( format , ## args ))
|
||||
|
||||
|
||||
#define GST_ERROR_PLUGIN_LOAD 0
|
||||
|
||||
|
||||
#endif /* __GSTINFO_H__ */
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
//#define GST_DEBUG_ENABLED
|
||||
#include "gst_private.h"
|
||||
|
||||
|
@ -116,7 +115,7 @@ gst_pad_init (GstPad *pad)
|
|||
pad->getregionfunc = NULL;
|
||||
pad->qosfunc = NULL;
|
||||
|
||||
pad->pushfunc = NULL; //GST_DEBUG_FUNCPTR(gst_pad_push_func);
|
||||
pad->pushfunc = GST_DEBUG_FUNCPTR(gst_pad_push_func);
|
||||
pad->pullfunc = NULL;
|
||||
pad->pullregionfunc = NULL;
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
//#define GST_DEBUG_ENABLED
|
||||
#include "gst_private.h"
|
||||
|
@ -411,7 +410,7 @@ gst_plugin_load_elementfactory (gchar *name)
|
|||
gchar *filename = g_strdup (plugin->filename);
|
||||
gchar *pluginname = g_strdup (plugin->name);
|
||||
|
||||
INFO("loaded elementfactory %s from plugin %s",name,plugin->name);
|
||||
INFO(GST_INFO_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);
|
||||
|
@ -458,7 +457,7 @@ gst_plugin_load_typefactory (gchar *mime)
|
|||
gchar *filename = g_strdup (plugin->filename);
|
||||
gchar *pluginname = g_strdup (plugin->name);
|
||||
|
||||
INFO(GST_INFO_PLUGIN_LOAD,"loading type factory for \"%s\" from plugin %s",mime,plugin->name);
|
||||
INFO(GST_INFO_PLUGIN_LOADING,"loading type factory for \"%s\" from plugin %s",mime,plugin->name);
|
||||
gst_plugin_remove(plugin);
|
||||
if (!gst_plugin_load_absolute(filename)) {
|
||||
DEBUG("gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, pluginname);
|
||||
|
@ -630,6 +629,6 @@ gst_plugin_load_thyself (xmlNodePtr parent)
|
|||
kinderen = kinderen->next;
|
||||
}
|
||||
// DEBUG("gstplugin: added %d registered factories and %d types\n", elementcount, typecount);
|
||||
INFO(GST_INFO_PLUGIN_LOAD,"added %d registered factories and %d types",elementcount,typecount);
|
||||
INFO(GST_INFO_PLUGIN_LOADING,"added %d registered factories and %d types",elementcount,typecount);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
* I'm not overly worried yet...
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gsttype.h"
|
||||
|
|
Loading…
Reference in a new issue