diff --git a/common b/common index 4e379694ae..2a3efdc282 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 4e379694ae9ff9843d65cf08928642eea44abdf8 +Subproject commit 2a3efdc282fb1ecfd2720dea40523b3441f10fed diff --git a/configure.ac b/configure.ac index fbf238660b..b1d5c1a43a 100644 --- a/configure.ac +++ b/configure.ac @@ -255,8 +255,6 @@ AC_HELP_STRING([--enable-plugin-builddir],[allow tests/demos to use non-installe esac], [PLUGINS_USE_BUILDDIR=no]) dnl Default value -GST_DEBUGINFO - AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling],[adds -pg to compiler commandline, for profiling]), [case "${enableval}" in @@ -327,6 +325,18 @@ AM_CONDITIONAL(BUILD_EXAMPLES, test "x$BUILD_EXAMPLES" = "xyes") dnl Next, check for the optional components: dnl ======================================== +dnl debugging stuff +AC_ARG_ENABLE(debug, +AC_HELP_STRING([--disable-debug],[disable addition of -g debugging info]), +[case "${enableval}" in + yes) USE_DEBUG=yes ;; + no) USE_DEBUG=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; +esac], +[USE_DEBUG=yes]) dnl Default value +translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_GST_DEBUG, true) +GST_SUBSYSTEM_DISABLE(GST_DEBUG,[debugging subsystem]) + translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_LOADSAVE, true) GST_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save]) translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TYPEFIND, true) @@ -351,8 +361,6 @@ GST_SUBSYSTEM_DISABLE(PLUGIN,[plugin]) translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_URI, true) GST_SUBSYSTEM_DISABLE(URI,[uri handlers]) -GST_EXT_CFLAGS="$GST_EXT_CFLAGS $GST_SUBSYSTEM_DISABLE_DEFINES" - dnl ################################################ dnl # Set defines according to variables set above # dnl ################################################ @@ -514,6 +522,7 @@ AC_OUTPUT( Makefile include/Makefile gst/Makefile +gst/gstconfig.h gst/gstversion.h gst/autoplug/Makefile gst/indexers/Makefile @@ -541,6 +550,7 @@ testsuite/bytestream/Makefile testsuite/caps/Makefile testsuite/cleanup/Makefile testsuite/clock/Makefile +testsuite/debug/Makefile testsuite/dynparams/Makefile testsuite/elements/Makefile testsuite/indexers/Makefile @@ -569,7 +579,6 @@ tools/Makefile docs/Makefile docs/faq/Makefile docs/gst/Makefile -docs/gst/gstreamer.types docs/libs/Makefile docs/manual/Makefile docs/pwg/Makefile diff --git a/docs/gst/Makefile.am b/docs/gst/Makefile.am index 7d9dc6743e..45add71cdd 100644 --- a/docs/gst/Makefile.am +++ b/docs/gst/Makefile.am @@ -113,6 +113,7 @@ DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ SCANOBJ_FILES = \ $(DOC_MODULE).args \ $(DOC_MODULE).hierarchy \ + $(DOC_MODULE)-scan.o \ $(DOC_MODULE).signals if HAVE_GTK_DOC @@ -182,12 +183,15 @@ clean-local: maintainer-clean-local: clean cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt +# company: don't delete .sgml and -sections.txt as they're in CVS # FIXME : thomas added all sgml files and some other things to make # make distcheck work distclean-local: clean rm -rf $(DOC_MODULE)-decl-list.txt - rm -rf $(DOC_MODULE)-*.txt - rm -rf tmpl/*.sgml + rm -rf $(DOC_MODULE)-decl.txt + rm -rf $(DOC_MODULE)-undocumented.txt + rm -rf $(DOC_MODULE)-unused.txt + rm -rf tmpl/*.sgml.bak rm -f $(DOC_MODULE).hierarchy rm -f *.stamp || true diff --git a/docs/gst/gstreamer-docs.sgml b/docs/gst/gstreamer-docs.sgml index d860aba722..c3e6a2a388 100644 --- a/docs/gst/gstreamer-docs.sgml +++ b/docs/gst/gstreamer-docs.sgml @@ -3,23 +3,21 @@ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ - + - + - - @@ -30,10 +28,9 @@ - - + @@ -46,7 +43,6 @@ --> - &GstUri; diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index a616f16188..04a0f5b9bd 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -82,41 +82,72 @@ gst_marshal_VOID__VOID
gstinfo -GstInfo -gst_get_category_name -gst_info_get_categories -gst_info_set_categories -gst_info_enable_category -gst_info_disable_category -gst_default_info_handler -GST_INFO_ENABLED +GST_STR_NULL +GST_DEBUG_PAD_NAME +GST_FUNCTION + +GstDebugLevel +GST_LEVEL_DEFAULT +gst_debug_level_get_name +GstDebugColorFlags +gst_debug_construct_term_color +GstDebugCategory +GST_CAT_DEFAULT + +GstLogFunction +gst_debug_log +gst_debug_logv +gst_debug_log_default +gst_debug_add_log_function +gst_debug_remove_log_function +gst_debug_remove_log_function_by_data + +gst_debug_set_active +gst_debug_is_active +gst_debug_set_colored +gst_debug_is_colored +gst_debug_set_default_threshold +gst_debug_get_default_threshold +gst_debug_set_threshold_for_name +gst_debug_unset_threshold_for_name + +GST_DEBUG_CATEGORY +GST_DEBUG_CATEGORY_EXTERN +GST_DEBUG_CATEGORY_STATIC +GST_DEBUG_CATEGORY_INIT +gst_debug_category_free +gst_debug_category_set_threshold +gst_debug_category_reset_threshold +gst_debug_category_get_threshold +gst_debug_category_get_name +gst_debug_category_get_color +gst_debug_category_get_description +gst_debug_get_all_categories + +GST_CAT_LEVEL_LOG GST_INFO -GST_INFO_ELEMENT -gst_debug_get_categories -gst_debug_set_categories -gst_debug_enable_category -gst_debug_disable_category -GST_DEBUG_ENTER -GST_DEBUG_LEAVE GST_DEBUG +GST_CAT_ERROR_OBJECT +GST_CAT_WARNING_OBJECT +GST_CAT_INFO_OBJECT +GST_CAT_DEBUG_OBJECT +GST_CAT_LOG_OBJECT +GST_CAT_ERROR +GST_CAT_WARNING +GST_CAT_LOG +GST_ERROR_OBJECT +GST_WARNING_OBJECT +GST_INFO_OBJECT +GST_DEBUG_OBJECT +GST_LOG_OBJECT +GST_ERROR +GST_WARNING +GST_CAT_INFO +GST_CAT_DEBUG +GST_LOG + GST_DEBUG_FUNCPTR GST_DEBUG_FUNCPTR_NAME -GST_DEBUG_PAD_NAME -GST_DEBUG_THREAD_ARGS -GST_DEBUG_THREAD_FORMAT -GST_DEBUG_ELEMENT -GST_ERROR -GST_ERROR_OBJECT -GstDebugHandler -gst_default_debug_handler -gst_default_error_handler -GstInfoHandler -GstErrorHandler - -gst_debug_print_stack_trace -GST_DEBUG_CHAR_MODE -GST_DEBUG_ENABLED -GST_DEBUG_ENABLE_CATEGORIES
@@ -166,6 +197,23 @@ GST_SCHEDULER_FACTORY_GET_CLASS GST_SCHEDULER_GET_CLASS
+
+gstconfig +GST_DISABLE_ALLOC_TRACE +GST_DISABLE_AUTOPLUG +GST_DISABLE_ENUMTYPES +GST_DISABLE_GST_DEBUG +GST_DISABLE_INDEX +GST_DISABLE_LOADSAVE +GST_DISABLE_LOADSAVE_REGISTRY +GST_DISABLE_PARSE +GST_DISABLE_PLUGIN +GST_DISABLE_TRACE +GST_DISABLE_TYPEFIND +GST_DISABLE_URI +GST_DISABLE_REGISTRY +
+
gstschedulerfactory GstSchedulerFactory diff --git a/docs/gst/gstreamer.types.in b/docs/gst/gstreamer.types similarity index 100% rename from docs/gst/gstreamer.types.in rename to docs/gst/gstreamer.types diff --git a/docs/gst/tmpl/gstconfig.sgml b/docs/gst/tmpl/gstconfig.sgml new file mode 100644 index 0000000000..fab53c4419 --- /dev/null +++ b/docs/gst/tmpl/gstconfig.sgml @@ -0,0 +1,131 @@ + +GstConfig + + +configuration options + + + +This describes the configureation options for GStreamer. When building +GStreamer there are a lot of parts (known internally as "subsystems" ) that can +be disabled for various reasons. The most common reasons are speed and size, +which is important because GStreamer is designed to run on embedded systems. + + + +If a subsystem is disabled, most of this changes are done in an API compatible +way, so you don't need to adapt your code in most cases. It is never done in an +ABI compatible way though. So if you want to disable a suybsystem, you have to +rebuild all programs depending on GStreamer, too. + + + +If a subsystem is disabled in GStreamer, a value is defined in +<gst/gst.h>. You can check this if you do subsystem-specific stuff. + +Doing subsystem specific things + +&hash;ifndef GST_DISABLE_GST_DEBUG +/* do stuff specific to the debugging subsystem */ +&hash;endif /* GST_DISABLE_GST_DEBUG */ + + + + + + + + + + + + + + + + + + +If this is defined, the debugging subsystem + is disabled and debugging messages are not output. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/gst/tmpl/gstinfo.sgml b/docs/gst/tmpl/gstinfo.sgml index a53e9743db..5efd90917f 100644 --- a/docs/gst/tmpl/gstinfo.sgml +++ b/docs/gst/tmpl/gstinfo.sgml @@ -2,315 +2,668 @@ GstInfo -info/debugging/error handling +debugging subsystem -gstinfo.c contains a number of debuggins subsystems. +This file describes the debugging subsystem. The debugging subsystem works +only after GStreamer was initilized - for example by calling #gst_init. -The INFO subsystem is used to provide informative printouts to -application and plugin developers. These messages can be enabled and -disabled via a category system, which is a bitmask enabling you to turn -on and off any subset of categories. - -The DEBUG subsystem is similar, but is intended for core developers -and those writing more complex pipelines or filters. It uses the same -category system, but must be enabled at configure time else it's not -compiled into the library. autogen.sh automatically enables the DEBUG -subsystem. + +The debugging subsystem is used to send informational strings to the debugging +developer. Each messages has some properties attached to it. These properties +are the debugging category, the severity (called "level" here) and an obtional +#GObject it belongs to. Each of these messages is sent to all registered +debugging handlers, which then handle the messages. GStreamer attaches a +default handler on startup, which outputs requested messages to stderr. -The ERROR subsystem doesn't use categories, but will print out a -more verbose message, and attempt to print out a stack trace of the error -before aborting the application. + +Messages are output by using shortcut macros like #GST_DEBUG, +#GST_CAT_ERROR_OBJECT or similar. These all expand to calling #gst_debug_log +with the right parameters. +The only thing a developer will probably want to do is define his own +categories. This is easily done with 3 lines. At the top of your code, declare +the variables and set the default category. + + +GST_DEBUG_CATEGORY (my_category); /* define category */ +&hash;define GST_CAT_DEFAULT my_category /* set as default */ + + +After that you only need to initialize the category. + + +GST_DEBUG_CATEGORY_INIT (my_category, "my category", 0, "This is my very own"); + + +Initialization must be done before the category is used first. Plugins do this +in their plugin_init function, libraries and applications should do that +during their initialization. + + + +The whole debugging subsystem can be disabled at build time with passing the +--disable-gst-debug switch to configure. If this is done, every function, macro +and even structs described in this file evaluate to default values or nothing +at all. So don't take addresses of these functions or use other tricks. +If you must do that for some reason, there is still an option. If the debugging +subsystem was compiled out, #GST_DISABLE_GST_DEBUG is defined in <gst/gst.h>, +so you can check that before doing your trick. +Disabling the debugging subsystem will give you a slight (read: unnoticable) +speed increase and will reduce the size of your compiled code. The GStreamer +library itself becomes around 10% smaller. + + + +Please note that there are naming conventions for the names of debugging +categories. These are explained at GST_DEBUG_CATEGORY_INIT(). - +configuration, +initialization for command line parameters +and environment variables that affect the debugging output. - + - +Macro to use when a string must not be NULL, but may be NULL. If the string is +NULL, "(NULL)" is printed instead. +In GStreamer printf string arguments may not be NULL, because on some platforms +(ie Solaris) the libc crashes in that case. This includes debugging strings. -@category: -@Returns: - - - - - - - -@Returns: - - - - - - - -@categories: - - - - - - - -@category: - - - - - - - -@category: - - - - - - - -@category: -@incore: -@file: -@function: -@line: -@debug_string: -@element: -@string: - - - - -When defined, INFO printouts are compiled into the library. - - - - - - -Print out any information usable at run-time by application developers. - - -@cat: the GST_CAT_... category for the information -@...: printf arguments - - - - -Print out information like #GST_INFO, but with an element pointer to clarify things. - - -@cat: the GST_CAT_... category for the information -@element: pointer to the #GstElement in question -@...: printf arguments - - - - - - - -@Returns: - - - - - - - -@categories: - - - - - - - -@category: - - - - - - - -@category: - - - - -Called at the beginning of a function, it simply prints out a DEBUG string of "entering" -in addition to the given string. - - -@...: printf arguments - - - - -Called at the end of a function, it simply prints out a DEBUG string of "leaving" -in addition to the given string. - - -@...: printf arguments - - - - -Print out debugging information. - - -@cat: the GST_CAT_... the debug falls within -@...: printf arguments - - - - -Add a function to the global function pointer table used for debugging. - - -@ptr: The pointer to add to the function table. - - - - -Get the name of the given function pointer by looking up its name in the global -function table. - - -@ptr: The pointer to look up. +@str: The string to check. +@Returns: A string that is guaranteed to be not NULL. -Print out debugging statements for a pad. +Evaluates to 2 strings, that describe the pad. Often used in debugging +statements. @pad: The pad to debug. - + -Part of the colorized debug functions for threads - - -@id: The thread id. - - - - -Part of the colorized debug functions for threads +This macro should evaluate to the name of the current function and be should +be defined when configuring your project, as it is compiler dependant. If it +is not defined, some default value is used. It is used to provide debugging +output with the function name of the message. - + -Print out usefull debugging info of an element. +The level defines the importance of a debugging message. The more important a +message is, the greater the probability that the debugging system outputs it. -@cat: The category of this debugging statement. -@element: The element to debug. -@...: printf arguments +@GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate +debugging output. +@GST_LEVEL_ERROR: Error messages are to be used only when an error occured +that stops the application from keeping working correctly. +An examples is gst_element_error, which outputs a message with this priority. +It does not mean that the application is terminating as with g_errror. +@GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour +that could lead to problems or weird behaviour later on. An example of this +would be clocking issues ("your computer is pretty slow") or broken input +data ("Can't synchronize to stream.") +@GST_LEVEL_INFO: Informational messages should be used to keep the developer +updated about what is happening. +Examples where this should be used are when a typefind function has +successfully determined the type of the stream or when an mp3 plugin detects +the format to be used. ("This file has mono sound.") +@GST_LEVEL_DEBUG: Debugging messages should be used when something common +happens that is not the expected default behavior. +An example would be notifications about state changes or receiving/sending of +events. +@GST_LEVEL_LOG: Log messages are messages that are very common but might be +useful to know. As a rule of thumb a pipeline that is iterating as expected +should never output anzthing else but LOG messages. +Examples for this are referencing/dereferencing of objects or cothread switches. +@GST_LEVEL_COUNT: The number of defined debugging levels. - - + -Print out an error condition and abort the application. +Defines the default debugging level to be used with GStreamer. It is +normally set to #GST_LEVEL_ERROR so only errors are printed. Developer +builds may chose to override that though. +You can use this as an argument to gst_debug_set_default_threshold() to +reset the debugging output to default behaviour. -@element: the #GstElement in question -@...: printf arguments + + + + + + + +@level: +@Returns: + + + + +These are some terminal-oriented flags you can use when creating your debugging +categories to make them stand out in debugging output. + + +@GST_DEBUG_FG_BLACK: Use black as foreground color. +@GST_DEBUG_FG_RED: Use red as foreground color. +@GST_DEBUG_FG_GREEN: Use green as foreground color. +@GST_DEBUG_FG_YELLOW: Use yellow as foreground color. +@GST_DEBUG_FG_BLUE: Use blue as foreground color. +@GST_DEBUG_FG_MAGENTA: Use magenta as foreground color. +@GST_DEBUG_FG_CYAN: Use cyan as foreground color. +@GST_DEBUG_FG_WHITE: Use white as foreground color. +@GST_DEBUG_BG_BLACK: Use black as background color. +@GST_DEBUG_BG_RED: Use red as background color. +@GST_DEBUG_BG_GREEN: Use green as background color. +@GST_DEBUG_BG_YELLOW: Use yellow as background color. +@GST_DEBUG_BG_BLUE: Use blue as background color. +@GST_DEBUG_BG_MAGENTA: Use magenta as background color. +@GST_DEBUG_BG_CYAN: Use cyan as background color. +@GST_DEBUG_BG_WHITE: Use white as background color. +@GST_DEBUG_BOLD: Make the output bold. +@GST_DEBUG_UNDERLINE: Underline the output. + + + + + + +@colorinfo: +@Returns: + + + + +This is the struct that describes the categories. Once initialized with +#GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore. + + + + + +The default category that is used when no other category is defined as the +default. If you want to define a default category, do it like this: + + +&hash;define GST_CAT_DEFAULT category_to_be_default + + + + + + + + + + +@category: +@level: +@file: +@function: +@line: +@object: +@message: +@data: + + + + + + + +@category: +@level: +@file: +@function: +@line: +@object: +@format: +@Varargs: + + + + + + + +@category: +@level: +@file: +@function: +@line: +@object: +@format: +@args: + + + + + + + +@category: +@level: +@file: +@function: +@line: +@object: +@message: +@unused: + + + + + + + +@func: +@data: + + + + + + + +@func: +@Returns: + + + + + + + +@data: +@Returns: + + + + + + + +@active: + + + + + + + +@Returns: + + + + + + + +@colored: + + + + + + + +@Returns: + + + + + + + +@level: + + + + + + + +@Returns: + + + + + + + +@name: +@level: + + + + + + + +@name: + + + + + + + +@cat: + + + + + + + +@cat: + + + + + + + +@cat: + + + + + + + +@cat: +@name: +@color: +@description: + + + + + + + +@category: + + + + + + + +@category: +@level: + + + + + + + +@category: + + + + + + + +@category: +@Returns: + + + + + + + +@category: +@Returns: + + + + + + + +@category: +@Returns: + + + + + + + +@category: +@Returns: + + + + + + + +@Returns: + + + + + + + +@cat: +@level: +@object: +@...: + + + + +Output an error message belonging to the given object in the given category. + + +@cat: category to use +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output a warning message belonging to the given object in the given category. + + +@cat: category to use +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output an informational message belonging to the given object in the given +category. + + +@cat: category to use +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output an debugging message belonging to the given object in the given category. + + +@cat: category to use +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output an logging message belonging to the given object in the given category. + + +@cat: category to use +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output an error message in the given category. + + +@cat: category to use +@...: printf-style message to output + + + + +Output a warning message in the given category. + + +@cat: category to use +@...: printf-style message to output + + + + +Output an informational message in the given category. + + +@cat: category to use +@...: printf-style message to output + + + + +Output a debuggign message in the given category. + + +@cat: category to use +@...: printf-style message to output + + + + +Output a logging message in the given category. + + +@cat: category to use +@...: printf-style message to output -Print out an error condition and abort the application. +Output an error message belonging to the given object in the default category. -@element: the #GstElement in question -@object: pointer to a 'contributing' object -@...: printf arguments +@obj: the #GObject the message belongs to +@...: printf-style message to output - + -The debug handler +Output a warning message belonging to the given object in the default category. -@category: -@core: -@file: -@function: -@line: -@debug_string: -@element: -@string: +@obj: the #GObject the message belongs to +@...: printf-style message to output - + + +Output an informational message belonging to the given object in the default +category. + + +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output a debugging message belonging to the given object in the default +category. + + +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output a logging message belonging to the given object in the default category. + + +@obj: the #GObject the message belongs to +@...: printf-style message to output + + + + +Output an error message in the default category. + + +@...: printf-style message to output + + + + +Output a warning message in the default category. + + +@...: printf-style message to output + + + + +Output an informational message in the default category. + + +@...: printf-style message to output + + + + +Output a debugging message in the default category. + + +@...: printf-style message to output + + + + +Output a logging message in the default category. + + +@...: printf-style message to output + + + -@category: -@incore: -@file: -@function: -@line: -@debug_string: -@element: -@string: +@ptr: - + -@file: -@function: -@line: -@debug_string: -@element: -@object: -@string: - - - - -The info handler - - -@category: -@incore: -@file: -@function: -@line: -@debug_string: -@element: -@string: - - - - -The error handler - - -@file: -@function: -@line: -@debug_string: -@element: -@object: -@string: - - +@ptr: diff --git a/docs/libs/Makefile.am b/docs/libs/Makefile.am index 05142bdab6..b0b44343e9 100644 --- a/docs/libs/Makefile.am +++ b/docs/libs/Makefile.am @@ -185,8 +185,10 @@ maintainer-clean-local: clean # make distcheck work distclean-local: clean rm -rf $(DOC_MODULE)-decl-list.txt - rm -rf $(DOC_MODULE)-*.txt - rm -rf tmpl/*.sgml + rm -rf $(DOC_MODULE)-decl.txt + rm -rf $(DOC_MODULE)-undocumented.txt + rm -rf $(DOC_MODULE)-unused.txt + rm -rf tmpl/*.sgml.bak rm -f $(DOC_MODULE).hierarchy rm -f *.stamp || true diff --git a/docs/libs/gstreamer-libs-docs.sgml b/docs/libs/gstreamer-libs-docs.sgml index 0cbe33979d..e400642777 100644 --- a/docs/libs/gstreamer-libs-docs.sgml +++ b/docs/libs/gstreamer-libs-docs.sgml @@ -1,10 +1,9 @@ - - - + + + ]> @@ -24,7 +23,6 @@ GStreamer provides some standard libraries you can use to create plugins. &GstGetbits; - &GstIDCT; &GstPutbits; &GstControl; diff --git a/docs/pwg/gst-plugin-writers-guide.xml b/docs/pwg/gst-plugin-writers-guide.xml index ad7b2e2069..66bcfef99d 100644 --- a/docs/pwg/gst-plugin-writers-guide.xml +++ b/docs/pwg/gst-plugin-writers-guide.xml @@ -10,6 +10,7 @@ + diff --git a/examples/autoplug/autoplug.c b/examples/autoplug/autoplug.c index c22507e8e1..dc9296d986 100644 --- a/examples/autoplug/autoplug.c +++ b/examples/autoplug/autoplug.c @@ -10,7 +10,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) GstElement *filesrc; GstElement *cache; - GST_DEBUG (0,"GstPipeline: play have type"); + GST_DEBUG ("GstPipeline: play have type"); gst_element_set_state (pipeline, GST_STATE_PAUSED); diff --git a/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c index 53364d0240..981576aed3 100644 --- a/examples/helloworld2/helloworld2.c +++ b/examples/helloworld2/helloworld2.c @@ -10,7 +10,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) GstElement *filesrc; GstElement *cache; - GST_DEBUG (0,"GstPipeline: play have type"); + GST_DEBUG ("GstPipeline: play have type"); gst_element_set_state (pipeline, GST_STATE_PAUSED); diff --git a/examples/mixer/mixer.c b/examples/mixer/mixer.c index 31358d8625..d21b197861 100644 --- a/examples/mixer/mixer.c +++ b/examples/mixer/mixer.c @@ -47,7 +47,7 @@ gst_play_type_find (GstBin *bin, GstElement *element) GstElement *pipeline; GstCaps *caps = NULL; - GST_DEBUG (0,"GstPipeline: typefind for element \"%s\"", + GST_DEBUG ("GstPipeline: typefind for element \"%s\"", GST_ELEMENT_NAME(element)); pipeline = gst_pipeline_new ("autoplug_pipeline"); @@ -116,9 +116,9 @@ int main(int argc,char *argv[]) main_bin = gst_pipeline_new("bin"); /* link adder and output to bin */ - GST_INFO (0, "main: adding adder to bin"); + GST_INFO ( "main: adding adder to bin"); gst_bin_add (GST_BIN(main_bin), adder); - GST_INFO (0, "main: adding audiosink to bin"); + GST_INFO ( "main: adding audiosink to bin"); gst_bin_add (GST_BIN(main_bin), audiosink); /* link adder and audiosink */ @@ -139,7 +139,7 @@ int main(int argc,char *argv[]) gst_bin_add (GST_BIN(main_bin), channel_in->pipe); /* request pads and link to adder */ - GST_INFO (0, "requesting pad\n"); + GST_INFO ( "requesting pad\n"); pad = gst_element_get_request_pad (adder, "sink%d"); printf ("\tGot new adder sink pad %s\n", gst_pad_get_name (pad)); sprintf (buffer, "channel%d", i); @@ -242,7 +242,7 @@ create_input_channel (int id, char* location) GstElement *new_element; GstElement *decoder; - GST_DEBUG (0, "c_i_p : creating channel with id %d for file %s", + GST_DEBUG ( "c_i_p : creating channel with id %d for file %s", id, location); /* allocate channel */ @@ -256,7 +256,7 @@ create_input_channel (int id, char* location) /* create channel */ - GST_DEBUG (0, "c_i_p : creating pipeline"); + GST_DEBUG ( "c_i_p : creating pipeline"); sprintf (buffer, "pipeline%d", id); channel->pipe = gst_bin_new (buffer); @@ -264,13 +264,13 @@ create_input_channel (int id, char* location) /* create elements */ - GST_DEBUG(0, "c_i_p : creating filesrc"); + GST_DEBUG ( "c_i_p : creating filesrc"); sprintf (buffer, "filesrc%d", id); channel->filesrc = gst_element_factory_make ("filesrc", buffer); g_assert(channel->filesrc != NULL); - GST_DEBUG(0, "c_i_p : setting location"); + GST_DEBUG ( "c_i_p : setting location"); g_object_set(G_OBJECT(channel->filesrc),"location", location, NULL); /* add filesrc to the bin before autoplug */ diff --git a/examples/plugins/example.c b/examples/plugins/example.c index 9d12f2d066..9609a4b45d 100644 --- a/examples/plugins/example.c +++ b/examples/plugins/example.c @@ -30,7 +30,7 @@ static GstElementDetails example_details = { "An example plugin", "Example/FirstExample", "Shows the basic structure of a plugin", - VERSION, + "0.1", "your name ", "(C) 2001", }; diff --git a/gst/Makefile.am b/gst/Makefile.am index 77a38aba81..c6afbb1f69 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -134,7 +134,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \ $(GST_LOADSAVE_SRC) -BUILT_SOURCES = gstmarshal.h gstmarshal.c gstenumtypes.h $(GST_ENUMTYPES_SRC) +BUILT_SOURCES = gstversion.h gstconfig.h gstmarshal.h gstmarshal.c gstenumtypes.h $(GST_ENUMTYPES_SRC) libgstreamer_@GST_MAJORMINOR@_la_CFLAGS = -D_GNU_SOURCE \ $(GST_CFLAGS) \ @@ -150,7 +150,6 @@ libgstreamer_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINO gst_headers = \ gst.h \ gstatomic.h \ - gstconfig.h \ gstobject.h \ gsttypes.h \ gstautoplug.h \ @@ -195,6 +194,7 @@ gst_headers = \ gstxml.h built_headers = \ + gstconfig.h \ gstversion.h \ gstmarshal.h \ gstenumtypes.h diff --git a/gst/autoplug/gstautoplugcache.c b/gst/autoplug/gstautoplugcache.c index 1c18dabf56..5a2080e8a6 100644 --- a/gst/autoplug/gstautoplugcache.c +++ b/gst/autoplug/gstautoplugcache.c @@ -19,8 +19,15 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include +GST_DEBUG_CATEGORY_STATIC(debug_category); +#define GST_CAT_DEFAULT debug_category + GstElementDetails gst_autoplugcache_details = { "AutoplugCache", "Generic", @@ -230,12 +237,12 @@ gst_autoplugcache_loop (GstElement *element) /* if we've been told to fire an empty signal (after a reset) */ if (cache->fire_empty) { int oldstate = GST_STATE(cache); - GST_DEBUG(0,"at front of cache, about to pull, but firing signal"); + GST_DEBUG ("at front of cache, about to pull, but firing signal"); gst_object_ref (GST_OBJECT (cache)); g_signal_emit (G_OBJECT(cache), gst_autoplugcache_signals[CACHE_EMPTY], 0, NULL); if (GST_STATE(cache) != oldstate) { gst_object_unref (GST_OBJECT (cache)); - GST_DEBUG(GST_CAT_AUTOPLUG, "state changed during signal, aborting"); + GST_DEBUG ("state changed during signal, aborting"); return; } gst_object_unref (GST_OBJECT (cache)); @@ -295,7 +302,7 @@ gst_autoplugcache_set_property (GObject *object, guint prop_id, const GValue *va switch (prop_id) { case ARG_CAPS_PROXY: cache->caps_proxy = g_value_get_boolean (value); -GST_DEBUG(0,"caps_proxy is %d",cache->caps_proxy); +GST_DEBUG ("caps_proxy is %d",cache->caps_proxy); if (cache->caps_proxy) { } else { } @@ -303,7 +310,7 @@ GST_DEBUG(0,"caps_proxy is %d",cache->caps_proxy); case ARG_RESET: /* no idea why anyone would set this to FALSE, but just in case ;-) */ if (g_value_get_boolean (value)) { - GST_DEBUG(0,"resetting playout pointer"); + GST_DEBUG ("resetting playout pointer"); /* reset the playout pointer to the begining again */ cache->current_playout = cache->cache_start; /* now we can fire a signal when the cache runs dry */ @@ -342,6 +349,8 @@ plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; + GST_DEBUG_CATEGORY_INIT (debug_category, "AUTOPLUGCACHE", 0, "autoplugcache element"); + factory = gst_element_factory_new ("autoplugcache", GST_TYPE_AUTOPLUGCACHE, &gst_autoplugcache_details); g_return_val_if_fail (factory != NULL, FALSE); @@ -357,4 +366,3 @@ GstPluginDesc plugin_desc = { "autoplugcache", plugin_init }; - diff --git a/gst/autoplug/gstautoplugger.c b/gst/autoplug/gstautoplugger.c index 08a6380896..7551dc30e9 100644 --- a/gst/autoplug/gstautoplugger.c +++ b/gst/autoplug/gstautoplugger.c @@ -19,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include GstElementDetails gst_autoplugger_details = { @@ -171,7 +175,7 @@ gst_autoplugger_init (GstAutoplugger *autoplugger) autoplugger->cache = gst_element_factory_make("autoplugcache", "unnamed_autoplugcache"); g_return_if_fail (autoplugger->cache != NULL); - GST_DEBUG(GST_CAT_AUTOPLUG, "turning on caps nego proxying in cache"); + GST_DEBUG ("turning on caps nego proxying in cache"); g_object_set(G_OBJECT(autoplugger->cache),"caps_proxy",TRUE,NULL); /* attach signals to the cache */ @@ -213,19 +217,19 @@ gst_autoplugger_external_sink_linked(GstPad *pad, GstPad *peerpad, GstAutoplugge GstPadTemplate *peertemplate; GstCaps *peercaps, *peertemplatecaps; - GST_INFO(GST_CAT_AUTOPLUG, "have cache:sink linked");*/ + GST_INFO ("have cache:sink linked");*/ /* autoplugger->sinkpadpeer = peerpad; */ /* if (autoplugger->sinkpadpeer) { peercaps = GST_PAD_CAPS(autoplugger->sinkpadpeer); if (peercaps) - GST_INFO(GST_CAT_AUTOPLUG, "there are some caps on this pad's peer: %s", + GST_INFO ("there are some caps on this pad's peer: %s", gst_caps_get_mime(peercaps)); peertemplate = GST_PAD_PAD_TEMPLATE(autoplugger->sinkpadpeer); if (peertemplate) { peertemplatecaps = GST_PAD_TEMPLATE_CAPS(peertemplate); if (peertemplatecaps) { - GST_INFO(GST_CAT_AUTOPLUG, "there are some caps on this pad's peer's padtemplate %s", + GST_INFO ("there are some caps on this pad's peer's padtemplate %s", gst_caps_get_mime(peertemplatecaps)); } } @@ -238,22 +242,22 @@ gst_autoplugger_external_src_linked(GstPad *pad, GstPad *peerpad, GstAutoplugger GstPadTemplate *peertemplate; GstCaps *peercaps, *peertemplatecaps; - GST_INFO(GST_CAT_AUTOPLUG, "have cache:src linked");*/ + GST_INFO ("have cache:src linked");*/ /* autoplugger->srcpadpeer = peerpad; */ /* if (autoplugger->srcpadpeer) { peercaps = GST_PAD_CAPS(autoplugger->srcpadpeer); if (peercaps) - GST_INFO(GST_CAT_AUTOPLUG, "there are some caps on this pad's peer: %s", + GST_INFO ("there are some caps on this pad's peer: %s", gst_caps_get_mime(peercaps)); peertemplate = GST_PAD_PAD_TEMPLATE(autoplugger->srcpadpeer); if (peertemplate) { peertemplatecaps = GST_PAD_TEMPLATE_CAPS(peertemplate); if (peertemplatecaps) { - GST_INFO(GST_CAT_AUTOPLUG, "there are some caps on this pad's peer's padtemplate %s", + GST_INFO ("there are some caps on this pad's peer's padtemplate %s", gst_caps_get_mime(peertemplatecaps)); autoplugger->sinktemplatecaps = peertemplatecaps;*/ -/* GST_DEBUG(GST_CAT_AUTOPLUG, "turning on caps nego proxying in cache"); */ +/* GST_DEBUG ("turning on caps nego proxying in cache"); */ /* gtk_object_set(G_OBJECT(autoplugger->cache),"caps_proxy",TRUE,NULL);*/ /* } } @@ -265,14 +269,14 @@ gst_autoplugger_external_src_linked(GstPad *pad, GstPad *peerpad, GstAutoplugger static void gst_autoplugger_external_sink_caps_changed(GstPad *pad, GstCaps *caps, GstAutoplugger *autoplugger) { - GST_INFO(GST_CAT_AUTOPLUG, "have cache:sink caps of %s\n",gst_caps_get_mime(caps)); + GST_INFO ("have cache:sink caps of %s\n",gst_caps_get_mime(caps)); autoplugger->sinkcaps = caps; } static void gst_autoplugger_external_src_caps_changed(GstPad *pad, GstCaps *caps, GstAutoplugger *autoplugger) { - GST_INFO(GST_CAT_AUTOPLUG, "have cache:src caps of %s\n",gst_caps_get_mime(caps)); + GST_INFO ("have cache:src caps of %s\n",gst_caps_get_mime(caps)); autoplugger->srccaps = caps; } */ @@ -284,20 +288,20 @@ gst_autoplugger_autoplug(GstAutoplugger *autoplugger,GstPad *srcpad,GstCaps *src GstPad *sinkpad; sinkpad = GST_PAD(GST_PAD_PEER(srcpad)); - GST_DEBUG(GST_CAT_AUTOPLUG,"unlinking %s:%s and %s:%s to autoplug between them", + GST_DEBUG ("unlinking %s:%s and %s:%s to autoplug between them", GST_DEBUG_PAD_NAME(srcpad),GST_DEBUG_PAD_NAME(sinkpad)); - GST_DEBUG(GST_CAT_AUTOPLUG,"srcpadcaps are of type %s",gst_caps_get_mime(srccaps)); - GST_DEBUG(GST_CAT_AUTOPLUG,"sinkpadcaps are of type %s",gst_caps_get_mime(sinkcaps)); + GST_DEBUG ("srcpadcaps are of type %s",gst_caps_get_mime(srccaps)); + GST_DEBUG ("sinkpadcaps are of type %s",gst_caps_get_mime(sinkcaps)); /* unlink the pads */ - GST_DEBUG(GST_CAT_AUTOPLUG, "unlinking the pads that will be joined by an autobin"); + GST_DEBUG ("unlinking the pads that will be joined by an autobin"); gst_pad_unlink(srcpad,sinkpad); if (!autoplugger->autoplug) { autoplugger->autoplug = gst_autoplug_factory_make("static"); g_return_val_if_fail(autoplugger->autoplug != NULL, FALSE); } - GST_DEBUG(GST_CAT_AUTOPLUG, "building autoplugged bin between caps"); + GST_DEBUG ("building autoplugged bin between caps"); autoplugger->autobin = gst_autoplug_to_caps(autoplugger->autoplug, srccaps,sinkcaps,NULL); g_return_val_if_fail(autoplugger->autobin != NULL, FALSE); @@ -306,20 +310,20 @@ gst_autoplugger_autoplug(GstAutoplugger *autoplugger,GstPad *srcpad,GstCaps *src gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); /* FIXME this is a hack */ -/* GST_DEBUG(GST_CAT_AUTOPLUG, "copying failed caps to srcpad %s:%s to ensure renego",GST_DEBUG_PAD_NAME(autoplugger->cache_srcpad)); */ +/* GST_DEBUG ("copying failed caps to srcpad %s:%s to ensure renego",GST_DEBUG_PAD_NAME(autoplugger->cache_srcpad)); */ /* gst_pad_set_caps(srcpad,srccaps); */ - if (GST_PAD_CAPS(srcpad) == NULL) GST_DEBUG(GST_CAT_AUTOPLUG,"no caps on cache:src!"); + if (GST_PAD_CAPS(srcpad) == NULL) GST_DEBUG ("no caps on cache:src!"); /* attach the autoplugged bin */ - GST_DEBUG(GST_CAT_AUTOPLUG, "attaching the autoplugged bin between the two pads"); + GST_DEBUG ("attaching the autoplugged bin between the two pads"); gst_pad_link(srcpad,gst_element_get_pad(autoplugger->autobin,"sink")); gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); gst_pad_link(gst_element_get_pad(autoplugger->autobin,"src_00"),sinkpad); gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); /* FIXME try to force the renego */ -/* GST_DEBUG(GST_CAT_AUTOPLUG, "trying to force everyone to nego"); */ +/* GST_DEBUG ("trying to force everyone to nego"); */ /* gst_pad_renegotiate(gst_element_get_pad(autoplugger->autobin,"sink")); */ /* gst_pad_renegotiate(sinkpad); */ @@ -335,7 +339,7 @@ gst_autoplugger_external_sink_caps_nego_failed(GstPad *pad, gboolean *result, Gs GstPad *sinkpad_peer; GstCaps *sinkpad_peer_caps; - GST_INFO(GST_CAT_AUTOPLUG, "have caps nego failure on sinkpad %s:%s!!!",GST_DEBUG_PAD_NAME(pad)); + GST_INFO ("have caps nego failure on sinkpad %s:%s!!!",GST_DEBUG_PAD_NAME(pad)); autoplugger->paused++; if (autoplugger->paused == 1) @@ -362,7 +366,7 @@ gst_autoplugger_external_sink_caps_nego_failed(GstPad *pad, gboolean *result, Gs /* try to PLAY the whole thing */ gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PLAYING); - GST_INFO(GST_CAT_AUTOPLUG, "done dealing with caps nego failure on sinkpad %s:%s",GST_DEBUG_PAD_NAME(pad)); + GST_INFO ("done dealing with caps nego failure on sinkpad %s:%s",GST_DEBUG_PAD_NAME(pad)); } static void @@ -373,7 +377,7 @@ gst_autoplugger_external_src_caps_nego_failed(GstPad *pad, gboolean *result, Gst GstPadTemplate *srcpad_peer_template; GstCaps *srcpad_peer_caps; - GST_INFO(GST_CAT_AUTOPLUG, "have caps nego failure on srcpad %s:%s!!!",GST_DEBUG_PAD_NAME(pad)); + GST_INFO ("have caps nego failure on srcpad %s:%s!!!",GST_DEBUG_PAD_NAME(pad)); autoplugger->paused++; if (autoplugger->paused == 1) @@ -399,7 +403,7 @@ gst_autoplugger_external_src_caps_nego_failed(GstPad *pad, gboolean *result, Gst autoplugger->disable_nocaps = TRUE; - GST_INFO(GST_CAT_AUTOPLUG, "done dealing with caps nego failure on srcpad %s:%s",GST_DEBUG_PAD_NAME(pad)); + GST_INFO ("done dealing with caps nego failure on srcpad %s:%s",GST_DEBUG_PAD_NAME(pad)); } @@ -408,7 +412,7 @@ gst_autoplugger_cache_empty(GstElement *element, GstAutoplugger *autoplugger) { GstPad *cache_sinkpad_peer,*cache_srcpad_peer; - GST_INFO(GST_CAT_AUTOPLUG, "autoplugger cache has hit empty, we can now remove it"); + GST_INFO ("autoplugger cache has hit empty, we can now remove it"); autoplugger->paused++; if (autoplugger->paused == 1) @@ -416,18 +420,18 @@ gst_autoplugger_cache_empty(GstElement *element, GstAutoplugger *autoplugger) gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PAUSED); /* unlink the cache from its peers */ - GST_DEBUG(GST_CAT_AUTOPLUG, "unlinking autoplugcache from its peers"); + GST_DEBUG ("unlinking autoplugcache from its peers"); cache_sinkpad_peer = GST_PAD (GST_PAD_PEER(autoplugger->cache_sinkpad)); cache_srcpad_peer = GST_PAD (GST_PAD_PEER(autoplugger->cache_srcpad)); gst_pad_unlink(cache_sinkpad_peer,autoplugger->cache_sinkpad); gst_pad_unlink(autoplugger->cache_srcpad,cache_srcpad_peer); /* remove the cache from self */ - GST_DEBUG(GST_CAT_AUTOPLUG, "removing the cache from the autoplugger"); + GST_DEBUG ("removing the cache from the autoplugger"); gst_bin_remove (GST_BIN(autoplugger), autoplugger->cache); /* link the two pads */ - GST_DEBUG(GST_CAT_AUTOPLUG, "relinking the autoplugcache's former peers"); + GST_DEBUG ("relinking the autoplugcache's former peers"); gst_pad_link(cache_sinkpad_peer,cache_srcpad_peer); autoplugger->paused--; @@ -437,13 +441,13 @@ gst_autoplugger_cache_empty(GstElement *element, GstAutoplugger *autoplugger) /* xmlSaveFile("autoplugger.gst", gst_xml_write(GST_ELEMENT_SCHED(autoplugger)->parent)); */ - GST_INFO(GST_CAT_AUTOPLUG, "autoplugger_cache_empty finished"); + GST_INFO ("autoplugger_cache_empty finished"); } static void gst_autoplugger_type_find_have_type(GstElement *element, GstCaps *caps, GstAutoplugger *autoplugger) { - GST_INFO(GST_CAT_AUTOPLUG, "typefind claims to have a type: %s",gst_caps_get_mime(caps)); + GST_INFO ("typefind claims to have a type: %s",gst_caps_get_mime(caps)); gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); @@ -453,7 +457,7 @@ gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PAUSED); /* first unlink the typefind and shut it down */ - GST_DEBUG(GST_CAT_AUTOPLUG, "unlinking typefind from the cache"); + GST_DEBUG ("unlinking typefind from the cache"); gst_pad_unlink(autoplugger->cache_srcpad,autoplugger->typefind_sinkpad); gst_bin_remove(GST_BIN(autoplugger),autoplugger->typefind); @@ -470,25 +474,25 @@ gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); gst_bin_add(GST_BIN(autoplugger),autoplugger->autobin); * * re-attach the srcpad's original peer to the cache * -* GST_DEBUG(GST_CAT_AUTOPLUG, "relinking the cache to the downstream peer"); * +* GST_DEBUG ("relinking the cache to the downstream peer"); * * gst_pad_link(autoplugger->cache_srcpad,autoplugger->srcpadpeer); * * attach the autoplugged bin * - GST_DEBUG(GST_CAT_AUTOPLUG, "attaching the autoplugged bin between cache and downstream peer"); + GST_DEBUG ("attaching the autoplugged bin between cache and downstream peer"); gst_pad_link(autoplugger->cache_srcpad,gst_element_get_pad(autoplugger->autobin,"sink")); gst_pad_link(gst_element_get_pad(autoplugger->autobin,"src_00"),autoplugger->srcpadpeer); */ /* FIXME set the caps on the new link - * GST_DEBUG(GST_CAT_AUTOPLUG,"forcing caps on the typefound pad"); + * GST_DEBUG ("forcing caps on the typefound pad"); * gst_pad_set_caps(autoplugger->cache_srcpad,caps); * reattach the original outside srcpad */ - GST_DEBUG(GST_CAT_AUTOPLUG,"re-attaching downstream peer to autoplugcache"); + GST_DEBUG ("re-attaching downstream peer to autoplugcache"); gst_pad_link(autoplugger->cache_srcpad,autoplugger->srcpadpeer); /* now reset the autoplugcache */ - GST_DEBUG(GST_CAT_AUTOPLUG, "resetting the cache to send first buffer(s) again"); + GST_DEBUG ("resetting the cache to send first buffer(s) again"); g_object_set(G_OBJECT(autoplugger->cache),"reset",TRUE,NULL); /* attach the cache_empty handler */ @@ -501,22 +505,22 @@ gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); /* try to PLAY the whole thing */ gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PLAYING); - GST_INFO(GST_CAT_AUTOPLUG, "typefind_have_type finished"); + GST_INFO ("typefind_have_type finished"); gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); } static void gst_autoplugger_cache_first_buffer(GstElement *element,GstBuffer *buf,GstAutoplugger *autoplugger) { - GST_INFO(GST_CAT_AUTOPLUG, "have first buffer through cache"); + GST_INFO ("have first buffer through cache"); autoplugger->cache_first_buffer = TRUE; /* if there are no established caps, worry */ if (!autoplugger->sinkcaps) { - GST_INFO(GST_CAT_AUTOPLUG, "have no caps for the buffer, Danger Will Robinson!"); + GST_INFO ("have no caps for the buffer, Danger Will Robinson!"); if (autoplugger->disable_nocaps) { - GST_DEBUG(GST_CAT_AUTOPLUG, "not dealing with lack of caps this time"); + GST_DEBUG ("not dealing with lack of caps this time"); return; } @@ -528,25 +532,25 @@ gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PAUSED); /* detach the srcpad */ - GST_DEBUG(GST_CAT_AUTOPLUG, "unlinking cache from its downstream peer"); + GST_DEBUG ("unlinking cache from its downstream peer"); autoplugger->srcpadpeer = GST_PAD(GST_PAD_PEER(autoplugger->cache_srcpad)); gst_pad_unlink(autoplugger->cache_srcpad,autoplugger->srcpadpeer); /* instantiate the typefind and set up the signal handlers */ if (!autoplugger->typefind) { - GST_DEBUG(GST_CAT_AUTOPLUG, "creating typefind and setting signal handler"); + GST_DEBUG ("creating typefind and setting signal handler"); autoplugger->typefind = gst_element_factory_make("typefind","unnamed_type_find"); autoplugger->typefind_sinkpad = gst_element_get_pad(autoplugger->typefind,"sink"); g_signal_connect (G_OBJECT(autoplugger->typefind),"have_type", G_CALLBACK (gst_autoplugger_type_find_have_type), autoplugger); } /* add it to self and attach it */ - GST_DEBUG(GST_CAT_AUTOPLUG, "adding typefind to self and linking to cache"); + GST_DEBUG ("adding typefind to self and linking to cache"); gst_bin_add(GST_BIN(autoplugger),autoplugger->typefind); gst_pad_link(autoplugger->cache_srcpad,autoplugger->typefind_sinkpad); /* bring the typefind into playing state */ - GST_DEBUG(GST_CAT_AUTOPLUG, "setting typefind state to PLAYING"); + GST_DEBUG ("setting typefind state to PLAYING"); gst_element_set_state(autoplugger->cache,GST_STATE_PLAYING); autoplugger->paused--; @@ -554,7 +558,7 @@ gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); /* try to PLAY the whole thing */ gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PLAYING); - GST_INFO(GST_CAT_AUTOPLUG,"here we go into nothingness, hoping the typefind will return us to safety"); + GST_INFO ("here we go into nothingness, hoping the typefind will return us to safety"); gst_scheduler_show(GST_ELEMENT_SCHED(autoplugger)); } else { /* * attach the cache_empty handler, since the cache simply isn't needed * diff --git a/gst/autoplug/gstsearchfuncs.c b/gst/autoplug/gstsearchfuncs.c index dc8bb61fee..4378d2826c 100644 --- a/gst/autoplug/gstsearchfuncs.c +++ b/gst/autoplug/gstsearchfuncs.c @@ -20,13 +20,23 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ - + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gstsearchfuncs.h" +/* FIXME: "evil hack" alarm, we need a better way to get a category in here */ +#ifndef GST_DISABLE_GST_DEBUG +extern GstDebugCategory *GST_CAT_AUTOPLUG_ATTEMPT; +#define GST_CAT_DEFAULT GST_CAT_AUTOPLUG_ATTEMPT +#endif + /* function that really misses in GLib * though the GLib version should take a function as argument... */ -void +static void g_list_free_list_and_elements (GList *list) { GList *walk = list; @@ -145,8 +155,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest) desttemp->direction == GST_PAD_SINK) { if (gst_autoplug_caps_intersect (gst_pad_template_get_caps (srctemp), gst_pad_template_get_caps (desttemp))) { - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "factory \"%s\" can connect with factory \"%s\"", + GST_DEBUG ("factory \"%s\" can connect with factory \"%s\"", GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest)); return desttemp; } @@ -156,8 +165,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest) } srctemps = g_list_next (srctemps); } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "factory \"%s\" cannot connect with factory \"%s\"", + GST_DEBUG ("factory \"%s\" cannot connect with factory \"%s\"", GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest)); return NULL; } @@ -331,8 +339,7 @@ gst_autoplug_sp (GstCaps *srccaps, GstCaps *sinkcaps, GList *factories) g_return_val_if_fail (srccaps != NULL, NULL); g_return_val_if_fail (sinkcaps != NULL, NULL); - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT, - "attempting to autoplug via shortest path from %s to %s", + GST_INFO ("attempting to autoplug via shortest path from %s to %s", gst_caps_get_mime (srccaps), gst_caps_get_mime (sinkcaps)); gst_caps_debug (srccaps, "source caps"); gst_caps_debug (sinkcaps, "sink caps"); @@ -343,18 +350,16 @@ gst_autoplug_sp (GstCaps *srccaps, GstCaps *sinkcaps, GList *factories) GstAutoplugNode *node = g_new0 (GstAutoplugNode, 1); node->prev = NULL; node->fac = (GstElementFactory *) factories->data; - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "trying with %s", node->fac->details->longname); + GST_DEBUG ("trying with %s", node->fac->details->longname); node->templ = gst_autoplug_can_connect_src (node->fac, srccaps); node->cost = (node->templ ? gst_autoplug_get_cost (node->fac) : GST_AUTOPLUG_MAX_COST); node->endpoint = gst_autoplug_can_connect_sink (node->fac, sinkcaps); if (node->templ && node->endpoint) - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "%s makes connection possible", + GST_DEBUG ("%s makes connection possible", node->fac->details->longname); else - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "direct connection with %s not possible", + GST_DEBUG ("direct connection with %s not possible", node->fac->details->longname); if ((node->endpoint != NULL) && ((bestnode == NULL) || (node->cost < bestnode->cost))) @@ -370,8 +375,7 @@ gst_autoplug_sp (GstCaps *srccaps, GstCaps *sinkcaps, GList *factories) /* check if we even have possible endpoints */ if (bestnode == NULL) { - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "no factory found that could connect to sink caps"); + GST_DEBUG ("no factory found that could connect to sink caps"); g_list_free_list_and_elements (factory_nodes); return NULL; } @@ -381,12 +385,12 @@ gst_autoplug_sp (GstCaps *srccaps, GstCaps *sinkcaps, GList *factories) { GList *nodes = factory_nodes; guint nextcost = GST_AUTOPLUG_MAX_COST; /* next cost to check */ - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "iterating at current cost %d, bestnode %s at %d", curcost, GST_OBJECT_NAME (bestnode->fac), bestnode->cost); + GST_DEBUG ("iterating at current cost %d, bestnode %s at %d", curcost, GST_OBJECT_NAME (bestnode->fac), bestnode->cost); /* check if we already have a valid best connection to the sink */ if (bestnode->cost <= curcost) { GList *ret; - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "found a way to connect via %s", GST_OBJECT_NAME ((GstObject *) bestnode->fac)); + GST_DEBUG ("found a way to connect via %s", GST_OBJECT_NAME ((GstObject *) bestnode->fac)); /* enter all factories into the return list */ ret = g_list_prepend (NULL, bestnode->fac); bestnode = bestnode->prev; @@ -440,12 +444,7 @@ gst_autoplug_sp (GstCaps *srccaps, GstCaps *sinkcaps, GList *factories) curcost = nextcost; } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "found no path from source caps to sink caps"); + GST_DEBUG ("found no path from source caps to sink caps"); g_list_free_list_and_elements (factory_nodes); return NULL; } - - - - - diff --git a/gst/autoplug/gstspider.c b/gst/autoplug/gstspider.c index 6a273afa6f..2db44ba11c 100644 --- a/gst/autoplug/gstspider.c +++ b/gst/autoplug/gstspider.c @@ -40,11 +40,18 @@ * - fix bugs * ... */ - + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gstspider.h" #include "gstspideridentity.h" #include "gstsearchfuncs.h" - + +GST_DEBUG_CATEGORY (gst_spider_debug); +#define GST_CAT_DEFAULT gst_spider_debug + /* signals and args */ enum { /* FILL ME */ @@ -202,7 +209,7 @@ gst_spider_request_new_pad (GstElement *element, GstPadTemplate *templ, const gc returnpad = gst_element_add_ghost_pad (element, returnpad, padname); gst_spider_link_new (identity); - GST_DEBUG (GST_CAT_ELEMENT_PADS, "successuflly created requested pad %s:%s", GST_DEBUG_PAD_NAME (returnpad)); + GST_DEBUG ("successuflly created requested pad %s:%s", GST_DEBUG_PAD_NAME (returnpad)); return returnpad; } @@ -270,11 +277,11 @@ static void gst_spider_link_sometimes (GstElement *src, GstPad *pad, GstSpiderConnection *conn) { gulong signal_id = conn->signal_id; - GstPad *sinkpad = conn->src->sink; /* try to autoplug the elements */ if (gst_spider_plug_from_srcpad (conn, pad) != GST_PAD_LINK_REFUSED) { - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "%s:%s was autoplugged to %s:%s, removing callback", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (sinkpad)); + GST_DEBUG ("%s:%s was autoplugged to %s:%s, removing callback", + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (conn->src->sink)); g_signal_handler_disconnect (src, signal_id); signal_id = 0; } @@ -305,7 +312,7 @@ static void gst_spider_link_reset (GstSpiderConnection *conn, GstElement *to) { GstSpider *spider = GST_SPIDER (GST_OBJECT_PARENT (conn->src)); - GST_DEBUG (GST_CAT_AUTOPLUG, "resetting link from %s to %s, currently at %s to %s", GST_ELEMENT_NAME (spider->sink_ident), + GST_DEBUG ("resetting link from %s to %s, currently at %s to %s", GST_ELEMENT_NAME (spider->sink_ident), GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (to)); while ((conn->path != NULL) && ((GstElement *) conn->path->data != to)) { @@ -487,7 +494,7 @@ gst_spider_create_and_plug (GstSpiderConnection *conn, GList *plugpath) element = (GstElement *) (endelements == NULL ? conn->src : endelements->data); } else { element = gst_element_factory_create ((GstElementFactory *) plugpath->data, NULL); - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "Adding element %s of type %s and syncing state with autoplugger", + GST_DEBUG ("Adding element %s of type %s and syncing state with autoplugger", GST_ELEMENT_NAME (element), GST_PLUGIN_FEATURE_NAME (plugpath->data)); gst_bin_add (GST_BIN (spider), element); } @@ -506,7 +513,7 @@ gst_spider_create_and_plug (GstSpiderConnection *conn, GList *plugpath) GstPadTemplate *templ = (GstPadTemplate *) templs->data; if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) && (GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES)) { - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "adding callback to link element %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src)); + GST_DEBUG ("adding callback to link element %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src)); conn->signal_id = g_signal_connect (G_OBJECT (conn->current), "new_pad", G_CALLBACK (gst_spider_link_sometimes), conn); g_list_free (plugpath); @@ -514,11 +521,11 @@ gst_spider_create_and_plug (GstSpiderConnection *conn, GList *plugpath) } templs = g_list_next (templs); } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "no chance to link element %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src)); + GST_DEBUG ("no chance to link element %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src)); g_list_free (plugpath); return GST_PAD_LINK_REFUSED; } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "added element %s and attached it to element %s", GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (conn->current)); + GST_DEBUG ("added element %s and attached it to element %s", GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (conn->current)); gst_spider_link_add (conn, element); if (plugpath != NULL) plugpath = g_list_delete_link (plugpath, plugpath); @@ -579,7 +586,7 @@ gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad) GstElement *startelement = conn->current; g_assert ((GstElement *) GST_OBJECT_PARENT (srcpad) == conn->current); - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "trying to plug from %s:%s to %s", + GST_DEBUG ("trying to plug from %s:%s to %s", GST_DEBUG_PAD_NAME (srcpad), GST_ELEMENT_NAME (conn->src)); /* find a path from src to sink */ @@ -596,10 +603,10 @@ gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad) /* if there is no way to plug: return */ if (plugpath == NULL) { - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "no chance to plug from %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src)); + GST_DEBUG ("no chance to plug from %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src)); return GST_PAD_LINK_REFUSED; } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "found a link that needs %d elements", g_list_length (plugpath)); + GST_DEBUG ("found a link that needs %d elements", g_list_length (plugpath)); /* now remove non-needed elements from the beginning of the path * alter src to point to the new element where we need to start @@ -612,7 +619,7 @@ gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad) plugpath = g_list_delete_link (plugpath, plugpath); } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "%d elements must be inserted to establish the link", g_list_length (plugpath)); + GST_DEBUG ("%d elements must be inserted to establish the link", g_list_length (plugpath)); /* create the elements and plug them */ result = gst_spider_create_and_plug (conn, plugpath); @@ -640,6 +647,9 @@ plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; + GST_DEBUG_CATEGORY_INIT (gst_spider_debug, "spider", 0, "spider autoplugging element"); + GST_DEBUG_CATEGORY_INIT (gst_spider_identity_debug, "spideridentity", 0, "spider autoplugging proxy element"); + factory = gst_element_factory_new("spider", GST_TYPE_SPIDER, &gst_spider_details); gst_plugin_set_longname (plugin, "Spider autoplugging elements"); diff --git a/gst/autoplug/gstspider.h b/gst/autoplug/gstspider.h index 0e1bfa288f..0958ddcad7 100644 --- a/gst/autoplug/gstspider.h +++ b/gst/autoplug/gstspider.h @@ -29,6 +29,7 @@ G_BEGIN_DECLS extern GstElementDetails gst_spider_details; +GST_DEBUG_CATEGORY_EXTERN(gst_spider_debug); /* * Theory of operation: diff --git a/gst/autoplug/gstspideridentity.c b/gst/autoplug/gstspideridentity.c index 6b07b2e431..6b3de77e86 100644 --- a/gst/autoplug/gstspideridentity.c +++ b/gst/autoplug/gstspideridentity.c @@ -20,11 +20,16 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "gstspideridentity.h" - #include "gstspider.h" +GST_DEBUG_CATEGORY (gst_spider_identity_debug); +#define GST_CAT_DEFAULT gst_spider_identity_debug + GstElementDetails gst_spider_identity_details = { "SpiderIdentity", "Generic", @@ -179,7 +184,7 @@ gst_spider_identity_chain (GstPad *pad, GstBuffer *buf) GstSpiderConnection *conn = (GstSpiderConnection *) list->data; list = g_list_next (list); if (conn->current != (GstElement *) conn->src) { - GST_DEBUG (GST_CAT_AUTOPLUG, "sending EOS to unconnected element %s from %s", + GST_DEBUG ("sending EOS to unconnected element %s from %s", GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (ident)); gst_pad_push (conn->src->src, GST_BUFFER (gst_event_new (GST_EVENT_EOS))); gst_element_set_eos (GST_ELEMENT (conn->src)); @@ -194,7 +199,7 @@ gst_spider_identity_chain (GstPad *pad, GstBuffer *buf) if ((ident->src != NULL) && (GST_PAD_PEER (ident->src) != NULL)) { /* g_print("pushing buffer %p (refcount %d - buffersize %d) to pad %s:%s\n", buf, GST_BUFFER_REFCOUNT (buf), GST_BUFFER_SIZE (buf), GST_DEBUG_PAD_NAME (ident->src)); */ - GST_DEBUG (0, "push %p %" G_GINT64_FORMAT, buf, GST_BUFFER_OFFSET (buf)); + GST_LOG ( "push %p %" G_GINT64_FORMAT, buf, GST_BUFFER_OFFSET (buf)); gst_pad_push (ident->src, buf); } else if (GST_IS_BUFFER (buf)) { gst_buffer_unref (buf); @@ -272,7 +277,7 @@ gst_spider_identity_request_new_pad (GstElement *element, GstPadTemplate *templ case GST_PAD_SINK: if (ident->sink != NULL) break; /* sink */ - GST_DEBUG(0, "element %s requests new sink pad", GST_ELEMENT_NAME(ident)); + GST_DEBUG ( "element %s requests new sink pad", GST_ELEMENT_NAME(ident)); ident->sink = gst_pad_new ("sink", GST_PAD_SINK); gst_element_add_pad (GST_ELEMENT (ident), ident->sink); gst_pad_set_link_function (ident->sink, GST_DEBUG_FUNCPTR (gst_spider_identity_link)); @@ -282,7 +287,7 @@ gst_spider_identity_request_new_pad (GstElement *element, GstPadTemplate *templ case GST_PAD_SRC: /* src */ if (ident->src != NULL) break; - GST_DEBUG(0, "element %s requests new src pad", GST_ELEMENT_NAME(ident)); + GST_DEBUG ( "element %s requests new src pad", GST_ELEMENT_NAME(ident)); ident->src = gst_pad_new ("src", GST_PAD_SRC); gst_element_add_pad (GST_ELEMENT (ident), ident->src); gst_pad_set_link_function (ident->src, GST_DEBUG_FUNCPTR (gst_spider_identity_link)); @@ -293,7 +298,7 @@ gst_spider_identity_request_new_pad (GstElement *element, GstPadTemplate *templ break; } - GST_DEBUG(0, "element %s requested a new pad but none could be created", GST_ELEMENT_NAME(ident)); + GST_DEBUG ( "element %s requested a new pad but none could be created", GST_ELEMENT_NAME(ident)); return NULL; } @@ -354,7 +359,7 @@ gst_spider_identity_start_type_finding (GstSpiderIdentity *ident) gchar *name;*/ gboolean restart = FALSE; - GST_DEBUG (GST_CAT_AUTOPLUG, "element %s starts typefinding", GST_ELEMENT_NAME(ident)); + GST_DEBUG ("element %s starts typefinding", GST_ELEMENT_NAME(ident)); if (GST_STATE (GST_ELEMENT_PARENT (ident)) == GST_STATE_PLAYING) { gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT (ident)), GST_STATE_PAUSED); @@ -481,9 +486,9 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident) GstTypeFactory *factory = GST_TYPE_FACTORY (factories->data); GstTypeFindFunc typefindfunc = (GstTypeFindFunc)factory->typefindfunc; - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, "trying typefind function %s", GST_PLUGIN_FEATURE_NAME (factory)); + GST_DEBUG ("trying typefind function %s", GST_PLUGIN_FEATURE_NAME (factory)); if (typefindfunc && (caps = typefindfunc (buf, factory))) { - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT, "typefind function %s found caps", GST_PLUGIN_FEATURE_NAME (factory)); + GST_INFO ("typefind function %s found caps", GST_PLUGIN_FEATURE_NAME (factory)); if (gst_pad_try_set_caps (ident->src, caps) <= 0) { g_warning ("typefind: found type but peer didn't accept it"); gst_caps_sink (caps); @@ -526,7 +531,7 @@ gst_spider_identity_handle_src_event (GstPad *pad, GstEvent *event) gboolean res = TRUE; GstSpiderIdentity *ident; - GST_DEBUG (0, "spider_identity src_event"); + GST_DEBUG ( "spider_identity src_event"); ident = GST_SPIDER_IDENTITY (gst_pad_get_parent (pad)); diff --git a/gst/autoplug/gstspideridentity.h b/gst/autoplug/gstspideridentity.h index bcc9bc8598..5d1dbecc1b 100644 --- a/gst/autoplug/gstspideridentity.h +++ b/gst/autoplug/gstspideridentity.h @@ -24,14 +24,12 @@ #ifndef __GST_SPIDER_IDENTITY_H__ #define __GST_SPIDER_IDENTITY_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_spider_identity_details; - +extern GstElementDetails gst_spider_identity_details; +GST_DEBUG_CATEGORY_EXTERN(gst_spider_identity_debug); #define GST_TYPE_SPIDER_IDENTITY \ (gst_spider_identity_get_type()) diff --git a/gst/autoplug/gststaticautoplug.c b/gst/autoplug/gststaticautoplug.c index 49ccc97295..bde915dc84 100644 --- a/gst/autoplug/gststaticautoplug.c +++ b/gst/autoplug/gststaticautoplug.c @@ -26,6 +26,9 @@ #define GST_AUTOPLUG_MAX_COST 999999 +GST_DEBUG_CATEGORY_STATIC(debug_category); +#define GST_CAT_DEFAULT debug_category + typedef guint (*GstAutoplugCostFunction) (gpointer src, gpointer dest, gpointer data); typedef const GList* (*GstAutoplugListFunction) (gpointer data); @@ -86,6 +89,8 @@ plugin_init (GModule *module, GstPlugin *plugin) { GstAutoplugFactory *factory; + GST_DEBUG_CATEGORY_INIT (debug_category, "STATIC_AUTOPLUG", 0, "static autoplugger element"); + gst_plugin_set_longname (plugin, "A static autoplugger"); factory = gst_autoplug_factory_new ("static", @@ -124,9 +129,8 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest) desttemp->direction == GST_PAD_SINK) { if (gst_caps_is_always_compatible (gst_pad_template_get_caps (srctemp), gst_pad_template_get_caps (desttemp))) { - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "factory \"%s\" can link with factory \"%s\"\n", GST_OBJECT_NAME (src), - GST_OBJECT_NAME (dest)); + GST_DEBUG ("factory \"%s\" can link with factory \"%s\"\n", GST_OBJECT_NAME (src), + GST_OBJECT_NAME (dest)); return TRUE; } } @@ -135,9 +139,8 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest) } srctemps = g_list_next (srctemps); } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "factory \"%s\" cannot link with factory \"%s\"\n", GST_OBJECT_NAME (src), - GST_OBJECT_NAME (dest)); + GST_DEBUG ("factory \"%s\" cannot link with factory \"%s\"\n", GST_OBJECT_NAME (src), + GST_OBJECT_NAME (dest)); return FALSE; } @@ -147,8 +150,8 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink) const GList *sinkpads; gboolean linked = FALSE; - GST_DEBUG (0,"gstpipeline: autoplug pad link function for \"%s\" to \"%s\"", - GST_ELEMENT_NAME(src), GST_ELEMENT_NAME(sink)); + GST_DEBUG ("gstpipeline: autoplug pad link function for \"%s\" to \"%s\"", + GST_ELEMENT_NAME(src), GST_ELEMENT_NAME(sink)); sinkpads = gst_element_get_pad_list(sink); while (sinkpads) { @@ -160,22 +163,22 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink) { if (gst_caps_is_always_compatible (gst_pad_get_caps(pad), gst_pad_get_caps(sinkpad))) { gst_pad_link(pad, sinkpad); - GST_DEBUG (0,"gstpipeline: autolink pad \"%s\" in element %s <-> ", GST_PAD_NAME (pad), + GST_DEBUG ("gstpipeline: autolink pad \"%s\" in element %s <-> ", GST_PAD_NAME (pad), GST_ELEMENT_NAME(src)); - GST_DEBUG (0,"pad \"%s\" in element %s", GST_PAD_NAME (sinkpad), + GST_DEBUG ("pad \"%s\" in element %s", GST_PAD_NAME (sinkpad), GST_ELEMENT_NAME(sink)); linked = TRUE; break; } else { - GST_DEBUG (0,"pads incompatible %s, %s", GST_PAD_NAME (pad), GST_PAD_NAME (sinkpad)); + GST_DEBUG ("pads incompatible %s, %s", GST_PAD_NAME (pad), GST_PAD_NAME (sinkpad)); } } sinkpads = g_list_next(sinkpads); } if (!linked) { - GST_DEBUG (0,"gstpipeline: no path to sinks for type"); + GST_DEBUG ("gstpipeline: no path to sinks for type"); } return linked; } @@ -192,8 +195,8 @@ autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data) dynamic_pad_struct *info = (dynamic_pad_struct *)data; const GList *pads = gst_element_get_pad_list (element); - GST_DEBUG (0,"attempting to dynamically create a ghostpad for %s=%s", GST_ELEMENT_NAME (element), - GST_PAD_NAME (pad)); + GST_DEBUG ("attempting to dynamically create a ghostpad for %s=%s", GST_ELEMENT_NAME (element), + GST_PAD_NAME (pad)); while (pads) { GstPad *pad = GST_PAD (pads->data); @@ -207,7 +210,7 @@ autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data) gst_element_add_ghost_pad (info->result, pad, name); g_free (name); - GST_DEBUG (0,"gstpipeline: new dynamic pad %s", GST_PAD_NAME (pad)); + GST_DEBUG ("gstpipeline: new dynamic pad %s", GST_PAD_NAME (pad)); break; } } @@ -231,7 +234,7 @@ gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink) } if (!linked) { - GST_DEBUG (0,"gstpipeline: delaying pad links for \"%s\" to \"%s\"", + GST_DEBUG ("gstpipeline: delaying pad links for \"%s\" to \"%s\"", GST_ELEMENT_NAME(src), GST_ELEMENT_NAME(sink)); g_signal_connect (G_OBJECT(src), "new_pad", G_CALLBACK (gst_autoplug_pads_autoplug_func), sink); @@ -302,7 +305,7 @@ gst_static_autoplug_to_caps (GstAutoplug *autoplug, GstCaps *srccaps, GstCaps *s caps.sink = capslist; - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"autoplugging two caps structures"); + GST_INFO ("autoplugging two caps structures"); elements = gst_autoplug_func (caps.src, caps.sink, gst_autoplug_element_factory_get_list, @@ -371,7 +374,7 @@ gst_static_autoplug_to_caps (GstAutoplug *autoplug, GstCaps *srccaps, GstCaps *s } } - GST_DEBUG (0,"common factory \"%s\"", GST_OBJECT_NAME (factory)); + GST_DEBUG ("common factory \"%s\"", GST_OBJECT_NAME (factory)); /* it is likely that the plugin is not loaded yet. thus when it loads it * will replace the elementfactory that gst built from the cache, and the @@ -433,10 +436,10 @@ differ: factory = (GstElementFactory *)(factories[i]->data); - GST_DEBUG (0,"factory \"%s\"", GST_OBJECT_NAME (factory)); + GST_DEBUG ("factory \"%s\"", GST_OBJECT_NAME (factory)); element = gst_element_factory_create(factory, GST_OBJECT_NAME (factory)); - GST_DEBUG (0,"adding element %s", GST_ELEMENT_NAME (element)); + GST_DEBUG ("adding element %s", GST_ELEMENT_NAME (element)); gst_bin_add(GST_BIN(thebin), element); gst_autoplug_signal_new_object (GST_AUTOPLUG (autoplug), GST_OBJECT (element)); @@ -457,7 +460,7 @@ differ: gboolean have_pad = FALSE; endcaps = g_list_next (endcaps); - GST_DEBUG (0,"attempting to create a ghostpad for %s", GST_ELEMENT_NAME (thesrcelement)); + GST_DEBUG ("attempting to create a ghostpad for %s", GST_ELEMENT_NAME (thesrcelement)); while (pads) { GstPad *pad = GST_PAD (pads->data); @@ -482,7 +485,7 @@ differ: data->endcap = endcap; data->i = i; - GST_DEBUG (0,"delaying the creation of a ghostpad for %s", GST_ELEMENT_NAME (thesrcelement)); + GST_DEBUG ("delaying the creation of a ghostpad for %s", GST_ELEMENT_NAME (thesrcelement)); g_signal_connect (G_OBJECT (thesrcelement), "new_pad", G_CALLBACK (autoplug_dynamic_pad), data); } @@ -525,7 +528,7 @@ construct_path (gst_autoplug_node *rgnNodes, gpointer factory) current = rgnNodes[find_factory(rgnNodes, factory)].iPrev; - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factories found in autoplugging (reversed order)"); + GST_INFO ("factories found in autoplugging (reversed order)"); while (current != NULL) { @@ -534,7 +537,7 @@ construct_path (gst_autoplug_node *rgnNodes, gpointer factory) next = rgnNodes[find_factory(rgnNodes, current)].iPrev; if (next) { factories = g_list_prepend (factories, current); - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory: \"%s\"", GST_OBJECT_NAME (current)); + GST_INFO ("factory: \"%s\"", GST_OBJECT_NAME (current)); } current = next; } @@ -642,4 +645,3 @@ gst_autoplug_func (gpointer src, gpointer sink, return construct_path (rgnNodes, sink); } - diff --git a/gst/autoplug/gststaticautoplugrender.c b/gst/autoplug/gststaticautoplugrender.c index 376fb01158..0b48bdaf74 100644 --- a/gst/autoplug/gststaticautoplugrender.c +++ b/gst/autoplug/gststaticautoplugrender.c @@ -26,6 +26,9 @@ #define GST_AUTOPLUG_MAX_COST 999999 +GST_DEBUG_CATEGORY_STATIC(debug_category); +#define GST_CAT_DEFAULT debug_category + typedef guint (*GstAutoplugCostFunction) (gpointer src, gpointer dest, gpointer data); typedef GList* (*GstAutoplugListFunction) (gpointer data); @@ -88,6 +91,8 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_plugin_set_longname (plugin, "A static autoplugger"); + GST_DEBUG_CATEGORY_INIT (debug_category, "STATIC_AUTOPLUG", 0, "static autoplug render element"); + factory = gst_autoplug_factory_new ("staticrender", "A static autoplugger, it constructs the complete element before running it", gst_static_autoplug_render_get_type ()); @@ -153,18 +158,16 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest) if (desttemp->direction == GST_PAD_SINK && desttemp->presence != GST_PAD_REQUEST) { if (gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (srctemp), GST_PAD_TEMPLATE_CAPS (desttemp))) { - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "factory \"%s\" can link with factory \"%s\"", - GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest)); + GST_DEBUG ("factory \"%s\" can link with factory \"%s\"", + GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest)); return TRUE; } } } } - GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT, - "factory \"%s\" cannot link with factory \"%s\"", - GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest)); + GST_DEBUG ("factory \"%s\" cannot link with factory \"%s\"", + GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest)); return FALSE; } @@ -175,7 +178,7 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink) gboolean linked = FALSE; GstElementState state = GST_STATE (gst_element_get_parent (src)); - GST_DEBUG (0,"gstpipeline: autoplug pad link function for %s %s:%s to \"%s\"", + GST_DEBUG ("gstpipeline: autoplug pad link function for %s %s:%s to \"%s\"", GST_ELEMENT_NAME (src), GST_DEBUG_PAD_NAME(pad), GST_ELEMENT_NAME(sink)); if (state == GST_STATE_PLAYING) @@ -194,7 +197,7 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink) break; } else { - GST_DEBUG (0,"pads incompatible %s, %s", GST_PAD_NAME (pad), GST_PAD_NAME (sinkpad)); + GST_DEBUG ("pads incompatible %s, %s", GST_PAD_NAME (pad), GST_PAD_NAME (sinkpad)); } } sinkpads = g_list_next(sinkpads); @@ -204,7 +207,7 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink) gst_element_set_state (GST_ELEMENT (gst_element_get_parent (src)), GST_STATE_PLAYING); if (!linked) { - GST_DEBUG (0,"gstpipeline: no path to sinks for type"); + GST_DEBUG ("gstpipeline: no path to sinks for type"); } return linked; } @@ -230,7 +233,7 @@ gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink) } if (!linked) { - GST_DEBUG (0,"gstpipeline: delaying pad links for \"%s\" to \"%s\"", + GST_DEBUG ("gstpipeline: delaying pad links for \"%s\" to \"%s\"", GST_ELEMENT_NAME(src), GST_ELEMENT_NAME(sink)); g_signal_connect (G_OBJECT(src),"new_pad", G_CALLBACK (gst_autoplug_pads_autoplug_func), sink); @@ -257,7 +260,6 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data) if (IS_CAPS (src) && IS_CAPS (dest)) { res = gst_caps_is_always_compatible ((GstCaps *)src, (GstCaps *)dest); - /*GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res); */ } else if (IS_CAPS (src)) { GstPadTemplate *templ; @@ -269,7 +271,6 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data) else res = FALSE; - /*GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory %s to src caps %d %d", ((GstElementFactory *)dest)->name, ((GstCaps *)src)->id, res);*/ } else if (IS_CAPS (dest)) { GstPadTemplate *templ; @@ -280,12 +281,10 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data) res = TRUE; else res = FALSE; - /*GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory %s to sink caps %d %d", ((GstElementFactory *)src)->name, ((GstCaps *)dest)->id, res);*/ } else { res = gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest); - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory %s to factory %s %d", - GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest), res); + GST_INFO ("factory %s to factory %s %d", GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest), res); } if (res) @@ -328,7 +327,7 @@ gst_static_autoplug_to_render (GstAutoplug *autoplug, GstCaps *srccaps, GstEleme else goto next; - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"autoplugging two caps structures"); + GST_INFO ("autoplugging two caps structures"); elements = gst_autoplug_func (caps.src, caps.sink, gst_autoplug_element_factory_get_list, @@ -396,7 +395,7 @@ next: } } - GST_DEBUG (0,"common factory \"%s\"", GST_OBJECT_NAME (factory)); + GST_DEBUG ("common factory \"%s\"", GST_OBJECT_NAME (factory)); element = gst_element_factory_create (factory, g_strdup (GST_OBJECT_NAME (factory))); gst_bin_add (GST_BIN(result), element); @@ -456,7 +455,7 @@ differ: if (factories[i]) { factory = (GstElementFactory *)(factories[i]->data); - GST_DEBUG (0,"factory \"%s\"", GST_OBJECT_NAME (factory)); + GST_DEBUG ("factory \"%s\"", GST_OBJECT_NAME (factory)); element = gst_element_factory_create(factory, g_strdup (GST_OBJECT_NAME (factory))); } else { @@ -472,11 +471,11 @@ differ: use_thread = FALSE; - GST_DEBUG (0,"sugest new thread for \"%s\" %08x", GST_ELEMENT_NAME (element), GST_FLAGS(element)); + GST_DEBUG ("sugest new thread for \"%s\" %08x", GST_ELEMENT_NAME (element), GST_FLAGS(element)); /* create a new queue and add to the previous bin */ queue = gst_element_factory_make("queue", g_strconcat("queue_", GST_ELEMENT_NAME(element), NULL)); - GST_DEBUG (0,"adding element \"%s\"", GST_ELEMENT_NAME (element)); + GST_DEBUG ("adding element \"%s\"", GST_ELEMENT_NAME (element)); /* this will be the new bin for all following elements */ thebin = gst_element_factory_make("thread", g_strconcat("thread_", GST_ELEMENT_NAME(element), NULL)); @@ -488,17 +487,17 @@ differ: gst_autoplug_pads_autoplug(thesrcelement, queue); - GST_DEBUG (0,"adding element %s", GST_ELEMENT_NAME (element)); + GST_DEBUG ("adding element %s", GST_ELEMENT_NAME (element)); gst_bin_add(GST_BIN(thebin), element); gst_autoplug_signal_new_object (GST_AUTOPLUG (autoplug), GST_OBJECT (element)); - GST_DEBUG (0,"adding element %s", GST_ELEMENT_NAME (thebin)); + GST_DEBUG ("adding element %s", GST_ELEMENT_NAME (thebin)); gst_bin_add(GST_BIN(current_bin), thebin); gst_autoplug_signal_new_object (GST_AUTOPLUG (autoplug), GST_OBJECT (thebin)); thesrcelement = queue; } /* no thread needed, easy case */ else { - GST_DEBUG (0,"adding element %s", GST_ELEMENT_NAME (element)); + GST_DEBUG ("adding element %s", GST_ELEMENT_NAME (element)); gst_bin_add(GST_BIN(thebin), element); gst_autoplug_signal_new_object (GST_AUTOPLUG (autoplug), GST_OBJECT (element)); } @@ -547,7 +546,7 @@ construct_path (gst_autoplug_node *rgnNodes, gpointer factory) current = rgnNodes[find_factory(rgnNodes, factory)].iPrev; - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factories found in autoplugging (reversed order)"); + GST_INFO ("factories found in autoplugging (reversed order)"); while (current != NULL) { @@ -556,7 +555,7 @@ construct_path (gst_autoplug_node *rgnNodes, gpointer factory) next = rgnNodes[find_factory(rgnNodes, current)].iPrev; if (next) { factories = g_list_prepend (factories, current); - GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory: \"%s\"", GST_OBJECT_NAME (current)); + GST_INFO ("factory: \"%s\"", GST_OBJECT_NAME (current)); } current = next; } @@ -664,4 +663,3 @@ gst_autoplug_func (gpointer src, gpointer sink, return construct_path (rgnNodes, sink); } - diff --git a/gst/cothreads.c b/gst/cothreads.c index 70749e93b3..afde372a63 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -34,7 +34,7 @@ #include "cothreads.h" #include "gstarch.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstutils.h" #ifdef HAVE_UCONTEXT_H @@ -113,7 +113,7 @@ cothread_context_init (void) * just return it */ ctx = g_static_private_get (&_cothread_ctx_key); if (ctx) { - GST_INFO (GST_CAT_COTHREADS, + GST_CAT_INFO (GST_CAT_COTHREADS, "returning private _cothread_ctx_key %p", ctx); return ctx; } @@ -129,10 +129,10 @@ cothread_context_init (void) ctx->data = g_hash_table_new (g_str_hash, g_str_equal); ctx->thread = g_thread_self(); - GST_INFO (GST_CAT_COTHREADS, "initializing cothreads"); + GST_CAT_INFO (GST_CAT_COTHREADS, "initializing cothreads"); /* set this thread's context pointer */ - GST_INFO (GST_CAT_COTHREADS, "setting private _cothread_ctx_key to %p in thread %p", + GST_CAT_INFO (GST_CAT_COTHREADS, "setting private _cothread_ctx_key to %p in thread %p", ctx,g_thread_self()); g_static_private_set (&_cothread_ctx_key, ctx, NULL); @@ -149,7 +149,7 @@ cothread_context_init (void) /* FIXME: an assumption is made that the stack segment is STACK_SIZE * aligned. */ ctx->stack_top = ((gulong) current_stack_frame | (STACK_SIZE - 1)) + 1; - GST_DEBUG (GST_CAT_COTHREADS, "stack top is 0x%08lx", ctx->stack_top); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "stack top is 0x%08lx", ctx->stack_top); /* * initialize the 0th cothread @@ -164,7 +164,7 @@ cothread_context_init (void) ctx->cothreads[0]->flags = COTHREAD_STARTED; ctx->cothreads[0]->sp = (void *) current_stack_frame; - GST_INFO (GST_CAT_COTHREADS, "0th cothread is %p at sp:%p", + GST_CAT_INFO (GST_CAT_COTHREADS, "0th cothread is %p at sp:%p", ctx->cothreads[0], ctx->cothreads[0]->sp); return ctx; @@ -185,7 +185,7 @@ cothread_context_free (cothread_context *ctx) g_assert (ctx->thread == g_thread_self()); g_assert (ctx->current == 0); - GST_INFO (GST_CAT_COTHREADS, "free cothread context"); + GST_CAT_INFO (GST_CAT_COTHREADS, "free cothread context"); for (i = 1; i < COTHREAD_MAXTHREADS; i++) { if (ctx->cothreads[i]) { @@ -198,7 +198,7 @@ cothread_context_free (cothread_context *ctx) } g_hash_table_destroy (ctx->data); /* make sure we free the private key for cothread context */ - GST_INFO (GST_CAT_COTHREADS, "setting private _cothread_ctx_key to NULL in thread %p", + GST_CAT_INFO (GST_CAT_COTHREADS, "setting private _cothread_ctx_key to NULL in thread %p", g_thread_self()); g_static_private_set (&_cothread_ctx_key, NULL, NULL); g_free (ctx); @@ -222,7 +222,7 @@ cothread_create (cothread_context *ctx) g_return_val_if_fail (ctx != NULL, NULL); - GST_DEBUG (GST_CAT_COTHREADS, "manager sef %p, cothread self %p", + GST_CAT_DEBUG (GST_CAT_COTHREADS, "manager sef %p, cothread self %p", ctx->thread, g_thread_self()); if (ctx->ncothreads == COTHREAD_MAXTHREADS) { @@ -241,21 +241,21 @@ cothread_create (cothread_context *ctx) } } - GST_DEBUG (GST_CAT_COTHREADS, "Found free cothread slot %d", slot); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "Found free cothread slot %d", slot); /* cothread stack space of the thread is mapped in reverse, with cothread 0 * stack space at the top */ cothread = (cothread_state *) (ctx->stack_top - (slot + 1) * COTHREAD_STACKSIZE); - GST_DEBUG (GST_CAT_COTHREADS, "cothread pointer is %p", cothread); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "cothread pointer is %p", cothread); #if 0 /* This tests to see whether or not we can grow down the stack */ { unsigned long ptr; for(ptr=ctx->stack_top - 4096; ptr > (unsigned long)cothread; ptr -= 4096){ - GST_DEBUG (GST_CAT_COTHREADS, "touching location 0x%08lx", ptr); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "touching location 0x%08lx", ptr); *(volatile unsigned int *)ptr = *(volatile unsigned int *)ptr; - GST_DEBUG (GST_CAT_COTHREADS, "ok (0x%08x)", *(unsigned int *)ptr); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "ok (0x%08x)", *(unsigned int *)ptr); } } #endif @@ -268,7 +268,7 @@ cothread_create (cothread_context *ctx) /* The mmap is necessary on Linux/i386, and possibly others, since the * kernel is picky about when we can expand our stack. */ - GST_DEBUG (GST_CAT_COTHREADS, "mmaping %p, size 0x%08x", cothread, + GST_CAT_DEBUG (GST_CAT_COTHREADS, "mmaping %p, size 0x%08x", cothread, COTHREAD_STACKSIZE); /* Remap with a guard page. This decreases our stack size by 8 kB (for * 4 kB pages) and also wastes almost 4 kB for the cothreads @@ -281,7 +281,7 @@ cothread_create (cothread_context *ctx) COTHREAD_STACKSIZE - page_size * 2, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - GST_DEBUG (GST_CAT_COTHREADS, "coming out of mmap"); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "coming out of mmap"); if (mmaped == MAP_FAILED) { perror ("mmap'ing cothread stack space"); return NULL; @@ -292,7 +292,7 @@ cothread_create (cothread_context *ctx) } cothread->magic_number = COTHREAD_MAGIC_NUMBER; - GST_DEBUG (GST_CAT_COTHREADS, "create cothread %d with magic number 0x%x", + GST_CAT_DEBUG (GST_CAT_COTHREADS, "create cothread %d with magic number 0x%x", slot, cothread->magic_number); cothread->ctx = ctx; cothread->cothreadnum = slot; @@ -302,7 +302,7 @@ cothread_create (cothread_context *ctx) cothread->stack_size = COTHREAD_STACKSIZE - page_size * 2; cothread->stack_base = (void *)cothread + 2 * page_size; - GST_INFO (GST_CAT_COTHREADS, + GST_CAT_INFO (GST_CAT_COTHREADS, "created cothread #%d in slot %d: %p at sp:%p", ctx->ncothreads, slot, cothread, cothread->sp); @@ -323,7 +323,7 @@ cothread_free (cothread_state *cothread) { g_return_if_fail (cothread != NULL); - GST_INFO (GST_CAT_COTHREADS, "flag cothread %d for destruction", + GST_CAT_INFO (GST_CAT_COTHREADS, "flag cothread %d for destruction", cothread->cothreadnum); /* we simply flag the cothread for destruction here */ @@ -346,7 +346,7 @@ cothread_destroy (cothread_state *cothread) g_assert (ctx->thread == g_thread_self()); g_assert (ctx == cothread_get_current_context()); - GST_INFO (GST_CAT_COTHREADS, "destroy cothread %d %p %d", + GST_CAT_INFO (GST_CAT_COTHREADS, "destroy cothread %d %p %d", cothreadnum, cothread, ctx->current); /* cothread 0 needs to be destroyed specially */ @@ -357,7 +357,7 @@ cothread_destroy (cothread_state *cothread) cothread_unlock (cothread); /* doing cleanups of the cothread create */ - GST_DEBUG (GST_CAT_COTHREADS, "destroy cothread %d with magic number 0x%x", + GST_CAT_DEBUG (GST_CAT_COTHREADS, "destroy cothread %d with magic number 0x%x", cothreadnum, cothread->magic_number); g_assert (cothread->magic_number == COTHREAD_MAGIC_NUMBER); @@ -411,7 +411,7 @@ cothread_main (cothread_context* ctx) { g_assert (ctx->thread == g_thread_self()); - GST_DEBUG (GST_CAT_COTHREADS, "returning %p, the 0th cothread", + GST_CAT_DEBUG (GST_CAT_COTHREADS, "returning %p, the 0th cothread", ctx->cothreads[0]); return ctx->cothreads[0]; } @@ -451,22 +451,22 @@ cothread_stub (void) { cothread_context *ctx = cothread_get_current_context(); cothread_state *cothread = ctx->cothreads[ctx->current]; +#ifndef GST_DISABLE_GST_DEBUG char __csf; void *current_stack_frame = &__csf; +#endif - GST_DEBUG_ENTER (""); - - GST_DEBUG (GST_CAT_COTHREADS, "stack addr %p", &ctx); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "stack addr %p", &ctx); cothread->flags |= COTHREAD_STARTED; while (TRUE) { cothread->func (cothread->argc, cothread->argv); - GST_DEBUG (GST_CAT_COTHREADS, "cothread[%d] thread->func exited", ctx->current); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "cothread[%d] thread->func exited", ctx->current); - GST_DEBUG (GST_CAT_COTHREADS, "sp=%p", current_stack_frame); - GST_DEBUG (GST_CAT_COTHREADS, "ctx=%p current=%p", ctx,cothread_get_current_context()); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "sp=%p", current_stack_frame); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "ctx=%p current=%p", ctx,cothread_get_current_context()); g_assert (ctx == cothread_get_current_context()); g_assert (ctx->current != 0); @@ -474,7 +474,6 @@ cothread_stub (void) /* we do this to avoid ever returning, we just switch to 0th thread */ cothread_switch (cothread_main (ctx)); } - GST_DEBUG_LEAVE (""); } /** @@ -594,26 +593,23 @@ cothread_switch (cothread_state *cothread) /* find the number of the thread to switch to */ - GST_INFO (GST_CAT_COTHREAD_SWITCH, + GST_CAT_INFO (GST_CAT_COTHREAD_SWITCH, "switching from cothread #%d to cothread #%d", ctx->current, cothread->cothreadnum); ctx->current = cothread->cothreadnum; - g_static_private_set (&_gst_debug_cothread_index, - GINT_TO_POINTER(ctx->current), NULL); - /* save the current stack pointer, frame pointer, and pc */ #ifdef GST_ARCH_PRESETJMP GST_ARCH_PRESETJMP (); #endif enter = setjmp (current->jmp); if (enter != 0) { - GST_DEBUG (GST_CAT_COTHREADS, + GST_CAT_DEBUG (GST_CAT_COTHREADS, "enter cothread #%d %d sp=%p jmpbuf=%p", current->cothreadnum, enter, current->sp, current->jmp); return; } - GST_DEBUG (GST_CAT_COTHREADS, "exit cothread #%d %d sp=%p jmpbuf=%p", + GST_CAT_DEBUG (GST_CAT_COTHREADS, "exit cothread #%d %d sp=%p jmpbuf=%p", current->cothreadnum, enter, current->sp, current->jmp); enter = 1; @@ -621,10 +617,10 @@ cothread_switch (cothread_state *cothread) cothread_destroy (current); } - GST_DEBUG (GST_CAT_COTHREADS, "set stack to %p", cothread->sp); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "set stack to %p", cothread->sp); /* restore stack pointer and other stuff of new cothread */ if (cothread->flags & COTHREAD_STARTED) { - GST_DEBUG (GST_CAT_COTHREADS, "via longjmp() jmpbuf %p", cothread->jmp); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "via longjmp() jmpbuf %p", cothread->jmp); /* switch to it */ longjmp (cothread->jmp, 1); } @@ -632,7 +628,7 @@ cothread_switch (cothread_state *cothread) #ifdef HAVE_MAKECONTEXT ucontext_t ucp; - GST_DEBUG (GST_CAT_COTHREADS, "making context"); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "making context"); g_assert (cothread != cothread_main(ctx)); @@ -648,7 +644,7 @@ cothread_switch (cothread_state *cothread) GST_ARCH_CALL (cothread_stub); #endif - GST_DEBUG (GST_CAT_COTHREADS, "exit thread "); + GST_CAT_DEBUG (GST_CAT_COTHREADS, "exit thread "); ctx->current = 0; } diff --git a/gst/elements/gstaggregator.c b/gst/elements/gstaggregator.c index b8882def21..2506d26391 100644 --- a/gst/elements/gstaggregator.c +++ b/gst/elements/gstaggregator.c @@ -20,8 +20,14 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gstaggregator.h" +GST_DEBUG_CATEGORY (gst_aggregator_debug); +#define GST_CAT_DEFAULT gst_aggregator_debug GstElementDetails gst_aggregator_details = { "Aggregator pipe fitting", @@ -354,4 +360,3 @@ gst_aggregator_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/gst/elements/gstaggregator.h b/gst/elements/gstaggregator.h index cd73803b37..e53b8540c5 100644 --- a/gst/elements/gstaggregator.h +++ b/gst/elements/gstaggregator.h @@ -29,6 +29,7 @@ G_BEGIN_DECLS extern GstElementDetails gst_aggregator_details; +GST_DEBUG_CATEGORY_EXTERN(gst_aggregator_debug); typedef enum { AGGREGATOR_LOOP = 1, diff --git a/gst/elements/gstelements.c b/gst/elements/gstelements.c index 0b07efe751..78413f2161 100644 --- a/gst/elements/gstelements.c +++ b/gst/elements/gstelements.c @@ -21,8 +21,13 @@ */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include +#include "gstfilesrc.h" #include "gstfilesink.h" #include "gstidentity.h" #include "gstfakesink.h" @@ -75,7 +80,22 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_plugin_set_longname (plugin, "Standard GST Elements"); - while (_elements[i].name) { + GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug, "fakesrc", 0, "fakesrc element"); + GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element"); + GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element"); + GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "fakesink", 0, "filesink element"); + GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element"); + GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element"); + GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug, "fdsink", 0, "fdsink element"); + GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element"); + GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0, "pipefilter element"); + GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element"); + GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0, "aggregator element"); + GST_DEBUG_CATEGORY_INIT (gst_shaper_debug, "shaper", 0, "shaper element"); + GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0, "statistics element"); + GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug, "md5sink", 0, "md5sink element"); + + while (_elements[i].name) { factory = gst_element_factory_new (_elements[i].name, (_elements[i].type) (), _elements[i].details); @@ -107,4 +127,3 @@ GstPluginDesc plugin_desc = { "gstelements", plugin_init }; - diff --git a/gst/elements/gstfakesink.c b/gst/elements/gstfakesink.c index 444d00afa1..84f23f89dc 100644 --- a/gst/elements/gstfakesink.c +++ b/gst/elements/gstfakesink.c @@ -21,8 +21,14 @@ */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "gstfakesink.h" + +GST_DEBUG_CATEGORY (gst_fakesink_debug); +#define GST_CAT_DEFAULT gst_fakesink_debug GstElementDetails gst_fakesink_details = { "Fake Sink", diff --git a/gst/elements/gstfakesink.h b/gst/elements/gstfakesink.h index 6d2efe1099..4228dbc333 100644 --- a/gst/elements/gstfakesink.h +++ b/gst/elements/gstfakesink.h @@ -24,14 +24,12 @@ #ifndef __GST_FAKESINK_H__ #define __GST_FAKESINK_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fakesink_details; - +extern GstElementDetails gst_fakesink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fakesink_debug); #define GST_TYPE_FAKESINK \ (gst_fakesink_get_type()) diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index a6141b4f6f..f4d0d89a69 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -24,12 +24,19 @@ #include #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstfakesrc.h" #define DEFAULT_SIZEMIN 0 #define DEFAULT_SIZEMAX 4096 #define DEFAULT_PARENTSIZE 4096*10 +GST_DEBUG_CATEGORY (gst_fakesrc_debug); +#define GST_CAT_DEFAULT gst_fakesrc_debug + GstElementDetails gst_fakesrc_details = { "Fake Source", "Source", @@ -502,7 +509,7 @@ gst_fakesrc_set_property (GObject *object, guint prop_id, const GValue *value, G break; case ARG_EOS: src->eos = g_value_get_boolean (value); - GST_INFO (0, "will EOS on next buffer"); + GST_INFO ( "will EOS on next buffer"); break; case ARG_SILENT: src->silent = g_value_get_boolean (value); @@ -753,7 +760,7 @@ gst_fakesrc_get(GstPad *pad) } if (src->eos) { - GST_INFO (0, "fakesrc is setting eos on pad"); + GST_INFO ( "fakesrc is setting eos on pad"); return GST_BUFFER(gst_event_new (GST_EVENT_EOS)); } @@ -770,10 +777,10 @@ gst_fakesrc_get(GstPad *pad) g_object_notify (G_OBJECT (src), "last_message"); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, src, "pre handoff emit"); + GST_LOG_OBJECT (src, "pre handoff emit"); g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0, buf, pad); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, src, "post handoff emit"); + GST_LOG_OBJECT (src, "post handoff emit"); return buf; } @@ -866,4 +873,3 @@ gst_fakesrc_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/gst/elements/gstfakesrc.h b/gst/elements/gstfakesrc.h index 61c64840ad..c6964cb700 100644 --- a/gst/elements/gstfakesrc.h +++ b/gst/elements/gstfakesrc.h @@ -24,13 +24,12 @@ #ifndef __GST_FAKESRC_H__ #define __GST_FAKESRC_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fakesrc_details; +extern GstElementDetails gst_fakesrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fakesrc_debug); typedef enum { FAKESRC_FIRST_LAST_LOOP = 1, diff --git a/gst/elements/gstfdsink.c b/gst/elements/gstfdsink.c index d888f222e8..b25f377d80 100644 --- a/gst/elements/gstfdsink.c +++ b/gst/elements/gstfdsink.c @@ -20,9 +20,15 @@ * Boston, MA 02111-1307, USA. */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstfdsink.h" #include +GST_DEBUG_CATEGORY (gst_fdsink_debug); +#define GST_CAT_DEFAULT gst_fdsink_debug GstElementDetails gst_fdsink_details = { "Filedescriptor Sink", @@ -122,7 +128,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf) g_return_if_fail (fdsink->fd >= 0); if (GST_BUFFER_DATA (buf)) { - GST_DEBUG (0,"writing %d bytes to file descriptor %d",GST_BUFFER_SIZE (buf), fdsink->fd); + GST_DEBUG ("writing %d bytes to file descriptor %d",GST_BUFFER_SIZE (buf), fdsink->fd); write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); } diff --git a/gst/elements/gstfdsink.h b/gst/elements/gstfdsink.h index 2b4f385c2d..4f6dfb69cc 100644 --- a/gst/elements/gstfdsink.h +++ b/gst/elements/gstfdsink.h @@ -24,14 +24,12 @@ #ifndef __GST_FDSINK_H__ #define __GST_FDSINK_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fdsink_details; - +extern GstElementDetails gst_fdsink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fdsink_debug); #define GST_TYPE_FDSINK \ (gst_fdsink_get_type()) diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index f36d1c2fc2..5b2bc91c27 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -27,10 +27,17 @@ #include #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstfdsrc.h" #define DEFAULT_BLOCKSIZE 4096 +GST_DEBUG_CATEGORY (gst_fdsrc_debug); +#define GST_CAT_DEFAULT gst_fdsrc_debug + GstElementDetails gst_fdsrc_details = { "Disk Source", diff --git a/gst/elements/gstfdsrc.h b/gst/elements/gstfdsrc.h index dfa49b660a..a17b2d5805 100644 --- a/gst/elements/gstfdsrc.h +++ b/gst/elements/gstfdsrc.h @@ -24,14 +24,12 @@ #ifndef __GST_FDSRC_H__ #define __GST_FDSRC_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fdsrc_details; - +extern GstElementDetails gst_fdsrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fdsrc_debug); #define GST_TYPE_FDSRC \ (gst_fdsrc_get_type()) diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index 23d46efeae..c82ee1e4a4 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -21,11 +21,18 @@ */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include "gstfilesink.h" #include +GST_DEBUG_CATEGORY (gst_filesink_debug); +#define GST_CAT_DEFAULT gst_filesink_debug + GstElementDetails gst_filesink_details = { "File Sink", "Sink/File", diff --git a/gst/elements/gstfilesink.h b/gst/elements/gstfilesink.h index d9ffa5ba43..99e38eb650 100644 --- a/gst/elements/gstfilesink.h +++ b/gst/elements/gstfilesink.h @@ -24,14 +24,12 @@ #ifndef __GST_FILESINK_H__ #define __GST_FILESINK_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_filesink_details; - +extern GstElementDetails gst_filesink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_filesink_debug); #define GST_TYPE_FILESINK \ (gst_filesink_get_type()) diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index aa45f7cdaa..23715a37b1 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -20,8 +20,11 @@ * Boston, MA 02111-1307, USA. */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include #include "gstfilesrc.h" #include @@ -69,6 +72,9 @@ */ +GST_DEBUG_CATEGORY (gst_filesrc_debug); +#define GST_CAT_DEFAULT gst_filesrc_debug + GstElementDetails gst_filesrc_details = { "File Source", "Source/File", @@ -299,7 +305,7 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G src->mapsize = g_value_get_ulong (value); g_object_notify (G_OBJECT (src), "mmapsize"); } else { - GST_INFO (0, "invalid mapsize, must a multiple of pagesize, which is %d", + GST_INFO ( "invalid mapsize, must a multiple of pagesize, which is %d", src->pagesize); } break; @@ -369,7 +375,7 @@ gst_filesrc_free_parent_mmap (GstBuffer *buf) munmap (GST_BUFFER_DATA (buf), GST_BUFFER_MAXSIZE (buf)); /* cast to unsigned long, since there's no gportable way to print * guint64 as hex */ - GST_DEBUG (0, "unmapped region %08lx+%08lx at %p", + GST_DEBUG ( "unmapped region %08lx+%08lx at %p", (unsigned long) GST_BUFFER_OFFSET (buf), (unsigned long) GST_BUFFER_MAXSIZE (buf), GST_BUFFER_DATA (buf)); @@ -400,7 +406,7 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size) size, src->fd, offset, strerror (errno)); return NULL; } - GST_DEBUG (0, "mapped region %08lx+%08lx from file into memory at %p", + GST_DEBUG ( "mapped region %08lx+%08lx from file into memory at %p", (unsigned long)offset, (unsigned long)size, mmapregion); /* time to allocate a new mapbuf */ @@ -504,7 +510,7 @@ gst_filesrc_get (GstPad *pad) GstEvent *event; src->seek_happened = FALSE; - GST_DEBUG (GST_CAT_EVENT, "filesrc sending discont"); + GST_DEBUG ("filesrc sending discont"); event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL); src->need_flush = FALSE; return GST_BUFFER (event); @@ -512,14 +518,14 @@ gst_filesrc_get (GstPad *pad) /* check for flush */ if (src->need_flush) { src->need_flush = FALSE; - GST_DEBUG (GST_CAT_EVENT, "filesrc sending flush"); + GST_DEBUG ("filesrc sending flush"); return GST_BUFFER (gst_event_new_flush ()); } /* check for EOF */ if (src->curoffset == src->filelen) { - GST_DEBUG (0, "filesrc eos %" G_GINT64_FORMAT - " %" G_GINT64_FORMAT, src->curoffset, src->filelen); + GST_DEBUG ("filesrc eos %" G_GINT64_FORMAT" %" G_GINT64_FORMAT, + src->curoffset, src->filelen); gst_element_set_eos (GST_ELEMENT (src)); return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); } @@ -537,9 +543,9 @@ gst_filesrc_get (GstPad *pad) readend = src->curoffset + readsize; } - GST_DEBUG (0, "attempting to read %08lx, %08lx, %08lx, %08lx", - (unsigned long)readsize, (unsigned long)readend, - (unsigned long)mapstart, (unsigned long)mapend); + GST_LOG ("attempting to read %08lx, %08lx, %08lx, %08lx", + (unsigned long)readsize, (unsigned long)readend, + (unsigned long)mapstart, (unsigned long)mapend); /* if the start is past the mapstart */ if (src->curoffset >= mapstart) { @@ -649,7 +655,7 @@ gst_filesrc_open_file (GstFileSrc *src) { g_return_val_if_fail (!GST_FLAG_IS_SET (src ,GST_FILESRC_OPEN), FALSE); - GST_DEBUG(0, "opening file %s",src->filename); + GST_DEBUG ( "opening file %s",src->filename); /* open the file */ src->fd = open (src->filename, O_RDONLY); @@ -779,7 +785,7 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event) { GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad)); - GST_DEBUG(0, "event %d", GST_EVENT_TYPE (event)); + GST_DEBUG ( "event %d", GST_EVENT_TYPE (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: @@ -797,19 +803,19 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event) if (offset > src->filelen) goto error; src->curoffset = offset; - GST_DEBUG(0, "seek set pending to %" G_GINT64_FORMAT, src->curoffset); + GST_DEBUG ( "seek set pending to %" G_GINT64_FORMAT, src->curoffset); break; case GST_SEEK_METHOD_CUR: if (offset + src->curoffset > src->filelen) goto error; src->curoffset += offset; - GST_DEBUG(0, "seek cur pending to %" G_GINT64_FORMAT, src->curoffset); + GST_DEBUG ( "seek cur pending to %" G_GINT64_FORMAT, src->curoffset); break; case GST_SEEK_METHOD_END: if (ABS (offset) > src->filelen) goto error; src->curoffset = src->filelen - ABS (offset); - GST_DEBUG(0, "seek end pending to %" G_GINT64_FORMAT, src->curoffset); + GST_DEBUG ( "seek end pending to %" G_GINT64_FORMAT, src->curoffset); break; default: goto error; diff --git a/gst/elements/gstfilesrc.h b/gst/elements/gstfilesrc.h index 25d27b0145..8065210c93 100644 --- a/gst/elements/gstfilesrc.h +++ b/gst/elements/gstfilesrc.h @@ -30,6 +30,9 @@ G_BEGIN_DECLS +extern GstElementDetails gst_filesrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_filesrc_debug); + #define GST_TYPE_FILESRC \ (gst_filesrc_get_type()) #define GST_FILESRC(obj) \ diff --git a/gst/elements/gstidentity.c b/gst/elements/gstidentity.c index 29b20bc2b3..df42d70bd2 100644 --- a/gst/elements/gstidentity.c +++ b/gst/elements/gstidentity.c @@ -22,8 +22,15 @@ #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstidentity.h" + +GST_DEBUG_CATEGORY (gst_identity_debug); +#define GST_CAT_DEFAULT gst_identity_debug GstElementDetails gst_identity_details = { "Identity", @@ -282,7 +289,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf) gst_pad_push (identity->srcpad, buf); if (identity->sleep_time) - usleep (identity->sleep_time); + g_usleep (identity->sleep_time); } } diff --git a/gst/elements/gstidentity.h b/gst/elements/gstidentity.h index 42ce65f1cd..dd04364c9f 100644 --- a/gst/elements/gstidentity.h +++ b/gst/elements/gstidentity.h @@ -25,13 +25,12 @@ #define __GST_IDENTITY_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_identity_details; - +extern GstElementDetails gst_identity_details; +GST_DEBUG_CATEGORY_EXTERN(gst_identity_debug); #define GST_TYPE_IDENTITY \ (gst_identity_get_type()) diff --git a/gst/elements/gstmd5sink.c b/gst/elements/gstmd5sink.c index ca43fc23b2..15dc9d1996 100644 --- a/gst/elements/gstmd5sink.c +++ b/gst/elements/gstmd5sink.c @@ -25,11 +25,16 @@ #include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include #include "gstmd5sink.h" +GST_DEBUG_CATEGORY (gst_md5sink_debug); +#define GST_CAT_DEFAULT gst_md5sink_debug + /* MD5Sink signals and args */ enum { /* FILL ME */ @@ -519,4 +524,3 @@ gst_md5sink_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/gst/elements/gstmd5sink.h b/gst/elements/gstmd5sink.h index 2ad4fdb6d4..5d24df69d5 100644 --- a/gst/elements/gstmd5sink.h +++ b/gst/elements/gstmd5sink.h @@ -25,13 +25,12 @@ #define __GST_MD5SINK_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_md5sink_details; - +extern GstElementDetails gst_md5sink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_md5sink_debug); #define GST_TYPE_MD5SINK \ (gst_md5sink_get_type()) diff --git a/gst/elements/gstmultidisksrc.c b/gst/elements/gstmultidisksrc.c index 629993bed8..a561588abf 100644 --- a/gst/elements/gstmultidisksrc.c +++ b/gst/elements/gstmultidisksrc.c @@ -27,10 +27,15 @@ #include #include -/*#define GST_DEBUG_ENABLED*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "gstmultidisksrc.h" +GST_DEBUG_CATEGORY (gst_multidisksrc_debug); +#define GST_CAT_DEFAULT gst_multidisksrc_debug + GstElementDetails gst_multidisksrc_details = { "Multi Disk Source", "Source/File", diff --git a/gst/elements/gstmultidisksrc.h b/gst/elements/gstmultidisksrc.h index eca04e155b..07e83980d3 100644 --- a/gst/elements/gstmultidisksrc.h +++ b/gst/elements/gstmultidisksrc.h @@ -28,7 +28,8 @@ G_BEGIN_DECLS -GstElementDetails gst_multidisksrc_details; +extern GstElementDetails gst_multidisksrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug); #define GST_TYPE_MULTIDISKSRC \ (gst_multidisksrc_get_type()) diff --git a/gst/elements/gstmultifilesrc.c b/gst/elements/gstmultifilesrc.c index 629993bed8..a561588abf 100644 --- a/gst/elements/gstmultifilesrc.c +++ b/gst/elements/gstmultifilesrc.c @@ -27,10 +27,15 @@ #include #include -/*#define GST_DEBUG_ENABLED*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "gstmultidisksrc.h" +GST_DEBUG_CATEGORY (gst_multidisksrc_debug); +#define GST_CAT_DEFAULT gst_multidisksrc_debug + GstElementDetails gst_multidisksrc_details = { "Multi Disk Source", "Source/File", diff --git a/gst/elements/gstmultifilesrc.h b/gst/elements/gstmultifilesrc.h index eca04e155b..07e83980d3 100644 --- a/gst/elements/gstmultifilesrc.h +++ b/gst/elements/gstmultifilesrc.h @@ -28,7 +28,8 @@ G_BEGIN_DECLS -GstElementDetails gst_multidisksrc_details; +extern GstElementDetails gst_multidisksrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug); #define GST_TYPE_MULTIDISKSRC \ (gst_multidisksrc_get_type()) diff --git a/gst/elements/gstpipefilter.c b/gst/elements/gstpipefilter.c index 7ac2d5f456..65a2a7fc2d 100644 --- a/gst/elements/gstpipefilter.c +++ b/gst/elements/gstpipefilter.c @@ -29,9 +29,14 @@ #include #include -/*#define DEBUG_ENABLED*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gstpipefilter.h" +GST_DEBUG_CATEGORY (gst_pipefilter_debug); +#define GST_CAT_DEFAULT gst_pipefilter_debug GstElementDetails gst_pipefilter_details = { "Pipefilter", @@ -141,7 +146,7 @@ gst_pipefilter_handle_event (GstPad *pad, GstEvent *event) pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad)); - GST_DEBUG (0,"pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter)); + GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter)); if (close (pipefilter->fdin[1]) < 0) perror("close"); if (close (pipefilter->fdout[0]) < 0) @@ -169,9 +174,9 @@ gst_pipefilter_get (GstPad *pad) g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, NULL); /* read it in from the file */ - GST_DEBUG (0,"attemting to read %ld bytes", pipefilter->bytes_per_read); + GST_DEBUG ("attemting to read %ld bytes", pipefilter->bytes_per_read); readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read); - GST_DEBUG (0,"read %ld bytes", readbytes); + GST_DEBUG ("read %ld bytes", readbytes); if (readbytes < 0) { perror("read"); gst_element_error(GST_ELEMENT(pipefilter),"reading"); @@ -207,9 +212,9 @@ gst_pipefilter_chain (GstPad *pad,GstBuffer *buf) data = GST_BUFFER_DATA(buf); size = GST_BUFFER_SIZE(buf); - GST_DEBUG (0,"attemting to write %ld bytes", size); + GST_DEBUG ("attemting to write %ld bytes", size); writebytes = write(pipefilter->fdin[1],data,size); - GST_DEBUG (0,"written %ld bytes", writebytes); + GST_DEBUG ("written %ld bytes", writebytes); if (writebytes < 0) { perror("write"); gst_element_error(GST_ELEMENT(pipefilter),"writing"); diff --git a/gst/elements/gstpipefilter.h b/gst/elements/gstpipefilter.h index 7699f4e28d..9516482c18 100644 --- a/gst/elements/gstpipefilter.h +++ b/gst/elements/gstpipefilter.h @@ -27,11 +27,10 @@ #include #include -#include "config.h" - G_BEGIN_DECLS -GstElementDetails gst_pipefilter_details; +extern GstElementDetails gst_pipefilter_details; +GST_DEBUG_CATEGORY_EXTERN(gst_pipefilter_debug); #define GST_TYPE_PIPEFILTER \ (gst_pipefilter_get_type()) diff --git a/gst/elements/gstshaper.c b/gst/elements/gstshaper.c index eaa6ae8f0d..cf981c8f50 100644 --- a/gst/elements/gstshaper.c +++ b/gst/elements/gstshaper.c @@ -22,7 +22,15 @@ #include -#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstshaper.h" + +GST_DEBUG_CATEGORY (gst_shaper_debug); +#define GST_CAT_DEFAULT gst_shaper_debug GstElementDetails gst_shaper_details = { "Shaper", @@ -380,4 +388,3 @@ gst_shaper_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/gst/elements/gstshaper.h b/gst/elements/gstshaper.h index 40540b1767..71995ae26d 100644 --- a/gst/elements/gstshaper.h +++ b/gst/elements/gstshaper.h @@ -25,13 +25,12 @@ #define __GST_SHAPER_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_shaper_details; - +extern GstElementDetails gst_shaper_details; +GST_DEBUG_CATEGORY_EXTERN(gst_shaper_debug); #define GST_TYPE_SHAPER \ (gst_shaper_get_type()) diff --git a/gst/elements/gststatistics.c b/gst/elements/gststatistics.c index 57dbebf1e7..a18e64b2c2 100644 --- a/gst/elements/gststatistics.c +++ b/gst/elements/gststatistics.c @@ -21,8 +21,14 @@ */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "gststatistics.h" + +GST_DEBUG_CATEGORY (gst_statistics_debug); +#define GST_CAT_DEFAULT gst_statistics_debug GstElementDetails gst_statistics_details = { "Statistics", @@ -299,9 +305,9 @@ gst_statistics_chain (GstPad *pad, GstBuffer *buf) if (update) { if (statistics->update) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, statistics, "pre update emit\n"); + GST_DEBUG ("[%s]: pre update emit", GST_ELEMENT_NAME (statistics)); g_signal_emit (G_OBJECT (statistics), gst_statistics_signals[SIGNAL_UPDATE], 0); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, statistics, "post update emit\n"); + GST_DEBUG ("[%s]: post update emit", GST_ELEMENT_NAME (statistics)); } if (!statistics->silent) { gst_statistics_print(statistics); diff --git a/gst/elements/gststatistics.h b/gst/elements/gststatistics.h index ae0242f0d3..aedf00adf2 100644 --- a/gst/elements/gststatistics.h +++ b/gst/elements/gststatistics.h @@ -24,13 +24,12 @@ #define __GST_STATISTICS_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_statistics_details; - +extern GstElementDetails gst_statistics_details; +GST_DEBUG_CATEGORY_EXTERN(gst_statistics_debug); #define GST_TYPE_STATISTICS \ (gst_statistics_get_type()) diff --git a/gst/elements/gsttee.c b/gst/elements/gsttee.c index 1db945c07c..2d9f4b1073 100644 --- a/gst/elements/gsttee.c +++ b/gst/elements/gsttee.c @@ -20,8 +20,14 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gsttee.h" +GST_DEBUG_CATEGORY (gst_tee_debug); +#define GST_CAT_DEFAULT gst_tee_debug GstElementDetails gst_tee_details = { "Tee pipe fitting", @@ -127,7 +133,7 @@ gst_tee_sinklink (GstPad *pad, GstCaps *caps) GstPadLinkReturn set_retval; GstCaps *caps1; - GST_DEBUG (0, "gst_tee_sinklink caps=%s", gst_caps_to_string(caps)); + GST_DEBUG ( "gst_tee_sinklink caps=%s", gst_caps_to_string(caps)); tee = GST_TEE (gst_pad_get_parent (pad)); @@ -162,7 +168,7 @@ gst_tee_srclink (GstPad *pad, GstCaps *caps) { GstTee *tee; - GST_DEBUG (0, "gst_tee_srclink caps=%s", gst_caps_to_string(caps)); + GST_DEBUG ( "gst_tee_srclink caps=%s", gst_caps_to_string(caps)); tee = GST_TEE (gst_pad_get_parent (pad)); @@ -176,7 +182,7 @@ gst_tee_getcaps (GstPad *pad, GstCaps *filter) GstTee *tee; const GList *pads; - GST_DEBUG (0, "gst_tee_getcaps"); + GST_DEBUG ( "gst_tee_getcaps"); tee = GST_TEE (gst_pad_get_parent (pad)); @@ -380,4 +386,3 @@ gst_tee_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/gst/elements/gsttee.h b/gst/elements/gsttee.h index 68b541daf2..0193bb0fa8 100644 --- a/gst/elements/gsttee.h +++ b/gst/elements/gsttee.h @@ -29,6 +29,7 @@ G_BEGIN_DECLS extern GstElementDetails gst_tee_details; +GST_DEBUG_CATEGORY_EXTERN(gst_tee_debug); #define GST_TYPE_TEE \ (gst_tee_get_type()) diff --git a/gst/gst.c b/gst/gst.c index d90f4d140d..023d567150 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -35,6 +35,8 @@ #endif /* GST_DISABLE_REGISTRY */ #include "gstregistrypool.h" +#define GST_CAT_DEFAULT GST_CAT_GST_INIT + #define MAX_PATH_SPLIT 16 #define GST_PLUGIN_SEPARATOR "," @@ -86,10 +88,11 @@ debug_log_handler (const gchar *log_domain, enum { ARG_VERSION=1, ARG_FATAL_WARNINGS, - ARG_INFO_MASK, - ARG_DEBUG_MASK, - ARG_MASK, - ARG_MASK_HELP, + ARG_DEBUG_LEVEL, + ARG_DEBUG, + ARG_DEBUG_DISABLE, + ARG_DEBUG_NO_COLOR, + ARG_DEBUG_HELP, ARG_DISABLE_CPU_OPT, ARG_PLUGIN_SPEW, ARG_PLUGIN_PATH, @@ -110,10 +113,13 @@ static const struct poptOption gstreamer_options[] = { {NULL, NUL, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, (void *) &init_popt_callback, 0, NULL, NULL}, {"gst-version", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_VERSION, "Print the GStreamer version", NULL}, {"gst-fatal-warnings", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_FATAL_WARNINGS, "Make all warnings fatal", NULL}, - {"gst-info-mask", NUL, POPT_ARG_INT|POPT_ARGFLAG_STRIP, NULL, ARG_INFO_MASK, "info bitmask", "MASK"}, - {"gst-debug-mask", NUL, POPT_ARG_INT|POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG_MASK, "debugging bitmask", "MASK"}, - {"gst-mask", NUL, POPT_ARG_INT|POPT_ARGFLAG_STRIP, NULL, ARG_MASK, "bitmask for both info and debugging", "MASK"}, - {"gst-mask-help", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_MASK_HELP, "how to set the level of diagnostic output (-mask values)", NULL}, +#ifndef GST_DISABLE_GST_DEBUG + {"gst-debug-level", NUL, POPT_ARG_INT|POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG_LEVEL, "default debug level from 1 (only error) to 5 (anything) or 0 for no output", "LEVEL"}, + {"gst-debug", NUL, POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG, "colon-seperated list of category=name pairs to use specific levels", "CATEGORIES"}, + {"gst-debug-no-color", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG_NO_COLOR, "disable color debugging output", NULL}, + {"gst-disable-debug", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG_DISABLE, "disable debugging"}, + {"gst-debug-help", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG_HELP, "print available debug categories and exit", NULL}, +#endif {"gst-disable-cpu-opt",NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_DISABLE_CPU_OPT,"Disable accelerated CPU instructions", NULL}, {"gst-plugin-spew", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_PLUGIN_SPEW, "enable verbose plugin loading diagnostics", NULL}, {"gst-plugin-path", NUL, POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, ARG_PLUGIN_PATH, "'" G_SEARCHPATH_SEPARATOR_S "'--separated path list for loading plugins", "PATHS"}, @@ -235,7 +241,7 @@ gst_init_check_with_popt_table (int *argc, char **argv[], if (gst_initialized) { - GST_DEBUG (GST_CAT_GST_INIT, "already initialized gst\n"); + GST_DEBUG ("already initialized gst"); return TRUE; } @@ -287,7 +293,7 @@ add_path_func (gpointer data, gpointer user_data) { GstRegistry *registry = GST_REGISTRY (user_data); - GST_INFO (GST_CAT_GST_INIT, "Adding plugin path: \"%s\"", (gchar *)data); + GST_INFO ("Adding plugin path: \"%s\"", (gchar *) data); gst_registry_add_path (registry, (gchar *)data); } #endif @@ -298,6 +304,34 @@ prepare_for_load_plugin_func (gpointer data, gpointer user_data) preload_plugins = g_slist_prepend (preload_plugins, data); } +static void +parse_debug_list (const gchar *list) +{ + gchar **split; + gchar **walk; + + g_return_if_fail (list != NULL); + + walk = split = g_strsplit (list, ":", 0); + + while (walk[0]) { + gchar **values = g_strsplit ( walk[0], "=", 2); + if (values[0] && values[1]) { + gint level = 0; + g_strstrip (values[0]); + g_strstrip (values[1]); + level = strtol (values[1], NULL, 0); + if (level >= 0 && level < GST_LEVEL_COUNT) { + GST_DEBUG ("setting debugging to level %d for name \"%s\"", + level, values[0]); + gst_debug_set_threshold_for_name (values[0], level); + } + } + g_strfreev (values); + walk++; + } + g_strfreev (split); +} static void load_plugin_func (gpointer data, gpointer user_data) { @@ -311,22 +345,16 @@ load_plugin_func (gpointer data, gpointer user_data) ret = gst_plugin_load_plugin (plugin, NULL); if (ret) { - GST_INFO (GST_CAT_GST_INIT, "Loaded plugin: \"%s\"", filename); + GST_INFO ("Loaded plugin: \"%s\"", filename); gst_registry_pool_add_plugin (plugin); + } else { + GST_WARNING ("Failed to load plugin: \"%s\"", filename); } - else - GST_INFO (GST_CAT_GST_INIT, "Failed to load plugin: \"%s\"", filename); g_free (data); } -static void -parse_number (const gchar *number, gint32 *val) -{ - *val = strtol(number,NULL,0); -} - static void split_and_iterate (const gchar *stringlist, gchar *separator, GFunc iterator, gpointer user_data) { @@ -355,8 +383,20 @@ split_and_iterate (const gchar *stringlist, gchar *separator, GFunc iterator, gp static gboolean init_pre (void) { + g_type_init (); + _gst_debug_init(); +#ifndef GST_DISABLE_REGISTRY + { + const gchar *debug_list; + + debug_list = g_getenv ("GST_DEBUG"); + if (debug_list) { + parse_debug_list (debug_list); + } + } +#endif #ifndef GST_DISABLE_REGISTRY { gchar *user_reg; @@ -454,9 +494,8 @@ init_post (void) llf = G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL; g_log_set_handler (g_log_domain_gstreamer, llf, debug_log_handler, NULL); - GST_INFO (GST_CAT_GST_INIT, - "Initializing GStreamer Core Library version %s %s", - GST_VERSION, _gst_use_threads?"":"(no threads)"); + GST_INFO ("Initializing GStreamer Core Library version %s %s", + VERSION, _gst_use_threads ? "" : "(no threads)"); _gst_format_initialize (); _gst_query_type_initialize (); @@ -537,29 +576,39 @@ init_post (void) } static void -gst_mask_help (void) +gst_debug_help (void) { - guint i; + GSList *cats, *walk; - g_print ("\n Mask (to be OR'ed) info/debug FLAGS \n"); - g_print ("--------------------------------------------------------\n"); - - for (i = 0; idata; + + if (gst_debug_is_colored ()) { + gchar *color = gst_debug_construct_term_color (cat->color); + g_print ("%s%-20s\033[00m %1d %s %s%s\033[00m\n", + color, + gst_debug_category_get_name (cat), + gst_debug_category_get_threshold (cat), + gst_debug_level_get_name (gst_debug_category_get_threshold (cat)), + color, + gst_debug_category_get_description (cat)); + g_free (color); + } else { + g_print ("%-20s %1d %s %s\n", gst_debug_category_get_name (cat), + gst_debug_category_get_threshold (cat), + gst_debug_level_get_name (gst_debug_category_get_threshold (cat)), + gst_debug_category_get_description (cat)); } - } + walk = g_slist_next (walk); + } + g_print ("\n"); } @@ -567,7 +616,6 @@ static void init_popt_callback (poptContext context, enum poptCallbackReason reason, const struct poptOption *option, const char *arg, void *data) { - gint32 val = 0; GLogLevelFlags fatal_mask; if (gst_initialized) @@ -586,21 +634,25 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason, fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; g_log_set_always_fatal (fatal_mask); break; - case ARG_INFO_MASK: - parse_number (arg, &val); - gst_info_set_categories ((guint32) val); + case ARG_DEBUG_LEVEL: { + gint tmp = 0; + tmp = strtol (arg, NULL, 0); + if (tmp >= 0 && tmp < GST_LEVEL_COUNT) { + gst_debug_set_default_threshold (tmp); + } break; - case ARG_DEBUG_MASK: - parse_number (arg, &val); - gst_debug_set_categories ((guint32) val); + } + case ARG_DEBUG: + parse_debug_list (arg); break; - case ARG_MASK: - parse_number (arg, &val); - gst_debug_set_categories ((guint32) val); - gst_info_set_categories ((guint32) val); + case ARG_DEBUG_NO_COLOR: + gst_debug_set_colored (FALSE); break; - case ARG_MASK_HELP: - gst_mask_help (); + case ARG_DEBUG_DISABLE: + gst_debug_set_active (FALSE); + break; + case ARG_DEBUG_HELP: + gst_debug_help (); exit (0); case ARG_DISABLE_CPU_OPT: _gst_enable_cpu_opt = FALSE; diff --git a/gst/gst_private.h b/gst/gst_private.h index 446e42ba46..400c6d5afe 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -25,7 +25,8 @@ #define __GST_PRIVATE_H__ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" +#endif /***** until we have gettext set up properly, don't even try this*/ #if 0 @@ -48,12 +49,44 @@ # endif /* ENABLE_NLS */ #endif -#endif /* HAVE_CONFIG_H */ - - #include #include +/*** debugging categories *****************************************************/ + +#ifndef GST_DISABLE_GST_DEBUG + #include +extern GstDebugCategory *GST_CAT_GST_INIT; +extern GstDebugCategory *GST_CAT_COTHREADS; +extern GstDebugCategory *GST_CAT_COTHREAD_SWITCH; +extern GstDebugCategory *GST_CAT_AUTOPLUG; +extern GstDebugCategory *GST_CAT_AUTOPLUG_ATTEMPT; +extern GstDebugCategory *GST_CAT_PARENTAGE; +extern GstDebugCategory *GST_CAT_STATES; +extern GstDebugCategory *GST_CAT_PLANNING; +extern GstDebugCategory *GST_CAT_SCHEDULING; +extern GstDebugCategory *GST_CAT_DATAFLOW; +extern GstDebugCategory *GST_CAT_BUFFER; +extern GstDebugCategory *GST_CAT_CAPS; +extern GstDebugCategory *GST_CAT_CLOCK; +extern GstDebugCategory *GST_CAT_ELEMENT_PADS; +extern GstDebugCategory *GST_CAT_ELEMENT_FACTORY; +extern GstDebugCategory *GST_CAT_PADS; +extern GstDebugCategory *GST_CAT_PIPELINE; +extern GstDebugCategory *GST_CAT_PLUGIN_LOADING; +extern GstDebugCategory *GST_CAT_PLUGIN_INFO; +extern GstDebugCategory *GST_CAT_PROPERTIES; +extern GstDebugCategory *GST_CAT_THREAD; +extern GstDebugCategory *GST_CAT_TYPES; +extern GstDebugCategory *GST_CAT_XML; +extern GstDebugCategory *GST_CAT_NEGOTIATION; +extern GstDebugCategory *GST_CAT_REFCOUNTING; +extern GstDebugCategory *GST_CAT_EVENT; +extern GstDebugCategory *GST_CAT_PARAMS; +extern GstDebugCategory *GST_CAT_CALL_TRACE; + +#endif + #endif /* __GST_PRIVATE_H__ */ diff --git a/gst/gstautoplug.c b/gst/gstautoplug.c index bcca35c960..2aa7e40fc5 100644 --- a/gst/gstautoplug.c +++ b/gst/gstautoplug.c @@ -20,15 +20,14 @@ * Boston, MA 02111-1307, USA. */ -/* #define GST_DEBUG_ENABLED */ - -#include #include "gst_private.h" +#include + #include "gstautoplug.h" #include "gstregistrypool.h" -#include "gstlog.h" +#include "gstinfo.h" enum { NEW_OBJECT, @@ -327,7 +326,7 @@ gst_autoplug_factory_find (const gchar *name) g_return_val_if_fail (name != NULL, NULL); - GST_DEBUG (0,"gstautoplug: find \"%s\"", name); + GST_DEBUG ("gstautoplug: find \"%s\"", name); feature = gst_registry_pool_find_feature (name, GST_TYPE_AUTOPLUG_FACTORY); if (feature) diff --git a/gst/gstbin.c b/gst/gstbin.c index fb0ff5a368..66f9a07bff 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -21,13 +21,12 @@ * Boston, MA 02111-1307, USA. */ -/* #define GST_DEBUG_ENABLED */ #include "gst_private.h" #include "gstevent.h" #include "gstbin.h" #include "gstxml.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstscheduler.h" #include "gstindex.h" @@ -258,19 +257,19 @@ gst_bin_set_index (GstElement *element, GstIndex *index) static void gst_bin_set_element_sched (GstElement *element, GstScheduler *sched) { - GST_INFO (GST_CAT_SCHEDULING, "setting element \"%s\" sched to %p", GST_ELEMENT_NAME (element), + GST_CAT_INFO (GST_CAT_SCHEDULING, "setting element \"%s\" sched to %p", GST_ELEMENT_NAME (element), sched); /* 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_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: child is already a manager, not resetting", GST_ELEMENT_NAME (element)); if (GST_ELEMENT_SCHED (element)) gst_scheduler_add_scheduler (sched, GST_ELEMENT_SCHED (element)); return; } - GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to parent's"); + GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: setting children's schedule to parent's", GST_ELEMENT_NAME (element)); gst_scheduler_add_element (sched, element); /* set the children's schedule */ @@ -297,7 +296,7 @@ gst_bin_set_element_sched (GstElement *element, GstScheduler *sched) /* if the peer element exists and is a candidate */ if (GST_PAD_PEER (pad)) { if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) { - GST_INFO (GST_CAT_SCHEDULING, + GST_CAT_INFO (GST_CAT_SCHEDULING, "peer is in same scheduler, telling scheduler"); if (GST_PAD_IS_SRC (pad)) @@ -315,20 +314,20 @@ static void gst_bin_unset_element_sched (GstElement *element, GstScheduler *sched) { if (GST_ELEMENT_SCHED (element) == NULL) { - GST_INFO (GST_CAT_SCHEDULING, "element \"%s\" has no scheduler", + GST_CAT_INFO (GST_CAT_SCHEDULING, "element \"%s\" has no scheduler", GST_ELEMENT_NAME (element)); return; } - GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from its sched %p", + GST_CAT_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from its sched %p", GST_ELEMENT_NAME (element), GST_ELEMENT_SCHED (element)); /* 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 unsetting sched"); + GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: child is already a manager, not unsetting sched", + GST_ELEMENT_NAME (element)); if (sched) { gst_scheduler_remove_scheduler (sched, GST_ELEMENT_SCHED (element)); } @@ -358,7 +357,7 @@ gst_bin_unset_element_sched (GstElement *element, GstScheduler *sched) /* if the peer element exists and is a candidate */ if (GST_PAD_PEER (pad)) { if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) { - GST_INFO (GST_CAT_SCHEDULING, "peer is in same scheduler, telling scheduler"); + GST_CAT_INFO (GST_CAT_SCHEDULING, "peer is in same scheduler, telling scheduler"); if (GST_PAD_IS_SRC (pad)) gst_scheduler_pad_unlink (sched, pad, GST_PAD_PEER (pad)); @@ -437,7 +436,8 @@ gst_bin_add_func (GstBin *bin, GstElement *element) gst_bin_set_element_sched (element, sched); } - GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "added child \"%s\"", GST_ELEMENT_NAME (element)); + GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: added child \"%s\"", + GST_ELEMENT_NAME (bin), GST_ELEMENT_NAME (element)); g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_ADDED], 0, element); } @@ -458,7 +458,7 @@ gst_bin_add (GstBin *bin, GstElement *element) g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (GST_IS_ELEMENT (element)); - GST_DEBUG (GST_CAT_PARENTAGE, "adding element \"%s\" to bin \"%s\"", + GST_CAT_DEBUG (GST_CAT_PARENTAGE, "adding element \"%s\" to bin \"%s\"", GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin)); bclass = GST_BIN_GET_CLASS (bin); @@ -499,7 +499,8 @@ gst_bin_remove_func (GstBin *bin, GstElement *element) while (state >>= 1) state_idx++; bin->child_states[state_idx]--; - GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", GST_ELEMENT_NAME (element)); + GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: removed child %s", + GST_ELEMENT_NAME (bin), GST_ELEMENT_NAME (element)); /* ref as we're going to emit a signal */ gst_object_ref (GST_OBJECT (element)); @@ -532,7 +533,7 @@ gst_bin_remove (GstBin *bin, GstElement *element) { GstBinClass *bclass; - GST_DEBUG_ELEMENT (GST_CAT_PARENTAGE, bin, "trying to remove child %s", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_PARENTAGE, "[%s]: trying to remove child %s", GST_ELEMENT_NAME (bin), GST_ELEMENT_NAME (element)); g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (GST_IS_ELEMENT (element)); @@ -594,7 +595,7 @@ gst_bin_child_state_change (GstBin *bin, GstElementState oldstate, g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (GST_IS_ELEMENT (child)); - GST_INFO (GST_CAT_STATES, "child %s changed state in bin %s from %s to %s", + GST_CAT_INFO (GST_CAT_STATES, "child %s changed state in bin %s from %s to %s", GST_ELEMENT_NAME (child), GST_ELEMENT_NAME (bin), gst_element_state_get_name (oldstate), gst_element_state_get_name (newstate)); @@ -626,7 +627,7 @@ gst_bin_child_state_change_func (GstBin *bin, GstElementState oldstate, if (bin->child_states[i] != 0) { gint state = (1 << i); if (GST_STATE (bin) != state) { - GST_INFO (GST_CAT_STATES, "bin %s need state change to %s", + GST_CAT_INFO (GST_CAT_STATES, "bin %s need state change to %s", GST_ELEMENT_NAME (bin), gst_element_state_get_name (state)); GST_STATE_PENDING (bin) = state; GST_UNLOCK (bin); @@ -663,19 +664,17 @@ gst_bin_change_state (GstElement * element) pending = GST_STATE_PENDING (element); transition = GST_STATE_TRANSITION (element); - GST_INFO_ELEMENT (GST_CAT_STATES, element, - "changing childrens' state from %s to %s", - gst_element_state_get_name (old_state), - gst_element_state_get_name (pending)); + GST_CAT_INFO (GST_CAT_STATES, "[%s]: changing childrens' state from %s to %s", + GST_ELEMENT_NAME (element), + gst_element_state_get_name (old_state), gst_element_state_get_name (pending)); if (pending == GST_STATE_VOID_PENDING) return GST_STATE_SUCCESS; if (old_state == pending) { - GST_INFO_ELEMENT (GST_CAT_STATES, element, - "old and pending state are both %s, returning", - gst_element_state_get_name (pending)); + GST_CAT_INFO (GST_CAT_STATES, "[%s]: old and pending state are both %s, returning", + GST_ELEMENT_NAME (element), gst_element_state_get_name (pending)); return GST_STATE_SUCCESS; } @@ -694,8 +693,7 @@ gst_bin_change_state (GstElement * element) switch (gst_element_set_state (child, pending)) { case GST_STATE_FAILURE: - GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING; - GST_DEBUG (GST_CAT_STATES, "child '%s' failed to go to state %d(%s)", + GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' failed to go to state %d(%s)", GST_ELEMENT_NAME (child), pending, gst_element_state_get_name (pending)); gst_element_set_state (child, old_child_state); @@ -709,7 +707,7 @@ gst_bin_change_state (GstElement * element) } break; case GST_STATE_ASYNC: - GST_DEBUG (GST_CAT_STATES, "child '%s' is changing state asynchronously", + GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' is changing state asynchronously", GST_ELEMENT_NAME (child)); have_async = TRUE; break; @@ -718,7 +716,8 @@ gst_bin_change_state (GstElement * element) } } - GST_INFO_ELEMENT (GST_CAT_STATES, element, "done changing bin's state from %s to %s, now in %s", + GST_CAT_INFO (GST_CAT_STATES, "[%s]: done changing bin's state from %s to %s, now in %s", + GST_ELEMENT_NAME (element), gst_element_state_get_name (old_state), gst_element_state_get_name (pending), gst_element_state_get_name (GST_STATE (element))); @@ -742,7 +741,7 @@ gst_bin_change_state_norecurse (GstBin * bin) GstElementStateReturn ret; if (parent_class->change_state) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, bin, "setting bin's own state"); + GST_CAT_DEBUG (GST_CAT_STATES, "[%s]: setting bin's own state", GST_ELEMENT_NAME (bin)); ret = parent_class->change_state (GST_ELEMENT (bin)); return ret; @@ -758,7 +757,7 @@ gst_bin_dispose (GObject * object) GList *children, *orig; GstElement *child; - GST_DEBUG (GST_CAT_REFCOUNTING, "dispose"); + GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "dispose"); if (gst_element_get_state (GST_ELEMENT (object)) == GST_STATE_PLAYING) gst_element_set_state (GST_ELEMENT (object), GST_STATE_PAUSED); @@ -798,7 +797,8 @@ gst_bin_get_by_name (GstBin * bin, const gchar * name) g_return_val_if_fail (GST_IS_BIN (bin), NULL); g_return_val_if_fail (name != NULL, NULL); - GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "looking up child element %s", name); + GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: looking up child element %s", + GST_ELEMENT_NAME (bin), name); children = bin->children; while (children) { @@ -890,7 +890,7 @@ gst_bin_sync_children_state (GstBin *bin) state = GST_STATE (bin); children = bin->children; - GST_INFO (GST_CAT_STATES, "syncing state of children with bin \"%s\"'s state %s", + GST_CAT_INFO (GST_CAT_STATES, "syncing state of children with bin \"%s\"'s state %s", GST_ELEMENT_NAME (bin), gst_element_state_get_name (state)); while (children) { @@ -929,7 +929,8 @@ gst_bin_save_thyself (GstObject * object, xmlNodePtr parent) childlist = xmlNewChild (parent, NULL, "children", NULL); - GST_INFO_ELEMENT (GST_CAT_XML, bin, "saving %d children", bin->numchildren); + GST_CAT_INFO (GST_CAT_XML, "[%s]: saving %d children", + GST_ELEMENT_NAME (bin), bin->numchildren); children = bin->children; while (children) { @@ -950,7 +951,7 @@ gst_bin_restore_thyself (GstObject * object, xmlNodePtr self) while (field) { if (!strcmp (field->name, "children")) { - GST_INFO_ELEMENT (GST_CAT_XML, GST_ELEMENT (object), "loading children"); + GST_CAT_INFO (GST_CAT_XML, "[%s]: loading children", GST_ELEMENT_NAME (object)); childlist = field->xmlChildrenNode; while (childlist) { if (!strcmp (childlist->name, "element")) { @@ -1012,7 +1013,7 @@ gst_bin_iterate (GstBin *bin) GstBinClass *oclass; gboolean running = TRUE; - GST_DEBUG_ENTER ("(\"%s\")", GST_ELEMENT_NAME (bin)); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, bin, "starting iteration"); g_return_val_if_fail (bin != NULL, FALSE); g_return_val_if_fail (GST_IS_BIN (bin), FALSE); @@ -1030,15 +1031,14 @@ gst_bin_iterate (GstBin *bin) if (bin->post_iterate_func) (bin->post_iterate_func) (bin, bin->post_iterate_data); - GST_DEBUG_LEAVE ("(\"%s\") %d", GST_ELEMENT_NAME (bin), running); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, bin, "finished iteration"); if (!running) { if (GST_STATE (bin) == GST_STATE_PLAYING && GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, bin, - "polling for child shutdown after useless iteration"); - usleep (1); - //gst_element_wait_state_change (GST_ELEMENT (bin)); + GST_CAT_DEBUG (GST_CAT_DATAFLOW, "[%s]: polling for child shutdown after useless iteration", + GST_ELEMENT_NAME (bin)); + g_usleep (1); running = TRUE; } } diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 6ffe635221..c7a0f16e1d 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -20,15 +20,13 @@ * Boston, MA 02111-1307, USA. */ -/* this file makes too much noise for most debugging sessions */ -#define GST_DEBUG_FORCE_DISABLE #include "gst_private.h" #include "gstatomic_impl.h" #include "gstdata_private.h" #include "gstbuffer.h" #include "gstmemchunk.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstbufferpool-default.h" GType _gst_buffer_type; @@ -63,7 +61,7 @@ _gst_buffer_initialize (void) chunk = gst_mem_chunk_new ("GstBufferChunk", sizeof (GstBuffer), sizeof (GstBuffer) * 200, 0); - GST_INFO (GST_CAT_BUFFER, "Buffers are initialized now"); + GST_CAT_INFO (GST_CAT_BUFFER, "Buffers are initialized now"); } GType @@ -192,7 +190,7 @@ gst_buffer_new (void) gst_alloc_trace_new (_gst_buffer_trace, newbuf); #endif - GST_DEBUG (GST_CAT_BUFFER, "new %p", newbuf); + GST_CAT_LOG (GST_CAT_BUFFER, "new %p", newbuf); _GST_DATA_INIT (GST_DATA (newbuf), _gst_buffer_type, @@ -312,7 +310,7 @@ gst_buffer_create_sub (GstBuffer *parent, guint offset, guint size) gst_alloc_trace_new (_gst_buffer_trace, buffer); #endif - GST_DEBUG (GST_CAT_BUFFER, "new %p", buf); + GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p", buffer); /* make sure nobody overwrites data in the new buffer * by setting the READONLY flag */ @@ -435,7 +433,7 @@ gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len) buf1->data - parent->data + offset, len); } else { - GST_DEBUG (GST_CAT_BUFFER, "slow path taken while spanning buffers %p and %p", + GST_CAT_DEBUG (GST_CAT_BUFFER, "slow path taken while spanning buffers %p and %p", buf1, buf2); /* otherwise we simply have to brute-force copy the buffers */ newbuf = gst_buffer_new_and_alloc (len); @@ -524,7 +522,7 @@ gst_buffer_pool_new (GstDataFreeFunction free, gst_alloc_trace_new (_gst_buffer_pool_trace, pool); #endif - GST_DEBUG (GST_CAT_BUFFER, "allocating new buffer pool %p\n", pool); + GST_CAT_DEBUG (GST_CAT_BUFFER, "allocating new buffer pool %p\n", pool); /* init data struct */ _GST_DATA_INIT (GST_DATA (pool), diff --git a/gst/gstbufferpool-default.c b/gst/gstbufferpool-default.c index a36b652ca9..7d3806ecdf 100644 --- a/gst/gstbufferpool-default.c +++ b/gst/gstbufferpool-default.c @@ -20,11 +20,12 @@ * Boston, MA 02111-1307, USA. */ +#include "gst_private.h" + #include "gstbuffer.h" #include "gstinfo.h" #include "gstmemchunk.h" - /* methods prefixed with underscores to avoid namespace collisions with * gstbuffer.c */ @@ -106,7 +107,7 @@ gst_buffer_pool_get_default (guint buffer_size, guint pool_size) g_hash_table_insert (_default_pools, GINT_TO_POINTER (real_buffer_size), pool); g_mutex_unlock (_default_pool_lock); - GST_DEBUG (GST_CAT_BUFFER,"new default buffer pool %p bytes:%d size:%d", + GST_CAT_DEBUG (GST_CAT_BUFFER,"new default buffer pool %p bytes:%d size:%d", pool, real_buffer_size, pool_size); return pool; @@ -121,7 +122,7 @@ _gst_buffer_pool_default_buffer_new (GstBufferPool *pool, guint64 offset, GstMemChunk *data_chunk = def->mem_chunk; buffer = gst_buffer_new (); - GST_INFO (GST_CAT_BUFFER, "creating new buffer %p from pool %p", buffer, pool); + GST_CAT_INFO (GST_CAT_BUFFER, "creating new buffer %p from pool %p", buffer, pool); GST_BUFFER_DATA (buffer) = gst_mem_chunk_alloc (data_chunk); @@ -155,7 +156,7 @@ _gst_buffer_pool_default_free (GstData *data) real_buffer_size = (((def->size-1) / 32) + 1) * 32; - GST_DEBUG (GST_CAT_BUFFER,"destroying default buffer pool %p bytes:%d size:%d", + GST_CAT_DEBUG (GST_CAT_BUFFER,"destroying default buffer pool %p bytes:%d size:%d", pool, real_buffer_size, def->size); g_mutex_lock (_default_pool_lock); diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 21a6cdf396..01f206b8cb 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -25,7 +25,7 @@ #include "gstcaps.h" #include "gsttype.h" #include "gstmemchunk.h" -#include "gstlog.h" +#include "gstinfo.h" #ifndef GST_DISABLE_TRACE /* #define GST_WITH_ALLOC_TRACE */ @@ -253,7 +253,7 @@ gst_caps_new_id (const gchar *name, const guint16 id, GstProps *props) gst_alloc_trace_new (_gst_caps_trace, caps); #endif - GST_DEBUG (GST_CAT_CAPS, "new %p, props %p", caps, props); + GST_CAT_LOG (GST_CAT_CAPS, "new %p, props %p", caps, props); gst_props_ref (props); gst_props_sink (props); @@ -318,7 +318,7 @@ gst_caps_destroy (GstCaps *caps) next = caps->next; - GST_DEBUG (GST_CAT_CAPS, "destroy %p", caps); + GST_CAT_LOG (GST_CAT_CAPS, "destroy %p", caps); gst_props_unref (caps->properties); g_free (caps->name); @@ -342,10 +342,14 @@ gst_caps_destroy (GstCaps *caps) void gst_caps_debug (GstCaps *caps, const gchar *label) { - GST_DEBUG_ENTER ("caps debug: %s", label); + GST_CAT_DEBUG (GST_CAT_CAPS, "starting caps debug: %s", label); + if (caps && caps->refcount == 0) { + g_warning ("Warning: refcount of caps %s is 0", label); + return; + } while (caps) { - GST_DEBUG (GST_CAT_CAPS, "caps: %p %s %s (%sfixed) (refcount %d) %s", + GST_CAT_DEBUG (GST_CAT_CAPS, "caps: %p %s %s (%sfixed) (refcount %d) %s", caps, caps->name, gst_caps_get_mime (caps), GST_CAPS_IS_FIXED (caps) ? "" : "NOT ", caps->refcount, GST_CAPS_IS_FLOATING (caps) ? "FLOATING" : ""); @@ -354,12 +358,12 @@ gst_caps_debug (GstCaps *caps, const gchar *label) gst_props_debug (caps->properties); } else { - GST_DEBUG (GST_CAT_CAPS, "no properties"); + GST_CAT_DEBUG (GST_CAT_CAPS, "no properties"); } caps = caps->next; } - GST_DEBUG_LEAVE ("caps debug"); + GST_CAT_DEBUG (GST_CAT_CAPS, "finished caps debug"); } /** @@ -381,7 +385,7 @@ gst_caps_unref (GstCaps *caps) g_return_val_if_fail (caps->refcount > 0, NULL); - GST_DEBUG (GST_CAT_CAPS, "unref %p (%d->%d) %d", + GST_CAT_LOG (GST_CAT_CAPS, "unref %p (%d->%d) %d", caps, caps->refcount, caps->refcount-1, GST_CAPS_FLAGS (caps)); caps->refcount--; @@ -410,7 +414,7 @@ gst_caps_ref (GstCaps *caps) g_return_val_if_fail (caps->refcount > 0, NULL); - GST_DEBUG (GST_CAT_CAPS, "ref %p (%d->%d) %d", + GST_CAT_LOG (GST_CAT_CAPS, "ref %p (%d->%d) %d", caps, caps->refcount, caps->refcount+1, GST_CAPS_FLAGS (caps)); caps->refcount++; @@ -431,7 +435,7 @@ gst_caps_sink (GstCaps *caps) return; if (GST_CAPS_IS_FLOATING (caps)) { - GST_DEBUG (GST_CAT_CAPS, "sink %p", caps); + GST_CAT_LOG (GST_CAT_CAPS, "sink %p", caps); GST_CAPS_FLAG_UNSET (caps, GST_CAPS_FLOATING); gst_caps_unref (caps); @@ -785,7 +789,7 @@ static gboolean gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps) { if (fromcaps->id != tocaps->id) { - GST_DEBUG (GST_CAT_CAPS,"mime types differ (%s to %s)", + GST_CAT_DEBUG (GST_CAT_CAPS,"mime types differ (%s to %s)", gst_type_find_by_id (fromcaps->id)->mime, gst_type_find_by_id (tocaps->id)->mime); return FALSE; @@ -796,13 +800,13 @@ gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps) return gst_props_check_compatibility (fromcaps->properties, tocaps->properties); } else { - GST_DEBUG (GST_CAT_CAPS,"no source caps"); + GST_CAT_DEBUG (GST_CAT_CAPS,"no source caps"); return FALSE; } } else { /* assume it accepts everything */ - GST_DEBUG (GST_CAT_CAPS,"no caps"); + GST_CAT_DEBUG (GST_CAT_CAPS,"no caps"); return TRUE; } } @@ -823,13 +827,13 @@ gst_caps_is_always_compatible (GstCaps *fromcaps, GstCaps *tocaps) if (fromcaps == NULL) { if (tocaps == NULL) { /* if both are NULL, they can always link. Think filesrc ! filesink */ - GST_DEBUG (GST_CAT_CAPS, "both caps NULL, compatible"); + GST_CAT_DEBUG (GST_CAT_CAPS, "both caps NULL, compatible"); return TRUE; } else { /* if source caps are NULL, it could be sending anything, so the * destination can't know if it can accept this. Think filesrc ! mad */ - GST_DEBUG (GST_CAT_CAPS, "source caps NULL, not guaranteed compatible"); + GST_CAT_DEBUG (GST_CAT_CAPS, "source caps NULL, not guaranteed compatible"); return FALSE; } } @@ -837,7 +841,7 @@ gst_caps_is_always_compatible (GstCaps *fromcaps, GstCaps *tocaps) if (tocaps == NULL) { /* if the dest caps are NULL, the element can accept anything, always, * so they're compatible by definition. Think mad ! filesink */ - GST_DEBUG (GST_CAT_CAPS,"destination caps NULL"); + GST_CAT_DEBUG (GST_CAT_CAPS,"destination caps NULL"); return TRUE; } } @@ -868,7 +872,7 @@ gst_caps_intersect_func (GstCaps *caps1, GstCaps *caps2) GstProps *props; if (caps1->id != caps2->id) { - GST_DEBUG (GST_CAT_CAPS, "mime types differ (%s to %s)", + GST_CAT_DEBUG (GST_CAT_CAPS, "mime types differ (%s to %s)", gst_type_find_by_id (caps1->id)->mime, gst_type_find_by_id (caps2->id)->mime); return NULL; @@ -907,14 +911,14 @@ gst_caps_intersect (GstCaps *caps1, GstCaps *caps2) GstCaps *result = NULL, *walk = NULL; /* printing the name is not useful here since caps can be chained */ - GST_DEBUG (GST_CAT_CAPS, "intersecting caps %p and %p", caps1, caps2); + GST_CAT_DEBUG (GST_CAT_CAPS, "intersecting caps %p and %p", caps1, caps2); if (caps1 == NULL) { - GST_DEBUG (GST_CAT_CAPS, "first caps is NULL, return other caps"); + GST_CAT_DEBUG (GST_CAT_CAPS, "first caps is NULL, return other caps"); return gst_caps_ref (caps2); } if (caps2 == NULL) { - GST_DEBUG (GST_CAT_CAPS, "second caps is NULL, return other caps"); + GST_CAT_DEBUG (GST_CAT_CAPS, "second caps is NULL, return other caps"); return gst_caps_ref (caps1); } @@ -953,14 +957,14 @@ gst_caps_union (GstCaps *caps1, GstCaps *caps2) GstCaps *result = NULL; /* printing the name is not useful here since caps can be chained */ - GST_DEBUG (GST_CAT_CAPS, "making union of caps %p and %p", caps1, caps2); + GST_CAT_DEBUG (GST_CAT_CAPS, "making union of caps %p and %p", caps1, caps2); if (caps1 == NULL) { - GST_DEBUG (GST_CAT_CAPS, "first caps is NULL, return other caps"); + GST_CAT_DEBUG (GST_CAT_CAPS, "first caps is NULL, return other caps"); return gst_caps_ref (caps2); } if (caps2 == NULL) { - GST_DEBUG (GST_CAT_CAPS, "second caps is NULL, return other caps"); + GST_CAT_DEBUG (GST_CAT_CAPS, "second caps is NULL, return other caps"); return gst_caps_ref (caps1); } @@ -986,7 +990,7 @@ gst_caps_normalize (GstCaps *caps) if (caps == NULL) return caps; - GST_DEBUG (GST_CAT_CAPS, "normalizing caps %p ", caps); + GST_CAT_DEBUG (GST_CAT_CAPS, "normalizing caps %p ", caps); walk = caps; diff --git a/gst/gstclock.c b/gst/gstclock.c index 527df3a94c..20b6daf194 100644 --- a/gst/gstclock.c +++ b/gst/gstclock.c @@ -23,8 +23,9 @@ #include #include "gst_private.h" + #include "gstclock.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstmemchunk.h" #ifndef GST_DISABLE_TRACE @@ -166,7 +167,7 @@ gst_clock_id_wait (GstClockID id, GstClockTimeDiff *jitter) requested = GST_CLOCK_ENTRY_TIME (entry); if (! GST_CLOCK_TIME_IS_VALID (requested)) { - GST_DEBUG (GST_CAT_CLOCK, "invalid time requested, returning _TIMEOUT"); + GST_CAT_DEBUG (GST_CAT_CLOCK, "invalid time requested, returning _TIMEOUT"); return GST_CLOCK_TIMEOUT; } @@ -180,12 +181,12 @@ gst_clock_id_wait (GstClockID id, GstClockTimeDiff *jitter) clock->entries = g_list_prepend (clock->entries, entry); GST_UNLOCK (clock); - GST_DEBUG (GST_CAT_CLOCK, "waiting on clock"); + GST_CAT_DEBUG (GST_CAT_CLOCK, "waiting on clock"); do { res = cclass->wait (clock, entry); } while (res == GST_CLOCK_ENTRY_RESTART); - GST_DEBUG (GST_CAT_CLOCK, "done waiting"); + GST_CAT_DEBUG (GST_CAT_CLOCK, "done waiting"); GST_LOCK (clock); clock->entries = g_list_remove (clock->entries, entry); @@ -600,7 +601,7 @@ gst_clock_handle_discont (GstClock *clock, guint64 time) { GstClockTime itime = G_GINT64_CONSTANT (0); - GST_DEBUG (GST_CAT_CLOCK, "clock discont %" G_GUINT64_FORMAT + GST_CAT_DEBUG (GST_CAT_CLOCK, "clock discont %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %d", time, clock->start_time, clock->accept_discont); @@ -619,7 +620,7 @@ gst_clock_handle_discont (GstClock *clock, guint64 time) } else { GST_UNLOCK (clock); - GST_DEBUG (GST_CAT_CLOCK, "clock discont refused %" G_GUINT64_FORMAT + GST_CAT_DEBUG (GST_CAT_CLOCK, "clock discont refused %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT, time, clock->start_time); return FALSE; @@ -631,7 +632,7 @@ gst_clock_handle_discont (GstClock *clock, guint64 time) g_list_foreach (clock->entries, (GFunc) gst_clock_reschedule_func, NULL); GST_UNLOCK (clock); - GST_DEBUG (GST_CAT_CLOCK, "new time %" G_GUINT64_FORMAT, + GST_CAT_DEBUG (GST_CAT_CLOCK, "new time %" G_GUINT64_FORMAT, gst_clock_get_time (clock)); g_mutex_lock (clock->active_mutex); diff --git a/gst/gstconfig.h b/gst/gstconfig.h deleted file mode 100644 index e16af082af..0000000000 --- a/gst/gstconfig.h +++ /dev/null @@ -1,24 +0,0 @@ -/* This header interprets the various GST_* macros that are typically * - * provided by the gstreamer-config or gstreamer.pc files. */ - -#ifndef __GST_CONFIG_H__ -#define __GST_CONFIG_H__ - - -/***** We include config.h in case someone perhaps used a gstreamer.m4 or - something else that provides funky overrides. BEWARE! *****/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - - -/***** Deal with XML stuff, we have to handle both loadsave and registry *****/ - -#if (! (defined(GST_DISABLE_LOADSAVE) && defined(GST_DISABLE_REGISTRY)) ) -# include -#else -# define GST_DISABLE_LOADSAVE_REGISTRY -#endif - -#endif /* __GST_CONFIG_H__ */ diff --git a/gst/gstconfig.h.in b/gst/gstconfig.h.in new file mode 100644 index 0000000000..2792821695 --- /dev/null +++ b/gst/gstconfig.h.in @@ -0,0 +1,73 @@ +/* This header interprets the various GST_* macros that are typically * + * provided by the gstreamer-config or gstreamer.pc files. */ + +#ifndef __GST_CONFIG_H__ +#define __GST_CONFIG_H__ + +/***** trick gtk-doc into believing these symbols are defined (yes, it's ugly) */ + +#if 0 +#define GST_DISABLE_LOADSAVE_REGISTRY 1 +#define GST_DISABLE_GST_DEBUG 1 +#define GST_DISABLE_LOADSAVE 1 +#define GST_DISABLE_TYPEFIND 1 +#define GST_DISABLE_AUTOPLUG 1 +#define GST_DISABLE_PARSE 1 +#define GST_DISABLE_TRACE 1 +#define GST_DISABLE_ALLOC_TRACE 1 +#define GST_DISABLE_REGISTRY 1 +#define GST_DISABLE_ENUMTYPES 1 +#define GST_DISABLE_INDEX 1 +#define GST_DISABLE_PLUGIN 1 +#define GST_DISABLE_URI 1 +#endif + + +/***** disabling of subsystems *****/ + +/* wether or not the debugging subsystem is enabled */ +@GST_DISABLE_GST_DEBUG_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_LOADSAVE_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_TYPEFIND_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_AUTOPLUG_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_PARSE_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_TRACE_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_ALLOC_TRACE_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_REGISTRY_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_ENUMTYPES_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_INDEX_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_PLUGIN_DEFINE@ + +/* DOES NOT WORK */ +@GST_DISABLE_URI_DEFINE@ + + +/***** Deal with XML stuff, we have to handle both loadsave and registry *****/ + +#if (! (defined(GST_DISABLE_LOADSAVE) && defined(GST_DISABLE_REGISTRY)) ) +# include +#else +# define GST_DISABLE_LOADSAVE_REGISTRY +#endif + +#endif /* __GST_CONFIG_H__ */ diff --git a/gst/gstcpu.c b/gst/gstcpu.c index 75b5ea64e5..41db47d7a7 100644 --- a/gst/gstcpu.c +++ b/gst/gstcpu.c @@ -24,7 +24,9 @@ #include #include "gst_private.h" + #include "gstcpu.h" +#include "gstinfo.h" static guint32 _gst_cpu_flags = 0; @@ -50,7 +52,7 @@ _gst_cpu_initialize (gboolean opt) } else g_string_append (featurelist, "(DISABLED)"); - GST_INFO (GST_CAT_GST_INIT, "CPU features: (%08lx) %s", flags, featurelist->str); + GST_CAT_INFO (GST_CAT_GST_INIT, "CPU features: (%08lx) %s", flags, featurelist->str); g_string_free (featurelist, TRUE); } diff --git a/gst/gstdata.c b/gst/gstdata.c index 3f63ffa8ab..bf1f4ae314 100644 --- a/gst/gstdata.c +++ b/gst/gstdata.c @@ -20,15 +20,12 @@ * Boston, MA 02111-1307, USA. */ -/* this file makes too much noise for most debugging sessions */ - -#define GST_DEBUG_FORCE_DISABLE #include "gst_private.h" #include "gstatomic_impl.h" #include "gstdata.h" #include "gstdata_private.h" -#include "gstlog.h" +#include "gstinfo.h" /** * gst_data_init: @@ -234,8 +231,8 @@ gst_data_unref (GstData *data) g_return_if_fail (data != NULL); - GST_INFO (GST_CAT_BUFFER, "unref data %p, count before unref is %d", - data, GST_DATA_REFCOUNT_VALUE (data)); + GST_CAT_LOG (GST_CAT_BUFFER, "unref data %p, count before unref is %d", + data, GST_DATA_REFCOUNT_VALUE (data)); g_return_if_fail (GST_DATA_REFCOUNT_VALUE (data) > 0); zero = gst_atomic_int_dec_and_test (&data->refcount); diff --git a/gst/gstelement.c b/gst/gstelement.c index 9e87726d44..2a7fd8e54f 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -20,7 +20,6 @@ * Boston, MA 02111-1307, USA. */ -/* #define GST_DEBUG_ENABLED */ #include #include #include @@ -31,7 +30,7 @@ #include "gstscheduler.h" #include "gstevent.h" #include "gstutils.h" -#include "gstlog.h" +#include "gstinfo.h" /* Element signals and args */ enum { @@ -239,7 +238,7 @@ element_get_property (GstElement *element, const GParamSpec *pspec, GValue *valu static void gst_element_threadsafe_properties_pre_run (GstElement *element) { - GST_DEBUG (GST_CAT_THREAD, "locking element %s", GST_OBJECT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "locking element %s", GST_OBJECT_NAME (element)); g_mutex_lock (element->property_mutex); gst_element_set_pending_properties (element); } @@ -247,7 +246,7 @@ gst_element_threadsafe_properties_pre_run (GstElement *element) static void gst_element_threadsafe_properties_post_run (GstElement *element) { - GST_DEBUG (GST_CAT_THREAD, "unlocking element %s", GST_OBJECT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "unlocking element %s", GST_OBJECT_NAME (element)); g_mutex_unlock (element->property_mutex); } @@ -375,7 +374,7 @@ gst_element_set_valist (GstElement *element, const gchar *first_property_name, v object = (GObject *) element; - GST_DEBUG (GST_CAT_PROPERTIES, + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "setting valist of properties starting with %s on element %s", first_property_name, gst_element_get_name (element)); @@ -532,7 +531,7 @@ gst_element_set_property (GstElement *element, const gchar *property_name, object = (GObject*) element; - GST_DEBUG (GST_CAT_PROPERTIES, "setting property %s on element %s", + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "setting property %s on element %s", property_name, gst_element_get_name (element)); if (!GST_FLAG_IS_SET (element, GST_ELEMENT_USE_THREADSAFE_PROPERTIES)) { g_object_set_property (object, property_name, value); @@ -757,11 +756,11 @@ gst_element_clock_wait (GstElement *element, GstClockID id, GstClockTimeDiff *ji g_return_val_if_fail (GST_IS_ELEMENT (element), GST_CLOCK_ERROR); if (GST_ELEMENT_SCHED (element)) { - GST_DEBUG (GST_CAT_CLOCK, "waiting on scheduler clock"); + GST_CAT_DEBUG (GST_CAT_CLOCK, "waiting on scheduler clock"); res = gst_scheduler_clock_wait (GST_ELEMENT_SCHED (element), element, id, jitter); } else { - GST_DEBUG (GST_CAT_CLOCK, "no scheduler, returning GST_CLOCK_TIMEOUT"); + GST_CAT_DEBUG (GST_CAT_CLOCK, "no scheduler, returning GST_CLOCK_TIMEOUT"); res = GST_CLOCK_TIMEOUT; } @@ -877,7 +876,7 @@ gst_element_add_pad (GstElement *element, GstPad *pad) g_return_if_fail (gst_object_check_uniqueness (element->pads, GST_PAD_NAME(pad)) == TRUE); /* set the pad's parent */ - GST_DEBUG (GST_CAT_ELEMENT_PADS,"setting parent of pad '%s' to '%s'", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,"setting parent of pad '%s' to '%s'", GST_PAD_NAME (pad), GST_STR_NULL (GST_ELEMENT_NAME (element))); gst_object_set_parent (GST_OBJECT (pad), GST_OBJECT (element)); @@ -958,20 +957,20 @@ gst_element_add_ghost_pad (GstElement *element, GstPad *pad, const gchar *name) /* then check to see if there's already a pad by that name here */ g_return_val_if_fail (gst_object_check_uniqueness (element->pads, name) == TRUE, NULL); - GST_DEBUG (GST_CAT_ELEMENT_PADS, + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "creating new ghost pad called %s, from pad %s:%s", name, GST_DEBUG_PAD_NAME(pad)); ghostpad = gst_ghost_pad_new (name, pad); /* add it to the list */ - GST_DEBUG(GST_CAT_ELEMENT_PADS,"adding ghost pad %s to element %s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,"adding ghost pad %s to element %s", name, GST_ELEMENT_NAME (element)); element->pads = g_list_append (element->pads, ghostpad); element->numpads++; /* 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",GST_DEBUG_PAD_NAME(ghostpad)); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,"added ghostpad %s:%s",GST_DEBUG_PAD_NAME(ghostpad)); /* emit the NEW_GHOST_PAD signal */ g_signal_emit (G_OBJECT (element), gst_element_signals[NEW_PAD], 0, ghostpad); @@ -1054,13 +1053,13 @@ gst_element_get_static_pad (GstElement *element, const gchar *name) pad = GST_PAD(walk->data); if (strcmp (GST_PAD_NAME(pad), name) == 0) { - GST_INFO (GST_CAT_ELEMENT_PADS, "found pad %s:%s", GST_DEBUG_PAD_NAME (pad)); + GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "found pad %s:%s", GST_DEBUG_PAD_NAME (pad)); return pad; } walk = g_list_next (walk); } - GST_INFO (GST_CAT_ELEMENT_PADS, "no such pad '%s' in element \"%s\"", name, GST_OBJECT_NAME (element)); + GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "no such pad '%s' in element \"%s\"", name, GST_OBJECT_NAME (element)); return NULL; } @@ -1102,7 +1101,7 @@ gst_element_get_request_pad (GstElement *element, const gchar *name) if (templ->presence == GST_PAD_REQUEST) { /* we know that %s and %d are the only possibilities because of sanity checks in gst_pad_template_new */ - GST_DEBUG (GST_CAT_PADS, "comparing %s to %s", name, templ->name_template); + GST_CAT_DEBUG (GST_CAT_PADS, "comparing %s to %s", name, templ->name_template); if ((str = strchr (templ->name_template, '%')) && strncmp (templ->name_template, name, str - templ->name_template) == 0 && strlen (name) > str - templ->name_template) { @@ -1246,7 +1245,7 @@ gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *newtempl = NULL; GList *padlist; - GST_DEBUG (GST_CAT_ELEMENT_PADS, "gst_element_get_compatible_pad_template()"); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "gst_element_get_compatible_pad_template()"); g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); @@ -1263,19 +1262,19 @@ gst_element_get_compatible_pad_template (GstElement *element, * Check direction (must be opposite) * Check caps */ - GST_DEBUG (GST_CAT_CAPS, "checking direction and caps"); + GST_CAT_DEBUG (GST_CAT_CAPS, "checking direction and caps"); if (padtempl->direction == GST_PAD_SRC && compattempl->direction == GST_PAD_SINK) { - GST_DEBUG (GST_CAT_CAPS, "compatible direction: found src pad template"); + GST_CAT_DEBUG (GST_CAT_CAPS, "compatible direction: found src pad template"); comp = gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (padtempl), GST_PAD_TEMPLATE_CAPS (compattempl)); - GST_DEBUG(GST_CAT_CAPS, "caps are %scompatible", (comp ? "" : "not ")); + GST_CAT_DEBUG (GST_CAT_CAPS, "caps are %scompatible", (comp ? "" : "not ")); } else if (padtempl->direction == GST_PAD_SINK && compattempl->direction == GST_PAD_SRC) { - GST_DEBUG (GST_CAT_CAPS, "compatible direction: found sink pad template"); + GST_CAT_DEBUG (GST_CAT_CAPS, "compatible direction: found sink pad template"); comp = gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (compattempl), GST_PAD_TEMPLATE_CAPS (padtempl)); - GST_DEBUG (GST_CAT_CAPS, "caps are %scompatible", (comp ? "" : "not ")); + GST_CAT_DEBUG (GST_CAT_CAPS, "caps are %scompatible", (comp ? "" : "not ")); } if (comp) { @@ -1435,7 +1434,7 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, g_return_val_if_fail (GST_IS_ELEMENT (src), FALSE); g_return_val_if_fail (GST_IS_ELEMENT (dest), FALSE); - GST_INFO (GST_CAT_ELEMENT_PADS, "trying to link element %s:%s to element %s:%s", + GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "trying to link element %s:%s to element %s:%s", GST_ELEMENT_NAME (src), srcpadname ? srcpadname : "(any)", GST_ELEMENT_NAME (dest), destpadname ? destpadname : "(any)"); @@ -1443,15 +1442,15 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, if (srcpadname) { srcpad = gst_element_get_pad (src, srcpadname); if (!srcpad) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "no pad %s:%s", GST_ELEMENT_NAME (src), srcpadname); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no pad %s:%s", GST_ELEMENT_NAME (src), srcpadname); return FALSE; } else { if (!(GST_RPAD_DIRECTION (srcpad) == GST_PAD_SRC)) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no src pad", GST_DEBUG_PAD_NAME (srcpad)); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no src pad", GST_DEBUG_PAD_NAME (srcpad)); return FALSE; } if (GST_PAD_PEER (srcpad) != NULL) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked", GST_DEBUG_PAD_NAME (srcpad)); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked", GST_DEBUG_PAD_NAME (srcpad)); return FALSE; } } @@ -1463,15 +1462,15 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, if (destpadname) { destpad = gst_element_get_pad (dest, destpadname); if (!destpad) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "no pad %s:%s", GST_ELEMENT_NAME (dest), destpadname); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no pad %s:%s", GST_ELEMENT_NAME (dest), destpadname); return FALSE; } else { if (!(GST_RPAD_DIRECTION (destpad) == GST_PAD_SINK)) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no sink pad", GST_DEBUG_PAD_NAME (destpad)); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is no sink pad", GST_DEBUG_PAD_NAME (destpad)); return FALSE; } if (GST_PAD_PEER (destpad) != NULL) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked", GST_DEBUG_PAD_NAME (destpad)); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is already linked", GST_DEBUG_PAD_NAME (destpad)); return FALSE; } } @@ -1488,16 +1487,16 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, if (srcpad) { /* loop through the allowed pads in the source, trying to find a * compatible destination pad */ - GST_DEBUG (GST_CAT_ELEMENT_PADS, "looping through allowed src and dest pads"); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "looping through allowed src and dest pads"); do { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "trying src pad %s:%s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "trying src pad %s:%s", GST_DEBUG_PAD_NAME (srcpad)); if ((GST_RPAD_DIRECTION (srcpad) == GST_PAD_SRC) && (GST_PAD_PEER (srcpad) == NULL)) { GstPad *temp = gst_element_get_compatible_pad_filtered (dest, srcpad, filtercaps); if (temp && gst_pad_link_filtered (srcpad, temp, filtercaps)) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (temp)); return TRUE; } @@ -1511,21 +1510,21 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, } while (srcpads); } if (srcpadname) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s:%s to %s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s:%s to %s", GST_DEBUG_PAD_NAME (srcpad), GST_ELEMENT_NAME (dest)); return FALSE; } if (destpad) { /* loop through the existing pads in the destination */ do { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "trying dest pad %s:%s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "trying dest pad %s:%s", GST_DEBUG_PAD_NAME (destpad)); if ((GST_RPAD_DIRECTION (destpad) == GST_PAD_SINK) && (GST_PAD_PEER (destpad) == NULL)) { GstPad *temp = gst_element_get_compatible_pad_filtered (src, destpad, filtercaps); if (temp && gst_pad_link_filtered (temp, destpad, filtercaps)) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s", GST_DEBUG_PAD_NAME (temp), GST_DEBUG_PAD_NAME (destpad)); return TRUE; } @@ -1538,12 +1537,12 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, } while (destpads); } if (destpadname) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s to %s:%s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s to %s:%s", GST_ELEMENT_NAME (src), GST_DEBUG_PAD_NAME (destpad)); return FALSE; } - GST_DEBUG (GST_CAT_ELEMENT_PADS, + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "we might have request pads on both sides, checking..."); srctempls = gst_element_get_pad_template_list (src); desttempls = gst_element_get_pad_template_list (dest); @@ -1563,7 +1562,7 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, destpad = gst_element_get_request_pad (dest, desttempl->name_template); if (gst_pad_link_filtered (srcpad, destpad, filtercaps)) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (destpad)); @@ -1578,7 +1577,7 @@ gst_element_link_pads_filtered (GstElement *src, const gchar *srcpadname, } } - GST_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s to %s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s to %s", GST_ELEMENT_NAME (src), GST_ELEMENT_NAME (dest)); return FALSE; } @@ -1704,12 +1703,12 @@ gst_element_unlink_pads (GstElement *src, const gchar *srcpadname, /* obtain the pads requested */ srcpad = gst_element_get_pad (src, srcpadname); if (srcpad == NULL) { - GST_ERROR(src,"source element has no pad \"%s\"",srcpadname); + GST_WARNING_OBJECT (src, "source element has no pad \"%s\"", srcpadname); return; } destpad = gst_element_get_pad (dest, destpadname); if (srcpad == NULL) { - GST_ERROR(dest,"destination element has no pad \"%s\"",destpadname); + GST_WARNING_OBJECT (dest, "destination element has no pad \"%s\"", destpadname); return; } @@ -1762,7 +1761,7 @@ gst_element_unlink (GstElement *src, GstElement *dest) g_return_if_fail (GST_IS_ELEMENT (src)); g_return_if_fail (GST_IS_ELEMENT (dest)); - GST_DEBUG (GST_CAT_ELEMENT_PADS, "unlinking \"%s\" and \"%s\"", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "unlinking \"%s\" and \"%s\"", GST_ELEMENT_NAME (src), GST_ELEMENT_NAME (dest)); srcpads = gst_element_get_pad_list (src); @@ -1793,7 +1792,7 @@ gst_element_error_func (GstElement* element, GstElement *source, { /* tell the parent */ if (GST_OBJECT_PARENT (element)) { - GST_DEBUG (GST_CAT_EVENT, "forwarding error \"%s\" from %s to %s", + GST_CAT_DEBUG (GST_CAT_EVENT, "forwarding error \"%s\" from %s to %s", errormsg, GST_ELEMENT_NAME (element), GST_OBJECT_NAME (GST_OBJECT_PARENT (element))); @@ -1808,11 +1807,11 @@ static GstPad* gst_element_get_random_pad (GstElement *element, GstPadDirection dir) { GList *pads = element->pads; - GST_DEBUG (GST_CAT_ELEMENT_PADS, "getting a random pad"); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "getting a random pad"); while (pads) { GstPad *pad = GST_PAD_CAST (pads->data); - GST_DEBUG (GST_CAT_ELEMENT_PADS, "checking pad %s:%s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "checking pad %s:%s", GST_DEBUG_PAD_NAME (pad)); if (GST_PAD_DIRECTION (pad) == dir) { @@ -1820,12 +1819,12 @@ gst_element_get_random_pad (GstElement *element, GstPadDirection dir) return pad; } else { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is not linked", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is not linked", GST_DEBUG_PAD_NAME (pad)); } } else { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is in wrong direction", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is in wrong direction", GST_DEBUG_PAD_NAME (pad)); } @@ -1891,12 +1890,12 @@ gst_element_send_event (GstElement *element, GstEvent *event) else { GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK); if (pad) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "sending event to random pad %s:%s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "sending event to random pad %s:%s", GST_DEBUG_PAD_NAME (pad)); return gst_pad_send_event (GST_PAD_PEER (pad), event); } } - GST_DEBUG (GST_CAT_ELEMENT_PADS, "can't send event on element %s", + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "can't send event on element %s", GST_ELEMENT_NAME (element)); return FALSE; } @@ -2073,11 +2072,11 @@ gst_element_error (GstElement *element, const gchar *error, ...) va_start (var_args, error); string = g_strdup_vprintf (error, var_args); va_end (var_args); - GST_INFO (GST_CAT_EVENT, "ERROR in %s: %s", GST_ELEMENT_NAME (element), string); + GST_CAT_INFO (GST_CAT_EVENT, "ERROR in %s: %s", GST_ELEMENT_NAME (element), string); /* if the element was already in error, stop now */ if (GST_FLAG_IS_SET (element, GST_ELEMENT_ERROR)) { - GST_INFO (GST_CAT_EVENT, "recursive ERROR detected in %s", GST_ELEMENT_NAME (element)); + GST_CAT_INFO (GST_CAT_EVENT, "recursive ERROR detected in %s", GST_ELEMENT_NAME (element)); g_free (string); return; } @@ -2149,11 +2148,11 @@ gst_element_set_locked_state (GstElement *element, gboolean locked_state) return; if (locked_state) { - GST_DEBUG (GST_CAT_STATES, "locking state of element %s", + GST_CAT_DEBUG (GST_CAT_STATES, "locking state of element %s", GST_ELEMENT_NAME (element)); GST_FLAG_SET (element, GST_ELEMENT_LOCKED_STATE); } else { - GST_DEBUG (GST_CAT_STATES, "unlocking state of element %s", + GST_CAT_DEBUG (GST_CAT_STATES, "unlocking state of element %s", GST_ELEMENT_NAME (element)); GST_FLAG_UNSET (element, GST_ELEMENT_LOCKED_STATE); } @@ -2176,7 +2175,7 @@ gst_element_sync_state_with_parent (GstElement *element) parent = GST_ELEMENT (GST_ELEMENT_PARENT(element)); g_return_val_if_fail (GST_IS_BIN (parent), FALSE); - GST_DEBUG (GST_CAT_STATES, "syncing state of element %s (%s) to %s (%s)", + GST_CAT_DEBUG (GST_CAT_STATES, "syncing state of element %s (%s) to %s (%s)", GST_ELEMENT_NAME (element), gst_element_state_get_name (GST_STATE (element)), GST_ELEMENT_NAME (parent), gst_element_state_get_name (GST_STATE (parent))); if (gst_element_set_state (element, GST_STATE (parent)) == GST_STATE_FAILURE) { @@ -2240,13 +2239,13 @@ gst_element_set_state (GstElement *element, GstElementState state) if (state == curpending) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "element is already in requested state %s", gst_element_state_get_name (state)); return (GST_STATE_SUCCESS); } - GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "setting state from %s to %s", + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "setting state from %s to %s", gst_element_state_get_name (curpending), gst_element_state_get_name (state)); @@ -2264,7 +2263,7 @@ gst_element_set_state (GstElement *element, GstElementState state) GST_STATE_PENDING (element) = curpending; if (curpending != state) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "intermediate: setting state from %s to %s", gst_element_state_get_name (GST_STATE (element)), gst_element_state_get_name (curpending)); @@ -2277,11 +2276,11 @@ gst_element_set_state (GstElement *element, GstElementState state) switch (return_val) { case GST_STATE_FAILURE: - GST_DEBUG_ELEMENT (GST_CAT_STATES, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "have failed change_state return"); goto exit; case GST_STATE_ASYNC: - GST_DEBUG_ELEMENT (GST_CAT_STATES, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "element will change state async"); goto exit; case GST_STATE_SUCCESS: @@ -2314,7 +2313,7 @@ gst_element_negotiate_pads (GstElement *element) { GList *pads = GST_ELEMENT_PADS (element); - GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "negotiating pads"); + GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element, "negotiating pads"); while (pads) { GstPad *pad = GST_PAD (pads->data); @@ -2359,7 +2358,7 @@ gst_element_negotiate_pads (GstElement *element) /* only try to negotiate if the peer element is in PAUSED or higher too */ if (otherstate >= GST_STATE_READY) { - GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element, "perform negotiate for %s:%s and %s:%s", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); @@ -2367,7 +2366,7 @@ gst_element_negotiate_pads (GstElement *element) return FALSE; } else { - GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element, "not negotiating %s:%s and %s:%s, not in READY yet", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); @@ -2383,7 +2382,7 @@ gst_element_clear_pad_caps (GstElement *element) { GList *pads = GST_ELEMENT_PADS (element); - GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "clearing pad caps"); + GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, element, "clearing pad caps"); while (pads) { GstRealPad *pad = GST_PAD_REALIZE (pads->data); @@ -2425,13 +2424,13 @@ gst_element_change_state (GstElement *element) if (old_pending == GST_STATE_VOID_PENDING || old_state == GST_STATE_PENDING (element)) { - GST_INFO (GST_CAT_STATES, + GST_CAT_INFO (GST_CAT_STATES, "no state change needed for element %s (VOID_PENDING)", GST_ELEMENT_NAME (element)); return GST_STATE_SUCCESS; } - GST_INFO (GST_CAT_STATES, "%s default handler sets state from %s to %s %04x", + GST_CAT_INFO (GST_CAT_STATES, "%s default handler sets state from %s to %s %04x", GST_ELEMENT_NAME (element), gst_element_state_get_name (old_state), gst_element_state_get_name (old_pending), @@ -2463,7 +2462,7 @@ gst_element_change_state (GstElement *element) parent = GST_ELEMENT_PARENT (element); - GST_DEBUG_ELEMENT (GST_CAT_STATES, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "signaling state change from %s to %s", gst_element_state_get_name (old_state), gst_element_state_get_name (GST_STATE (element))); @@ -2472,7 +2471,7 @@ gst_element_change_state (GstElement *element) if (element->sched) { if (gst_scheduler_state_transition (element->sched, element, old_transition) != GST_STATE_SUCCESS) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, element, + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "scheduler could not change state"); goto failure; } @@ -2526,7 +2525,7 @@ gst_element_dispose (GObject *object) GList *pads; GstPad *pad; - GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "dispose"); + GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, element, "dispose"); gst_element_set_state (element, GST_STATE_NULL); @@ -2538,7 +2537,7 @@ gst_element_dispose (GObject *object) pad = GST_PAD (pads->data); if (GST_PAD_PEER (pad)) { - GST_DEBUG (GST_CAT_REFCOUNTING, "unlinking pad '%s'", + GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "unlinking pad '%s'", GST_OBJECT_NAME (GST_OBJECT (GST_PAD (GST_PAD_PEER (pad))))); gst_pad_unlink (pad, GST_PAD (GST_PAD_PEER (pad))); } @@ -2751,7 +2750,7 @@ gst_element_set_scheduler (GstElement *element, { g_return_if_fail (GST_IS_ELEMENT (element)); - GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting scheduler to %p", sched); + GST_CAT_INFO_OBJECT (GST_CAT_PARENTAGE, element, "setting scheduler to %p", sched); gst_object_replace ((GstObject **)&GST_ELEMENT_SCHED (element), GST_OBJECT (sched)); } @@ -2821,7 +2820,7 @@ gst_element_set_eos_recursive (GstElement *element) parent that's PAUSED was PLAYING before. That means it has reached EOS. */ GstElement *parent; - GST_DEBUG (GST_CAT_EVENT, "setting recursive EOS on %s", + GST_CAT_DEBUG (GST_CAT_EVENT, "setting recursive EOS on %s", GST_OBJECT_NAME (element)); g_signal_emit (G_OBJECT (element), gst_element_signals[EOS], 0); @@ -2843,7 +2842,7 @@ gst_element_set_eos (GstElement *element) { g_return_if_fail (GST_IS_ELEMENT (element)); - GST_DEBUG (GST_CAT_EVENT, "setting EOS on element %s", + GST_CAT_DEBUG (GST_CAT_EVENT, "setting EOS on element %s", GST_OBJECT_NAME (element)); if (GST_STATE (element) == GST_STATE_PLAYING) { diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 9f7f9492e4..e71bb9ab78 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -20,12 +20,11 @@ * Boston, MA 02111-1307, USA. */ -/* #define DEBUG_ENABLED */ #include "gst_private.h" #include "gstelement.h" #include "gstregistrypool.h" -#include "gstlog.h" +#include "gstinfo.h" static void gst_element_factory_class_init (GstElementFactoryClass *klass); static void gst_element_factory_init (GstElementFactory *factory); @@ -103,7 +102,7 @@ gst_element_factory_find (const gchar *name) return GST_ELEMENT_FACTORY (feature); /* this should be an ERROR */ - GST_DEBUG (GST_CAT_ELEMENT_FACTORY,"no such elementfactory \"%s\"", name); + GST_CAT_DEBUG (GST_CAT_ELEMENT_FACTORY,"no such elementfactory \"%s\"", name); return NULL; } @@ -212,7 +211,7 @@ gst_element_factory_create (GstElementFactory *factory, if (!gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) return NULL; - GST_DEBUG (GST_CAT_ELEMENT_FACTORY, + GST_CAT_DEBUG (GST_CAT_ELEMENT_FACTORY, "creating element from factory \"%s\" (name \"%s\", type %d)", GST_PLUGIN_FEATURE_NAME (factory), GST_STR_NULL (name), (gint) factory->type); @@ -225,7 +224,7 @@ gst_element_factory_create (GstElementFactory *factory, /* attempt to set the elementfactory class pointer if necessary */ oclass = GST_ELEMENT_CLASS (g_type_class_ref (factory->type)); if (oclass->elementfactory == NULL) { - GST_DEBUG (GST_CAT_ELEMENT_FACTORY, "class %s", GST_PLUGIN_FEATURE_NAME (factory)); + GST_CAT_DEBUG (GST_CAT_ELEMENT_FACTORY, "class %s", GST_PLUGIN_FEATURE_NAME (factory)); oclass->elementfactory = factory; /* copy pad template pointers to the element class, @@ -266,19 +265,19 @@ gst_element_factory_make (const gchar *factoryname, const gchar *name) g_return_val_if_fail (factoryname != NULL, NULL); - GST_DEBUG (GST_CAT_ELEMENT_FACTORY, "gstelementfactory: make \"%s\" \"%s\"", + GST_CAT_DEBUG (GST_CAT_ELEMENT_FACTORY, "gstelementfactory: make \"%s\" \"%s\"", factoryname, GST_STR_NULL (name)); /* gst_plugin_load_element_factory (factoryname); */ factory = gst_element_factory_find (factoryname); if (factory == NULL) { - GST_INFO (GST_CAT_ELEMENT_FACTORY,"no such element factory \"%s\"!", + GST_CAT_INFO (GST_CAT_ELEMENT_FACTORY,"no such element factory \"%s\"!", factoryname); return NULL; } element = gst_element_factory_create (factory, name); if (element == NULL) { - GST_INFO (GST_CAT_ELEMENT_FACTORY, + GST_CAT_INFO (GST_CAT_ELEMENT_FACTORY, "couldn't create instance of element factory \"%s\"!", factoryname); return NULL; diff --git a/gst/gstevent.c b/gst/gstevent.c index 337a691b42..3fc0509f13 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -22,12 +22,13 @@ #include /* memcpy */ -#include "gstinfo.h" +#include "gst_private.h" #include "gstdata_private.h" + +#include "gstinfo.h" #include "gstmemchunk.h" #include "gstevent.h" #include "gstlog.h" - #ifndef GST_DISABLE_TRACE /* #define GST_WITH_ALLOC_TRACE */ #include "gsttrace.h" @@ -76,7 +77,7 @@ _gst_event_copy (GstEvent *event) static void _gst_event_free (GstEvent* event) { - GST_INFO (GST_CAT_EVENT, "freeing event %p", event); + GST_CAT_INFO (GST_CAT_EVENT, "freeing event %p", event); if (GST_EVENT_SRC (event)) { gst_object_unref (GST_EVENT_SRC (event)); @@ -144,7 +145,7 @@ gst_event_new (GstEventType type) gst_alloc_trace_new (_event_trace, event); #endif - GST_INFO (GST_CAT_EVENT, "creating new event %p %d", event, type); + GST_CAT_INFO (GST_CAT_EVENT, "creating new event %p %d", event, type); _GST_DATA_INIT (GST_DATA (event), _gst_event_type, diff --git a/gst/gstindex.c b/gst/gstindex.c index 63c2929167..caaf92ca53 100644 --- a/gst/gstindex.c +++ b/gst/gstindex.c @@ -20,10 +20,10 @@ * Boston, MA 02111-1307, USA. */ -#include "gstlog.h" #include "gst_private.h" -#include "gstregistrypool.h" +#include "gstinfo.h" +#include "gstregistrypool.h" #include "gstpad.h" #include "gstindex.h" @@ -152,7 +152,7 @@ gst_index_init (GstIndex *index) GST_FLAG_SET (index, GST_INDEX_WRITABLE); GST_FLAG_SET (index, GST_INDEX_READABLE); - GST_DEBUG(0, "created new index"); + GST_DEBUG ( "created new index"); } static void @@ -203,7 +203,7 @@ gst_index_group_new(guint groupnum) indexgroup->certainty = GST_INDEX_UNKNOWN; indexgroup->peergroup = -1; - GST_DEBUG(0, "created new index group %d",groupnum); + GST_DEBUG ( "created new index group %d",groupnum); return indexgroup; } @@ -274,7 +274,7 @@ gst_index_new_group(GstIndex *index) { index->curgroup = gst_index_group_new(++index->maxgroup); index->groups = g_list_append(index->groups,index->curgroup); - GST_DEBUG(0, "created new group %d in index",index->maxgroup); + GST_DEBUG ( "created new group %d in index",index->maxgroup); return index->maxgroup; } @@ -305,13 +305,13 @@ gst_index_set_group(GstIndex *index, gint groupnum) list = g_list_next(list); if (indexgroup->groupnum == groupnum) { index->curgroup = indexgroup; - GST_DEBUG(0, "switched to index group %d", indexgroup->groupnum); + GST_DEBUG ( "switched to index group %d", indexgroup->groupnum); return TRUE; } } /* couldn't find the group in question */ - GST_DEBUG(0, "couldn't find index group %d",groupnum); + GST_DEBUG ( "couldn't find index group %d",groupnum); return FALSE; } @@ -892,7 +892,7 @@ gst_index_factory_find (const gchar *name) g_return_val_if_fail (name != NULL, NULL); - GST_DEBUG (0,"gstindex: find \"%s\"", name); + GST_DEBUG ("gstindex: find \"%s\"", name); feature = gst_registry_pool_find_feature (name, GST_TYPE_INDEX_FACTORY); if (feature) @@ -949,4 +949,3 @@ gst_index_factory_make (const gchar *name) return gst_index_factory_create (factory); } - diff --git a/gst/gstinfo.c b/gst/gstinfo.c index e5726627b3..1c94310a9a 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -1,8 +1,9 @@ /* GStreamer * Copyright (C) 1999,2000 Erik Walthinsen * 2000 Wim Taymans + * 2003 Benjamin Otte * - * gstinfo.c: INFO, ERROR, and DEBUG systems + * gstinfo.c: debugging functions * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,11 +21,23 @@ * Boston, MA 02111-1307, USA. */ +#include "gst_private.h" + +#include "gstinfo.h" + +#ifndef GST_DISABLE_GST_DEBUG + #include +#include +#include "gstinfo.h" +#include "gstlog.h" #include "gst_private.h" #include "gstelement.h" #include "gstpad.h" #include "gstscheduler.h" +#include "gst_private.h" + +GST_DEBUG_CATEGORY_STATIC(GST_CAT_DEBUG); #if defined __sgi__ #include @@ -46,448 +59,798 @@ int dladdr(void *address, Dl_info *dl) v = _rld_new_interface(_RLD_DLADDR,address,dl); return (int)v; } -#endif +#endif /* __sgi__ */ extern gchar *_gst_progname; -GStaticPrivate _gst_debug_cothread_index = G_STATIC_PRIVATE_INIT; +static void gst_debug_reset_threshold (gpointer category, + gpointer unused); +static void gst_debug_reset_all_thresholds (void); + +/* list of all name/level pairs from --gst-debug and GST_DEBUG */ +static GStaticMutex __level_name_mutex = G_STATIC_MUTEX_INIT; +static GSList *__level_name = NULL; +typedef struct { + GPatternSpec * pat; + GstDebugLevel level; +} LevelNameEntry; + +/* list of all categories */ +static GStaticMutex __cat_mutex = G_STATIC_MUTEX_INIT; +static GSList *__categories = NULL; + +/* all registered debug handlers */ +typedef struct { + GstLogFunction func; + gpointer user_data; +} LogFuncEntry; +static GStaticMutex __log_func_mutex = G_STATIC_MUTEX_INIT; +static GSList *__log_functions = NULL; + +static GstAtomicInt __default_level; +static GstAtomicInt __use_color; +static GstAtomicInt __enabled; -/***** Categories and colorization *****/ -/* be careful with these, make them match the enum */ -static gchar *_gst_info_category_strings[] = { - /* [GST_CAT_GST_INIT] = */ "GST_INIT", - /* [GST_CAT_COTHREADS] = */ "COTHREADS", - /* [GST_CAT_COTHREAD_SWITCH] = */ "COTHREAD_SWITCH", - /* [GST_CAT_AUTOPLUG] = */ "AUTOPLUG", - /* [GST_CAT_AUTOPLUG_ATTEMPT] = */ "AUTOPLUG_ATTEMPT", - /* [GST_CAT_PARENTAGE] = */ "PARENTAGE", - /* [GST_CAT_STATES] = */ "STATES", - /* [GST_CAT_PLANNING] = */ "PLANNING", - /* [GST_CAT_SCHEDULING] = */ "SCHEDULING", - /* [GST_CAT_DATAFLOW] = */ "DATAFLOW", - /* [GST_CAT_BUFFER] = */ "BUFFER", - /* [GST_CAT_CAPS] = */ "CAPS", - /* [GST_CAT_CLOCK] = */ "CLOCK", - /* [GST_CAT_ELEMENT_PADS] = */ "ELEMENT_PADS", - /* [GST_CAT_ELEMENT_FACTORY] = */ "ELEMENTFACTORY", - /* [GST_CAT_PADS] = */ "PADS", - /* [GST_CAT_PIPELINE] = */ "PIPELINE", - /* [GST_CAT_PLUGIN_LOADING] = */ "PLUGIN_LOADING", - /* [GST_CAT_PLUGIN_ERRORS] = */ "PLUGIN_ERRORS", - /* [GST_CAT_PLUGIN_INFO] = */ "PLUGIN_INFO", - /* [GST_CAT_PROPERTIES] = */ "PROPERTIES", - /* [GST_CAT_THREAD] = */ "THREAD", - /* [GST_CAT_TYPES] = */ "TYPES", - /* [GST_CAT_XML] = */ "XML", - /* [GST_CAT_NEGOTIATION] = */ "NEGOTIATION", - /* [GST_CAT_REFCOUNTING] = */ "REFCOUNTING", - /* [GST_CAT_EVENT] = */ "EVENT", - /* [GST_CAT_PARAMS] = */ "PARAMS", - /* [GST_CAT_APPLICATION] = */ "APPLICATION", - "", - /* [GST_CAT_CALL_TRACE] = */ "CALL_TRACE", - /* [31] = */ -}; +GstDebugCategory *GST_CAT_DEFAULT = NULL; + +GstDebugCategory *GST_CAT_GST_INIT = NULL; +GstDebugCategory *GST_CAT_COTHREADS = NULL; +GstDebugCategory *GST_CAT_COTHREAD_SWITCH = NULL; +GstDebugCategory *GST_CAT_AUTOPLUG = NULL; +GstDebugCategory *GST_CAT_AUTOPLUG_ATTEMPT = NULL; +GstDebugCategory *GST_CAT_PARENTAGE = NULL; +GstDebugCategory *GST_CAT_STATES = NULL; +GstDebugCategory *GST_CAT_PLANNING = NULL; +GstDebugCategory *GST_CAT_SCHEDULING = NULL; +GstDebugCategory *GST_CAT_DATAFLOW = NULL; +GstDebugCategory *GST_CAT_BUFFER = NULL; +GstDebugCategory *GST_CAT_CAPS = NULL; +GstDebugCategory *GST_CAT_CLOCK = NULL; +GstDebugCategory *GST_CAT_ELEMENT_PADS = NULL; +GstDebugCategory *GST_CAT_ELEMENT_FACTORY = NULL; +GstDebugCategory *GST_CAT_PADS = NULL; +GstDebugCategory *GST_CAT_PIPELINE = NULL; +GstDebugCategory *GST_CAT_PLUGIN_LOADING = NULL; +GstDebugCategory *GST_CAT_PLUGIN_INFO = NULL; +GstDebugCategory *GST_CAT_PROPERTIES = NULL; +GstDebugCategory *GST_CAT_THREAD = NULL; +GstDebugCategory *GST_CAT_TYPES = NULL; +GstDebugCategory *GST_CAT_XML = NULL; +GstDebugCategory *GST_CAT_NEGOTIATION = NULL; +GstDebugCategory *GST_CAT_REFCOUNTING = NULL; +GstDebugCategory *GST_CAT_EVENT = NULL; +GstDebugCategory *GST_CAT_PARAMS = NULL; +GstDebugCategory *GST_CAT_CALL_TRACE = NULL; /** - * gst_get_category_name: - * @category: the category to return the name of - * - * Return a string containing the name of the category - * - * Returns: string containing the name of the category + * _gst_debug_init: + * + * Initializes the debugging system. + * Normally you don't want to call this, because gst_init does it for you. + */ +void _gst_debug_init (void) +{ + gst_atomic_int_init (&__default_level, GST_LEVEL_DEFAULT); + gst_atomic_int_init (&__use_color, 1); + gst_atomic_int_init (&__enabled, 1); + + /* do NOT use a single debug function before this line has been run */ + GST_CAT_DEFAULT = _gst_debug_category_new ("default", + GST_DEBUG_UNDERLINE, + NULL); + GST_CAT_DEBUG = _gst_debug_category_new ("GST_DEBUG", + GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, + "debugging subsystem"); + + gst_debug_add_log_function (gst_debug_log_default, NULL); + + /* FIXME: add descriptions here */ + GST_CAT_GST_INIT = _gst_debug_category_new ("GST_INIT", + GST_DEBUG_BOLD | GST_DEBUG_FG_RED, + NULL); + GST_CAT_COTHREADS = _gst_debug_category_new ("GST_COTHREADS", + GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, + NULL); + GST_CAT_COTHREAD_SWITCH = _gst_debug_category_new ("GST_COTHREAD_SWITCH", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_GREEN, + NULL); + GST_CAT_AUTOPLUG = _gst_debug_category_new ("GST_AUTOPLUG", + GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, + NULL); + GST_CAT_AUTOPLUG_ATTEMPT = _gst_debug_category_new ("GST_AUTOPLUG_ATTEMPT", + GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN | GST_DEBUG_BG_BLUE, + NULL); + GST_CAT_PARENTAGE = _gst_debug_category_new ("GST_PARENTAGE", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_STATES = _gst_debug_category_new ("GST_STATES", + GST_DEBUG_BOLD | GST_DEBUG_FG_RED, + NULL); + GST_CAT_PLANNING = _gst_debug_category_new ("GST_PLANNING", + GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, + NULL); + GST_CAT_SCHEDULING = _gst_debug_category_new ("GST_SCHEDULING", + GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, + NULL); + GST_CAT_DATAFLOW = _gst_debug_category_new ("GST_DATAFLOW", + GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, + NULL); + GST_CAT_BUFFER = _gst_debug_category_new ("GST_BUFFER", + GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, + NULL); + GST_CAT_CAPS = _gst_debug_category_new ("GST_CAPS", + GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, + NULL); + GST_CAT_CLOCK = _gst_debug_category_new ("GST_CLOCK", + GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, + NULL); + GST_CAT_ELEMENT_PADS = _gst_debug_category_new ("GST_ELEMENT_PADS", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_ELEMENT_FACTORY = _gst_debug_category_new ("GST_ELEMENT_FACTORY", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_PADS = _gst_debug_category_new ("GST_PADS", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_PIPELINE = _gst_debug_category_new ("GST_PIPELINE", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_PLUGIN_LOADING = _gst_debug_category_new ("GST_PLUGIN_LOADING", + GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN, + NULL); + GST_CAT_PLUGIN_INFO = _gst_debug_category_new ("GST_PLUGIN_INFO", + GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN, + NULL); + GST_CAT_PROPERTIES = _gst_debug_category_new ("GST_PROPERTIES", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_BLUE, + NULL); + GST_CAT_THREAD = _gst_debug_category_new ("GST_THREAD", + GST_DEBUG_BOLD | GST_DEBUG_FG_RED, + NULL); + GST_CAT_TYPES = _gst_debug_category_new ("GST_TYPES", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_XML = _gst_debug_category_new ("GST_XML", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_NEGOTIATION = _gst_debug_category_new ("GST_NEGOTIATION", + GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, + NULL); + GST_CAT_REFCOUNTING = _gst_debug_category_new ("GST_REFCOUNTING", + GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_GREEN, + NULL); + GST_CAT_EVENT = _gst_debug_category_new ("GST_EVENT", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, + NULL); + GST_CAT_PARAMS = _gst_debug_category_new ("GST_PARAMS", + GST_DEBUG_BOLD | GST_DEBUG_FG_BLACK | GST_DEBUG_BG_YELLOW, + NULL); + GST_CAT_CALL_TRACE = _gst_debug_category_new ("GST_CALL_TRACE", + GST_DEBUG_BOLD, + NULL); +} + +/* we can't do this further above, because we initialize the GST_CAT_DEFAULT struct */ +#define GST_CAT_DEFAULT GST_CAT_DEBUG + +/** + * gst_debug_log: + * @category: category to log + * @level: level of the message is in + * @file: the file that emitted the message, usually the __FILE__ identifier + * @function: the function that emitted the message + * @line: the line from that the message was emitted, usually __LINE__ + * @object: the object this message relates to or NULL if none + * @format: a printf style format string + * @...: optional arguments for the format + * + * Logs the given message using the currently registered debugging handlers. + */ +void gst_debug_log (GstDebugCategory *category, GstDebugLevel level, + const gchar *file, const gchar *function, gint line, + GObject *object, gchar *format, ...) +{ + va_list var_args; + + va_start (var_args, format); + gst_debug_logv (category, level, file, function, line, object, format, var_args); + va_end (var_args); +} +/** + * gst_debug_logv: + * @category: category to log + * @level: level of the message is in + * @file: the file that emitted the message, usually the __FILE__ identifier + * @function: the function that emitted the message + * @line: the line from that the message was emitted, usually __LINE__ + * @object: the object this message relates to or NULL if none + * @format: a printf style format string + * @args: optional arguments for the format + * + * Logs the given message using the currently registered debugging handlers. + */ +void gst_debug_logv (GstDebugCategory *category, GstDebugLevel level, + const gchar *file, const gchar *function, gint line, + GObject *object, gchar *format, va_list args) +{ + gchar *message; + LogFuncEntry *entry; + GSList *handler; + + g_return_if_fail (category != NULL); + g_return_if_fail (file != NULL); + g_return_if_fail (function != NULL); + g_return_if_fail (format != NULL); + + message = g_strdup_vprintf (format, args); + g_static_mutex_lock (&__log_func_mutex); + handler = __log_functions; + while (handler) { + entry = handler->data; + handler = g_slist_next (handler); + entry->func (category, level, file, function, line, object, message, entry->user_data); + } + g_static_mutex_unlock (&__log_func_mutex); + g_free (message); +} +/** + * gst_debug_construct_term_color: + * @colorinfo: the color info + * + * Constructs a string that can be used for getting the desired color in color + * terminals. + * You need to free the string after use. + * + * Returns: a string containing the color definition + */ +gchar * +gst_debug_construct_term_color (guint colorinfo) +{ + GString *color; + gchar *ret; + + color = g_string_new ("\033[00"); + + if (colorinfo & GST_DEBUG_BOLD) { + g_string_append (color, ";01"); + } + if (colorinfo & GST_DEBUG_UNDERLINE) { + g_string_append (color, ";04"); + } + if (colorinfo & GST_DEBUG_FG_MASK) { + g_string_append_printf (color, ";3%1d", colorinfo & GST_DEBUG_FG_MASK); + } + if (colorinfo & GST_DEBUG_BG_MASK) { + g_string_append_printf (color, ";4%1d", (colorinfo & GST_DEBUG_BG_MASK) >> 4); + } + g_string_append (color, "m"); + + ret = color->str; + g_string_free (color, FALSE); + return ret; +} +/** + * gst_debug_log_default: + * @category: category to log + * @level: level of the message + * @file: the file that emitted the message, usually the __FILE__ identifier + * @function: the function that emitted the message + * @line: the line from that the message was emitted, usually __LINE__ + * @message: the actual message + * @object: the object this message relates to or NULL if none + * @unused: an unused variable, reserved for some user_data. + * + * The default logging handler used by GStreamer. Logging functions get called + * whenever a macro like GST_DEBUG or similar is used. This function outputs the + * message and additional info using the glib error handler. + * You can add other handlers by using #gst_debug_add_log_function. + * And you can remove this handler by calling + * gst_debug_remove_log_function (gst_debug_log_default); + */ +void +gst_debug_log_default (GstDebugCategory *category, GstDebugLevel level, + const gchar *file, const gchar *function, gint line, + GObject *object, gchar *message, gpointer unused) +{ + gchar *color; + gchar *clear; + gchar *obj; + gchar *pidcolor; + gint pid; + + if (level > gst_debug_category_get_threshold (category)) + return; + + pid = getpid(); + + /* color info */ + if (gst_debug_is_colored ()) { + color = gst_debug_construct_term_color (gst_debug_category_get_color (category)); + clear = "\033[00m"; + pidcolor = g_strdup_printf ("\033[3%1dm", pid % 6 + 31); + } else { + color = g_strdup (""); + clear = ""; + pidcolor = g_strdup (""); + } + /* nicely printed object */ + if (object == NULL) { + obj = g_strdup (""); + } else if (GST_IS_PAD (object) && GST_OBJECT_NAME (object)) { + obj = g_strdup_printf ("[%s:%s] ", GST_DEBUG_PAD_NAME (object)); + } else if (GST_IS_OBJECT (object) && GST_OBJECT_NAME (object)) { + obj = g_strdup_printf ("[%s] ", GST_OBJECT_NAME (object)); + } else { + obj = g_strdup_printf ("[%s@%p] ", G_OBJECT_TYPE_NAME(object), object); + } + + g_printerr ("%s %s%s%s(%s%5d%s) %s%s(%d):%s: %s%s%s\n", + gst_debug_level_get_name (level), + color, gst_debug_category_get_name (category), clear, + pidcolor, pid, clear, + color, file, line, function, obj, clear, + message); + + g_free (color); + g_free (pidcolor); + g_free (obj); +} +/** + * gst_debug_level_get_name: + * @level: the level to get the name for + * + * Get the string trepresentation of a debugging level + * + * Returns: the name */ const gchar * -gst_get_category_name (gint category) { - if ((category >= 0) && (category < GST_CAT_MAX_CATEGORY)) - return _gst_info_category_strings[category]; - else - return NULL; -} - - -/* - * Attribute codes: - * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed - * Text color codes: - * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white - * Background color codes: - * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white - */ -/* be careful with these, make them match the enum */ -const gchar *_gst_category_colors[32] = { - /* [GST_CAT_GST_INIT] = */ "07;37", - /* [GST_CAT_COTHREADS] = */ "00;32", - /* [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_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_ELEMENT_FACTORY] = */ "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_THREAD] = */ "00;31", - /* [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_APPLICATION] = */ "07;36", - "", - /* [GST_CAT_CALL_TRACE] = */ "", - /* [31] = */ "05;31", -}; - -/* colorization hash - DEPRACATED in favor of above */ -inline gint _gst_debug_stringhash_color(gchar *file) { - int filecolor = 0; - while (file[0]) filecolor += *(char *)(file++); - filecolor = (filecolor % 6) + 31; - return filecolor; -} - - -/***** DEBUG system *****/ -GstDebugHandler _gst_debug_handler = gst_default_debug_handler; -guint32 _gst_debug_categories = 0x00000000; - -/** - * gst_default_debug_handler: - * @category: category of the DEBUG message - * @incore: if the debug handler is for core code. - * @file: the file the DEBUG occurs in - * @function: the function the DEBUG occurs in - * @line: the line number in the file - * @debug_string: the current debug_string in the function, if any - * @element: pointer to the #GstElement in question - * @string: the actual DEBUG string - * - * Prints out the DEBUG mesage in a variant of the following form: - * - * DEBUG(pid:cid):gst_function:542(args): [elementname] something neat happened - */ -void -gst_default_debug_handler (gint category, gboolean incore, - const gchar *file, const gchar *function, - gint line, const gchar *debug_string, - void *element, gchar *string) - G_GNUC_NO_INSTRUMENT; - -void -gst_default_debug_handler (gint category, gboolean incore, - const gchar *file, const gchar *function, - gint line, const gchar *debug_string, - void *element, gchar *string) +gst_debug_level_get_name (GstDebugLevel level) { - gchar *empty = ""; - gchar *elementname = empty,*location = empty; - int pid = getpid(); - int cothread_id = GPOINTER_TO_INT(g_static_private_get(&_gst_debug_cothread_index)); -#ifdef GST_DEBUG_COLOR - int pid_color = pid%6 + 31; - int cothread_color = (cothread_id < 0) ? 37 : (cothread_id%6 + 31); -#endif - - if (debug_string == NULL) debug_string = ""; -/* if (category != GST_CAT_GST_INIT) */ - location = g_strdup_printf ("%s(%d): %s: %s:", - file, line, function, debug_string); - if (element && GST_IS_ELEMENT (element)) -#ifdef GST_DEBUG_COLOR - elementname = g_strdup_printf (" \033[04m[%s]\033[00m", - GST_STR_NULL (GST_OBJECT_NAME (element))); -#else - elementname = g_strdup_printf (" [%s]", GST_OBJECT_NAME (element)); -#endif - -#ifdef GST_DEBUG_COLOR - fprintf (stderr, "DEBUG(\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033[" - "%s;%sm%s%s\033[00m %s\n", - pid_color, pid, cothread_color, cothread_id, incore ? "00" : "01", - _gst_category_colors[category], location, elementname, string); -#else - fprintf(stderr,"DEBUG(%5d:%2d)%s%s %s\n", - pid, cothread_id, location, elementname, string); -#endif /* GST_DEBUG_COLOR */ - - if (location != empty) g_free (location); - if (elementname != empty) g_free (elementname); - - g_free (string); + switch (level) { + case GST_LEVEL_NONE: return ""; + case GST_LEVEL_ERROR: return "ERROR"; + case GST_LEVEL_WARNING: return "WARN "; + case GST_LEVEL_INFO: return "INFO "; + case GST_LEVEL_DEBUG: return "DEBUG"; + case GST_LEVEL_LOG: return "LOG "; + default: + g_warning ("invalid level specified for gst_debug_level_get_name"); + return ""; + } } - - /** - * gst_debug_set_categories: - * @categories: bitmask of DEBUG categories to enable - * - * Enable the output of DEBUG categories based on the given bitmask. - * The bit for any given category is (1 << GST_CAT_...). + * gst_debug_add_log_function: + * @func: the function to use + * @data: user data + * + * Adds the logging function to the list of logging functions. + * Be sure to use G_GNUC_NO_INSTRUMENT on that function, it is needed. */ void -gst_debug_set_categories (guint32 categories) { - _gst_debug_categories = categories; -} - -/** - * gst_debug_get_categories: - * - * Return the current bitmask of enabled DEBUG categories - * - * Returns: the current bitmask of enabled DEBUG categories - * The bit for any given category is (1 << GST_CAT_...). - */ -guint32 -gst_debug_get_categories () { - return _gst_debug_categories; -} - -/** - * gst_debug_enable_category: - * @category: the category to enable - * - * Enables the given GST_CAT_... DEBUG category. - */ -void -gst_debug_enable_category (gint category) { - _gst_debug_categories |= (1 << category); -} - -/** - * gst_debug_disable_category: - * @category: the category to disable - * - * Disables the given GST_CAT_... DEBUG category. - */ -void -gst_debug_disable_category (gint category) { - _gst_debug_categories &= ~ (1 << category); -} - -/***** INFO system *****/ -GstInfoHandler _gst_info_handler = gst_default_info_handler; -guint32 _gst_info_categories = 0x00000001; - -/* FIXME:what does debug_string DO ??? */ -/** - * gst_default_info_handler: - * @category: category of the INFO message - * @incore: if the info handler is for core code. - * @file: the file the INFO occurs in - * @function: the function the INFO occurs in - * @line: the line number in the file - * @debug_string: the current debug_string in the function, if any - * @element: pointer to the #GstElement in question - * @string: the actual INFO string - * - * Prints out the INFO mesage in a variant of the following form: - * - * FIXME: description should be fixed - * INFO:gst_function:542(args): [elementname] something neat happened - */ -void -gst_default_info_handler (gint category, gboolean incore, - const gchar *file, const gchar *function, - gint line, const gchar *debug_string, - void *element, gchar *string) +gst_debug_add_log_function (GstLogFunction func, gpointer data) { - gchar *empty = ""; - gchar *elementname = empty,*location = empty; - int pid = getpid(); - int cothread_id = GPOINTER_TO_INT(g_static_private_get(&_gst_debug_cothread_index)); -#ifdef GST_DEBUG_COLOR - int pid_color = pid%6 + 31; - int cothread_color = (cothread_id < 0) ? 37 : (cothread_id%6 + 31); -#endif + LogFuncEntry *entry; - if (debug_string == NULL) debug_string = ""; - if (category != GST_CAT_GST_INIT) - location = g_strdup_printf ("%s(%d): %s: %s:", - file, line, function, debug_string); - if (element && GST_IS_ELEMENT (element)) - elementname = g_strdup_printf (" \033[04m[%s]\033[00m", - GST_OBJECT_NAME (element)); + g_return_if_fail (func != NULL); -/* -#ifdef GST_DEBUG_ENABLED -*/ - #ifdef GST_DEBUG_COLOR - fprintf (stderr, "\033[01mINFO\033[00m (\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033[" - GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n", - pid_color, pid, cothread_color, cothread_id, - _gst_category_colors[category], location, elementname, string); - #else - fprintf (stderr, "INFO (%5d:%2d)%s%s %s\n", - pid, cothread_id, location, elementname, string); -#endif /* GST_DEBUG_COLOR */ -/* -#else - #ifdef GST_DEBUG_COLOR - fprintf(stderr,"\033[01mINFO\033[00m:\033[" GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n", - location,elementname,_gst_category_colors[category],string); - #else - fprintf(stderr,"INFO:%s%s %s\n", - location,elementname,string); - #endif * GST_DEBUG_COLOR * + entry = g_new (LogFuncEntry, 1); + entry->func = func; + entry->user_data = data; + g_static_mutex_lock (&__log_func_mutex); + __log_functions = g_slist_prepend (__log_functions, entry); + g_static_mutex_unlock (&__log_func_mutex); -#endif -*/ - - if (location != empty) g_free (location); - if (elementname != empty) g_free (elementname); - - g_free (string); + GST_DEBUG ("prepended log function %p (user data %p) to log functions", + func, data); } - -/** - * gst_info_set_categories: - * @categories: bitmask of INFO categories to enable - * - * Enable the output of INFO categories based on the given bitmask. - * The bit for any given category is (1 << GST_CAT_...). - */ -void -gst_info_set_categories (guint32 categories) { - _gst_info_categories = categories; -} - -/** - * gst_info_get_categories: - * - * Return the current bitmask of enabled INFO categories - * The bit for any given category is (1 << GST_CAT_...). - * - * Returns: the current bitmask of enabled INFO categories - * The bit for any given category is (1 << GST_CAT_...). - */ -guint32 -gst_info_get_categories () { - return _gst_info_categories; -} - -/** - * gst_info_enable_category: - * @category: the category to enable - * - * Enables the given GST_CAT_... INFO category. - */ -void -gst_info_enable_category (gint category) { - _gst_info_categories |= (1 << category); -} - -/** - * gst_info_disable_category: - * @category: the category to disable - * - * Disables the given GST_CAT_... INFO category. - */ -void -gst_info_disable_category (gint category) { - _gst_info_categories &= ~ (1 << category); -} - - - -/***** ERROR system *****/ -GstErrorHandler _gst_error_handler = gst_default_error_handler; - -/** - * gst_default_error_handler: - * @file: the file the ERROR occurs in - * @function: the function the INFO occurs in - * @line: the line number in the file - * @debug_string: the current debug_string in the function, if any - * @element: pointer to the #GstElement in question - * @object: pointer to a related object - * @string: the actual ERROR string - * - * Prints out the given ERROR string in a variant of the following format: - * - * ***** GStreamer ERROR ***** in file gstsomething.c at gst_function:399(arg) - * Element: /pipeline/thread/element.src - * Error: peer is null! - * ***** attempting to stack trace.... ***** - * - * At the end, it attempts to print the stack trace via GDB. - */ -void -gst_default_error_handler (gchar *file, gchar *function, - gint line, gchar *debug_string, - void *element, void *object, gchar *string) +static gint +gst_debug_compare_log_function_by_func (gconstpointer entry, gconstpointer func) { - int chars = 0; - gchar *path; - int i; + gpointer entryfunc = ((LogFuncEntry *) entry)->func; + + return (entryfunc < func) ? -1 : (entryfunc > func) ? 1 : 0; +} +static gint +gst_debug_compare_log_function_by_data (gconstpointer entry, gconstpointer data) +{ + gpointer entrydata = ((LogFuncEntry *) entry)->user_data; + + return (entrydata < data) ? -1 : (entrydata > data) ? 1 : 0; +} +/** + * gst_debug_remove_log_function: + * @func: the log function to remove + * + * Removes all registrered instances of the given logging functions. + * + * Returns: How many instances of the function were removed + */ +guint +gst_debug_remove_log_function (GstLogFunction func) +{ + GSList *found; + guint removals = 0; - /* if there are NULL pointers, point them to null strings to clean up output */ - if (!debug_string) debug_string = ""; - if (!string) string = ""; + g_return_val_if_fail (func != NULL, 0); - /* print out a preamble */ - fprintf(stderr,"***** GStreamer ERROR ***** in file %s at %s:%d%s\n", - file,function,line,debug_string); + g_static_mutex_lock (&__log_func_mutex); + while ((found = g_slist_find_custom (__log_functions, func, + gst_debug_compare_log_function_by_func))) { + g_free (found->data); + __log_functions = g_slist_delete_link (__log_functions, found); + removals++; + } + g_static_mutex_unlock (&__log_func_mutex); + GST_DEBUG ("removed log function %p %d times from log function list", + func, removals); - /* if there's an element, print out the pertinent information */ - if (element) { - if (GST_IS_OBJECT(element)) { - path = gst_object_get_path_string(element); - fprintf(stderr,"Element: %s",path); - chars = 9 + strlen(path); - g_free(path); - } else { - fprintf(stderr,"Element ptr: %p",element); - chars = 15 + sizeof(void*)*2; + return removals; +} +/** + * gst_debug_remove_log_function_by_data: + * @data: user data of the log function to remove + * + * Removes all registrered instances of log functions with the given user data. + * + * Returns: How many instances of the function were removed + */ +guint +gst_debug_remove_log_function_by_data (gpointer data) +{ + GSList *found; + guint removals = 0; + + g_static_mutex_lock (&__log_func_mutex); + while ((found = g_slist_find_custom (__log_functions, data, + gst_debug_compare_log_function_by_data))) { + g_free (found->data); + __log_functions = g_slist_delete_link (__log_functions, found); + removals++; + } + g_static_mutex_unlock (&__log_func_mutex); + GST_DEBUG ("removed %d log functions with user data %p from log function list", + removals, data); + + return removals; +} +/** + * gst_debug_set_colored: + * @colored: Whether to use colored output or not + * + * Sets or unsets the use of coloured debugging output. + */ +void +gst_debug_set_colored (gboolean colored) +{ + gst_atomic_int_set (&__use_color, colored ? 1 : 0); +} +/** + * gst_debug_is_colored: + * + * Checks if the debugging output should be colored. + * + * Returns: TRUE, if the debug output should be colored. + */ +gboolean +gst_debug_is_colored (void) +{ + return gst_atomic_int_read (&__use_color) == 0 ? FALSE : TRUE; +} +/** + * gst_debug_set_active: + * @active: Whether to use debugging output or not + * + * If activated, debugging messages are sent to the debugging + * handlers. + * It makes sense to deactivate it for speed issues. + */ +void +gst_debug_set_active (gboolean active) +{ + gst_atomic_int_set (&__enabled, active ? 1 : 0); +} +/** + * gst_debug_is_active: + * + * Checks if debugging output is activated. + * + * Returns: TRUE, if debugging is activated + */ +gboolean +gst_debug_is_active (void) +{ + return gst_atomic_int_read (&__enabled) == 0 ? FALSE : TRUE; +} +/** + * gst_debug_set_default_threshold: + * @level: level to set + * + * Sets the default threshold to the given level and updates all categories to + * use this threshold. + */ +void +gst_debug_set_default_threshold (GstDebugLevel level) +{ + gst_atomic_int_set (&__default_level, level); + gst_debug_reset_all_thresholds (); +} +/** + * gst_debug_get_default_threshold: + * + * Returns the default threshold that is used for new categories. + * + * Returns: the default threshold level + */ +GstDebugLevel +gst_debug_get_default_threshold (void) +{ + return (GstDebugLevel) gst_atomic_int_read (&__default_level); +} +static void +gst_debug_reset_threshold (gpointer category, gpointer unused) +{ + GstDebugCategory *cat = (GstDebugCategory *) category; + GSList *walk; + + g_static_mutex_lock (&__level_name_mutex); + walk = __level_name; + while (walk) { + LevelNameEntry *entry = walk->data; + walk = g_slist_next (walk); + if (g_pattern_match_string (entry->pat, cat->name)) { + GST_LOG ("category %s matches pattern %p - gets set to level %d", + cat->name, entry->pat, entry->level); + gst_debug_category_set_threshold (cat, entry->level); + goto exit; } } + gst_debug_category_set_threshold (cat, gst_debug_get_default_threshold ()); - /* if there's an object, print it out as well */ - if (object) { - /* 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 - fprintf(stderr,"\n"); +exit: + g_static_mutex_unlock (&__level_name_mutex); +} +static void +gst_debug_reset_all_thresholds (void) +{ + g_static_mutex_lock (&__cat_mutex); + g_slist_foreach (__categories, gst_debug_reset_threshold, NULL); + g_static_mutex_unlock (&__cat_mutex); +} +static void +for_each_threshold_by_entry (gpointer data, gpointer user_data) +{ + GstDebugCategory *cat = (GstDebugCategory *) data; + LevelNameEntry *entry = (LevelNameEntry *) user_data; - if (GST_IS_OBJECT(object)) { - path = gst_object_get_path_string(object); - fprintf(stderr,"Object: %s",path); - g_free(path); - } else { - fprintf(stderr,"Object ptr: %p",object); + if (g_pattern_match_string (entry->pat, cat->name)) { + GST_LOG ("category %s matches pattern %p - gets set to level %d", + cat->name, entry->pat, entry->level); + gst_debug_category_set_threshold (cat, entry->level); + } +} +/** + * gst_debug_set_threshold_for_name: + * @name: name of the categories to set + * @level: level to set them to + * + * Sets all categories which match the gven glob style pattern to the given + * level. + */ +void +gst_debug_set_threshold_for_name (const gchar *name, GstDebugLevel level) +{ + GPatternSpec *pat; + LevelNameEntry *entry; + + g_return_if_fail (name != NULL); + + pat = g_pattern_spec_new (name); + entry = g_new (LevelNameEntry, 1); + entry->pat = pat; + entry->level = level; + g_static_mutex_lock (&__level_name_mutex); + __level_name = g_slist_prepend (__level_name, entry); + g_static_mutex_unlock (&__level_name_mutex); + g_static_mutex_lock (&__cat_mutex); + g_slist_foreach (__categories, for_each_threshold_by_entry, entry); + g_static_mutex_unlock (&__cat_mutex); +} +/** + * gst_debug_unset_threshold_for_name: + * @name: name of the categories to set + * + * Resets all categories with the given name back to the default level. + */ +void +gst_debug_unset_threshold_for_name (const gchar *name) +{ + GSList *walk; + GPatternSpec *pat; + + g_return_if_fail (name != NULL); + + pat = g_pattern_spec_new (name); + g_static_mutex_lock (&__level_name_mutex); + walk = __level_name; + /* improve this if you want, it's mighty slow */ + while (walk) { + LevelNameEntry *entry = walk->data; + if (g_pattern_spec_equal (entry->pat, pat)) { + __level_name = g_slist_remove_link (__level_name, walk); + g_pattern_spec_free (entry->pat); + g_free (entry); + g_slist_free_1 (walk); + walk = __level_name; } } + g_static_mutex_unlock (&__level_name_mutex); + g_pattern_spec_free (pat); + gst_debug_reset_all_thresholds (); +} +GstDebugCategory * +_gst_debug_category_new (gchar *name, guint color, gchar *description) +{ + GstDebugCategory *cat; + + g_return_val_if_fail (name != NULL, NULL); - fprintf(stderr,"\n"); - fprintf(stderr,"Error: %s\n",string); + cat = g_new (GstDebugCategory, 1); + cat->name = g_strdup (name); + cat->color = color; + if (description != NULL) { + cat->description = g_strdup (description); + } else { + cat->description = g_strdup ("no description"); + } + cat->threshold = g_new (GstAtomicInt, 1); + gst_atomic_int_init (cat->threshold, 0); + gst_debug_reset_threshold (cat, NULL); - g_free(string); + /* add to category list */ + g_static_mutex_lock (&__cat_mutex); + __categories = g_slist_prepend (__categories, cat); + g_static_mutex_unlock (&__cat_mutex); - fprintf(stderr,"***** attempting to stack trace.... *****\n"); + return cat; +} +/** + * gst_debug_category_free: + * @category: category to remove + * + * Removes and frees the category and all associated ressources. + */ +void +gst_debug_category_free (GstDebugCategory *category) +{ + if (category == NULL) return; - g_on_error_stack_trace (_gst_progname); + /* remove from category list */ + g_static_mutex_lock (&__cat_mutex); + __categories = g_slist_remove (__categories, category); + g_static_mutex_unlock (&__cat_mutex); - exit(1); + g_free ((gpointer) category->name); + g_free ((gpointer) category->description); + gst_atomic_int_destroy (category->threshold); + g_free (category->threshold); + g_free (category); +} +/** + * gst_debug_category_set_threshold: + * @category: category to set threshold for + * @level: the threshold to set + * + * Sets the threshold of the category to the given level. Debug information will + * only be output if the threshold is lower or equal to the level of the + * debugging message. + * + * Do not use this function in production code, because other functions may + * change the threshold of categories as side effect. It is however a nice + * function to use when debugging (even from gdb). + * + */ +void +gst_debug_category_set_threshold (GstDebugCategory *category, GstDebugLevel level) +{ + g_return_if_fail (category != NULL); + + gst_atomic_int_set (category->threshold, level); +} +/** + * gst_debug_category_reset_threshold: + * @category: category to set threshold for + * + * Resets the threshold of the category to the default level. Debug information + * will only be output if the threshold is lower or equal to the level of the + * debugging message. + * Use this function to set the threshold back to where it was after using + * gst_debug_category_set_threshold(). + */ +void +gst_debug_category_reset_threshold (GstDebugCategory *category) +{ + gst_debug_reset_threshold (category, NULL); +} +/** + * gst_debug_category_get_threshold: + * @category: category to get threshold for + * + * Returns the threshold of a #GstCategory. + * + * Returns: the level that is used as threshold + */ +GstDebugLevel +gst_debug_category_get_threshold (GstDebugCategory *category) +{ + return gst_atomic_int_read (category->threshold); +} +/** + * gst_debug_category_get_name: + * @category: category to get name for + * + * Returns the name of a #GstCategory. + * + * Returns: the name of the category + */ +const gchar * +gst_debug_category_get_name (GstDebugCategory *category) +{ + return category->name; +} +/** + * gst_debug_category_get_color: + * @category: category to get color for + * + * Returns the color of a #GstCategory to use when outputting this. + * + * Returns: the color of the category + */ +guint +gst_debug_category_get_color (GstDebugCategory *category) +{ + return category->color; +} +/** + * gst_debug_category_get_description: + * @category: category to get description for + * + * Returns the description of a #GstCategory + * + * Returns: the description of the category + */ +const gchar * +gst_debug_category_get_description (GstDebugCategory *category) +{ + return category->description; +} +/** + * gst_debug_get_all_categories: + * + * Returns a snapshot of a all categories that are currently in use . This list + * may change anytime. + * The caller has to free the list after use. + * This function is not threadsafe, so only use it while only the + * main thread is running. + * + * Returns: the list of categories + */ +GSList * +gst_debug_get_all_categories (void) +{ + GSList *ret; + + g_static_mutex_lock (&__cat_mutex); + ret = g_slist_copy (__categories); + g_static_mutex_unlock (&__cat_mutex); + + return ret; } +/*** FUNCTION POINTERS ********************************************************/ -/***** DEBUG system *****/ -#ifdef GST_DEBUG_ENABLED GHashTable *__gst_function_pointers = NULL; - gchar *_gst_debug_nameof_funcptr (void *ptr) G_GNUC_NO_INSTRUMENT; /* This function MUST NOT return NULL */ @@ -504,7 +867,6 @@ _gst_debug_nameof_funcptr (void *ptr) return g_strdup_printf("%p",ptr); } } - void * _gst_debug_register_funcptr (void *ptr, gchar *ptrname) { @@ -515,8 +877,8 @@ _gst_debug_register_funcptr (void *ptr, gchar *ptrname) return ptr; } -#endif /* GST_DEBUG_ENABLED */ +#endif /* GST_DISABLE_GST_DEBUG */ #ifdef GST_ENABLE_FUNC_INSTRUMENTATION /* FIXME make this thread specific */ @@ -528,7 +890,7 @@ void __cyg_profile_func_enter(void *this_fn,void *call_site) gchar *name = _gst_debug_nameof_funcptr (this_fn); gchar *site = _gst_debug_nameof_funcptr (call_site); - GST_DEBUG(GST_CAT_CALL_TRACE, "entering function %s from %s", name, site); + GST_CAT_DEBUG(GST_CAT_CALL_TRACE, "entering function %s from %s", name, site); stack_trace = g_slist_prepend (stack_trace, g_strdup_printf ("%8p in %s from %p (%s)", this_fn, name, call_site, site)); g_free (name); @@ -540,7 +902,7 @@ void __cyg_profile_func_exit(void *this_fn,void *call_site) { gchar *name = _gst_debug_nameof_funcptr (this_fn); - GST_DEBUG(GST_CAT_CALL_TRACE, "leaving function %s", name); + GST_CAT_DEBUG(GST_CAT_CALL_TRACE, "leaving function %s", name); g_free (stack_trace->data); stack_trace = g_slist_delete_link (stack_trace, stack_trace); @@ -572,4 +934,3 @@ gst_debug_print_stack_trace (void) } #endif /* GST_ENABLE_FUNC_INTSTRUMENTATION */ - diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 7f78dfa478..08f54cec81 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -1,8 +1,9 @@ /* GStreamer * Copyright (C) 1999,2000 Erik Walthinsen * 2000 Wim Taymans + * 2003 Benjamin Otte * - * gstinfo.h: + * gstinfo.h: debugging functions * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,454 +24,522 @@ #ifndef __GSTINFO_H__ #define __GSTINFO_H__ -#include -#include -#include -#include +#include +#include +#include +#include +#include -#ifdef HAVE_CONFIG_H -#include +/* + * GStreamer's debugging subsystem is an easy way to get information about what + * the application is doing. + * It is not meant for programming errors. Use GLibs methods (g_warning and so + * on for that. + */ + +/* log levels */ +typedef enum { + GST_LEVEL_NONE = 0, + GST_LEVEL_ERROR, + GST_LEVEL_WARNING, + GST_LEVEL_INFO, + GST_LEVEL_DEBUG, + GST_LEVEL_LOG, + /* add more */ + GST_LEVEL_COUNT +} GstDebugLevel; + +/* we can now override this to be more general in maintainer builds or cvs checkouts */ +#ifndef GST_LEVEL_DEFAULT +#define GST_LEVEL_DEFAULT GST_LEVEL_ERROR #endif +/* defines for format (colors etc) - don't change them around, it uses terminal layout + * Terminal color strings: + * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed + * Text color codes: + * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white + * Background color codes: + * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white + */ +typedef enum { + /* colors */ + GST_DEBUG_FG_BLACK = 0x0000, + GST_DEBUG_FG_RED = 0x0001, + GST_DEBUG_FG_GREEN = 0x0002, + GST_DEBUG_FG_YELLOW = 0x0003, + GST_DEBUG_FG_BLUE = 0x0004, + GST_DEBUG_FG_MAGENTA = 0x0005, + GST_DEBUG_FG_CYAN = 0x0006, + GST_DEBUG_FG_WHITE = 0x0007, + /* background colors */ + GST_DEBUG_BG_BLACK = 0x0000, + GST_DEBUG_BG_RED = 0x0010, + GST_DEBUG_BG_GREEN = 0x0020, + GST_DEBUG_BG_YELLOW = 0x0030, + GST_DEBUG_BG_BLUE = 0x0040, + GST_DEBUG_BG_MAGENTA = 0x0050, + GST_DEBUG_BG_CYAN = 0x0060, + GST_DEBUG_BG_WHITE = 0x0070, + /* other formats */ + GST_DEBUG_BOLD = 0x0100, + GST_DEBUG_UNDERLINE = 0x0200 +} GstDebugColorFlags; + +#define GST_DEBUG_FG_MASK (0x000F) +#define GST_DEBUG_BG_MASK (0x00F0) +#define GST_DEBUG_FORMAT_MASK (0xFF00) + +typedef struct _GstDebugCategory GstDebugCategory; +struct _GstDebugCategory { + /*< private >*/ + GstAtomicInt * threshold; + guint color; /* see defines above */ + + const gchar * name; + const gchar * description; +}; + +/********** some convenience macros for debugging **********/ + /* This is needed in printf's if a char* might be NULL. Solaris crashes then */ #define GST_STR_NULL(str) ((str) ? (str) : "(NULL)") -/* FIXME: convert to using G_STRLOC all the way if we can ! */ - -#ifndef FUNCTION -#ifdef G_GNUC_PRETTY_FUNCTION -#define FUNCTION G_GNUC_PRETTY_FUNCTION -#elif HAVE_FUNC -#define FUNCTION __func__ -#elif HAVE_PRETTY_FUNCTION -#define FUNCTION __PRETTY_FUNCTION__ -#elif HAVE_FUNCTION -#define FUNCTION __FUNCTION__ -#else -#define FUNCTION "" -#endif -#endif /* ifndef FUNCTION */ - -/***** are we in the core or not? *****/ -#ifdef __GST_PRIVATE_H__ - #define _GST_DEBUG_INCORE TRUE -#else - #define _GST_DEBUG_INCORE FALSE -#endif - - -/* colorization stuff */ -#ifdef GST_DEBUG_COLOR - #ifdef __GST_PRIVATE_H__ /* FIXME this should be some libgst.la -specific thing */ - #define GST_DEBUG_CHAR_MODE "00" - #else - #define GST_DEBUG_CHAR_MODE "01" - #endif -#endif - -gint _gst_debug_stringhash_color(gchar *file); - - - -/********************************************************************** - * Categories - **********************************************************************/ - -const gchar * gst_get_category_name (gint category); - -enum { - GST_CAT_GST_INIT = 0, /* Library initialization */ - GST_CAT_COTHREADS, /* Cothread creation, etc. */ - GST_CAT_COTHREAD_SWITCH, /* Cothread switching */ - GST_CAT_AUTOPLUG, /* Successful autoplug results */ - GST_CAT_AUTOPLUG_ATTEMPT, /* Attempted autoplug operations */ - GST_CAT_PARENTAGE, /* GstBin parentage issues */ - GST_CAT_STATES, /* State changes and such */ - GST_CAT_PLANNING, /* Plan generation */ - GST_CAT_SCHEDULING, /* Schedule construction */ - GST_CAT_DATAFLOW, /* Events during actual data movement */ - GST_CAT_BUFFER, /* Buffer creation/destruction */ - GST_CAT_CAPS, /* Capabilities matching */ - GST_CAT_CLOCK, /* Clocking */ - GST_CAT_ELEMENT_PADS, /* Element pad management */ - GST_CAT_ELEMENT_FACTORY, /* Elementfactory stuff */ - GST_CAT_PADS, /* Pad creation/linking */ - GST_CAT_PIPELINE, /* Pipeline stuff */ - GST_CAT_PLUGIN_LOADING, /* Plugin loading */ - GST_CAT_PLUGIN_ERRORS, /* Errors during plugin loading */ - GST_CAT_PLUGIN_INFO, /* Plugin state information */ - GST_CAT_PROPERTIES, /* Properties */ - GST_CAT_THREAD, /* Thread creation/management */ - GST_CAT_TYPES, /* Typing */ - GST_CAT_XML, /* XML load/save of everything */ - GST_CAT_NEGOTIATION, /* Caps Negotiation stuff */ - GST_CAT_REFCOUNTING, /* Ref Counting stuff */ - GST_CAT_EVENT, /* Event system */ - GST_CAT_PARAMS, /* Dynamic parameters */ - GST_CAT_APPLICATION, /* Application-defined debugging */ - - GST_CAT_CALL_TRACE = 30, /* Call tracing */ - - GST_CAT_MAX_CATEGORY = 31 -}; - -extern const gchar *_gst_category_colors[32]; - -extern GStaticPrivate _gst_debug_cothread_index; - - -/********************************************************************** - * DEBUG system - **********************************************************************/ - -/* for include files that make too much noise normally */ -#ifdef GST_DEBUG_FORCE_DISABLE -#undef GST_DEBUG_ENABLED -#endif -/* for applications that really really want all the noise */ -#ifdef GST_DEBUG_FORCE_ENABLE -#define GST_DEBUG_ENABLED -#endif - -/*#ifdef GST_DEBUG_ENABLED */ -#define GST_DEBUG_ENABLE_CATEGORIES 0xffffffff -/*#else */ -/*#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000 */ -/*#endif */ - - -typedef void (*GstDebugHandler) (gint category,gboolean core, - const gchar *file,const gchar *function, - gint line,const gchar *debug_string, - void *element,gchar *string); - -void gst_default_debug_handler (gint category,gboolean incore, - const gchar *file, const gchar *function, - gint line,const gchar *debug_string, - void *element,gchar *string); - -extern guint32 _gst_debug_categories; -extern GstDebugHandler _gst_debug_handler; - -/* fallback, this should probably be a 'weak' symbol or something */ -G_GNUC_UNUSED static gchar *_debug_string = NULL; - - - -#ifdef G_HAVE_ISO_VARARGS - -#ifdef GST_DEBUG_ENABLED -#define GST_DEBUG(cat, ...) G_STMT_START{ \ - if ((1< + * + * When naming your category, please follow the following definitions to ensure + * that the pattern matching for categories works as expected. It is not + * earth-shattering if you don't follow these conventions, but it would be nice + * for everyone. + * + * + * If you define a category for a plugin or a feature of it, name the category + * like the feature. So if you wanted to write a "filesrc" element, you would + * name the category "filesink". Use lowercase letters only. + * If you define more than one category for the same element, append an + * underscore and an identifier to your categories, like this: "filesrc_cache" + * + * + * If you create a library or an application using debugging categories, use a + * common prefix followed by an underscore for all your categories. GStreamer + * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure + * to include uppercase letters. + * + * + */ +#define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{ \ + if (cat == NULL) \ + cat = _gst_debug_category_new (name,color,description); \ +}G_STMT_END +void gst_debug_category_free (GstDebugCategory * category); +void gst_debug_category_set_threshold (GstDebugCategory * category, + GstDebugLevel level); +void gst_debug_category_reset_threshold (GstDebugCategory * category); +GstDebugLevel gst_debug_category_get_threshold (GstDebugCategory * category); +const gchar * gst_debug_category_get_name (GstDebugCategory * category); +guint gst_debug_category_get_color (GstDebugCategory * category); +const gchar * gst_debug_category_get_description (GstDebugCategory * category); +GSList * gst_debug_get_all_categories (void); + +gchar * gst_debug_construct_term_color (guint colorinfo); -/***** Colorized debug for thread ids *****/ -#ifdef GST_DEBUG_COLOR - #define GST_DEBUG_THREAD_FORMAT "\033[00;%dm%d\033[00m" - #define GST_DEBUG_THREAD_ARGS(id) ( ((id) < 0) ? 37 : ((id) % 6 + 31) ), (id) -#else - #define GST_DEBUG_THREAD_FORMAT "%d" - #define GST_DEBUG_THREAD_ARGS(id) (id) -#endif +extern GstDebugCategory * GST_CAT_DEFAULT; - - -/********************************************************************** - * The following is a DEBUG_ENTER implementation that will wrap the - * function it sits at the head of. It removes the need for a - * DEBUG_LEAVE call. However, it segfaults whenever it gets anywhere - * near cothreads. We will not use it for the moment. +/** + * GST_CAT_LEVEL_LOG: + * @cat: category to use + * @level: the severity of the message + * @object: the #GObject the message belongs to or NULL if none + * @...: A printf-style message to output * -typedef void (*_debug_function_f)(); -G_GNUC_UNUSED static gchar *_debug_string_pointer = NULL; -G_GNUC_UNUSED static GModule *_debug_self_module = NULL; + * Outputs a debugging message. This is the most general macro for outputting + * debugging messages. You will probably want to use one of the ones described + * below. + */ +#ifdef G_HAVE_ISO_VARARGS +#define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \ + if (gst_debug_is_active ()) { \ + gst_debug_log (cat, level, __FILE__, GST_FUNCTION, __LINE__, G_OBJECT (object), __VA_ARGS__); \ + } \ +}G_STMT_END +#else /* G_HAVE_GNUC_VARARGS */ +#define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \ + if (gst_debug_is_active ()) { \ + gst_debug_log (cat, level, __FILE__, GST_FUNCTION, __LINE__, G_OBJECT (object), ##args ); \ + } \ +}G_STMT_END +#endif /* G_HAVE_ISO_VARARGS */ + +#ifndef GST_DEBUG_ENABLE_DEPRECATED #ifdef G_HAVE_ISO_VARARGS -#define _DEBUG_ENTER_BUILTIN(...) \ - static int _debug_in_wrapper = 0; \ - gchar *_debug_string = ({ \ - if (!_debug_in_wrapper) { \ - void *_return_value; \ - gchar *_debug_string; \ - _debug_function_f function; \ - void *_function_args = __builtin_apply_args(); \ - _debug_in_wrapper = 1; \ - _debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \ - _debug_string_pointer = _debug_string; \ - fprintf(stderr,"%s: entered " FUNCTION, _debug_string); \ - fprintf(stderr, __VA_ARGS__ ); \ - fprintf(stderr,"\n"); \ - if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \ - g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \ - _return_value = __builtin_apply(function,_function_args,64); \ - fprintf(stderr,"%s: left " FUNCTION, _debug_string); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr,"\n"); \ - g_free(_debug_string); \ - __builtin_return(_return_value); \ - } else { \ - _debug_in_wrapper = 0; \ - } \ - _debug_string_pointer; \ - }); +#define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__) +#define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__) +#define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__) +#define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__) +#define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__) -#elif defined(G_HAVE_GNUC_VARARGS) +#define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__) +#define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__) +#define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__) +#define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__) +#define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__) -#define _DEBUG_ENTER_BUILTIN(format,args...) \ - static int _debug_in_wrapper = 0; \ - gchar *_debug_string = ({ \ - if (!_debug_in_wrapper) { \ - void *_return_value; \ - gchar *_debug_string; \ - _debug_function_f function; \ - void *_function_args = __builtin_apply_args(); \ - _debug_in_wrapper = 1; \ - _debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \ - _debug_string_pointer = _debug_string; \ - fprintf(stderr,"%s: entered " FUNCTION format "\n" , _debug_string , ## args ); \ - if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \ - g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \ - _return_value = __builtin_apply(function,_function_args,64); \ - fprintf(stderr,"%s: left " FUNCTION format "\n" , _debug_string , ## args ); \ - g_free(_debug_string); \ - __builtin_return(_return_value); \ - } else { \ - _debug_in_wrapper = 0; \ - } \ - _debug_string_pointer; \ - }); +#define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__) +#define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__) +#define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__) +#define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__) +#define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__) -#endif +#define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__) +#define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__) +#define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__) +#define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__) +#define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__) -* WARNING: there's a gcc CPP bug lurking in here. The extra space before the ##args * - * somehow make the preprocessor leave the _debug_string. If it's removed, the * - * _debug_string somehow gets stripped along with the ##args, and that's all she wrote. * +#else /* G_HAVE_GNUC_VARARGS */ + +#define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args ) +#define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args ) +#define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args ) +#define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args ) +#define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args ) + +#define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args ) +#define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args ) +#define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args ) +#define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args ) +#define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args ) + +#define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args ) +#define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args ) +#define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args ) +#define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args ) +#define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args ) + +#define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args ) +#define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args ) +#define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args ) +#define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args ) +#define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args ) + +#endif /* G_HAVE_ISO_VARARGS */ + +#else /* GST_DEBUG_ENABLE_DEPRECATED */ +/* This is a workaround so the old debugging stuff of Gstreamer 0.6 works. + This is undocumented and will go when 0.8 comes out. */ #ifdef G_HAVE_ISO_VARARGS +# define GST_INFO(cat,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__) +# define GST_DEBUG(cat,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__) +# define GST_INFO_ELEMENT(cat,obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__) +# define GST_DEBUG_ELEMENT(cat,obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__) +# define GST_DEBUG_ENTER(...) GST_DEBUG ("entering: " __VA_ARGS__ ) +# define GST_DEBUG_LEAVE(...) GST_DEBUG ("leaving: " __VA_ARGS__ ) +# define GST_INFO_ENTER(...) GST_INFO ("entering: " __VA_ARGS__ ) +# define GST_INFO_LEAVE(...) GST_INFO ("leaving: " __VA_ARGS__ ) +#else /* G_HAVE_GNUC_VARARGS */ +# define GST_INFO(cat,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args ) +# define GST_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args ) +# define GST_INFO_ELEMENT(cat,obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args ) +# define GST_DEBUG_ELEMENT(cat,obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args ) +# define GST_DEBUG_ENTER(args...) GST_DEBUG ("entering: " ##args ) +# define GST_DEBUG_LEAVE(args...) GST_DEBUG ("leaving: " ##args ) +# define GST_INFO_ENTER(args...) GST_INFO ("entering: " ##args ) +# define GST_INFO_LEAVE(args...) GST_INFO ("leaving: " ##args ) +#endif /* G_HAVE_ISO_VARARGS */ -#define _DEBUG_BUILTIN(...) \ - if (_debug_string != (void *)-1) { \ - if (_debug_string) { \ - fprintf(stderr, "%s: " _debug_string); \ - fprintf(stderr, __VA_ARGS__); \ - } else { \ - fprintf(stderr,GST_DEBUG_PREFIX(": " __VA_ARGS__)); \ - } \ - } +#endif /* !GST_DEBUG_ENABLE_DEPRECATED */ -#elif defined(G_HAVE_GNUC_VARARGS) - -#define _DEBUG_BUILTIN(format,args...) \ - if (_debug_string != (void *)-1) { \ - if (_debug_string) \ - fprintf(stderr,"%s: " format , _debug_string , ## args); \ - else \ - fprintf(stderr,GST_DEBUG_PREFIX(": " format , ## args)); \ - } - -#endif - -*/ - - - -/********************************************************************** - * INFO system - **********************************************************************/ - -typedef void (*GstInfoHandler) (gint category,gboolean incore, - const gchar *file,const gchar *function, - gint line,const gchar *debug_string, - void *element,gchar *string); - -void gst_default_info_handler (gint category,gboolean incore, - const gchar *file,const gchar *function, - gint line,const gchar *debug_string, - void *element,gchar *string); - -extern GstInfoHandler _gst_info_handler; -extern guint32 _gst_info_categories; - -/* for include files that make too much noise normally */ -#ifdef GST_INFO_FORCE_DISABLE -#undef GST_INFO_ENABLED -#endif -/* for applications that really really want all the noise */ -#ifdef GST_INFO_FORCE_ENABLE -#define GST_INFO_ENABLED -#endif - -#ifdef G_HAVE_ISO_VARARGS - -#ifdef GST_INFO_ENABLED -#define GST_INFO(cat,...) G_STMT_START{ \ - if ((1< + * + * Make sure you free the string after use. + * + * + * + * Returns: The name of the function + */ #define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr) -#else + +#else /* GST_DISABLE_GST_DEBUG */ + +#ifdef __GNUC__ +# pragma GCC poison gst_debug_log +# pragma GCC poison gst_debug_logv +# pragma GCC poison gst_debug_log_default +# pragma GCC poison _gst_debug_category_new +#endif + +#define _gst_debug_init() /* NOP */ + +#define gst_debug_set_log_function(func,data) /* NOP */ +#define gst_debug_reset_log_function(void) /* NOP */ +#define gst_debug_set_default_threshold(level) /* NOP */ +#define gst_debug_get_default_threshold() (GST_LEVEL_NONE) +#define gst_debug_category_set_threshold_for_name(name, level) /* NOP */ +#define gst_debug_category_unset_threshold_for_name(name) /* NOP */ + +#define gst_debug_level_get_name(level) ("NONE") +#define gst_debug_add_log_function(func,data) (FALSE) +#define gst_debug_remove_log_function(func) (0) +#define gst_debug_remove_log_function_by_data(data) (0) +#define gst_debug_set_active(active) /* NOP */ +#define gst_debug_is_active() (FALSE) +#define gst_debug_set_colored(colored) /* NOP */ +#define gst_debug_is_colored() (FALSE) +#define gst_debug_set_default_threshold(level) /* NOP */ +#define gst_debug_get_default_threshold() (GST_LEVEL_NONE) +#define gst_debug_set_threshold_for_name(name,level) /* NOP */ +#define gst_debug_unset_threshold_for_name(name) /* NOP */ + +#define GST_DEBUG_CATEGORY(var) /* NOP */ +#define GST_DEBUG_CATEGORY_EXTERN(var) /* NOP */ +#define GST_DEBUG_CATEGORY_STATIC(var) /* NOP */ +#define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) /* NOP */ +#define gst_debug_category_free(category) /* NOP */ +#define gst_debug_category_set_threshold(category,level) /* NOP */ +#define gst_debug_category_reset_threshold(category) /* NOP */ +#define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE) +#define gst_debug_category_get_name(cat) ("") +#define gst_debug_category_get_color(cat) (0) +#define gst_debug_category_get_description(cat) ("") +#define gst_debug_get_all_categories() (NULL) +#define gst_debug_construct_term_color(colorinfo) (g_strdup ("00")) + +#ifdef G_HAVE_ISO_VARARGS + +#define GST_CAT_LEVEL_LOG(cat,level,...) /* NOP */ + +#define GST_CAT_ERROR_OBJECT(...) /* NOP */ +#define GST_CAT_WARNING_OBJECT(...) /* NOP */ +#define GST_CAT_INFO_OBJECT(...) /* NOP */ +#define GST_CAT_DEBUG_OBJECT(...) /* NOP */ +#define GST_CAT_LOG_OBJECT(...) /* NOP */ + +#define GST_CAT_ERROR(...) /* NOP */ +#define GST_CAT_WARNING(...) /* NOP */ +#define GST_CAT_INFO(...) /* NOP */ +#define GST_CAT_DEBUG(...) /* NOP */ +#define GST_CAT_LOG(...) /* NOP */ + +#define GST_ERROR_OBJECT(...) /* NOP */ +#define GST_WARNING_OBJECT(...) /* NOP */ +#define GST_INFO_OBJECT(...) /* NOP */ +#define GST_DEBUG_OBJECT(...) /* NOP */ +#define GST_LOG_OBJECT(...) /* NOP */ + +#define GST_ERROR(...) /* NOP */ +#define GST_WARNING(...) /* NOP */ +#define GST_INFO(...) /* NOP */ +#define GST_DEBUG(...) /* NOP */ +#define GST_LOG(...) /* NOP */ + +#ifdef GST_DEBUG_ENABLE_DEPRECATED +#define GST_INFO_ELEMENT(cat,obj,...) /* NOP */ +#define GST_DEBUG_ELEMENT(cat,obj,...) /* NOP */ +#define GST_DEBUG_ENTER(...) /* NOP */ +#define GST_DEBUG_LEAVE(...) /* NOP */ +#define GST_INFO_ENTER(...) /* NOP */ +#define GST_INFO_LEAVE(...) /* NOP */ +#endif /* GST_DEBUG_ENABLE_DEPRECATED */ + +#else /* !G_HAVE_ISO_VARARGS */ + +#define GST_CAT_LEVEL_LOG(cat,level,args...) /* NOP */ + +#define GST_CAT_ERROR_OBJECT(args...) /* NOP */ +#define GST_CAT_WARNING_OBJECT(args...) /* NOP */ +#define GST_CAT_INFO_OBJECT(args...) /* NOP */ +#define GST_CAT_DEBUG_OBJECT(args...) /* NOP */ +#define GST_CAT_LOG_OBJECT(args...) /* NOP */ + +#define GST_CAT_ERROR(args...) /* NOP */ +#define GST_CAT_WARNING(args...) /* NOP */ +#define GST_CAT_INFO(args...) /* NOP */ +#define GST_CAT_DEBUG(args...) /* NOP */ +#define GST_CAT_LOG(args...) /* NOP */ + +#define GST_ERROR_OBJECT(args...) /* NOP */ +#define GST_WARNING_OBJECT(args...) /* NOP */ +#define GST_INFO_OBJECT(args...) /* NOP */ +#define GST_DEBUG_OBJECT(args...) /* NOP */ +#define GST_LOG_OBJECT(args...) /* NOP */ + +#define GST_ERROR(args...) /* NOP */ +#define GST_WARNING(args...) /* NOP */ +#define GST_INFO(args...) /* NOP */ +#define GST_DEBUG(args...) /* NOP */ +#define GST_LOG(args...) /* NOP */ + +#ifdef GST_DEBUG_ENABLE_DEPRECATED +#define GST_INFO_ELEMENT(cat,obj,args...) /* NOP */ +#define GST_DEBUG_ELEMENT(cat,obj,args...) /* NOP */ +#define GST_DEBUG_ENTER(args...) /* NOP */ +#define GST_DEBUG_LEAVE(args...) /* NOP */ +#define GST_INFO_ENTER(args...) /* NOP */ +#define GST_INFO_LEAVE(args...) /* NOP */ +#endif /* GST_DEBUG_ENABLE_DEPRECATED */ + +#endif /* G_HAVE_ISO_VARARGS */ + #define GST_DEBUG_FUNCPTR(ptr) (ptr) -#define GST_DEBUG_FUNCPTR_NAME(ptr) "" -#endif /* GST_DEBUG_ENABLED */ +#define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr)) + +#endif /* GST_DISABLE_GST_DEBUG */ void gst_debug_print_stack_trace (void); diff --git a/gst/gstobject.c b/gst/gstobject.c index 5b2459651c..f45648c4d0 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -23,7 +23,8 @@ #include "gst_private.h" #include "gstobject.h" -#include "gstlog.h" +#include "gstinfo.h" + #ifndef GST_DISABLE_TRACE #include "gsttrace.h" #endif @@ -211,8 +212,7 @@ gst_object_ref (GstObject *object) { g_return_val_if_fail (GST_IS_OBJECT (object), NULL); - GST_DEBUG (GST_CAT_REFCOUNTING, "ref %p '%s' %d->%d", object, - GST_STR_NULL (GST_OBJECT_NAME (object)), + GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "ref %d->%d", G_OBJECT (object)->ref_count, G_OBJECT (object)->ref_count + 1); @@ -233,8 +233,7 @@ gst_object_unref (GstObject *object) g_return_if_fail (GST_IS_OBJECT (object)); g_return_if_fail (G_OBJECT (object)->ref_count > 0); - GST_DEBUG (GST_CAT_REFCOUNTING, "unref %p '%s' %d->%d", object, - GST_STR_NULL (GST_OBJECT_NAME (object)), + GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unref %d->%d", G_OBJECT (object)->ref_count, G_OBJECT (object)->ref_count - 1); @@ -256,7 +255,7 @@ gst_object_sink (GstObject *object) g_return_if_fail (object != NULL); g_return_if_fail (GST_IS_OBJECT (object)); - GST_DEBUG (GST_CAT_REFCOUNTING, "sink %p '%s'", object, GST_STR_NULL (GST_OBJECT_NAME (object))); + GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "sink"); if (GST_OBJECT_FLOATING (object)) { GST_FLAG_UNSET (object, GST_FLOATING); @@ -275,7 +274,13 @@ gst_object_sink (GstObject *object) void gst_object_replace (GstObject **oldobj, GstObject *newobj) { - GST_DEBUG (GST_CAT_REFCOUNTING, "replace %p %p", *oldobj, newobj); + g_return_if_fail (oldobj != NULL); + g_return_if_fail (*oldobj == NULL || GST_IS_OBJECT (*oldobj)); + g_return_if_fail (newobj == NULL || GST_IS_OBJECT (newobj)); + + GST_CAT_LOG (GST_CAT_REFCOUNTING, "replace %s %s", + *oldobj ? GST_STR_NULL (GST_OBJECT_NAME (*oldobj)) : "(NONE)", + newobj ? GST_STR_NULL (GST_OBJECT_NAME (newobj)) : "(NONE)"); if (*oldobj != newobj) { if (newobj) gst_object_ref (newobj); @@ -288,7 +293,7 @@ gst_object_replace (GstObject **oldobj, GstObject *newobj) static void gst_object_dispose (GObject *object) { - GST_DEBUG (GST_CAT_REFCOUNTING, "dispose %p '%s'", object, GST_STR_NULL (GST_OBJECT_NAME (object))); + GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose"); GST_FLAG_SET (GST_OBJECT (object), GST_DESTROYED); GST_OBJECT_PARENT (object) = NULL; @@ -302,7 +307,7 @@ gst_object_finalize (GObject *object) { GstObject *gstobject = GST_OBJECT (object); - GST_DEBUG (GST_CAT_REFCOUNTING, "finalize %p '%s'", object, GST_STR_NULL (GST_OBJECT_NAME (object))); + GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "finalize"); g_signal_handlers_destroy (object); @@ -346,7 +351,7 @@ gst_object_dispatch_properties_changed (GObject *object, while (gst_object) { /* need own category? */ for (i = 0; i < n_pspecs; i++) { - GST_DEBUG (GST_CAT_EVENT, "deep notification from %s to %s (%s)", GST_OBJECT_NAME (object), + GST_CAT_LOG (GST_CAT_EVENT, "deep notification from %s to %s (%s)", GST_OBJECT_NAME (object), GST_OBJECT_NAME (gst_object), pspecs[i]->name); g_signal_emit (gst_object, gst_object_signals[DEEP_NOTIFY], g_quark_from_string (pspecs[i]->name), (GstObject *) object, pspecs[i]); @@ -501,11 +506,7 @@ gst_object_set_parent (GstObject *object, GstObject *parent) g_return_if_fail (parent != NULL); g_return_if_fail (GST_IS_OBJECT (parent)); g_return_if_fail (object != parent); - - if (object->parent != NULL) { - GST_ERROR_OBJECT (object,object->parent, "object's parent is already set, must unparent first"); - return; - } + g_return_if_fail (object->parent == NULL); gst_object_ref (object); gst_object_sink (object); @@ -545,7 +546,7 @@ gst_object_unparent (GstObject *object) if (object->parent == NULL) return; - GST_DEBUG (GST_CAT_REFCOUNTING, "unparent '%s'",GST_OBJECT_NAME(object)); + GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unparent"); g_signal_emit (G_OBJECT (object), gst_object_signals[PARENT_UNSET], 0, object->parent); diff --git a/gst/gstpad.c b/gst/gstpad.c index 509c0d7b22..bcd60f5f0a 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -20,7 +20,6 @@ * Boston, MA 02111-1307, USA. */ -/* #define GST_DEBUG_ENABLED */ #include "gst_private.h" #include "gstpad.h" @@ -30,7 +29,7 @@ #include "gstbin.h" #include "gstscheduler.h" #include "gstevent.h" -#include "gstlog.h" +#include "gstinfo.h" enum { TEMPL_PAD_CREATED, @@ -398,11 +397,11 @@ gst_pad_set_active (GstPad *pad, gboolean active) realpad = GST_PAD_REALIZE (pad); if (active) { - GST_DEBUG (GST_CAT_PADS, "activating pad %s:%s", + GST_CAT_DEBUG (GST_CAT_PADS, "activating pad %s:%s", GST_DEBUG_PAD_NAME (realpad)); GST_FLAG_UNSET (realpad, GST_PAD_DISABLED); } else { - GST_DEBUG (GST_CAT_PADS, "de-activating pad %s:%s", + GST_CAT_DEBUG (GST_CAT_PADS, "de-activating pad %s:%s", GST_DEBUG_PAD_NAME (realpad)); GST_FLAG_SET (realpad, GST_PAD_DISABLED); } @@ -474,7 +473,7 @@ gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain) g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_CHAINFUNC (pad) = chain; - GST_DEBUG (GST_CAT_PADS, "chainfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "chainfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (chain)); } @@ -494,7 +493,7 @@ gst_pad_set_get_function (GstPad *pad, GST_RPAD_GETFUNC (pad) = get; - GST_DEBUG (GST_CAT_PADS, "getfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "getfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (get)); } @@ -513,7 +512,7 @@ gst_pad_set_event_function (GstPad *pad, GST_RPAD_EVENTFUNC (pad) = event; - GST_DEBUG (GST_CAT_PADS, "eventfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "eventfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (event)); } @@ -532,7 +531,7 @@ gst_pad_set_event_mask_function (GstPad *pad, GST_RPAD_EVENTMASKFUNC (pad) = mask_func; - GST_DEBUG (GST_CAT_PADS, "eventmaskfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "eventmaskfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (mask_func)); } @@ -607,7 +606,7 @@ gst_pad_set_convert_function (GstPad *pad, GST_RPAD_CONVERTFUNC (pad) = convert; - GST_DEBUG (GST_CAT_PADS, "convertfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "convertfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (convert)); } @@ -626,7 +625,7 @@ gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query) GST_RPAD_QUERYFUNC (pad) = query; - GST_DEBUG (GST_CAT_PADS, "queryfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "queryfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (query)); } @@ -645,7 +644,7 @@ gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func) GST_RPAD_QUERYTYPEFUNC (pad) = type_func; - GST_DEBUG (GST_CAT_PADS, "querytypefunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "querytypefunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (type_func)); } @@ -719,7 +718,7 @@ gst_pad_set_internal_link_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_INTLINKFUNC (pad) = intlink; - GST_DEBUG (GST_CAT_PADS, "internal link for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "internal link for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (intlink)); } @@ -737,7 +736,7 @@ gst_pad_set_formats_function (GstPad *pad, GstPadFormatsFunction formats) g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_FORMATSFUNC (pad) = formats; - GST_DEBUG (GST_CAT_PADS, "formats function for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "formats function for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (formats)); } @@ -757,7 +756,7 @@ gst_pad_set_link_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_LINKFUNC (pad) = link; - GST_DEBUG (GST_CAT_PADS, "linkfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "linkfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (link)); } @@ -776,7 +775,7 @@ gst_pad_set_getcaps_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_GETCAPSFUNC (pad) = getcaps; - GST_DEBUG (GST_CAT_PADS, "getcapsfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "getcapsfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (getcaps)); } /** @@ -796,7 +795,7 @@ gst_pad_set_bufferpool_function (GstPad *pad, g_return_if_fail (GST_PAD_IS_SINK (pad)); GST_RPAD_BUFFERPOOLFUNC (pad) = bufpool; - GST_DEBUG (GST_CAT_PADS, "bufferpoolfunc for %s:%s set to %s", + GST_CAT_DEBUG (GST_CAT_PADS, "bufferpoolfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (bufpool)); } @@ -820,7 +819,7 @@ gst_pad_unlink (GstPad *srcpad, g_return_if_fail (sinkpad != NULL); g_return_if_fail (GST_IS_PAD (sinkpad)); - GST_INFO (GST_CAT_ELEMENT_PADS, "unlinking %s:%s(%p) and %s:%s(%p)", + GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "unlinking %s:%s(%p) and %s:%s(%p)", GST_DEBUG_PAD_NAME (srcpad), srcpad, GST_DEBUG_PAD_NAME (sinkpad), sinkpad); @@ -874,7 +873,7 @@ gst_pad_unlink (GstPad *srcpad, g_signal_emit (G_OBJECT (realsink), gst_real_pad_signals[REAL_UNLINKED], 0, realsrc); - GST_INFO (GST_CAT_ELEMENT_PADS, "unlinked %s:%s and %s:%s", + GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "unlinked %s:%s and %s:%s", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); gst_object_unref (GST_OBJECT (realsrc)); @@ -988,7 +987,7 @@ gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps) g_return_val_if_fail (sinkpad != NULL, FALSE); g_return_val_if_fail (GST_IS_PAD (sinkpad), FALSE); - GST_INFO (GST_CAT_PADS, "trying to link %s:%s and %s:%s", + GST_CAT_INFO (GST_CAT_PADS, "trying to link %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 */ @@ -996,27 +995,27 @@ gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps) realsink = GST_PAD_REALIZE (sinkpad); if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) { - GST_INFO (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s", + GST_CAT_INFO (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); } /* FIXME: shouldn't we convert this to g_return_val_if_fail? */ if (GST_RPAD_PEER (realsrc) != NULL) { - GST_INFO (GST_CAT_PADS, "Real source pad %s:%s has a peer, failed", + GST_CAT_INFO (GST_CAT_PADS, "Real source pad %s:%s has a peer, failed", GST_DEBUG_PAD_NAME (realsrc)); return FALSE; } if (GST_RPAD_PEER (realsink) != NULL) { - GST_INFO (GST_CAT_PADS, "Real sink pad %s:%s has a peer, failed", + GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has a peer, failed", GST_DEBUG_PAD_NAME (realsink)); return FALSE; } if (GST_PAD_PARENT (realsrc) == NULL) { - GST_INFO (GST_CAT_PADS, "Real src pad %s:%s has no parent, failed", + GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s has no parent, failed", GST_DEBUG_PAD_NAME (realsrc)); return FALSE; } if (GST_PAD_PARENT (realsink) == NULL) { - GST_INFO (GST_CAT_PADS, "Real sink pad %s:%s has no parent, failed", + GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has no parent, failed", GST_DEBUG_PAD_NAME (realsrc)); return FALSE; } @@ -1037,12 +1036,12 @@ gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps) realsink = temppad; } if (GST_RPAD_DIRECTION (realsrc) != GST_PAD_SRC) { - GST_INFO (GST_CAT_PADS, "Real src pad %s:%s is not a source pad, failed", + GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s is not a source pad, failed", GST_DEBUG_PAD_NAME (realsrc)); return FALSE; } if (GST_RPAD_DIRECTION (realsink) != GST_PAD_SINK) { - GST_INFO (GST_CAT_PADS, "Real sink pad %s:%s is not a sink pad, failed", + GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s is not a sink pad, failed", GST_DEBUG_PAD_NAME (realsink)); return FALSE; } @@ -1053,7 +1052,7 @@ gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps) /* try to negotiate the pads, we don't need to clear the caps here */ if (!gst_pad_try_relink_filtered_func (realsrc, realsink, filtercaps, FALSE)) { - GST_DEBUG (GST_CAT_CAPS, "relink_filtered_func failed, can't link"); + GST_CAT_DEBUG (GST_CAT_CAPS, "relink_filtered_func failed, can't link"); GST_RPAD_PEER (realsrc) = NULL; GST_RPAD_PEER (realsink) = NULL; @@ -1077,12 +1076,12 @@ gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps) GST_PAD_CAST (realsrc), GST_PAD_CAST (realsink)); } else { - GST_INFO (GST_CAT_PADS, "not telling link to scheduler %s:%s and %s:%s, %p %p", + GST_CAT_INFO (GST_CAT_PADS, "not telling link to scheduler %s:%s and %s:%s, %p %p", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad), src_sched, sink_sched); } - GST_INFO (GST_CAT_PADS, "linked %s:%s and %s:%s, successful", + GST_CAT_INFO (GST_CAT_PADS, "linked %s:%s and %s:%s, successful", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); return TRUE; @@ -1305,12 +1304,12 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify) * negotiation */ if (parent && GST_STATE (parent) < GST_STATE_READY) { - GST_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not READY", + GST_CAT_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not READY", GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (pad)); return GST_PAD_LINK_DELAYED; } - GST_INFO (GST_CAT_CAPS, "trying to set caps %p on pad %s:%s", + GST_CAT_INFO (GST_CAT_CAPS, "trying to set caps %p on pad %s:%s", caps, GST_DEBUG_PAD_NAME (pad)); /* first see if we have to check against a filter, we ref the caps here as we're @@ -1331,7 +1330,7 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify) /* oops, empty intersection, caps don"t have anything in common */ if (!intersection) { - GST_INFO (GST_CAT_CAPS, "caps did not intersect with %s:%s's allowed caps", + GST_CAT_INFO (GST_CAT_CAPS, "caps did not intersect with %s:%s's allowed caps", GST_DEBUG_PAD_NAME (pad)); gst_caps_debug (caps, "caps themselves (attemped to set)"); gst_caps_debug (allowed, @@ -1352,7 +1351,7 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify) gchar *debug_string; gboolean negotiating; - GST_INFO (GST_CAT_CAPS, "calling link function on pad %s:%s", + GST_CAT_INFO (GST_CAT_CAPS, "calling link function on pad %s:%s", GST_DEBUG_PAD_NAME (pad)); negotiating = GST_FLAG_IS_SET (pad, GST_PAD_NEGOTIATING); @@ -1387,18 +1386,18 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify) return GST_PAD_LINK_REFUSED; } - GST_INFO (GST_CAT_CAPS, + GST_CAT_INFO (GST_CAT_CAPS, "got reply %s (%d) from link function on pad %s:%s", debug_string, res, GST_DEBUG_PAD_NAME (pad)); /* done means the link function called another caps negotiate function * on this pad that succeeded, we dont need to continue */ if (res == GST_PAD_LINK_DONE) { - GST_INFO (GST_CAT_CAPS, "pad %s:%s is done", GST_DEBUG_PAD_NAME (pad)); + GST_CAT_INFO (GST_CAT_CAPS, "pad %s:%s is done", GST_DEBUG_PAD_NAME (pad)); return GST_PAD_LINK_DONE; } if (res == GST_PAD_LINK_REFUSED) { - GST_INFO (GST_CAT_CAPS, "pad %s:%s doesn't accept caps", + GST_CAT_INFO (GST_CAT_CAPS, "pad %s:%s doesn't accept caps", GST_DEBUG_PAD_NAME (pad)); return GST_PAD_LINK_REFUSED; } @@ -1406,7 +1405,7 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify) /* we can only set caps on the pad if they are fixed */ if (GST_CAPS_IS_FIXED (caps)) { - GST_INFO (GST_CAT_CAPS, "setting caps on pad %s:%s", + GST_CAT_INFO (GST_CAT_CAPS, "setting caps on pad %s:%s", GST_DEBUG_PAD_NAME (pad)); /* if we got this far all is ok, remove the old caps, set the new one */ gst_caps_replace_sink (&GST_PAD_CAPS (pad), caps); @@ -1414,7 +1413,7 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify) g_object_notify (G_OBJECT (pad), "caps"); } else { - GST_INFO (GST_CAT_CAPS, + GST_CAT_INFO (GST_CAT_CAPS, "caps are not fixed on pad %s:%s, not setting them yet", GST_DEBUG_PAD_NAME (pad)); @@ -1443,7 +1442,7 @@ gst_pad_try_set_caps (GstPad *pad, GstCaps *caps) realpad = GST_PAD_REALIZE (pad); peer = GST_RPAD_PEER (realpad); - GST_INFO (GST_CAT_CAPS, "trying to set caps %p on pad %s:%s", + GST_CAT_INFO (GST_CAT_CAPS, "trying to set caps %p on pad %s:%s", caps, GST_DEBUG_PAD_NAME (realpad)); gst_caps_debug (caps, "caps that we are trying to set"); @@ -1454,7 +1453,7 @@ gst_pad_try_set_caps (GstPad *pad, GstCaps *caps) /* setting non fixed caps on a pad is not allowed */ if (!GST_CAPS_IS_FIXED (caps)) { - GST_INFO (GST_CAT_CAPS, + GST_CAT_INFO (GST_CAT_CAPS, "trying to set unfixed caps on pad %s:%s, not allowed", GST_DEBUG_PAD_NAME (realpad)); g_warning ("trying to set non fixed caps on pad %s:%s, not allowed", @@ -1469,7 +1468,7 @@ gst_pad_try_set_caps (GstPad *pad, GstCaps *caps) * if it has a link function */ if (peer && ((set_retval = gst_pad_try_set_caps_func (peer, caps, TRUE)) <= 0)) { - GST_INFO (GST_CAT_CAPS, "tried to set caps on peerpad %s:%s but couldn't, return value %d", + GST_CAT_INFO (GST_CAT_CAPS, "tried to set caps on peerpad %s:%s but couldn't, return value %d", GST_DEBUG_PAD_NAME (peer), set_retval); goto done; } @@ -1477,11 +1476,11 @@ gst_pad_try_set_caps (GstPad *pad, GstCaps *caps) /* then try to set our own caps, we don't need to be notified */ if ((set_retval = gst_pad_try_set_caps_func (realpad, caps, FALSE)) <= 0) { - GST_INFO (GST_CAT_CAPS, "tried to set own caps on pad %s:%s but couldn't, return value %d", + GST_CAT_INFO (GST_CAT_CAPS, "tried to set own caps on pad %s:%s but couldn't, return value %d", GST_DEBUG_PAD_NAME (realpad), set_retval); goto done; } - GST_INFO (GST_CAT_CAPS, "succeeded setting caps %p on pad %s:%s, return value %d", + GST_CAT_INFO (GST_CAT_CAPS, "succeeded setting caps %p on pad %s:%s, return value %d", caps, GST_DEBUG_PAD_NAME (realpad), set_retval); g_assert (GST_PAD_CAPS (pad)); @@ -1517,7 +1516,7 @@ gst_pad_try_relink_filtered_func (GstRealPad *srcpad, GstRealPad *sinkpad, /* optinally clear the caps */ if (clear) { - GST_INFO (GST_CAT_PADS, + GST_CAT_INFO (GST_CAT_PADS, "start relink filtered %s:%s and %s:%s, clearing caps", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); @@ -1527,16 +1526,16 @@ gst_pad_try_relink_filtered_func (GstRealPad *srcpad, GstRealPad *sinkpad, gst_caps_replace (&GST_RPAD_FILTER (realsink), NULL); } else { - GST_INFO (GST_CAT_PADS, "start relink filtered %s:%s and %s:%s", + GST_CAT_INFO (GST_CAT_PADS, "start relink filtered %s:%s and %s:%s", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); } srccaps = gst_pad_get_caps (GST_PAD (realsrc)); - GST_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", + GST_CAT_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", GST_DEBUG_PAD_NAME (realsrc)); gst_caps_debug (srccaps, "caps of src pad (pre-relink)"); sinkcaps = gst_pad_get_caps (GST_PAD (realsink)); - GST_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", + GST_CAT_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", GST_DEBUG_PAD_NAME (realsink)); gst_caps_debug (sinkcaps, "caps of sink pad (pre-relink)"); @@ -1548,14 +1547,14 @@ gst_pad_try_relink_filtered_func (GstRealPad *srcpad, GstRealPad *sinkpad, if (!intersection && (srccaps || sinkcaps)) { /* the intersection is NULL but the pad caps were not both NULL, * this means they have no common format */ - GST_INFO (GST_CAT_PADS, "pads %s:%s and %s:%s have no common type", + GST_CAT_INFO (GST_CAT_PADS, "pads %s:%s and %s:%s have no common type", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); /* make sure any floating caps from gst_pad_get_caps are freed here */ gst_caps_sink (srccaps); gst_caps_sink (sinkcaps); return FALSE; } else { - GST_INFO (GST_CAT_PADS, "pads %s:%s and %s:%s intersected to %s caps", + GST_CAT_INFO (GST_CAT_PADS, "pads %s:%s and %s:%s intersected to %s caps", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink), (intersection ? (GST_CAPS_IS_FIXED (intersection) ? "fixed" : "variable") : @@ -1575,7 +1574,7 @@ gst_pad_try_relink_filtered_func (GstRealPad *srcpad, GstRealPad *sinkpad, gst_caps_sink (intersection); if (!filtered_intersection) { - GST_INFO (GST_CAT_PADS, + GST_CAT_INFO (GST_CAT_PADS, "filtered link between pads %s:%s and %s:%s is empty", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); return FALSE; @@ -1587,7 +1586,7 @@ gst_pad_try_relink_filtered_func (GstRealPad *srcpad, GstRealPad *sinkpad, gst_caps_replace_sink (&GST_RPAD_APPFILTER (realsrc), filtercaps); } } - GST_DEBUG (GST_CAT_CAPS, "setting filter for link to:"); + GST_CAT_DEBUG (GST_CAT_CAPS, "setting filter for link to:"); gst_caps_debug (intersection, "filter for link"); /* both the app filter and the filter, while stored on both peer pads, @@ -1630,35 +1629,35 @@ gst_pad_perform_negotiate (GstPad *srcpad, GstPad *sinkpad) /* shortcut negotiation */ parent = GST_PAD_PARENT (realsrc); if (parent && GST_STATE (parent) < GST_STATE_READY) { - GST_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not READY", + GST_CAT_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not READY", GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (realsrc)); return TRUE; } parent = GST_PAD_PARENT (realsink); if (parent && GST_STATE (parent) < GST_STATE_READY) { - GST_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not READY", + GST_CAT_DEBUG (GST_CAT_CAPS, "parent %s of pad %s:%s is not READY", GST_ELEMENT_NAME (parent), GST_DEBUG_PAD_NAME (realsink)); return TRUE; } - GST_INFO (GST_CAT_PADS, "perform negotiate for link %s:%s-%s:%s", + GST_CAT_INFO (GST_CAT_PADS, "perform negotiate for link %s:%s-%s:%s", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); filter = GST_RPAD_APPFILTER (realsrc); if (filter) { - GST_INFO (GST_CAT_PADS, "dumping filter for link %s:%s-%s:%s", + GST_CAT_INFO (GST_CAT_PADS, "dumping filter for link %s:%s-%s:%s", GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); gst_caps_debug (filter, "link filter caps"); } /* calculate the new caps here */ srccaps = gst_pad_get_caps (GST_PAD (realsrc)); - GST_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", + GST_CAT_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", GST_DEBUG_PAD_NAME (realsrc)); gst_caps_debug (srccaps, "src caps, awaiting negotiation, after applying filter"); sinkcaps = gst_pad_get_caps (GST_PAD (realsink)); - GST_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", + GST_CAT_DEBUG (GST_CAT_PADS, "dumping caps of pad %s:%s", GST_DEBUG_PAD_NAME (realsink)); gst_caps_debug (sinkcaps, "sink caps, awaiting negotiation, after applying filter"); @@ -1783,7 +1782,7 @@ gst_pad_proxy_link (GstPad *pad, GstCaps *caps) peer = GST_RPAD_PEER (realpad); - GST_INFO (GST_CAT_CAPS, "proxy link to pad %s:%s", + GST_CAT_INFO (GST_CAT_CAPS, "proxy link to pad %s:%s", GST_DEBUG_PAD_NAME (realpad)); if (peer && gst_pad_try_set_caps_func (peer, caps, TRUE) < 0) @@ -1794,7 +1793,7 @@ gst_pad_proxy_link (GstPad *pad, GstCaps *caps) if (peer) { gst_caps_debug (caps, "proxy link filter"); - GST_INFO (GST_CAT_CAPS, "setting filter on %s:%s and %s:%s", + GST_CAT_INFO (GST_CAT_CAPS, "setting filter on %s:%s and %s:%s", GST_DEBUG_PAD_NAME (peer), GST_DEBUG_PAD_NAME (realpad)); gst_caps_replace_sink (&GST_RPAD_FILTER (peer), caps); @@ -1824,26 +1823,26 @@ gst_pad_get_caps (GstPad *pad) realpad = GST_PAD_REALIZE (pad); - GST_DEBUG (GST_CAT_CAPS, "get pad caps of %s:%s (%p)", + GST_CAT_DEBUG (GST_CAT_CAPS, "get pad caps of %s:%s (%p)", GST_DEBUG_PAD_NAME (realpad), realpad); /* note that we will not _ref the caps here as this function might be * called recursively */ if (GST_PAD_CAPS (realpad)) { - GST_DEBUG (GST_CAT_CAPS, "using pad real caps %p", GST_PAD_CAPS (realpad)); + GST_CAT_DEBUG (GST_CAT_CAPS, "using pad real caps %p", GST_PAD_CAPS (realpad)); return GST_PAD_CAPS (realpad); } else if GST_RPAD_GETCAPSFUNC (realpad) { - GST_DEBUG (GST_CAT_CAPS, "using pad get function"); + GST_CAT_DEBUG (GST_CAT_CAPS, "using pad get function"); return GST_RPAD_GETCAPSFUNC (realpad) (GST_PAD_CAST (realpad), NULL); } else if (GST_PAD_PAD_TEMPLATE (realpad)) { GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (realpad); - GST_DEBUG (GST_CAT_CAPS, "using pad template %p with caps %p", + GST_CAT_DEBUG (GST_CAT_CAPS, "using pad template %p with caps %p", templ, GST_PAD_TEMPLATE_CAPS (templ)); return GST_PAD_TEMPLATE_CAPS (templ); } - GST_DEBUG (GST_CAT_CAPS, "pad has no caps"); + GST_CAT_DEBUG (GST_CAT_CAPS, "pad has no caps"); return NULL; } @@ -1921,7 +1920,7 @@ gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad) } } else { - GST_DEBUG (GST_CAT_PADS, + GST_CAT_DEBUG (GST_CAT_PADS, "could not check capabilities of pads (%s:%s) and (%s:%s) %p %p", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad), GST_PAD_CAPS (srcpad), GST_PAD_CAPS (sinkpad)); @@ -1967,7 +1966,7 @@ gst_pad_get_allowed_caps (GstPad *pad) realpad = GST_PAD_REALIZE (pad); - GST_DEBUG (GST_CAT_PROPERTIES, "get allowed caps of %s:%s", + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "get allowed caps of %s:%s", GST_DEBUG_PAD_NAME (pad)); caps = gst_caps_ref (GST_RPAD_FILTER (realpad)); @@ -1993,7 +1992,7 @@ gst_pad_recalc_allowed_caps (GstPad *pad) g_return_val_if_fail (pad != NULL, FALSE); g_return_val_if_fail (GST_IS_PAD (pad), FALSE); - GST_DEBUG (GST_CAT_PROPERTIES, "set allowed caps of %s:%s", + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "set allowed caps of %s:%s", GST_DEBUG_PAD_NAME (pad)); @@ -2072,16 +2071,16 @@ gst_pad_get_bufferpool (GstPad *pad) if (!peer) return NULL; - GST_DEBUG_ENTER ("(%s:%s)", GST_DEBUG_PAD_NAME (pad)); + GST_CAT_DEBUG (GST_CAT_BUFFER, "(%s:%s): getting bufferpool", GST_DEBUG_PAD_NAME (pad)); if (peer->bufferpoolfunc) { - GST_DEBUG (GST_CAT_PADS, + GST_CAT_DEBUG (GST_CAT_PADS, "calling bufferpoolfunc &%s (@%p) of peer pad %s:%s", GST_DEBUG_FUNCPTR_NAME (peer->bufferpoolfunc), &peer->bufferpoolfunc, GST_DEBUG_PAD_NAME (((GstPad*) peer))); return (peer->bufferpoolfunc) (((GstPad*) peer)); } else { - GST_DEBUG (GST_CAT_PADS, "no bufferpoolfunc for peer pad %s:%s at %p", + GST_CAT_DEBUG (GST_CAT_PADS, "no bufferpoolfunc for peer pad %s:%s at %p", GST_DEBUG_PAD_NAME (((GstPad*) peer)), &peer->bufferpoolfunc); return NULL; } @@ -2097,7 +2096,7 @@ gst_real_pad_dispose (GObject *object) * and a parent would hold a reference */ g_assert (GST_PAD_PEER (pad) == NULL); - GST_DEBUG (GST_CAT_REFCOUNTING, "dispose %s:%s", GST_DEBUG_PAD_NAME(pad)); + GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "dispose %s:%s", GST_DEBUG_PAD_NAME(pad)); /* we destroy the ghostpads, because they are nothing without the real pad */ if (GST_REAL_PAD (pad)->ghostpads) { @@ -2109,7 +2108,7 @@ gst_real_pad_dispose (GObject *object) GstPad *ghostpad = GST_PAD (ghostpads->data); if (GST_IS_ELEMENT (GST_OBJECT_PARENT (ghostpad))){ - GST_DEBUG (GST_CAT_REFCOUNTING, "removing ghost pad from element '%s'", + GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "removing ghost pad from element '%s'", GST_OBJECT_NAME (GST_OBJECT_PARENT (ghostpad))); gst_element_remove_ghost_pad (GST_ELEMENT (GST_OBJECT_PARENT (ghostpad)), GST_PAD (ghostpad)); @@ -2124,7 +2123,7 @@ gst_real_pad_dispose (GObject *object) gst_caps_replace (&GST_RPAD_APPFILTER (pad), NULL); if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad))) { - GST_DEBUG (GST_CAT_REFCOUNTING, "removing pad from element '%s'", + GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "removing pad from element '%s'", GST_OBJECT_NAME (GST_OBJECT (GST_ELEMENT (GST_OBJECT_PARENT (pad))))); gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad); @@ -2171,7 +2170,7 @@ gst_pad_load_and_link (xmlNodePtr self, GstObject *parent) split = g_strsplit (peer, ".", 2); if (split[0] == NULL || split[1] == NULL) { - GST_DEBUG (GST_CAT_XML, + GST_CAT_DEBUG (GST_CAT_XML, "Could not parse peer '%s' for pad %s:%s, leaving unlinked", peer, GST_DEBUG_PAD_NAME (pad)); return; @@ -2279,7 +2278,7 @@ gst_pad_push (GstPad *pad, GstBuffer *buf) GstData *data = GST_DATA(buf); g_assert (GST_IS_PAD (pad)); - GST_DEBUG_ENTER ("(%s:%s)", GST_DEBUG_PAD_NAME (pad)); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, "pushing"); g_return_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SRC); @@ -2301,7 +2300,7 @@ gst_pad_push (GstPad *pad, GstBuffer *buf) if (peer->chainhandler) { if (data) { - GST_DEBUG (GST_CAT_DATAFLOW, + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, "calling chainhandler &%s of peer pad %s:%s", GST_DEBUG_FUNCPTR_NAME (peer->chainhandler), GST_DEBUG_PAD_NAME (GST_PAD (peer))); @@ -2339,7 +2338,7 @@ gst_pad_pull (GstPad *pad) { GstRealPad *peer; - GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, "pulling"); g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK, GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT))); @@ -2357,9 +2356,10 @@ restart: if (peer->gethandler) { GstData *data; - GST_DEBUG (GST_CAT_DATAFLOW, "calling gethandler %s of peer pad %s:%s", - GST_DEBUG_FUNCPTR_NAME (peer->gethandler), - GST_DEBUG_PAD_NAME (peer)); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, pad, + "calling gethandler %s of peer pad %s:%s", + GST_DEBUG_FUNCPTR_NAME (peer->gethandler), + GST_DEBUG_PAD_NAME (peer)); data = GST_DATA((peer->gethandler) (GST_PAD_CAST (peer))); @@ -2372,14 +2372,13 @@ restart: /* no null buffers allowed */ gst_element_error (GST_PAD_PARENT (pad), "NULL buffer during pull on %s:%s", - GST_DEBUG_PAD_NAME (pad), NULL); + GST_DEBUG_PAD_NAME (pad)); } else { gst_element_error (GST_PAD_PARENT (pad), "internal error: pull on pad %s:%s " "but the peer pad %s:%s has no gethandler", - GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer), - NULL); + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer)); } } return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT)); @@ -2765,7 +2764,7 @@ gst_ghost_pad_new (const gchar *name, /* FIXME need to ref the real pad here... ? */ - GST_DEBUG (GST_CAT_PADS, "created ghost pad \"%s\"", + GST_CAT_DEBUG (GST_CAT_PADS, "created ghost pad \"%s\"", gst_pad_get_name (GST_PAD (ghostpad))); return GST_PAD (ghostpad); @@ -2980,13 +2979,13 @@ gst_pad_send_event (GstPad *pad, GstEvent *event) if (GST_EVENT_SRC (event) == NULL) GST_EVENT_SRC (event) = gst_object_ref (GST_OBJECT (rpad)); - GST_DEBUG (GST_CAT_EVENT, "have event %d on pad %s:%s", + GST_CAT_DEBUG (GST_CAT_EVENT, "have event %d on pad %s:%s", GST_EVENT_TYPE (event), GST_DEBUG_PAD_NAME (rpad)); if (GST_RPAD_EVENTHANDLER (rpad)) success = GST_RPAD_EVENTHANDLER (rpad) (GST_PAD_CAST (rpad), event); else { - GST_DEBUG (GST_CAT_EVENT, "there's no event function for pad %s:%s", + GST_CAT_DEBUG (GST_CAT_EVENT, "there's no event function for pad %s:%s", GST_DEBUG_PAD_NAME (rpad)); gst_event_unref (event); } diff --git a/gst/gstparse.c b/gst/gstparse.c index 5f581c4134..835d745599 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -23,9 +23,10 @@ #include +#include "gst_private.h" + #include "gstparse.h" #include "gstinfo.h" -#include "gstlog.h" extern GstElement *_gst_parse_launch (const gchar *, GError **); @@ -118,7 +119,7 @@ gst_parse_launch (const gchar * pipeline_description, GError **error) g_return_val_if_fail (pipeline_description != NULL, NULL); - GST_INFO (GST_CAT_PIPELINE, "parsing pipeline description %s", + GST_CAT_INFO (GST_CAT_PIPELINE, "parsing pipeline description %s", pipeline_description); /* the need for the mutex will go away with flex 2.5.6 */ diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index dff9517f32..ad422a86df 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -23,7 +23,7 @@ #include "gst_private.h" #include "gstpipeline.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstscheduler.h" GstElementDetails gst_pipeline_details = { diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 6113e499d4..e02a094b74 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -26,10 +26,11 @@ #include #include "gst_private.h" + #include "gstplugin.h" #include "gstversion.h" #include "gstregistrypool.h" -#include "gstlog.h" +#include "gstinfo.h" #include "config.h" #include "gstfilter.h" @@ -98,7 +99,7 @@ static GstPlugin* gst_plugin_register_func (GstPluginDesc *desc, GstPlugin *plugin, GModule *module) { if (!gst_plugin_check_version (desc->major_version, desc->minor_version)) { - GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" has incompatible version, not loading", + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" has incompatible version, not loading", plugin->filename); return NULL; } @@ -107,11 +108,11 @@ gst_plugin_register_func (GstPluginDesc *desc, GstPlugin *plugin, GModule *modul plugin->name = g_strdup(desc->name); if (!((desc->plugin_init) (module, plugin))) { - GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" failed to initialise", + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" failed to initialise", plugin->filename); return NULL; } - GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" initialised", GST_STR_NULL (plugin->filename)); + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" initialised", GST_STR_NULL (plugin->filename)); return plugin; } @@ -157,7 +158,7 @@ gst_plugin_load_plugin (GstPlugin *plugin, GError **error) filename = plugin->filename; - GST_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"", filename); + GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"", filename); if (g_module_supported () == FALSE) { g_set_error (error, @@ -184,13 +185,13 @@ gst_plugin_load_plugin (GstPlugin *plugin, GError **error) if (g_module_symbol (module, "plugin_desc", &ptr)) { desc = (GstPluginDesc *)ptr; - GST_DEBUG (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loaded, called entry function...", filename); + GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loaded, called entry function...", filename); plugin->filename = g_strdup (filename); plugin = gst_plugin_register_func (desc, plugin, module); if (plugin != NULL) { - GST_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loaded", plugin->filename); + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loaded", plugin->filename); plugin->module = module; return TRUE; } @@ -242,11 +243,11 @@ gst_plugin_unload_plugin (GstPlugin *plugin) if (g_module_close (plugin->module)) { plugin->module = NULL; - GST_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" unloaded", plugin->filename); + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" unloaded", plugin->filename); return TRUE; } else { - GST_INFO (GST_CAT_PLUGIN_LOADING, "failed to unload plugin \"%s\"", plugin->filename); + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "failed to unload plugin \"%s\"", plugin->filename); return FALSE; } } @@ -537,14 +538,14 @@ gst_plugin_load (const gchar *name) if (plugin) { gboolean result = gst_plugin_load_plugin (plugin, &error); if (error) { - GST_DEBUG (GST_CAT_PLUGIN_LOADING, "load_plugin error: %s\n", + GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "load_plugin error: %s\n", error->message); g_error_free (error); } return result; } - GST_DEBUG (GST_CAT_PLUGIN_LOADING, "Could not find %s in registry pool", + GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "Could not find %s in registry pool", name); return FALSE; diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c index 865d46cccb..dbd680d0e0 100644 --- a/gst/gstpluginfeature.c +++ b/gst/gstpluginfeature.c @@ -21,10 +21,11 @@ */ #include "gst_private.h" + #include "gstpluginfeature.h" #include "gstplugin.h" #include "gstregistry.h" -#include "gstlog.h" +#include "gstinfo.h" static void gst_plugin_feature_class_init (GstPluginFeatureClass *klass); static void gst_plugin_feature_init (GstPluginFeature *feature); @@ -94,7 +95,7 @@ gst_plugin_feature_ensure_loaded (GstPluginFeature *feature) if (plugin && !gst_plugin_is_loaded (plugin)) { #ifndef GST_DISABLE_REGISTRY if (GST_IS_REGISTRY (plugin->manager)) { - GST_DEBUG (GST_CAT_PLUGIN_LOADING, + GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "loading plugin %s for feature", plugin->name); if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager), plugin) != GST_REGISTRY_OK) @@ -135,4 +136,3 @@ gst_plugin_feature_type_name_filter (GstPluginFeature *feature, return ((data->type == 0 || data->type == G_OBJECT_TYPE (feature)) && (data->name == NULL || !strcmp (data->name, GST_PLUGIN_FEATURE_NAME (feature)))); } - diff --git a/gst/gstprops.c b/gst/gstprops.c index 9f6a56c28c..4fc1f7b2c9 100644 --- a/gst/gstprops.c +++ b/gst/gstprops.c @@ -22,7 +22,7 @@ #include "gst_private.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstprops.h" #include "gstmemchunk.h" @@ -589,38 +589,39 @@ _gst_props_initialize (void) static void gst_props_debug_entry (GstPropsEntry *entry) { - const gchar *name = g_quark_to_string (entry->propid); + /* unused when debugging is disabled */ + G_GNUC_UNUSED const gchar *name = g_quark_to_string (entry->propid); switch (entry->propstype) { case GST_PROPS_INT_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: %s: int %d", entry, name, entry->data.int_data); + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: %s: int %d", entry, name, entry->data.int_data); break; case GST_PROPS_FLOAT_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: %s: float %f", entry, name, entry->data.float_data); + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: %s: float %f", entry, name, entry->data.float_data); break; case GST_PROPS_FOURCC_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: %s: fourcc %c%c%c%c", entry, name, + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: %s: fourcc %c%c%c%c", entry, name, (entry->data.fourcc_data>>0)&0xff, (entry->data.fourcc_data>>8)&0xff, (entry->data.fourcc_data>>16)&0xff, (entry->data.fourcc_data>>24)&0xff); break; case GST_PROPS_BOOLEAN_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: %s: bool %d", entry, name, entry->data.bool_data); + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: %s: bool %d", entry, name, entry->data.bool_data); break; case GST_PROPS_STRING_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: %s: string \"%s\"", entry, name, entry->data.string_data.string); + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: %s: string \"%s\"", entry, name, entry->data.string_data.string); break; case GST_PROPS_INT_RANGE_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: %s: int range %d-%d", entry, name, entry->data.int_range_data.min, + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: %s: int range %d-%d", entry, name, entry->data.int_range_data.min, entry->data.int_range_data.max); break; case GST_PROPS_FLOAT_RANGE_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: %s: float range %f-%f", entry, name, entry->data.float_range_data.min, + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: %s: float range %f-%f", entry, name, entry->data.float_range_data.min, entry->data.float_range_data.max); break; case GST_PROPS_LIST_TYPE: - GST_DEBUG (GST_CAT_PROPERTIES, "%p: [list]", entry); + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%p: [list]", entry); g_list_foreach (entry->data.list_data.entries, (GFunc) gst_props_debug_entry, NULL); break; default: @@ -746,7 +747,7 @@ gst_props_alloc_entry (void) gst_alloc_trace_new (_entries_trace, entry); #endif - GST_DEBUG (GST_CAT_PROPERTIES, "new entry %p", entry); + GST_CAT_LOG (GST_CAT_PROPERTIES, "new entry %p", entry); return entry; } @@ -776,7 +777,7 @@ gst_props_entry_clean (GstPropsEntry *entry) void gst_props_entry_destroy (GstPropsEntry *entry) { - GST_DEBUG (GST_CAT_PROPERTIES, "destroy entry %p", entry); + GST_CAT_LOG (GST_CAT_PROPERTIES, "destroy entry %p", entry); gst_props_entry_clean (entry); @@ -809,7 +810,7 @@ gst_props_empty_new (void) gst_alloc_trace_new (_props_trace, props); #endif - GST_DEBUG (GST_CAT_PROPERTIES, "new %p", props); + GST_CAT_LOG (GST_CAT_PROPERTIES, "new %p", props); props->properties = NULL; props->refcount = 1; @@ -972,11 +973,11 @@ void gst_props_debug (GstProps *props) { if (!props) { - GST_DEBUG (GST_CAT_PROPERTIES, "props (null)"); + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "props (null)"); return; } - GST_DEBUG (GST_CAT_PROPERTIES, "props %p, refcount %d, flags %d", + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "props %p, refcount %d, flags %d", props, props->refcount, props->flags); g_list_foreach (props->properties, (GFunc) gst_props_debug_entry, NULL); @@ -1350,7 +1351,7 @@ gst_props_unref (GstProps *props) g_return_val_if_fail (props->refcount > 0, NULL); - GST_DEBUG (GST_CAT_PROPERTIES, "unref %p (%d->%d)", props, props->refcount, props->refcount-1); + GST_CAT_LOG (GST_CAT_PROPERTIES, "unref %p (%d->%d)", props, props->refcount, props->refcount-1); props->refcount--; if (props->refcount == 0) { @@ -1377,7 +1378,7 @@ gst_props_ref (GstProps *props) g_return_val_if_fail (props->refcount > 0, NULL); - GST_DEBUG (GST_CAT_PROPERTIES, "ref %p (%d->%d)", props, props->refcount, props->refcount+1); + GST_CAT_LOG (GST_CAT_PROPERTIES, "ref %p (%d->%d)", props, props->refcount, props->refcount+1); props->refcount++; @@ -1397,7 +1398,7 @@ gst_props_sink (GstProps *props) if (props == NULL) return; - GST_DEBUG (GST_CAT_PROPERTIES, "sink %p", props); + GST_CAT_LOG (GST_CAT_PROPERTIES, "sink %p", props); if (GST_PROPS_IS_FLOATING (props)) { GST_PROPS_FLAG_UNSET (props, GST_PROPS_FLOATING); @@ -1958,7 +1959,7 @@ gst_props_entry_check_list_compatibility (GstPropsEntry *entry1, GstPropsEntry * static gboolean gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2) { - GST_DEBUG (GST_CAT_PROPERTIES,"compare: %s %s", g_quark_to_string (entry1->propid), g_quark_to_string (entry2->propid)); + GST_CAT_DEBUG (GST_CAT_PROPERTIES,"compare: %s %s", g_quark_to_string (entry1->propid), g_quark_to_string (entry2->propid)); if (entry2->propstype == GST_PROPS_LIST_TYPE && entry1->propstype != GST_PROPS_LIST_TYPE) { return gst_props_entry_check_list_compatibility (entry1, entry2); @@ -2004,7 +2005,7 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry switch (entry2->propstype) { /* b <---> a */ case GST_PROPS_FOURCC_TYPE: - GST_DEBUG(GST_CAT_PROPERTIES,"\"%c%c%c%c\" <--> \"%c%c%c%c\" ?", + GST_CAT_DEBUG (GST_CAT_PROPERTIES,"\"%c%c%c%c\" <--> \"%c%c%c%c\" ?", (entry2->data.fourcc_data>>0)&0xff, (entry2->data.fourcc_data>>8)&0xff, (entry2->data.fourcc_data>>16)&0xff, @@ -2022,13 +2023,13 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry switch (entry2->propstype) { /* b <---> a - d */ case GST_PROPS_INT_RANGE_TYPE: - GST_DEBUG(GST_CAT_PROPERTIES,"%d <= %d <= %d ?",entry2->data.int_range_data.min, + GST_CAT_DEBUG (GST_CAT_PROPERTIES,"%d <= %d <= %d ?",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 */ case GST_PROPS_INT_TYPE: - GST_DEBUG(GST_CAT_PROPERTIES,"%d == %d ?",entry1->data.int_data,entry2->data.int_data); + GST_CAT_DEBUG (GST_CAT_PROPERTIES,"%d == %d ?",entry1->data.int_data,entry2->data.int_data); return (entry2->data.int_data == entry1->data.int_data); default: break; @@ -2059,7 +2060,7 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry switch (entry2->propstype) { /* t <---> t */ case GST_PROPS_STRING_TYPE: - GST_DEBUG(GST_CAT_PROPERTIES,"\"%s\" <--> \"%s\" ?", + GST_CAT_DEBUG (GST_CAT_PROPERTIES,"\"%s\" <--> \"%s\" ?", entry2->data.string_data.string, entry1->data.string_data.string); return (!strcmp (entry2->data.string_data.string, entry1->data.string_data.string)); default: @@ -2118,7 +2119,7 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops) if (!gst_props_entry_check_compatibility (entry1, entry2)) { compatible = FALSE; - GST_DEBUG (GST_CAT_PROPERTIES, "%s are not compatible: ", + GST_CAT_DEBUG (GST_CAT_PROPERTIES, "%s are not compatible: ", g_quark_to_string (entry1->propid)); } diff --git a/gst/gstqueue.c b/gst/gstqueue.c index c01deb3cd4..b201639680 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -21,23 +21,13 @@ * Boston, MA 02111-1307, USA. */ -/* #define DEBUG_ENABLED */ -/* #define STATUS_ENABLED */ -#ifdef STATUS_ENABLED -#define STATUS(A) GST_DEBUG(GST_CAT_DATAFLOW, A, GST_ELEMENT_NAME(queue)) -#else -#define STATUS(A) -#endif - - -#include "config.h" #include "gst_private.h" #include "gstqueue.h" #include "gstscheduler.h" #include "gstevent.h" -#include "gstlog.h" +#include "gstinfo.h" GstElementDetails gst_queue_details = { "Queue", @@ -253,7 +243,7 @@ gst_queue_init (GstQueue *queue) queue->not_full = g_cond_new (); queue->events = g_async_queue_new(); queue->queue = g_queue_new (); - GST_DEBUG_ELEMENT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions"); + GST_CAT_DEBUG_OBJECT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions"); } static void @@ -286,7 +276,7 @@ gst_queue_get_bufferpool (GstPad *pad) static void gst_queue_cleanup_data (gpointer data, const gpointer user_data) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p", data); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p", data); gst_data_unref (GST_DATA (data)); } @@ -324,17 +314,17 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf) g_async_queue_lock(queue->events); while (g_async_queue_length_unlocked(queue->events) > 0){ GstEvent *event = (GstEvent*)g_async_queue_pop_unlocked(queue->events); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "sending event upstream\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "sending event upstream\n"); gst_pad_event_default (pad, event); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "event sent\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "event sent\n"); } g_async_queue_unlock(queue->events); restart: /* we have to lock the queue since we span threads */ - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); g_mutex_lock (queue->qlock); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ()); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ()); /* assume don't need to flush this buffer when the queue is filled */ queue->flush = FALSE; @@ -342,11 +332,11 @@ restart: if (GST_IS_EVENT (buf)) { switch (GST_EVENT_TYPE (buf)) { case GST_EVENT_FLUSH: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); gst_queue_locked_flush (queue); break; case GST_EVENT_EOS: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "eos in on %s %d\n", + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "eos in on %s %d\n", GST_ELEMENT_NAME (queue), queue->level_buffers); break; default: @@ -355,7 +345,7 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d",buf,GST_BUFFER_SIZE(buf)); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d",buf,GST_BUFFER_SIZE(buf)); if (queue->level_buffers == queue->size_buffers) { g_mutex_unlock (queue->qlock); @@ -367,7 +357,7 @@ restart: /* 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"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end"); if (GST_IS_EVENT (buf)) fprintf(stderr, "Error: queue [%s] leaked an event, type:%d\n", GST_ELEMENT_NAME(GST_ELEMENT(queue)), @@ -381,7 +371,7 @@ restart: gpointer front; GstBuffer *leakbuf; - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end"); front = g_queue_pop_head (queue->queue); leakbuf = (GstBuffer *)(front); @@ -397,24 +387,24 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); 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 (queue->interrupt) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted!!"); g_mutex_unlock (queue->qlock); if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad), GST_ELEMENT (queue))) goto out_unref; /* if we got here because we were unlocked after a flush, we don't need * to add the buffer to the queue again */ if (queue->flush) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "not adding pending buffer after flush"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "not adding pending buffer after flush"); goto out_unref; } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding pending buffer after interrupt"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "adding pending buffer after interrupt"); goto restart; } if (GST_STATE (queue) != GST_STATE_PLAYING) { @@ -432,12 +422,12 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d buffers, %d bytes", + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); g_cond_wait (queue->not_full, queue->qlock); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_full signal"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "got not_full signal"); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); } @@ -450,11 +440,11 @@ restart: /* this assertion _has_ to hold */ g_assert (queue->queue->length == queue->level_buffers); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d buffers, %d bytes", GST_DEBUG_PAD_NAME(pad), queue->level_buffers, queue->size_buffers, queue->level_bytes); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_empty"); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling not_empty"); g_cond_signal (queue->not_empty); g_mutex_unlock (queue->qlock); @@ -481,11 +471,11 @@ gst_queue_get (GstPad *pad) restart: /* have to lock for thread-safety */ - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); g_mutex_lock (queue->qlock); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%p %p", g_thread_self (), queue->not_empty); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p %p", g_thread_self (), queue->not_empty); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); while (queue->level_buffers == 0) { /* if there's a pending state change for this queue or its manager, switch @@ -493,7 +483,7 @@ restart: */ //while (GST_STATE_PENDING (queue) != GST_STATE_VOID_PENDING) { if (queue->interrupt) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted!!"); g_mutex_unlock (queue->qlock); if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad), GST_ELEMENT (queue))) return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT)); @@ -511,7 +501,7 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d buffers, %d bytes", + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); /* if (queue->block_timeout > -1){ */ @@ -528,26 +518,26 @@ restart: else { g_cond_wait (queue->not_empty, queue->qlock); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_empty signal"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "got not_empty signal"); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); front = g_queue_pop_head (queue->queue); buf = (GstBuffer *)(front); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue", buf); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue", buf); queue->level_buffers--; queue->level_bytes -= GST_BUFFER_SIZE(buf); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d buffers, %d bytes", GST_DEBUG_PAD_NAME(pad), queue->level_buffers, queue->size_buffers, queue->level_bytes); /* this assertion _has_ to hold */ g_assert (queue->queue->length == queue->level_buffers); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_full"); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling not_full"); g_cond_signal (queue->not_full); g_mutex_unlock (queue->qlock); @@ -557,7 +547,7 @@ restart: GstEvent *event = GST_EVENT(buf); switch (GST_EVENT_TYPE(event)) { case GST_EVENT_EOS: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos", GST_ELEMENT_NAME (queue)); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos", GST_ELEMENT_NAME (queue)); gst_element_set_eos (GST_ELEMENT (queue)); break; default: @@ -599,7 +589,7 @@ gst_queue_handle_src_event (GstPad *pad, GstEvent *event) switch (event_type) { case GST_EVENT_FLUSH: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); gst_queue_locked_flush (queue); break; case GST_EVENT_SEEK: @@ -641,7 +631,7 @@ gst_queue_change_state (GstElement *element) queue = GST_QUEUE (element); - GST_DEBUG_ENTER("('%s')", GST_ELEMENT_NAME (element)); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change"); /* lock the queue so another thread (not in sync with this thread's state) * can't call this queue's _get (or whatever) @@ -656,7 +646,7 @@ gst_queue_change_state (GstElement *element) break; case GST_STATE_PAUSED_TO_PLAYING: if (!GST_PAD_IS_LINKED (queue->sinkpad)) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, queue, "queue %s is not linked", GST_ELEMENT_NAME (queue)); + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue, "queue %s is not linked", GST_ELEMENT_NAME (queue)); /* FIXME can this be? */ g_cond_signal (queue->not_empty); @@ -670,7 +660,7 @@ gst_queue_change_state (GstElement *element) sink_sched = gst_pad_get_scheduler (GST_PAD_CAST (queue->sinkpad)); if (src_sched == sink_sched) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, queue, "queue %s does not connect different schedulers", + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue, "queue %s does not connect different schedulers", GST_ELEMENT_NAME (queue)); g_warning ("queue %s does not connect different schedulers", @@ -696,7 +686,7 @@ gst_queue_change_state (GstElement *element) error: g_mutex_unlock (queue->qlock); - GST_DEBUG_LEAVE("('%s')", GST_ELEMENT_NAME (element)); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "done with state change"); return ret; } diff --git a/gst/gstregistry.c b/gst/gstregistry.c index 71289a2cef..df0f856279 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -28,6 +28,8 @@ #include #include +#include "gst_private.h" + #include "gstinfo.h" #include "gstregistry.h" #include "gstlog.h" @@ -487,4 +489,3 @@ gst_registry_update_plugin (GstRegistry *registry, GstPlugin *plugin) return GST_REGISTRY_PLUGIN_LOAD_ERROR; } - diff --git a/gst/gstregistrypool.c b/gst/gstregistrypool.c index ca9e951944..e221c3553a 100644 --- a/gst/gstregistrypool.c +++ b/gst/gstregistrypool.c @@ -22,6 +22,8 @@ #include +#include "gst_private.h" + #include "gstinfo.h" #include "gstregistrypool.h" #include "gstlog.h" @@ -326,4 +328,3 @@ gst_registry_pool_get_prefered (GstRegistryFlags flags) #endif /* GST_DISABLE_REGISTRY */ return NULL; } - diff --git a/gst/gstscheduler.c b/gst/gstscheduler.c index 77590c8d3b..c829fab915 100644 --- a/gst/gstscheduler.c +++ b/gst/gstscheduler.c @@ -24,7 +24,7 @@ #include "gstsystemclock.h" #include "gstscheduler.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstregistrypool.h" static void gst_scheduler_class_init (GstSchedulerClass *klass); @@ -90,7 +90,7 @@ gst_scheduler_dispose (GObject *object) GstScheduler *sched = GST_SCHEDULER (object); /* thse lists should all be NULL */ - GST_DEBUG (0, "scheduler %p dispose %p %p %p", + GST_DEBUG ( "scheduler %p dispose %p %p %p", object, sched->clock_providers, sched->clock_receivers, @@ -228,7 +228,7 @@ gst_scheduler_add_element (GstScheduler *sched, GstElement *element) /* if it's already in this scheduler, don't bother doing anything */ if (GST_ELEMENT_SCHED (element) == sched) { - GST_DEBUG (GST_CAT_SCHEDULING, "element %s already in scheduler %p", + GST_CAT_DEBUG (GST_CAT_SCHEDULING, "element %s already in scheduler %p", GST_ELEMENT_NAME (element), sched); return; } @@ -238,11 +238,11 @@ gst_scheduler_add_element (GstScheduler *sched, GstElement *element) if (gst_element_provides_clock (element)) { sched->clock_providers = g_list_prepend (sched->clock_providers, element); - GST_DEBUG (GST_CAT_CLOCK, "added clock provider %s", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_CLOCK, "added clock provider %s", GST_ELEMENT_NAME (element)); } if (gst_element_requires_clock (element)) { sched->clock_receivers = g_list_prepend (sched->clock_receivers, element); - GST_DEBUG (GST_CAT_CLOCK, "added clock receiver %s", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_CLOCK, "added clock receiver %s", GST_ELEMENT_NAME (element)); } gst_element_set_scheduler (element, sched); @@ -307,7 +307,7 @@ gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint t if (clock) gst_clock_reset (clock); - GST_DEBUG (GST_CAT_CLOCK, "scheduler READY to PAUSED clock is %p (%s)", clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler READY to PAUSED clock is %p (%s)", clock, (clock ? GST_OBJECT_NAME (clock) : "nil")); gst_object_replace ((GstObject **)&sched->current_clock, (GstObject *)clock); @@ -317,12 +317,12 @@ gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint t { GstClock *clock = gst_scheduler_get_clock (sched); - GST_DEBUG (GST_CAT_CLOCK, "scheduler PAUSED to PLAYING clock is %p (%s)", clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler PAUSED to PLAYING clock is %p (%s)", clock, (clock ? GST_OBJECT_NAME (clock) : "nil")); gst_scheduler_set_clock (sched, clock); if (clock) { - GST_DEBUG (GST_CAT_CLOCK, "enabling clock %p (%s)", clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "enabling clock %p (%s)", clock, GST_OBJECT_NAME (clock)); gst_clock_set_active (clock, TRUE); } @@ -330,7 +330,7 @@ gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint t } case GST_STATE_PLAYING_TO_PAUSED: if (sched->current_clock) { - GST_DEBUG (GST_CAT_CLOCK, "disabling clock %p (%s)", sched->current_clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "disabling clock %p (%s)", sched->current_clock, GST_OBJECT_NAME (sched->current_clock)); gst_clock_set_active (sched->current_clock, FALSE); } @@ -385,7 +385,7 @@ gst_scheduler_add_scheduler (GstScheduler *sched, GstScheduler *sched2) g_return_if_fail (GST_IS_SCHEDULER (sched2)); g_return_if_fail (sched2->parent_sched == NULL); - GST_DEBUG (0,"gstscheduler: %p add scheduler %p", sched, sched2); + GST_DEBUG ("gstscheduler: %p add scheduler %p", sched, sched2); gst_object_ref (GST_OBJECT (sched2)); gst_object_ref (GST_OBJECT (sched)); @@ -415,7 +415,7 @@ gst_scheduler_remove_scheduler (GstScheduler *sched, GstScheduler *sched2) g_return_if_fail (GST_IS_SCHEDULER (sched2)); g_return_if_fail (sched2->parent_sched == sched); - GST_DEBUG (0,"gstscheduler: %p remove scheduler %p", sched, sched2); + GST_DEBUG ("gstscheduler: %p remove scheduler %p", sched, sched2); sclass = GST_SCHEDULER_GET_CLASS (sched); @@ -561,7 +561,7 @@ gst_scheduler_get_clock (GstScheduler *sched) if (GST_FLAG_IS_SET (sched, GST_SCHEDULER_FLAG_FIXED_CLOCK)) { clock = sched->clock; - GST_DEBUG (GST_CAT_CLOCK, "scheduler using fixed clock %p (%s)", clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler using fixed clock %p (%s)", clock, (clock ? GST_OBJECT_NAME (clock) : "nil")); } else { @@ -589,8 +589,8 @@ gst_scheduler_get_clock (GstScheduler *sched) clock = gst_system_clock_obtain (); } } - GST_DEBUG (GST_CAT_CLOCK, "scheduler selected clock %p (%s)", clock, - (clock ? GST_OBJECT_NAME (clock) : "nil")); + GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, sched, "scheduler selected clock %p (%s)", clock, + clock ? GST_STR_NULL (GST_OBJECT_NAME (clock)) : "-"); return clock; } @@ -614,7 +614,7 @@ gst_scheduler_use_clock (GstScheduler *sched, GstClock *clock) gst_object_replace ((GstObject **)&sched->clock, (GstObject *)clock); - GST_DEBUG (GST_CAT_CLOCK, "scheduler using fixed clock %p (%s)", clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler using fixed clock %p (%s)", clock, (clock ? GST_OBJECT_NAME (clock) : "nil")); } @@ -643,7 +643,7 @@ gst_scheduler_set_clock (GstScheduler *sched, GstClock *clock) while (receivers) { GstElement *element = GST_ELEMENT (receivers->data); - GST_DEBUG (GST_CAT_CLOCK, "scheduler setting clock %p (%s) on element %s", clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler setting clock %p (%s) on element %s", clock, (clock ? GST_OBJECT_NAME (clock) : "nil"), GST_ELEMENT_NAME (element)); gst_element_set_clock (element, clock); @@ -652,7 +652,7 @@ gst_scheduler_set_clock (GstScheduler *sched, GstClock *clock) while (schedulers) { GstScheduler *scheduler = GST_SCHEDULER (schedulers->data); - GST_DEBUG (GST_CAT_CLOCK, "scheduler setting clock %p (%s) on scheduler %p", clock, + GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler setting clock %p (%s) on scheduler %p", clock, (clock ? GST_OBJECT_NAME (clock) : "nil"), scheduler); gst_scheduler_set_clock (scheduler, clock); schedulers = g_list_next (schedulers); @@ -675,7 +675,7 @@ gst_scheduler_auto_clock (GstScheduler *sched) gst_object_replace ((GstObject **)&sched->clock, NULL); - GST_DEBUG (GST_CAT_CLOCK, "scheduler using automatic clock"); + GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler using automatic clock"); } /** @@ -871,7 +871,7 @@ gst_scheduler_factory_find (const gchar *name) g_return_val_if_fail (name != NULL, NULL); - GST_DEBUG (0,"gstscheduler: find \"%s\"", name); + GST_DEBUG ("gstscheduler: find \"%s\"", name); feature = gst_registry_pool_find_feature (name, GST_TYPE_SCHEDULER_FACTORY); diff --git a/gst/gstsystemclock.c b/gst/gstsystemclock.c index a22ec2ae60..99671f1628 100644 --- a/gst/gstsystemclock.c +++ b/gst/gstsystemclock.c @@ -23,7 +23,7 @@ #include #include "gst_private.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstsystemclock.h" @@ -178,15 +178,15 @@ gst_system_clock_wait (GstClock *clock, GstClockEntry *entry) current = gst_clock_get_time (clock); diff = GST_CLOCK_ENTRY_TIME (entry) - current; - if (ABS (diff) > clock->max_diff) { - g_warning ("abnormal clock request diff: ABS(%" G_GINT64_FORMAT - ") > %" G_GINT64_FORMAT, diff, clock->max_diff); + if (diff + clock->max_diff < 0) { + g_warning ("clock is way behind: %" G_GINT64_FORMAT + "s (max allowed is %" G_GINT64_FORMAT "s", -diff, clock->max_diff); return GST_CLOCK_ENTRY_EARLY; } target = gst_system_clock_get_internal_time (clock) + diff; - GST_DEBUG (GST_CAT_CLOCK, "real_target %" G_GUINT64_FORMAT + GST_CAT_DEBUG (GST_CAT_CLOCK, "real_target %" G_GUINT64_FORMAT " target %" G_GUINT64_FORMAT " now %" G_GUINT64_FORMAT, target, GST_CLOCK_ENTRY_TIME (entry), current); diff --git a/gst/gstthread.c b/gst/gstthread.c index b06f3bcf45..e6ccdd0a10 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -21,6 +21,8 @@ * Boston, MA 02111-1307, USA. */ +#include "gst_private.h" + #include "gstthread.h" #include "gstscheduler.h" #include "gstinfo.h" @@ -175,7 +177,7 @@ gst_thread_init (GstThread *thread) { GstScheduler *scheduler; - GST_DEBUG (GST_CAT_THREAD, "initializing thread"); + GST_CAT_DEBUG (GST_CAT_THREAD, "initializing thread"); /* threads are managing bins and iterate themselves */ /* CR1: the GstBin code checks these flags */ @@ -197,7 +199,7 @@ gst_thread_dispose (GObject *object) { GstThread *thread = GST_THREAD (object); - GST_DEBUG (GST_CAT_REFCOUNTING, "GstThread: dispose"); + GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "GstThread: dispose"); G_OBJECT_CLASS (parent_class)->dispose (object); @@ -299,7 +301,7 @@ gst_thread_release_children_locks (GstThread *thread) GList *pads; g_assert (element); - GST_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (element)); elements = g_list_next (elements); if (!gst_element_release_locks (element)) @@ -324,8 +326,8 @@ gst_thread_release_children_locks (GstThread *thread) continue; /* FIXME: deal with case where there's no peer */ if (GST_ELEMENT_SCHED (peerelement) != GST_ELEMENT_SCHED (thread)) { - GST_DEBUG (GST_CAT_THREAD, "element \"%s\" has pad cross sched boundary", GST_ELEMENT_NAME (element)); - GST_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (peerelement)); + GST_CAT_DEBUG (GST_CAT_THREAD, "element \"%s\" has pad cross sched boundary", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "waking element \"%s\"", GST_ELEMENT_NAME (peerelement)); if (!gst_element_release_locks (peerelement)) g_warning ("element %s could not release locks", GST_ELEMENT_NAME (peerelement)); } @@ -343,7 +345,7 @@ gst_thread_catch (GstThread *thread) g_mutex_lock (thread->lock); GST_FLAG_SET (thread, GST_THREAD_MUTEX_LOCKED); } - GST_DEBUG (GST_CAT_THREAD, "%s is catching itself", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "%s is catching itself", GST_ELEMENT_NAME (thread)); GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING); } else { /* another thread is trying to catch us */ @@ -351,7 +353,7 @@ gst_thread_catch (GstThread *thread) wait = !GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING); while (!wait) { GTimeVal tv; - GST_DEBUG (GST_CAT_THREAD, "catching %s...", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "catching %s...", GST_ELEMENT_NAME (thread)); GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING); g_cond_signal (thread->cond); gst_thread_release_children_locks (thread); @@ -359,7 +361,7 @@ gst_thread_catch (GstThread *thread) g_time_val_add (&tv, 1000); /* wait a millisecond to catch the thread */ wait = g_cond_timed_wait (thread->cond, thread->lock, &tv); } - GST_DEBUG (GST_CAT_THREAD, "caught %s", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "caught %s", GST_ELEMENT_NAME (thread)); } g_assert (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)); } @@ -385,7 +387,7 @@ gst_thread_change_state (GstElement *element) thread = GST_THREAD (element); - GST_DEBUG (GST_CAT_STATES, "%s is changing state from %s to %s", + GST_CAT_DEBUG (GST_CAT_STATES, "%s is changing state from %s to %s", GST_ELEMENT_NAME (element), gst_element_state_get_name (GST_STATE (element)), gst_element_state_get_name (GST_STATE_PENDING (element))); @@ -406,10 +408,10 @@ gst_thread_change_state (GstElement *element) thread, STACK_SIZE, FALSE, TRUE, thread->priority, NULL); if (!thread->thread_id){ - GST_DEBUG (GST_CAT_THREAD, "g_thread_create_full for %sfailed", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "g_thread_create_full for %sfailed", GST_ELEMENT_NAME (element)); goto error_out; } - GST_DEBUG (GST_CAT_THREAD, "GThread created"); + GST_CAT_DEBUG (GST_CAT_THREAD, "GThread created"); /* wait for it to 'spin up' */ g_cond_wait (thread->cond, thread->lock); @@ -443,7 +445,7 @@ gst_thread_change_state (GstElement *element) case GST_STATE_READY_TO_NULL: /* we can't join the threads here, because this could have been triggered by ourself (ouch) */ - GST_DEBUG (GST_CAT_THREAD, "destroying GThread %p", thread->thread_id); + GST_CAT_DEBUG (GST_CAT_THREAD, "destroying GThread %p", thread->thread_id); GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING); thread->thread_id = NULL; if (thread == gst_thread_get_current()) { @@ -454,7 +456,7 @@ gst_thread_change_state (GstElement *element) /* unlock and signal - we are out */ gst_thread_release (thread); - GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", + GST_CAT_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", GST_ELEMENT_NAME (thread)); g_signal_emit (G_OBJECT (thread), gst_thread_signals[SHUTDOWN], 0); @@ -467,8 +469,8 @@ gst_thread_change_state (GstElement *element) /* it should be dead now */ break; default: - GST_DEBUG_ELEMENT (GST_CAT_THREAD, element, "UNHANDLED STATE CHANGE! %x", - GST_STATE_TRANSITION (element)); + GST_CAT_DEBUG (GST_CAT_THREAD, "[%s]: UNHANDLED STATE CHANGE! %x", + GST_ELEMENT_NAME (element), GST_STATE_TRANSITION (element)); g_assert_not_reached (); break; } @@ -483,7 +485,7 @@ gst_thread_change_state (GstElement *element) return ret; error_out: - GST_DEBUG (GST_CAT_STATES, "changing state from %s to %s failed for %s", + GST_CAT_DEBUG (GST_CAT_STATES, "changing state from %s to %s failed for %s", gst_element_state_get_name (GST_STATE (element)), gst_element_state_get_name (GST_STATE_PENDING (element)), GST_ELEMENT_NAME (element)); @@ -498,7 +500,7 @@ static void gst_thread_child_state_change (GstBin *bin, GstElementState oldstate, GstElementState newstate, GstElement *element) { - GST_DEBUG (GST_CAT_THREAD, "%s (from thread %s) child %s changed state from %s to %s", + GST_CAT_DEBUG (GST_CAT_THREAD, "%s (from thread %s) child %s changed state from %s to %s", GST_ELEMENT_NAME (bin), gst_thread_get_current() ? GST_ELEMENT_NAME (gst_thread_get_current()) : "(none)", GST_ELEMENT_NAME (element), gst_element_state_get_name (oldstate), @@ -526,7 +528,7 @@ gst_thread_main_loop (void *arg) thread = GST_THREAD (arg); g_mutex_lock (thread->lock); - GST_DEBUG (GST_CAT_THREAD, "Thread %s started main loop", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "Thread %s started main loop", GST_ELEMENT_NAME (thread)); /* initialize gst_thread_current */ g_private_set (gst_thread_current, thread); @@ -540,7 +542,7 @@ gst_thread_main_loop (void *arg) if (GST_STATE (thread) == GST_STATE_PLAYING) { GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING); status = TRUE; - GST_DEBUG (GST_CAT_THREAD, "%s starts iterating", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "%s starts iterating", GST_ELEMENT_NAME (thread)); while (status && GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) { g_mutex_unlock (thread->lock); status = gst_bin_iterate (GST_BIN (thread)); @@ -554,7 +556,7 @@ gst_thread_main_loop (void *arg) } if (GST_FLAG_IS_SET (thread, GST_THREAD_STATE_REAPING)) break; - GST_DEBUG (GST_CAT_THREAD, "%s was caught", GST_ELEMENT_NAME (thread)); + GST_CAT_DEBUG (GST_CAT_THREAD, "%s was caught", GST_ELEMENT_NAME (thread)); g_cond_signal (thread->cond); g_cond_wait (thread->cond, thread->lock); } @@ -570,7 +572,7 @@ gst_thread_main_loop (void *arg) g_cond_signal (thread->cond); g_mutex_unlock (thread->lock); - GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", + GST_CAT_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", GST_ELEMENT_NAME (thread)); return NULL; @@ -590,7 +592,7 @@ static void gst_thread_restore_thyself (GstObject *object, xmlNodePtr self) { - GST_DEBUG (GST_CAT_THREAD,"gstthread: restore"); + GST_CAT_DEBUG (GST_CAT_THREAD,"gstthread: restore"); if (GST_OBJECT_CLASS (parent_class)->restore_thyself) GST_OBJECT_CLASS (parent_class)->restore_thyself (object, self); diff --git a/gst/gsttype.c b/gst/gsttype.c index 29c8837376..26d86abfe4 100644 --- a/gst/gsttype.c +++ b/gst/gsttype.c @@ -32,7 +32,7 @@ #include "gsttype.h" #include "gstregistrypool.h" #include "gstobject.h" -#include "gstlog.h" +#include "gstinfo.h" /* global list of registered types */ @@ -146,7 +146,7 @@ gst_type_register (GstTypeFactory *factory) g_return_val_if_fail (factory != NULL, 0); -/* GST_INFO (GST_CAT_TYPES,"type register %s", factory->mime); */ +/* GST_CAT_INFO (GST_CAT_TYPES,"type register %s", factory->mime); */ id = gst_type_find_by_mime (factory->mime); if (!id) { @@ -168,7 +168,7 @@ gst_type_register (GstTypeFactory *factory) /* if there is no existing typefind function, try to use new one */ } - GST_DEBUG (GST_CAT_TYPES,"gsttype: %s(%p) gave new mime type '%s', id %d", + GST_CAT_DEBUG (GST_CAT_TYPES,"gsttype: %s(%p) gave new mime type '%s', id %d", GST_OBJECT_NAME (factory), factory, type->mime, type->id); type->factories = g_slist_prepend (type->factories, factory); @@ -186,12 +186,12 @@ gst_type_find_by_mime_func (const gchar *mime) g_return_val_if_fail (mime != NULL, 0); walk = _gst_types; -/* GST_DEBUG (GST_CAT_TYPES,"searching for '%s'",mime); */ +/* GST_CAT_DEBUG (GST_CAT_TYPES,"searching for '%s'",mime); */ mimelen = strlen (mime); while (walk) { type = (GstType *)walk->data; search = type->mime; -/* GST_DEBUG (GST_CAT_TYPES,"checking against '%s'",search); */ +/* GST_CAT_DEBUG (GST_CAT_TYPES,"checking against '%s'",search); */ typelen = strlen (search); while ((search - type->mime) < typelen) { found = strstr (search, mime); @@ -321,7 +321,7 @@ gst_type_type_find_dummy (GstBuffer *buffer, gpointer priv) GstCaps *res = NULL; GstTypeFactory *factory = (GstTypeFactory *)priv; - GST_DEBUG (GST_CAT_TYPES,"gsttype: need to load typefind function for %s", factory->mime); + GST_CAT_DEBUG (GST_CAT_TYPES,"gsttype: need to load typefind function for %s", factory->mime); if (gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) { if (factory->typefindfunc == gst_type_type_find_dummy) { diff --git a/gst/gsttypefind.c b/gst/gsttypefind.c index 7f2479a055..39dee6382a 100644 --- a/gst/gsttypefind.c +++ b/gst/gsttypefind.c @@ -23,7 +23,7 @@ #include "gst_private.h" #include "gsttype.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gsttypefind.h" #define DEFAULT_MAX_BUFFERS 1 @@ -190,7 +190,7 @@ gst_type_find_chain (GstPad *pad, GstBuffer *buf) typefind = GST_TYPE_FIND (GST_OBJECT_PARENT (pad)); - GST_DEBUG (0,"got buffer of %d bytes in '%s'", + GST_DEBUG ("got buffer of %d bytes in '%s'", GST_BUFFER_SIZE (buf), GST_OBJECT_NAME (typefind)); type_list = gst_type_get_list (); @@ -206,10 +206,10 @@ gst_type_find_chain (GstPad *pad, GstBuffer *buf) GstTypeFindFunc typefindfunc = (GstTypeFindFunc)factory->typefindfunc; GstCaps *caps; - GST_DEBUG (GST_CAT_TYPES, "try type (%p) :%d \"%s\" %p", + GST_CAT_DEBUG (GST_CAT_TYPES, "try type (%p) :%d \"%s\" %p", factory, type->id, type->mime, typefindfunc); if (typefindfunc && (caps = typefindfunc (buf, factory))) { - GST_DEBUG (GST_CAT_TYPES, "found type: %d \"%s\" \"%s\"", + GST_CAT_DEBUG (GST_CAT_TYPES, "found type: %d \"%s\" \"%s\"", caps->id, type->mime, gst_caps_get_name (caps)); typefind->caps = caps; diff --git a/gst/gsturi.c b/gst/gsturi.c index 82dd7718fd..e198998fc9 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -24,7 +24,7 @@ #include "gsturi.h" #include "gstregistrypool.h" -#include "gstlog.h" +#include "gstinfo.h" static void gst_uri_handler_class_init (GstURIHandlerClass *klass); static void gst_uri_handler_init (GstURIHandler *factory); diff --git a/gst/gsturitype.c b/gst/gsturitype.c index e3f94043db..b3abd9506e 100644 --- a/gst/gsturitype.c +++ b/gst/gsturitype.c @@ -23,7 +23,7 @@ #include "gst_private.h" #include "gsturi.h" -#include "gstlog.h" +#include "gstinfo.h" GType gst_uri_get_uri_type (void) diff --git a/gst/gstutils.c b/gst/gstutils.c index d9c959080c..97be120a9e 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -27,7 +27,7 @@ #include "gst_private.h" #include "gstutils.h" #include "gsturitype.h" -#include "gstlog.h" +#include "gstinfo.h" /** * gst_util_dump_mem: @@ -82,7 +82,7 @@ gst_util_set_value_from_string(GValue *value, const gchar *value_str) g_return_if_fail(value != NULL); g_return_if_fail(value_str != NULL); - GST_DEBUG(GST_CAT_PARAMS, "parsing '%s' to type %s", value_str, g_type_name(G_VALUE_TYPE(value))); + GST_CAT_DEBUG (GST_CAT_PARAMS, "parsing '%s' to type %s", value_str, g_type_name(G_VALUE_TYPE(value))); switch (G_VALUE_TYPE(value)) { case G_TYPE_STRING: @@ -169,7 +169,7 @@ gst_util_set_object_arg (GObject * object, const gchar * name, const gchar * val return; } - GST_DEBUG (0, "paramspec->flags is %d, paramspec->value_type is %d", + GST_DEBUG ( "paramspec->flags is %d, paramspec->value_type is %d", paramspec->flags, (gint) paramspec->value_type); if (paramspec->flags & G_PARAM_WRITABLE) { diff --git a/gst/gstversion.h.in b/gst/gstversion.h.in index de008d17f4..c7af0dca70 100644 --- a/gst/gstversion.h.in +++ b/gst/gstversion.h.in @@ -24,9 +24,15 @@ #ifndef __GST_VERSION_H__ #define __GST_VERSION_H__ -#define GST_VERSION_MAJOR @GST_VERSION_MAJOR@ -#define GST_VERSION_MINOR @GST_VERSION_MINOR@ -#define GST_VERSION_MICRO @GST_VERSION_MICRO@ +/** + * Use these only when you want to know what GStreamer version your stuff was + * compiled against. + * Use the #gst_version function if you want to know which versiuon of + * GStreamer you are currently linked against. + */ +#define GST_VERSION_MAJOR (@GST_VERSION_MAJOR@) +#define GST_VERSION_MINOR (@GST_VERSION_MINOR@) +#define GST_VERSION_MICRO (@GST_VERSION_MICRO@) void gst_version (guint *major, guint *minor, guint *micro); diff --git a/gst/gstxml.c b/gst/gstxml.c index 02398bb4b2..4d413a5841 100644 --- a/gst/gstxml.c +++ b/gst/gstxml.c @@ -23,7 +23,7 @@ #include "gst_private.h" #include "gstxml.h" -#include "gstlog.h" +#include "gstinfo.h" #include "gstbin.h" enum { @@ -346,14 +346,14 @@ gst_xml_get_element (GstXML *xml, const guchar *name) g_return_val_if_fail(xml != NULL, NULL); g_return_val_if_fail(name != NULL, NULL); - GST_DEBUG (0,"gstxml: getting element \"%s\"", name); + GST_DEBUG ("gstxml: getting element \"%s\"", name); topelements = gst_xml_get_topelements (xml); while (topelements) { GstElement *top = GST_ELEMENT (topelements->data); - GST_DEBUG (0,"gstxml: getting element \"%s\"", name); + GST_DEBUG ("gstxml: getting element \"%s\"", name); if (!strcmp (GST_ELEMENT_NAME (top), name)) { return top; } @@ -399,7 +399,7 @@ gst_xml_make_element (xmlNodePtr cur, GstObject *parent) g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (type != NULL, NULL); - GST_INFO (GST_CAT_XML,"loading \"%s\" of type \"%s\"", name, type); + GST_CAT_INFO (GST_CAT_XML,"loading \"%s\" of type \"%s\"", name, type); element = gst_element_factory_make (type, name); diff --git a/gst/indexers/gstfileindex.c b/gst/indexers/gstfileindex.c index cb967dfee0..8311e8f10b 100644 --- a/gst/indexers/gstfileindex.c +++ b/gst/indexers/gstfileindex.c @@ -17,16 +17,14 @@ * Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include +#include #include #include #include #include #include +#include #define GST_TYPE_FILE_INDEX \ (gst_file_index_get_type ()) @@ -193,7 +191,7 @@ gst_file_index_class_init (GstFileIndexClass *klass) static void gst_file_index_init (GstFileIndex *index) { - GST_DEBUG(0, "created new file index"); + GST_DEBUG ( "created new file index"); index->id_index = g_hash_table_new (g_int_hash, g_int_equal); } @@ -789,11 +787,7 @@ show_entry (GstIndexEntry *entry) static void gst_file_index_add_entry (GstIndex *index, GstIndexEntry *entry) { - GstFileIndex *fileindex = GST_FILE_INDEX (index); - - GST_DEBUG (0, "adding entry %p\n", fileindex); - - //show_entry (entry); + GST_LOG_OBJECT (index, "adding this entry"); switch (entry->type){ case GST_INDEX_ENTRY_ID: diff --git a/gst/indexers/gstmemindex.c b/gst/indexers/gstmemindex.c index bc5d59fa08..80856c4637 100644 --- a/gst/indexers/gstmemindex.c +++ b/gst/indexers/gstmemindex.c @@ -17,10 +17,7 @@ * Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include +#include #define GST_TYPE_MEM_INDEX \ (gst_index_get_type ()) @@ -158,7 +155,7 @@ gst_mem_index_class_init (GstMemIndexClass *klass) static void gst_mem_index_init (GstMemIndex *index) { - GST_DEBUG(0, "created new mem index"); + GST_DEBUG ( "created new mem index"); index->associations = NULL; index->id_index = g_hash_table_new (g_int_hash, g_int_equal); @@ -260,9 +257,7 @@ gst_mem_index_add_format (GstIndex *index, GstIndexEntry *entry) static void gst_mem_index_add_entry (GstIndex *index, GstIndexEntry *entry) { - GstMemIndex *memindex = GST_MEM_INDEX (index); - - GST_DEBUG (0, "adding entry %p\n", memindex); + GST_LOG_OBJECT (index, "added this entry"); switch (entry->type){ case GST_INDEX_ENTRY_ID: diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index e428a71e68..5522dfda34 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -4,14 +4,13 @@ #include #include #include + +#include "../gst_private.h" + #include "../gstparse.h" #include "../gstinfo.h" #include "types.h" -#ifdef HAVE_CONFIG_H -#include -#endif - #define YYERROR_VERBOSE 1 #define YYPARSE_PARAM graph @@ -102,11 +101,11 @@ typedef struct { # define YYDEBUG 1 /* bison 1.35 calls this macro with side effects, we need to make sure the side effects work - crappy bison -# define YYFPRINTF(a, ...) GST_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__) +# define YYFPRINTF(a, ...) GST_CAT_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__) */ # define YYFPRINTF(a, ...) G_STMT_START{ \ gchar *temp = g_strdup_printf (__VA_ARGS__); \ - GST_DEBUG (GST_CAT_PIPELINE, temp); \ + GST_CAT_DEBUG (GST_CAT_PIPELINE, temp); \ g_free (temp); \ }G_STMT_END #endif @@ -127,11 +126,11 @@ typedef struct { # define YYDEBUG 1 /* bison 1.35 calls this macro with side effects, we need to make sure the side effects work - crappy bison -# define YYFPRINTF(a, args...) GST_DEBUG (GST_CAT_PIPELINE, ## args ) +# define YYFPRINTF(a, args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, ## args ) */ # define YYFPRINTF(a, args...) G_STMT_START{ \ gchar *temp = g_strdup_printf ( ## args ); \ - GST_DEBUG (GST_CAT_PIPELINE, temp); \ + GST_CAT_DEBUG (GST_CAT_PIPELINE, temp); \ g_free (temp); \ }G_STMT_END #endif @@ -400,15 +399,15 @@ gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data) { DelayedLink *link = (DelayedLink *) data; - GST_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s", - GST_ELEMENT_NAME (src), link->src_pad, - GST_ELEMENT_NAME (link->sink), link->sink_pad); + GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s", + GST_ELEMENT_NAME (src), link->src_pad, + GST_ELEMENT_NAME (link->sink), link->sink_pad); if (gst_element_link_pads_filtered (src, link->src_pad, link->sink, link->sink_pad, link->caps)) { /* do this here, we don't want to get any problems later on when unlocking states */ - GST_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked", - GST_ELEMENT_NAME (src), link->src_pad, - GST_ELEMENT_NAME (link->sink), link->sink_pad); + GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked", + GST_ELEMENT_NAME (src), link->src_pad, + GST_ELEMENT_NAME (link->sink), link->sink_pad); g_signal_handler_disconnect (src, link->signal_id); g_free (link->src_pad); g_free (link->sink_pad); @@ -433,8 +432,8 @@ gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad, /* TODO: maybe we should check if src_pad matches this template's names */ - GST_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s", - GST_ELEMENT_NAME (src), src_pad, GST_ELEMENT_NAME (sink), sink_pad); + GST_CAT_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s", + GST_ELEMENT_NAME (src), src_pad, GST_ELEMENT_NAME (sink), sink_pad); data->src_pad = g_strdup (src_pad); data->sink = sink; @@ -464,10 +463,10 @@ gst_parse_perform_link (link_t *link, graph_t *graph) g_assert (GST_IS_ELEMENT (src)); g_assert (GST_IS_ELEMENT (sink)); - GST_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u with caps \"%s\"", - GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs), - GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks), - link->caps ? gst_caps_to_string (link->caps) : "-"); + GST_CAT_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u with caps \"%s\"", + GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs), + GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks), + link->caps ? gst_caps_to_string (link->caps) : "-"); if (!srcs || !sinks) { if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL, @@ -777,7 +776,7 @@ _gst_parse_launch (const gchar *str, GError **error) g.error = error; #ifdef __GST_PARSE_TRACE - GST_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled"); + GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled"); __strings = __chains = __links = 0; #endif /* __GST_PARSE_TRACE */ @@ -795,7 +794,7 @@ _gst_parse_launch (const gchar *str, GError **error) } g_free (dstr); - GST_INFO (GST_CAT_PIPELINE, "got %u elements and %u links", g.chain ? g_slist_length (g.chain->elements) : 0, g_slist_length (g.links)); + GST_CAT_INFO (GST_CAT_PIPELINE, "got %u elements and %u links", g.chain ? g_slist_length (g.chain->elements) : 0, g_slist_length (g.links)); if (!g.chain) { ret = NULL; @@ -860,7 +859,7 @@ _gst_parse_launch (const gchar *str, GError **error) out: #ifdef __GST_PARSE_TRACE - GST_DEBUG (GST_CAT_PIPELINE, "TRACE: %u strings, %u chains and %u links left", __strings, __chains, __links); + GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: %u strings, %u chains and %u links left", __strings, __chains, __links); if (__strings || __chains || __links) { g_warning ("TRACE: %u strings, %u chains and %u links left", __strings, __chains, __links); } diff --git a/gst/parse/parse.l b/gst/parse/parse.l index b4746978b0..021d13b738 100644 --- a/gst/parse/parse.l +++ b/gst/parse/parse.l @@ -2,18 +2,17 @@ #include #include #include + +#include "../gst_private.h" + #include "types.h" #include "../gstinfo.h" #include "grammar.tab.h" -#ifdef HAVE_CONFIG_H -#include -#endif - #ifdef G_HAVE_ISO_VARARGS -#define PRINT(...) GST_DEBUG (GST_CAT_PIPELINE, "flex: "__VA_ARGS__) +#define PRINT(...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: "__VA_ARGS__) #elif defined(G_HAVE_GNUC_VARARGS) -#define PRINT(args...) GST_DEBUG (GST_CAT_PIPELINE, "flex: "##args) +#define PRINT(args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: "##args) #else #define PRINT(args...) #endif diff --git a/gst/registries/gstxmlregistry.c b/gst/registries/gstxmlregistry.c index 84fc0a9eec..c28174e964 100644 --- a/gst/registries/gstxmlregistry.c +++ b/gst/registries/gstxmlregistry.c @@ -20,7 +20,10 @@ * Boston, MA 02111-1307, USA. */ -/* #define DEBUG_ENABLED */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include @@ -35,6 +38,7 @@ #include #include #include +#include #include "gstxmlregistry.h" @@ -422,7 +426,7 @@ plugin_times_older_than_recurse(gchar *path, time_t regtime) time_t pathtime = get_time(path); if (pathtime > regtime) { - GST_INFO (GST_CAT_PLUGIN_LOADING, + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "time for %s was %ld; more recent than registry time of %ld\n", path, (long)pathtime, (long)regtime); return FALSE; @@ -455,7 +459,7 @@ plugin_times_older_than(GList *paths, time_t regtime) */ while (paths) { - GST_DEBUG (GST_CAT_PLUGIN_LOADING, + GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "comparing plugin times from %s with %ld\n", (gchar *)paths->data, (long) regtime); if(!plugin_times_older_than_recurse(paths->data, regtime)) @@ -485,10 +489,10 @@ gst_xml_registry_open_func (GstXMLRegistry *registry, GstXMLRegistryMode mode) /* if it's not writable, then don't bother */ if (!(gst_registry->flags & GST_REGISTRY_WRITABLE)) { - GST_INFO (GST_CAT_GST_INIT, "Registry isn't writable"); + GST_CAT_INFO (GST_CAT_GST_INIT, "Registry isn't writable"); return FALSE; } - GST_INFO (GST_CAT_GST_INIT, "Registry doesn't exist, trying to build..."); + GST_CAT_INFO (GST_CAT_GST_INIT, "Registry doesn't exist, trying to build..."); gst_registry_rebuild (gst_registry); gst_registry_save (gst_registry); /* FIXME: verify that the flags actually get updated ! */ @@ -502,18 +506,18 @@ gst_xml_registry_open_func (GstXMLRegistry *registry, GstXMLRegistryMode mode) if (!plugin_times_older_than (paths, get_time (registry->location))) { if (gst_registry->flags & GST_REGISTRY_WRITABLE) { - GST_INFO (GST_CAT_GST_INIT, "Registry out of date, rebuilding..."); + GST_CAT_INFO (GST_CAT_GST_INIT, "Registry out of date, rebuilding..."); gst_registry_rebuild (gst_registry); gst_registry_save (gst_registry); if (!plugin_times_older_than (paths, get_time (registry->location))) { - GST_INFO (GST_CAT_GST_INIT, "Registry still out of date, something is wrong..."); + GST_CAT_INFO (GST_CAT_GST_INIT, "Registry still out of date, something is wrong..."); return FALSE; } } else { - GST_INFO (GST_CAT_PLUGIN_LOADING, "Can't write to this registry and it's out of date, ignoring it"); + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "Can't write to this registry and it's out of date, ignoring it"); return FALSE; } } @@ -613,7 +617,7 @@ gst_xml_registry_load (GstRegistry *registry) seconds = g_timer_elapsed (timer, NULL); g_timer_destroy (timer); - GST_INFO (0, "registry: loaded %s in %f seconds\n (%s)", + GST_INFO ( "registry: loaded %s in %f seconds\n (%s)", registry->name, seconds, xmlregistry->location); CLASS (xmlregistry)->close_func (xmlregistry); @@ -698,7 +702,7 @@ gst_type_type_find_dummy (GstBuffer *buffer, gpointer priv) { GstTypeFactory *factory = (GstTypeFactory *)priv; - GST_DEBUG (GST_CAT_TYPES,"gsttype: need to load typefind function for %s", factory->mime); + GST_CAT_DEBUG (GST_CAT_TYPES,"gsttype: need to load typefind function for %s", factory->mime); if (gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) { if (factory->typefindfunc) { @@ -1613,7 +1617,7 @@ gst_xml_registry_rebuild (GstRegistry *registry) while (walk) { gchar *path = (gchar *) walk->data; - GST_INFO (GST_CAT_PLUGIN_LOADING, + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "Rebuilding registry %p in directory %s...", registry, path); plugins = g_list_concat (plugins, @@ -1654,7 +1658,7 @@ gst_xml_registry_rebuild (GstRegistry *registry) g_warning ("Bizarre behavior: plugin %s actually loaded", ((GstPlugin *) walk->data)->filename); } else { - GST_INFO (GST_CAT_PLUGIN_LOADING, "Plugin %s failed to load: %s", + GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "Plugin %s failed to load: %s", ((GstPlugin *) walk->data)->filename, error->message); g_print ("Plugin %s failed to load\n", ((GstPlugin *) walk->data)->filename); diff --git a/gst/schedulers/cothreads_compat.h b/gst/schedulers/cothreads_compat.h index 38d4ce75c5..4087a491e3 100644 --- a/gst/schedulers/cothreads_compat.h +++ b/gst/schedulers/cothreads_compat.h @@ -100,15 +100,9 @@ static void do_cothread_switch(cothread *to) { cothread *from = cothread_self (); if (from == (to)) { - GST_DEBUG (GST_CAT_COTHREAD_SWITCH, - "trying to switch to the same cothread (%p), not allowed", - (to)); g_warning ("trying to switch to the same cothread, not allowed"); } else { - GST_INFO (GST_CAT_COTHREAD_SWITCH, - "switching from cothread %p to cothread %p", from, (to)); cothread_switch (from, (to)); - GST_INFO (GST_CAT_COTHREAD_SWITCH, "we're in cothread %p now", from); } } diff --git a/gst/schedulers/gstbasicscheduler.c b/gst/schedulers/gstbasicscheduler.c index 241318fb44..4470b51e54 100644 --- a/gst/schedulers/gstbasicscheduler.c +++ b/gst/schedulers/gstbasicscheduler.c @@ -20,11 +20,18 @@ * Boston, MA 02111-1307, USA. */ -/*#define GST_DEBUG_ENABLED */ -#include "../gst.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include #include "cothreads_compat.h" +GST_DEBUG_CATEGORY_STATIC(debug_dataflow); +GST_DEBUG_CATEGORY_STATIC(debug_scheduler); +#define GST_CAT_DEFAULT debug_scheduler + typedef struct _GstSchedulerChain GstSchedulerChain; #define GST_ELEMENT_THREADSTATE(elem) (cothread*) (GST_ELEMENT_CAST (elem)->sched_private) @@ -243,6 +250,9 @@ plugin_init (GModule *module, GstPlugin *plugin) { GstSchedulerFactory *factory; + GST_DEBUG_CATEGORY_INIT (debug_dataflow, "dataflow", 0, "basic scheduler dataflow"); + GST_DEBUG_CATEGORY_INIT (debug_scheduler, "scheduler", 0, "basic scheduler general information"); + gst_plugin_set_longname (plugin, "A basic scheduler"); factory = gst_scheduler_factory_new ("basic"COTHREADS_NAME, @@ -251,8 +261,7 @@ plugin_init (GModule *module, GstPlugin *plugin) if (factory != NULL) { gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - } - else { + } else { g_warning ("could not register scheduler: "COTHREADS_NAME); } return TRUE; @@ -271,14 +280,14 @@ gst_basic_scheduler_loopfunc_wrapper (int argc, char **argv) GstElement *element = GST_ELEMENT_CAST (argv); G_GNUC_UNUSED const gchar *name = GST_ELEMENT_NAME (element); - GST_DEBUG_ENTER ("(%d,'%s')", argc, name); + GST_DEBUG("entering loopfunc wrapper of %s", name); gst_object_ref (GST_OBJECT (element)); do { - GST_DEBUG (GST_CAT_DATAFLOW, "calling loopfunc %s for element %s", + GST_CAT_DEBUG (debug_dataflow, "calling loopfunc %s for element %s", GST_DEBUG_FUNCPTR_NAME (element->loopfunc), name); (element->loopfunc) (element); - GST_DEBUG (GST_CAT_DATAFLOW, "element %s ended loop function", name); + GST_CAT_DEBUG (debug_dataflow, "element %s ended loop function", name); } while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element)); GST_FLAG_UNSET (element, GST_ELEMENT_COTHREAD_STOPPING); @@ -292,7 +301,7 @@ gst_basic_scheduler_loopfunc_wrapper (int argc, char **argv) SCHED (element)->current = NULL; } - GST_DEBUG_LEAVE ("(%d,'%s')", argc, name); + GST_DEBUG("leaving loopfunc wrapper of %s", name); gst_object_unref (GST_OBJECT (element)); return 0; @@ -304,9 +313,9 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv) GstElement *element = GST_ELEMENT_CAST (argv); G_GNUC_UNUSED const gchar *name = GST_ELEMENT_NAME (element); - GST_DEBUG_ENTER ("(\"%s\")", name); + GST_DEBUG ("entered chain wrapper of element %s", name); - GST_DEBUG (GST_CAT_DATAFLOW, "stepping through pads"); + GST_CAT_DEBUG (debug_dataflow, "stepping through pads"); gst_object_ref (GST_OBJECT (element)); do { @@ -326,7 +335,7 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv) GST_PAD_IS_LINKED (realpad)) { GstBuffer *buf; - GST_DEBUG (GST_CAT_DATAFLOW, "pulling data from %s:%s", name, + GST_CAT_DEBUG (debug_dataflow, "pulling data from %s:%s", name, GST_PAD_NAME (pad)); buf = gst_pad_pull (pad); if (buf) { @@ -334,10 +343,10 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv) gst_pad_send_event (pad, GST_EVENT (buf)); } else { - GST_DEBUG (GST_CAT_DATAFLOW, "calling chain function of %s:%s %p", + GST_CAT_DEBUG (debug_dataflow, "calling chain function of %s:%s %p", name, GST_PAD_NAME (pad), buf); GST_RPAD_CHAINFUNC (realpad) (pad, buf); - GST_DEBUG (GST_CAT_DATAFLOW, + GST_CAT_DEBUG (debug_dataflow, "calling chain function of element %s done", name); } } @@ -356,7 +365,7 @@ gst_basic_scheduler_chain_wrapper (int argc, char **argv) SCHED (element)->current = NULL; } - GST_DEBUG_LEAVE ("(%d,'%s')", argc, name); + GST_DEBUG ("leaving chain wrapper of element %s", name); gst_object_unref (GST_OBJECT (element)); return 0; @@ -371,7 +380,7 @@ gst_basic_scheduler_src_wrapper (int argc, char **argv) GstBuffer *buf = NULL; G_GNUC_UNUSED const gchar *name = GST_ELEMENT_NAME (element); - GST_DEBUG_ENTER ("(%d,\"%s\")", argc, name); + GST_DEBUG ("entering src wrapper of element %s", name); do { pads = element->pads; @@ -384,11 +393,11 @@ gst_basic_scheduler_src_wrapper (int argc, char **argv) pads = g_list_next (pads); if (GST_RPAD_DIRECTION (realpad) == GST_PAD_SRC && GST_PAD_IS_USABLE (realpad)) { - GST_DEBUG (GST_CAT_DATAFLOW, "calling _getfunc for %s:%s", GST_DEBUG_PAD_NAME (realpad)); + GST_CAT_DEBUG (debug_dataflow, "calling _getfunc for %s:%s", GST_DEBUG_PAD_NAME (realpad)); g_return_val_if_fail (GST_RPAD_GETFUNC (realpad) != NULL, 0); buf = GST_RPAD_GETFUNC (realpad) (GST_PAD_CAST (realpad)); if (buf) { - GST_DEBUG (GST_CAT_DATAFLOW, "calling gst_pad_push on pad %s:%s %p", + GST_CAT_DEBUG (debug_dataflow, "calling gst_pad_push on pad %s:%s %p", GST_DEBUG_PAD_NAME (realpad), buf); gst_pad_push (GST_PAD_CAST (realpad), buf); } @@ -404,7 +413,7 @@ gst_basic_scheduler_src_wrapper (int argc, char **argv) SCHED (element)->current->post_run_func (SCHED (element)->current); SCHED (element)->current = NULL; - GST_DEBUG_LEAVE (""); + GST_DEBUG ("leaving src wrapper of element %s", name); return 0; } @@ -419,22 +428,22 @@ gst_basic_scheduler_chainhandler_proxy (GstPad * pad, GstBuffer * buf) parent = GST_PAD_PARENT (pad); peer = GST_RPAD_PEER (pad); - GST_DEBUG_ENTER ("(%s:%s)", GST_DEBUG_PAD_NAME (pad)); - GST_DEBUG (GST_CAT_DATAFLOW, "putting buffer %p in peer \"%s:%s\"'s pen", buf, + GST_DEBUG ("entered chainhandler proxy of %s:%s", GST_DEBUG_PAD_NAME (pad)); + GST_CAT_DEBUG (debug_dataflow, "putting buffer %p in peer \"%s:%s\"'s pen", buf, GST_DEBUG_PAD_NAME (peer)); /* * loop until the bufferpen is empty so we can fill it up again */ while (GST_RPAD_BUFPEN (GST_RPAD_PEER (pad)) != NULL && --loop_count) { - GST_DEBUG (GST_CAT_DATAFLOW, "switching to %p to empty bufpen %d", + GST_CAT_DEBUG (debug_dataflow, "switching to %p to empty bufpen %d", GST_ELEMENT_THREADSTATE (parent), loop_count); do_element_switch (parent); /* we may no longer be the same pad, check. */ if (GST_RPAD_PEER (peer) != (GstRealPad *) pad) { - GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!"); + GST_CAT_DEBUG (debug_dataflow, "new pad in mid-switch!"); pad = (GstPad *) GST_RPAD_PEER (peer); } parent = GST_PAD_PARENT (pad); @@ -451,12 +460,12 @@ gst_basic_scheduler_chainhandler_proxy (GstPad * pad, GstBuffer * buf) /* now fill the bufferpen and switch so it can be consumed */ GST_RPAD_BUFPEN (GST_RPAD_PEER (pad)) = buf; - GST_DEBUG (GST_CAT_DATAFLOW, "switching to %p to consume buffer %p", + GST_CAT_DEBUG (debug_dataflow, "switching to %p to consume buffer %p", GST_ELEMENT_THREADSTATE (GST_PAD_PARENT (pad)), buf); do_element_switch (parent); - GST_DEBUG (GST_CAT_DATAFLOW, "done switching"); + GST_DEBUG ("leaving chainhandler proxy of %s:%s", GST_DEBUG_PAD_NAME (pad)); } static void @@ -466,21 +475,20 @@ gst_basic_scheduler_select_proxy (GstPad * pad, GstBuffer * buf) parent = GST_PAD_PARENT (pad); - GST_DEBUG_ENTER ("(%s:%s)", GST_DEBUG_PAD_NAME (pad)); - - GST_DEBUG (GST_CAT_DATAFLOW, "putting buffer %p in peer's pen", buf); + GST_CAT_DEBUG (debug_dataflow, "putting buffer %p in peer's pen of pad %s:%s", + buf, GST_DEBUG_PAD_NAME (pad)); g_assert (GST_RPAD_BUFPEN (GST_RPAD_PEER (pad)) == NULL); /* now fill the bufferpen and switch so it can be consumed */ GST_RPAD_BUFPEN (GST_RPAD_PEER (pad)) = buf; - GST_DEBUG (GST_CAT_DATAFLOW, "switching to %p", + GST_CAT_DEBUG (debug_dataflow, "switching to %p", GST_ELEMENT_THREADSTATE (parent)); /* FIXME temporarily diabled */ /* parent->select_pad = pad; */ do_element_switch (parent); - GST_DEBUG (GST_CAT_DATAFLOW, "done switching"); + GST_CAT_DEBUG (debug_dataflow, "done switching"); } @@ -491,7 +499,7 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad) GstElement *parent; GstRealPad *peer; - GST_DEBUG_ENTER ("(%s:%s)", GST_DEBUG_PAD_NAME (pad)); + GST_DEBUG ("entering gethandler proxy of %s:%s", GST_DEBUG_PAD_NAME (pad)); parent = GST_PAD_PARENT (pad); peer = GST_RPAD_PEER (pad); @@ -500,7 +508,7 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad) /* we will loop switching to the peer until it's filled up the bufferpen */ while (GST_RPAD_BUFPEN (pad) == NULL) { - GST_DEBUG (GST_CAT_DATAFLOW, "switching to \"%s\": %p to fill bufpen", + GST_CAT_DEBUG (debug_dataflow, "switching to \"%s\": %p to fill bufpen", GST_ELEMENT_NAME (parent), GST_ELEMENT_THREADSTATE (parent)); @@ -508,7 +516,7 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad) /* we may no longer be the same pad, check. */ if (GST_RPAD_PEER (peer) != (GstRealPad *) pad) { - GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!"); + GST_CAT_DEBUG (debug_dataflow, "new pad in mid-switch!"); pad = (GstPad *) GST_RPAD_PEER (peer); if (!pad) { gst_element_error (parent, "pad unlinked"); @@ -517,12 +525,14 @@ gst_basic_scheduler_gethandler_proxy (GstPad * pad) peer = GST_RPAD_PEER (pad); } } - GST_DEBUG (GST_CAT_DATAFLOW, "done switching"); + GST_CAT_DEBUG (debug_dataflow, "done switching"); /* now grab the buffer from the pen, clear the pen, and return the buffer */ buf = GST_RPAD_BUFPEN (pad); GST_RPAD_BUFPEN (pad) = NULL; + GST_DEBUG ("leaving gethandler proxy of %s:%s", GST_DEBUG_PAD_NAME (pad)); + return buf; } @@ -531,8 +541,8 @@ gst_basic_scheduler_eventhandler_proxy (GstPad *srcpad, GstEvent *event) { gboolean flush; - GST_INFO (GST_CAT_SCHEDULING, "intercepting event %d on pad %s:%s", - GST_EVENT_TYPE (event), GST_DEBUG_PAD_NAME (srcpad)); + GST_INFO ("intercepting event %d on pad %s:%s", + GST_EVENT_TYPE (event), GST_DEBUG_PAD_NAME (srcpad)); /* figure out if we need to flush */ switch (GST_EVENT_TYPE (event)) { @@ -551,10 +561,10 @@ gst_basic_scheduler_eventhandler_proxy (GstPad *srcpad, GstEvent *event) if (flush) { GstData *data = GST_DATA (GST_RPAD_BUFPEN (srcpad)); - GST_INFO (GST_CAT_SCHEDULING, "event is flush"); + GST_INFO ("event is flush"); if (data) { - GST_INFO (GST_CAT_SCHEDULING, "need to clear some buffers"); + GST_INFO ("need to clear some buffers"); gst_data_unref (data); GST_RPAD_BUFPEN (srcpad) = NULL; @@ -572,7 +582,7 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) const GList *pads; GstPad *pad; - GST_DEBUG (GST_CAT_SCHEDULING, "chain is using COTHREADS"); + GST_DEBUG ("chain is using COTHREADS"); g_assert (chain->sched->context != NULL); @@ -592,7 +602,7 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) /* if the element has a loopfunc... */ if (element->loopfunc != NULL) { wrapper_function = GST_DEBUG_FUNCPTR (gst_basic_scheduler_loopfunc_wrapper); - GST_DEBUG (GST_CAT_SCHEDULING, "element '%s' is a loop-based", + GST_DEBUG ("element '%s' is a loop-based", GST_ELEMENT_NAME (element)); } else { @@ -603,14 +613,12 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) /* if it doesn't have any sinks, it must be a source (duh) */ if (element->numsinkpads == 0) { wrapper_function = GST_DEBUG_FUNCPTR (gst_basic_scheduler_src_wrapper); - GST_DEBUG (GST_CAT_SCHEDULING, - "element '%s' is a source, using _src_wrapper", + GST_DEBUG ("element '%s' is a source, using _src_wrapper", GST_ELEMENT_NAME (element)); } else { wrapper_function = GST_DEBUG_FUNCPTR (gst_basic_scheduler_chain_wrapper); - GST_DEBUG (GST_CAT_SCHEDULING, - "element '%s' is a filter, using _chain_wrapper", + GST_DEBUG ("element '%s' is a filter, using _chain_wrapper", GST_ELEMENT_NAME (element)); } } @@ -633,8 +641,7 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) gboolean different_sched = (peerelement->sched != GST_SCHEDULER (chain->sched)); gboolean peer_decoupled = GST_FLAG_IS_SET (peerelement, GST_ELEMENT_DECOUPLED); - GST_DEBUG (GST_CAT_SCHEDULING, - "inspecting pad %s:%s", GST_DEBUG_PAD_NAME (peerpad)); + GST_DEBUG ("inspecting pad %s:%s", GST_DEBUG_PAD_NAME (peerpad)); /* we don't need to check this for decoupled elements */ if (!decoupled) { @@ -654,14 +661,12 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) * handlers so we can talk with it */ else if (different_sched) { if (GST_RPAD_DIRECTION (peerpad) == GST_PAD_SINK) { - GST_DEBUG (GST_CAT_SCHEDULING, - "copying chain func into push proxy for peer %s:%s", + GST_DEBUG ("copying chain func into push proxy for peer %s:%s", GST_DEBUG_PAD_NAME (peerpad)); GST_RPAD_CHAINHANDLER (peerpad) = GST_RPAD_CHAINFUNC (peerpad); } else { - GST_DEBUG (GST_CAT_SCHEDULING, - "copying get func into pull proxy for peer %s:%s", + GST_DEBUG ("copying get func into pull proxy for peer %s:%s", GST_DEBUG_PAD_NAME (peerpad)); GST_RPAD_GETHANDLER (peerpad) = GST_RPAD_GETFUNC (peerpad); } @@ -675,14 +680,12 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) if (decoupled) { /* set the chain proxies */ if (GST_RPAD_DIRECTION (pad) == GST_PAD_SINK) { - GST_DEBUG (GST_CAT_SCHEDULING, - "copying chain function into push proxy for %s:%s", + GST_DEBUG ("copying chain function into push proxy for %s:%s", GST_DEBUG_PAD_NAME (pad)); GST_RPAD_CHAINHANDLER (pad) = GST_RPAD_CHAINFUNC (pad); } else { - GST_DEBUG (GST_CAT_SCHEDULING, - "copying get function into pull proxy for %s:%s", + GST_DEBUG ("copying get function into pull proxy for %s:%s", GST_DEBUG_PAD_NAME (pad)); GST_RPAD_GETHANDLER (pad) = GST_RPAD_GETFUNC (pad); } @@ -690,15 +693,13 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) /* otherwise we really are a cothread */ else { if (GST_RPAD_DIRECTION (pad) == GST_PAD_SINK) { - GST_DEBUG (GST_CAT_SCHEDULING, - "setting cothreaded push proxy for sinkpad %s:%s", + GST_DEBUG ("setting cothreaded push proxy for sinkpad %s:%s", GST_DEBUG_PAD_NAME (pad)); GST_RPAD_CHAINHANDLER (pad) = GST_DEBUG_FUNCPTR (gst_basic_scheduler_chainhandler_proxy); GST_RPAD_EVENTHANDLER (pad) = GST_RPAD_EVENTFUNC (pad); } else { - GST_DEBUG (GST_CAT_SCHEDULING, - "setting cothreaded pull proxy for srcpad %s:%s", + GST_DEBUG ("setting cothreaded pull proxy for srcpad %s:%s", GST_DEBUG_PAD_NAME (pad)); GST_RPAD_GETHANDLER (pad) = GST_DEBUG_FUNCPTR (gst_basic_scheduler_gethandler_proxy); /* the gethandler proxy function can queue a buffer in the bufpen, we need @@ -711,8 +712,7 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) /* need to set up the cothread now */ if (wrapper_function != NULL) { if (GST_ELEMENT_THREADSTATE (element) == NULL) { - GST_DEBUG (GST_CAT_SCHEDULING, - "about to create a cothread, wrapper for '%s' is &%s", + GST_DEBUG ("about to create a cothread, wrapper for '%s' is &%s", GST_ELEMENT_NAME (element), GST_DEBUG_FUNCPTR_NAME (wrapper_function)); do_cothread_create (GST_ELEMENT_THREADSTATE (element), @@ -723,19 +723,18 @@ gst_basic_scheduler_cothreaded_chain (GstBin * bin, GstSchedulerChain * chain) GST_ELEMENT_NAME (element), NULL); return FALSE; } - GST_DEBUG (GST_CAT_SCHEDULING, "created cothread %p for '%s'", + GST_DEBUG ("created cothread %p for '%s'", GST_ELEMENT_THREADSTATE (element), GST_ELEMENT_NAME (element)); } else { /* set the cothread wrapper function */ - GST_DEBUG (GST_CAT_SCHEDULING, - "about to set the wrapper function for '%s' to &%s", + GST_DEBUG ("about to set the wrapper function for '%s' to &%s", GST_ELEMENT_NAME (element), GST_DEBUG_FUNCPTR_NAME (wrapper_function)); do_cothread_setfunc (GST_ELEMENT_THREADSTATE (element), chain->sched->context, wrapper_function, 0, (char **) element); - GST_DEBUG (GST_CAT_SCHEDULING, "set wrapper function for '%s' to &%s", + GST_DEBUG ("set wrapper function for '%s' to &%s", GST_ELEMENT_NAME (element), GST_DEBUG_FUNCPTR_NAME (wrapper_function)); } @@ -766,7 +765,7 @@ gst_basic_scheduler_chain_new (GstBasicScheduler * sched) /* notify the scheduler that something changed */ GST_FLAG_SET(sched, GST_BASIC_SCHEDULER_CHANGE); - GST_INFO (GST_CAT_SCHEDULING, "created new chain %p, now are %d chains in sched %p", + GST_INFO ("created new chain %p, now are %d chains in sched %p", chain, sched->num_chains, sched); return chain; @@ -785,7 +784,7 @@ gst_basic_scheduler_chain_destroy (GstSchedulerChain * chain) g_list_free (chain->disabled); /* should be empty... */ g_list_free (chain->elements); /* ditto */ - GST_INFO (GST_CAT_SCHEDULING, "destroyed chain %p, now are %d chains in sched %p", chain, + GST_INFO ("destroyed chain %p, now are %d chains in sched %p", chain, sched->num_chains, sched); g_free (chain); @@ -802,10 +801,10 @@ gst_basic_scheduler_chain_add_element (GstSchedulerChain * chain, GstElement * e /* add the element to either the main list or the disabled list */ if (GST_STATE(element) == GST_STATE_PLAYING) { - GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to chain %p enabled", GST_ELEMENT_NAME (element),chain); + GST_INFO ("adding element \"%s\" to chain %p enabled", GST_ELEMENT_NAME (element),chain); chain->elements = g_list_prepend (chain->elements, element); } else { - GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to chain %p disabled", GST_ELEMENT_NAME (element),chain); + GST_INFO ("adding element \"%s\" to chain %p disabled", GST_ELEMENT_NAME (element),chain); chain->disabled = g_list_prepend (chain->disabled, element); } chain->num_elements++; @@ -818,7 +817,7 @@ static gboolean gst_basic_scheduler_chain_enable_element (GstSchedulerChain * chain, GstElement * element) { - GST_INFO (GST_CAT_SCHEDULING, "enabling element \"%s\" in chain %p", + GST_INFO ("enabling element \"%s\" in chain %p", GST_ELEMENT_NAME (element), chain); /* remove from disabled list */ @@ -839,7 +838,7 @@ static void gst_basic_scheduler_chain_disable_element (GstSchedulerChain * chain, GstElement * element) { - GST_INFO (GST_CAT_SCHEDULING, "disabling element \"%s\" in chain %p", + GST_INFO ("disabling element \"%s\" in chain %p", GST_ELEMENT_NAME (element), chain); /* remove from elements list */ @@ -860,7 +859,7 @@ gst_basic_scheduler_chain_disable_element (GstSchedulerChain * chain, static void gst_basic_scheduler_chain_remove_element (GstSchedulerChain * chain, GstElement * element) { - GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from chain %p", GST_ELEMENT_NAME (element), + GST_INFO ("removing element \"%s\" from chain %p", GST_ELEMENT_NAME (element), chain); /* if it's active, deactivate it */ @@ -913,13 +912,13 @@ gst_basic_scheduler_chain_elements (GstBasicScheduler * sched, GstElement * elem /* first check to see if they're in the same chain, we're done if that's the case */ if ((chain1 != NULL) && (chain1 == chain2)) { - GST_INFO (GST_CAT_SCHEDULING, "elements are already in the same chain"); + GST_INFO ("elements are already in the same chain"); return; } /* now, if neither element has a chain, create one */ if ((chain1 == NULL) && (chain2 == NULL)) { - GST_INFO (GST_CAT_SCHEDULING, "creating new chain to hold two new elements"); + GST_INFO ("creating new chain to hold two new elements"); chain = gst_basic_scheduler_chain_new (sched); gst_basic_scheduler_chain_add_element (chain, element1); gst_basic_scheduler_chain_add_element (chain, element2); @@ -929,7 +928,7 @@ gst_basic_scheduler_chain_elements (GstBasicScheduler * sched, GstElement * elem /* otherwise if both have chains already, join them */ } else if ((chain1 != NULL) && (chain2 != NULL)) { - GST_INFO (GST_CAT_SCHEDULING, "merging chain %p into chain %p", chain2, chain1); + GST_INFO ("merging chain %p into chain %p", chain2, chain1); /* take the contents of chain2 and merge them into chain1 */ chain1->disabled = g_list_concat (chain1->disabled, g_list_copy (chain2->disabled)); chain1->elements = g_list_concat (chain1->elements, g_list_copy (chain2->elements)); @@ -948,7 +947,7 @@ gst_basic_scheduler_chain_elements (GstBasicScheduler * sched, GstElement * elem else chain = chain2, element = element1; - GST_INFO (GST_CAT_SCHEDULING, "adding element to existing chain"); + GST_INFO ("adding element to existing chain"); gst_basic_scheduler_chain_add_element (chain, element); /* FIXME chain changed here */ /* gst_basic_scheduler_cothreaded_chain(chain->sched->parent,chain); */ @@ -964,7 +963,7 @@ gst_basic_scheduler_find_chain (GstBasicScheduler * sched, GstElement * element) GList *chains; GstSchedulerChain *chain; - GST_INFO (GST_CAT_SCHEDULING, "searching for element \"%s\" in chains", + GST_INFO ("searching for element \"%s\" in chains", GST_ELEMENT_NAME (element)); chains = sched->chains; @@ -1002,21 +1001,21 @@ gst_basic_scheduler_chain_recursive_add (GstSchedulerChain * chain, GstElement * /* add it to this one */ gst_basic_scheduler_chain_add_element (chain, element); - GST_DEBUG (GST_CAT_SCHEDULING, "recursing on element \"%s\"", GST_ELEMENT_NAME (element)); + GST_DEBUG ("recursing on element \"%s\"", GST_ELEMENT_NAME (element)); /* now go through all the pads and see which peers can be added */ pads = element->pads; while (pads) { pad = GST_PAD (pads->data); pads = g_list_next (pads); - GST_DEBUG (GST_CAT_SCHEDULING, "have pad %s:%s, checking for valid peer", + GST_DEBUG ("have pad %s:%s, checking for valid peer", GST_DEBUG_PAD_NAME (pad)); /* if the peer exists and could be in the same chain */ if (GST_PAD_PEER (pad)) { - GST_DEBUG (GST_CAT_SCHEDULING, "has peer %s:%s", GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad))); + GST_DEBUG ("has peer %s:%s", GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad))); peerelement = GST_PAD_PARENT (GST_PAD_PEER (pad)); if (GST_ELEMENT_SCHED (GST_PAD_PARENT (pad)) == GST_ELEMENT_SCHED (peerelement)) { - GST_DEBUG (GST_CAT_SCHEDULING, "peer \"%s\" is valid for same chain", + GST_DEBUG ("peer \"%s\" is valid for same chain", GST_ELEMENT_NAME (peerelement)); gst_basic_scheduler_chain_recursive_add (chain, peerelement, remove); } @@ -1032,7 +1031,7 @@ gst_basic_scheduler_setup (GstScheduler *sched) { /* first create thread context */ if (GST_BASIC_SCHEDULER_CAST (sched)->context == NULL) { - GST_DEBUG (GST_CAT_SCHEDULING, "initializing cothread context"); + GST_DEBUG ("initializing cothread context"); GST_BASIC_SCHEDULER_CAST (sched)->context = do_cothread_context_init (); } } @@ -1065,7 +1064,7 @@ gst_basic_scheduler_add_element (GstScheduler * sched, GstElement * element) GstSchedulerChain *chain; GstBasicScheduler *bsched = GST_BASIC_SCHEDULER (sched); - GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element)); + GST_INFO ("adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element)); /* only deal with elements after this point, not bins */ /* exception is made for Bin's that are schedulable, like the autoplugger */ @@ -1088,7 +1087,7 @@ gst_basic_scheduler_remove_element (GstScheduler * sched, GstElement * element) GstBasicScheduler *bsched = GST_BASIC_SCHEDULER (sched); if (g_list_find (bsched->elements, element)) { - GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from scheduler", + GST_INFO ("removing element \"%s\" from scheduler", GST_ELEMENT_NAME (element)); /* if we are removing the currently scheduled element */ @@ -1122,17 +1121,17 @@ gst_basic_scheduler_state_transition (GstScheduler *sched, GstElement *element, /* check if our parent changed state */ if (GST_SCHEDULER_PARENT (sched) == element) { - GST_INFO (GST_CAT_SCHEDULING, "parent \"%s\" changed state", GST_ELEMENT_NAME (element)); + GST_INFO ("parent \"%s\" changed state", GST_ELEMENT_NAME (element)); if (transition == GST_STATE_PLAYING_TO_PAUSED) { - GST_INFO (GST_CAT_SCHEDULING, "setting scheduler state to stopped"); + GST_INFO ("setting scheduler state to stopped"); GST_SCHEDULER_STATE (sched) = GST_SCHEDULER_STATE_STOPPED; } else if (transition == GST_STATE_PAUSED_TO_PLAYING) { - GST_INFO (GST_CAT_SCHEDULING, "setting scheduler state to running"); + GST_INFO ("setting scheduler state to running"); GST_SCHEDULER_STATE (sched) = GST_SCHEDULER_STATE_RUNNING; } else { - GST_INFO (GST_CAT_SCHEDULING, "no interesting state change, doing nothing"); + GST_INFO ("no interesting state change, doing nothing"); } } else if (transition == GST_STATE_PLAYING_TO_PAUSED || @@ -1147,16 +1146,14 @@ gst_basic_scheduler_state_transition (GstScheduler *sched, GstElement *element, } else if (transition == GST_STATE_PAUSED_TO_PLAYING) { if (!gst_basic_scheduler_chain_enable_element (chain, element)) { - GST_INFO (GST_CAT_SCHEDULING, - "could not enable element \"%s\"", + GST_INFO ("could not enable element \"%s\"", GST_ELEMENT_NAME (element)); return GST_STATE_FAILURE; } } } else { - GST_INFO (GST_CAT_SCHEDULING, - "element \"%s\" not found in any chain, no state change", + GST_INFO ("element \"%s\" not found in any chain, no state change", GST_ELEMENT_NAME (element)); } } @@ -1229,13 +1226,13 @@ gst_basic_scheduler_pad_link (GstScheduler * sched, GstPad *srcpad, GstPad *sink sinkelement = GST_PAD_PARENT (sinkpad); g_return_if_fail (sinkelement != NULL); - GST_INFO (GST_CAT_SCHEDULING, "have pad linked callback on %s:%s to %s:%s", + GST_INFO ("have pad linked callback on %s:%s to %s:%s", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); - GST_DEBUG (GST_CAT_SCHEDULING, "srcpad sched is %p, sinkpad sched is %p", + GST_DEBUG ("srcpad sched is %p, sinkpad sched is %p", GST_ELEMENT_SCHED (srcelement), GST_ELEMENT_SCHED (sinkelement)); if (GST_ELEMENT_SCHED (srcelement) == GST_ELEMENT_SCHED (sinkelement)) { - GST_INFO (GST_CAT_SCHEDULING, "peer %s:%s is in same scheduler, chaining together", + GST_INFO ("peer %s:%s is in same scheduler, chaining together", GST_DEBUG_PAD_NAME (sinkpad)); gst_basic_scheduler_chain_elements (bsched, srcelement, sinkelement); } @@ -1248,7 +1245,7 @@ gst_basic_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad, GstPad * GstSchedulerChain *chain1, *chain2; GstBasicScheduler *bsched = GST_BASIC_SCHEDULER (sched); - GST_INFO (GST_CAT_SCHEDULING, "unlinking pads %s:%s and %s:%s", + GST_INFO ("unlinking pads %s:%s and %s:%s", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); /* we need to have the parent elements of each pad */ @@ -1271,12 +1268,12 @@ gst_basic_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad, GstPad * #if 1 if (chain1 != chain2) { /* elements not in the same chain don't need to be separated */ - GST_INFO (GST_CAT_SCHEDULING, "elements not in the same chain"); + GST_INFO ("elements not in the same chain"); return; } if (chain1) { - GST_INFO (GST_CAT_SCHEDULING, "destroying chain"); + GST_INFO ("destroying chain"); gst_basic_scheduler_chain_destroy (chain1); /* now create a new chain to hold element1 and build it from scratch */ @@ -1295,7 +1292,7 @@ gst_basic_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad, GstPad * /* if they're both in the same chain, move second set of elements to a new chain */ if (chain1 && (chain1 == chain2)) { - GST_INFO (GST_CAT_SCHEDULING, "creating new chain for second element and peers"); + GST_INFO ("creating new chain for second element and peers"); chain2 = gst_basic_scheduler_chain_new (bsched); gst_basic_scheduler_chain_recursive_add (chain2, element2, TRUE); } @@ -1308,7 +1305,7 @@ gst_basic_scheduler_pad_select (GstScheduler * sched, GList * padlist) GstPad *pad = NULL; GList *padlist2 = padlist; - GST_INFO (GST_CAT_SCHEDULING, "performing select"); + GST_INFO ("performing select"); while (padlist2) { pad = GST_PAD (padlist2->data); @@ -1347,7 +1344,6 @@ gst_basic_scheduler_clock_wait (GstScheduler *sched, GstElement *element, static GstSchedulerState gst_basic_scheduler_iterate (GstScheduler * sched) { - GstBin *bin = GST_BIN (sched->parent); GList *chains; GstSchedulerChain *chain; GstElement *entry; @@ -1355,7 +1351,9 @@ gst_basic_scheduler_iterate (GstScheduler * sched) gint scheduled = 0; GstBasicScheduler *bsched = GST_BASIC_SCHEDULER (sched); - GST_DEBUG_ENTER ("(\"%s\")", GST_ELEMENT_NAME (bin)); + GST_CAT_LOG_OBJECT (debug_dataflow, sched, + "starting iteration in bin %s", + GST_ELEMENT_NAME (sched->parent)); /* clear the changes flag */ GST_FLAG_UNSET(bsched, GST_BASIC_SCHEDULER_CHANGE); @@ -1372,23 +1370,23 @@ gst_basic_scheduler_iterate (GstScheduler * sched) /* all we really have to do is switch to the first child */ /* FIXME this should be lots more intelligent about where to start */ - GST_DEBUG (GST_CAT_DATAFLOW, "starting iteration via cothreads using %s scheduler", + GST_CAT_DEBUG (debug_dataflow, "starting iteration via cothreads using %s scheduler", _SCHEDULER_NAME); if (chain->elements) { entry = NULL; /*MattH ADDED?*/ - GST_DEBUG (GST_CAT_SCHEDULING, "there are %d elements in this chain", chain->num_elements); + GST_DEBUG ("there are %d elements in this chain", chain->num_elements); elements = chain->elements; while (elements) { entry = GST_ELEMENT_CAST (elements->data); elements = g_list_next (elements); if (GST_FLAG_IS_SET (entry, GST_ELEMENT_DECOUPLED)) { - GST_DEBUG (GST_CAT_SCHEDULING, "entry \"%s\" is DECOUPLED, skipping", + GST_DEBUG ("entry \"%s\" is DECOUPLED, skipping", GST_ELEMENT_NAME (entry)); entry = NULL; } else if (GST_FLAG_IS_SET (entry, GST_ELEMENT_INFINITE_LOOP)) { - GST_DEBUG (GST_CAT_SCHEDULING, "entry \"%s\" is not valid, skipping", + GST_DEBUG ("entry \"%s\" is not valid, skipping", GST_ELEMENT_NAME (entry)); entry = NULL; } @@ -1400,7 +1398,7 @@ gst_basic_scheduler_iterate (GstScheduler * sched) GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING); - GST_DEBUG (GST_CAT_DATAFLOW, "set COTHREAD_STOPPING flag on \"%s\"(@%p)", + GST_CAT_DEBUG (debug_dataflow, "set COTHREAD_STOPPING flag on \"%s\"(@%p)", GST_ELEMENT_NAME (entry), entry); if (GST_ELEMENT_THREADSTATE (entry)) { @@ -1413,7 +1411,7 @@ gst_basic_scheduler_iterate (GstScheduler * sched) return GST_SCHEDULER_STATE_RUNNING; } else { - GST_DEBUG (GST_CAT_DATAFLOW, "cothread switch not possible, element has no threadstate"); + GST_CAT_DEBUG (debug_dataflow, "cothread switch not possible, element has no threadstate"); return GST_SCHEDULER_STATE_ERROR; } @@ -1423,31 +1421,32 @@ gst_basic_scheduler_iterate (GstScheduler * sched) * if it was, return to gstthread.c::gst_thread_main_loop() to * execute the state change. */ - GST_DEBUG (GST_CAT_DATAFLOW, "cothread switch ended or interrupted"); + GST_CAT_DEBUG (debug_dataflow, "cothread switch ended or interrupted"); if (state != GST_SCHEDULER_STATE_RUNNING) { - GST_INFO (GST_CAT_DATAFLOW, "scheduler is not running, in state %d", state); + GST_CAT_INFO (debug_dataflow, "scheduler is not running, in state %d", state); return state; } scheduled++; } else { - GST_INFO (GST_CAT_DATAFLOW, "no entry in this chain, trying the next one"); + GST_CAT_INFO (debug_dataflow, "no entry in this chain, trying the next one"); } } else { - GST_INFO (GST_CAT_DATAFLOW, "no enabled elements in this chain, trying the next one"); + GST_CAT_INFO (debug_dataflow, "no enabled elements in this chain, trying the next one"); } } - GST_DEBUG (GST_CAT_DATAFLOW, "leaving (%s)", GST_ELEMENT_NAME (bin)); + GST_CAT_LOG_OBJECT (debug_dataflow, sched, "leaving (%s)", + GST_ELEMENT_NAME (sched->parent)); if (scheduled == 0) { - GST_INFO (GST_CAT_DATAFLOW, "nothing was scheduled, return STOPPED"); + GST_CAT_INFO (debug_dataflow, "nothing was scheduled, return STOPPED"); return GST_SCHEDULER_STATE_STOPPED; } else { - GST_INFO (GST_CAT_DATAFLOW, "scheduler still running, return RUNNING"); + GST_CAT_INFO (debug_dataflow, "scheduler still running, return RUNNING"); return GST_SCHEDULER_STATE_RUNNING; } } diff --git a/gst/schedulers/gstoptimalscheduler.c b/gst/schedulers/gstoptimalscheduler.c index dd7f5dfcf5..8406105748 100644 --- a/gst/schedulers/gstoptimalscheduler.c +++ b/gst/schedulers/gstoptimalscheduler.c @@ -20,9 +20,15 @@ * Boston, MA 02111-1307, USA. */ -/*#define GST_DEBUG_ENABLED */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include +GST_DEBUG_CATEGORY_STATIC(debug_scheduler); +#define GST_CAT_DEFAULT debug_scheduler + #ifdef USE_COTHREADS # include "cothreads_compat.h" #else @@ -341,6 +347,8 @@ plugin_init (GModule *module, GstPlugin *plugin) { GstSchedulerFactory *factory; + GST_DEBUG_CATEGORY_INIT (debug_scheduler, "scheduler", 0, "optimal scheduler"); + gst_plugin_set_longname (plugin, "An optimal scheduler"); #ifdef USE_COTHREADS @@ -375,7 +383,7 @@ destroy_chain (GstOptSchedulerChain *chain) { GstOptScheduler *osched; - GST_INFO (GST_CAT_SCHEDULING, "destroy chain %p", chain); + GST_INFO ( "destroy chain %p", chain); g_assert (chain->num_groups == 0); g_assert (chain->groups == NULL); @@ -401,7 +409,7 @@ create_chain (GstOptScheduler *osched) gst_object_ref (GST_OBJECT (osched)); osched->chains = g_slist_prepend (osched->chains, chain); - GST_INFO (GST_CAT_SCHEDULING, "new chain %p", chain); + GST_INFO ( "new chain %p", chain); return chain; } @@ -409,8 +417,8 @@ create_chain (GstOptScheduler *osched) static GstOptSchedulerChain* ref_chain (GstOptSchedulerChain *chain) { - GST_INFO (GST_CAT_SCHEDULING, "ref chain %p %d->%d", chain, - chain->refcount, chain->refcount+1); + GST_LOG ("ref chain %p %d->%d", chain, + chain->refcount, chain->refcount+1); chain->refcount++; return chain; @@ -419,8 +427,8 @@ ref_chain (GstOptSchedulerChain *chain) static GstOptSchedulerChain* unref_chain (GstOptSchedulerChain *chain) { - GST_INFO (GST_CAT_SCHEDULING, "unref chain %p %d->%d", chain, - chain->refcount, chain->refcount-1); + GST_LOG ("unref chain %p %d->%d", chain, + chain->refcount, chain->refcount-1); if (--chain->refcount == 0) { destroy_chain (chain); @@ -433,7 +441,7 @@ unref_chain (GstOptSchedulerChain *chain) static GstOptSchedulerChain* add_to_chain (GstOptSchedulerChain *chain, GstOptSchedulerGroup *group) { - GST_INFO (GST_CAT_SCHEDULING, "adding group %p to chain %p", group, chain); + GST_INFO ( "adding group %p to chain %p", group, chain); g_assert (group->chain == NULL); @@ -453,7 +461,7 @@ add_to_chain (GstOptSchedulerChain *chain, GstOptSchedulerGroup *group) static GstOptSchedulerChain* remove_from_chain (GstOptSchedulerChain *chain, GstOptSchedulerGroup *group) { - GST_INFO (GST_CAT_SCHEDULING, "removing group %p from chain %p", group, chain); + GST_INFO ( "removing group %p from chain %p", group, chain); if (!chain) return NULL; @@ -480,7 +488,7 @@ merge_chains (GstOptSchedulerChain *chain1, GstOptSchedulerChain *chain2) g_assert (chain1 != NULL); - GST_INFO (GST_CAT_SCHEDULING, "merging chain %p and %p", chain1, chain2); + GST_INFO ( "merging chain %p and %p", chain1, chain2); if (chain1 == chain2 || chain2 == NULL) return chain1; @@ -491,7 +499,7 @@ merge_chains (GstOptSchedulerChain *chain1, GstOptSchedulerChain *chain2) GstOptSchedulerGroup *group = (GstOptSchedulerGroup *) walk->data; walk = g_slist_next (walk); - GST_INFO (GST_CAT_SCHEDULING, "reparenting group %p from chain %p to %p", + GST_INFO ( "reparenting group %p from chain %p to %p", group, chain2, chain1); group->chain = NULL; @@ -515,7 +523,7 @@ chain_group_set_enabled (GstOptSchedulerChain *chain, GstOptSchedulerGroup *grou g_assert (chain != NULL); g_assert (group != NULL); - GST_INFO (GST_CAT_SCHEDULING, "request to %d group %p in chain %p, have %d groups enabled out of %d", + GST_INFO ( "request to %d group %p in chain %p, have %d groups enabled out of %d", enabled, group, chain, chain->num_enabled, chain->num_groups); if (enabled) @@ -527,11 +535,11 @@ chain_group_set_enabled (GstOptSchedulerChain *chain, GstOptSchedulerGroup *grou if (chain->num_enabled < chain->num_groups) chain->num_enabled++; - GST_INFO (GST_CAT_SCHEDULING, "enable group %p in chain %p, now %d groups enabled out of %d", group, chain, + GST_INFO ( "enable group %p in chain %p, now %d groups enabled out of %d", group, chain, chain->num_enabled, chain->num_groups); if (chain->num_enabled == chain->num_groups) { - GST_INFO (GST_CAT_SCHEDULING, "enable chain %p", chain); + GST_INFO ( "enable chain %p", chain); GST_OPT_SCHEDULER_CHAIN_ENABLE (chain); } } @@ -539,11 +547,11 @@ chain_group_set_enabled (GstOptSchedulerChain *chain, GstOptSchedulerGroup *grou if (chain->num_enabled > 0) chain->num_enabled--; - GST_INFO (GST_CAT_SCHEDULING, "disable group %p in chain %p, now %d groups enabled out of %d", group, chain, + GST_INFO ( "disable group %p in chain %p, now %d groups enabled out of %d", group, chain, chain->num_enabled, chain->num_groups); if (chain->num_enabled == 0) { - GST_INFO (GST_CAT_SCHEDULING, "disable chain %p", chain); + GST_INFO ( "disable chain %p", chain); GST_OPT_SCHEDULER_CHAIN_DISABLE (chain); } } @@ -577,8 +585,8 @@ chain_recursively_migrate_group (GstOptSchedulerChain *chain, GstOptSchedulerGro static GstOptSchedulerGroup* ref_group (GstOptSchedulerGroup *group) { - GST_INFO (GST_CAT_SCHEDULING, "ref group %p %d->%d", group, - group->refcount, group->refcount+1); + GST_LOG ("ref group %p %d->%d", group, + group->refcount, group->refcount+1); group->refcount++; @@ -589,8 +597,8 @@ ref_group (GstOptSchedulerGroup *group) static GstOptSchedulerGroup* ref_group_by_count (GstOptSchedulerGroup *group, gint count) { - GST_INFO (GST_CAT_SCHEDULING, "ref group %p %d->%d", group, - group->refcount, group->refcount+count); + GST_LOG ("ref group %p %d->%d", group, + group->refcount, group->refcount+count); group->refcount += count; @@ -601,8 +609,8 @@ ref_group_by_count (GstOptSchedulerGroup *group, gint count) static GstOptSchedulerGroup* unref_group (GstOptSchedulerGroup *group) { - GST_INFO (GST_CAT_SCHEDULING, "unref group %p %d->%d", group, - group->refcount, group->refcount-1); + GST_LOG ("unref group %p %d->%d", group, + group->refcount, group->refcount-1); if (--group->refcount == 1) { destroy_group (group); @@ -618,10 +626,10 @@ add_to_group (GstOptSchedulerGroup *group, GstElement *element) g_assert (group != NULL); g_assert (element != NULL); - GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to group %p", GST_ELEMENT_NAME (element), group); + GST_INFO ( "adding element \"%s\" to group %p", GST_ELEMENT_NAME (element), group); if (GST_ELEMENT_IS_DECOUPLED (element)) { - GST_INFO (GST_CAT_SCHEDULING, "element \"%s\" is decoupled, not adding to group %p", + GST_INFO ( "element \"%s\" is decoupled, not adding to group %p", GST_ELEMENT_NAME (element), group); return group; } @@ -647,7 +655,7 @@ create_group (GstOptSchedulerChain *chain, GstElement *element) GstOptSchedulerGroup *group; group = g_new0 (GstOptSchedulerGroup, 1); - GST_INFO (GST_CAT_SCHEDULING, "new group %p", group); + GST_INFO ( "new group %p", group); group->refcount = 1; group->flags = GST_OPT_SCHEDULER_GROUP_DISABLED; @@ -682,7 +690,7 @@ destroy_group_scheduler (GstOptSchedulerGroup *group) static void destroy_group (GstOptSchedulerGroup *group) { - GST_INFO (GST_CAT_SCHEDULING, "destroy group %p", group); + GST_INFO ( "destroy group %p", group); g_assert (group != NULL); g_assert (group->elements == NULL); @@ -698,7 +706,7 @@ destroy_group (GstOptSchedulerGroup *group) static GstOptSchedulerGroup* remove_from_group (GstOptSchedulerGroup *group, GstElement *element) { - GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from group %p", GST_ELEMENT_NAME (element), group); + GST_INFO ( "removing element \"%s\" from group %p", GST_ELEMENT_NAME (element), group); g_assert (group != NULL); g_assert (element != NULL); @@ -729,7 +737,7 @@ merge_groups (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) { g_assert (group1 != NULL); - GST_INFO (GST_CAT_SCHEDULING, "merging groups %p and %p", group1, group2); + GST_INFO ( "merging groups %p and %p", group1, group2); if (group1 == group2 || group2 == NULL) return group1; @@ -747,7 +755,7 @@ merge_groups (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) static void group_error_handler (GstOptSchedulerGroup *group) { - GST_INFO (GST_CAT_SCHEDULING, "group %p has errored", group); + GST_INFO ( "group %p has errored", group); chain_group_set_enabled (group->chain, group, FALSE); group->chain->sched->state = GST_OPT_SCHEDULER_STATE_ERROR; @@ -762,18 +770,18 @@ group_element_set_enabled (GstOptSchedulerGroup *group, GstElement *element, gbo g_assert (group != NULL); g_assert (element != NULL); - GST_INFO (GST_CAT_SCHEDULING, "request to %d element %s in group %p, have %d elements enabled out of %d", + GST_INFO ( "request to %d element %s in group %p, have %d elements enabled out of %d", enabled, GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); if (enabled) { if (group->num_enabled < group->num_elements) group->num_enabled++; - GST_INFO (GST_CAT_SCHEDULING, "enable element %s in group %p, now %d elements enabled out of %d", + GST_INFO ( "enable element %s in group %p, now %d elements enabled out of %d", GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); if (group->num_enabled == group->num_elements) { - GST_INFO (GST_CAT_SCHEDULING, "enable group %p", group); + GST_INFO ( "enable group %p", group); chain_group_set_enabled (group->chain, group, TRUE); } } @@ -781,11 +789,11 @@ group_element_set_enabled (GstOptSchedulerGroup *group, GstElement *element, gbo if (group->num_enabled > 0) group->num_enabled--; - GST_INFO (GST_CAT_SCHEDULING, "disable element %s in group %p, now %d elements enabled out of %d", + GST_INFO ( "disable element %s in group %p, now %d elements enabled out of %d", GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); if (group->num_enabled == 0) { - GST_INFO (GST_CAT_SCHEDULING, "disable group %p", group); + GST_INFO ( "disable group %p", group); chain_group_set_enabled (group->chain, group, FALSE); } } @@ -799,7 +807,7 @@ static gboolean schedule_group (GstOptSchedulerGroup *group) { if (!group->entry) { - GST_INFO (GST_CAT_SCHEDULING, "not scheduling group %p without entry", group); + GST_INFO ( "not scheduling group %p without entry", group); return FALSE; } @@ -811,7 +819,7 @@ schedule_group (GstOptSchedulerGroup *group) return TRUE; #else if (group->schedulefunc == NULL) { - GST_INFO (GST_CAT_SCHEDULING, "not scheduling group %p without schedulefunc", + GST_INFO ( "not scheduling group %p without schedulefunc", group); return FALSE; } @@ -824,7 +832,7 @@ schedule_group (GstOptSchedulerGroup *group) static void gst_opt_scheduler_schedule_run_queue (GstOptScheduler *osched) { - GST_INFO (GST_CAT_SCHEDULING, "entering scheduler run queue recursion %d %d", + GST_LOG_OBJECT (osched, "entering scheduler run queue recursion %d %d", osched->recursion, g_list_length (osched->runqueue)); /* make sure we don't exceed max_recursion */ @@ -844,7 +852,7 @@ gst_opt_scheduler_schedule_run_queue (GstOptScheduler *osched) /* runqueue hols refcount to group */ osched->runqueue = g_list_remove (osched->runqueue, group); - GST_INFO (GST_CAT_SCHEDULING, "scheduling %p", group); + GST_LOG_OBJECT (osched, "scheduling group %p", group); res = schedule_group (group); if (!res) { @@ -852,12 +860,12 @@ gst_opt_scheduler_schedule_run_queue (GstOptScheduler *osched) group_error_handler (group); } else { - GST_INFO (GST_CAT_SCHEDULING, "done scheduling %p", group); + GST_LOG_OBJECT (osched, "done scheduling group %p", group); } unref_group (group); } - GST_INFO (GST_CAT_SCHEDULING, "run queue length after scheduling %d", g_list_length (osched->runqueue)); + GST_LOG_OBJECT (osched, "run queue length after scheduling %d", g_list_length (osched->runqueue)); osched->recursion--; } @@ -878,8 +886,8 @@ schedule_chain (GstOptSchedulerChain *chain) if (!GST_OPT_SCHEDULER_GROUP_IS_DISABLED (group)) { ref_group (group); - GST_INFO (GST_CAT_SCHEDULING, "scheduling group %p in chain %p", - group, chain); + GST_LOG ("scheduling group %p in chain %p", + group, chain); #ifdef USE_COTHREADS schedule_group (group); @@ -890,8 +898,8 @@ schedule_chain (GstOptSchedulerChain *chain) gst_opt_scheduler_schedule_run_queue (osched); #endif - GST_INFO (GST_CAT_SCHEDULING, "done scheduling group %p in chain %p", - group, chain); + GST_LOG ("done scheduling group %p in chain %p", + group, chain); unref_group (group); break; } @@ -910,7 +918,7 @@ get_group_schedule_function (int argc, char *argv[]) GstOptSchedulerGroup *group = (GstOptSchedulerGroup *) argv; const GList *pads = gst_element_get_pad_list (group->entry); - GST_INFO (GST_CAT_SCHEDULING, "get wrapper of group %p", group); + GST_LOG ("get wrapper of group %p", group); group->flags |= GST_OPT_SCHEDULER_GROUP_RUNNING; @@ -923,8 +931,8 @@ get_group_schedule_function (int argc, char *argv[]) if (!GST_PAD_IS_SRC (pad) || !GST_IS_REAL_PAD (pad)) continue; - GST_INFO (GST_CAT_SCHEDULING, "doing get and push on pad \"%s:%s\" in group %p", - GST_DEBUG_PAD_NAME (pad), group); + GST_LOG ("doing get and push on pad \"%s:%s\" in group %p", + GST_DEBUG_PAD_NAME (pad), group); buffer = GST_RPAD_GETFUNC (pad) (pad); if (buffer) { @@ -951,17 +959,17 @@ loop_group_schedule_function (int argc, char *argv[]) GstOptSchedulerGroup *group = (GstOptSchedulerGroup *) argv; GstElement *entry = group->entry; - GST_INFO (GST_CAT_SCHEDULING, "loop wrapper of group %p", group); + GST_LOG ("loop wrapper of group %p", group); group->flags |= GST_OPT_SCHEDULER_GROUP_RUNNING; - GST_INFO (GST_CAT_SCHEDULING, "calling loopfunc of element %s in group %p", - GST_ELEMENT_NAME (entry), group); + GST_LOG ("calling loopfunc of element %s in group %p", + GST_ELEMENT_NAME (entry), group); entry->loopfunc (entry); - GST_INFO (GST_CAT_SCHEDULING, "loopfunc ended of element %s in group %p", - GST_ELEMENT_NAME (entry), group); + GST_LOG ("loopfunc ended of element %s in group %p", + GST_ELEMENT_NAME (entry), group); group->flags &= ~GST_OPT_SCHEDULER_GROUP_RUNNING; @@ -990,7 +998,7 @@ gst_opt_scheduler_loop_wrapper (GstPad *sinkpad, GstBuffer *buffer) GstOptSchedulerGroup *group; GstOptScheduler *osched; - GST_INFO (GST_CAT_SCHEDULING, "loop wrapper, putting buffer in bufpen"); + GST_LOG ("loop wrapper, putting buffer in bufpen"); group = GST_ELEMENT_SCHED_GROUP (GST_PAD_PARENT (sinkpad)); osched = group->chain->sched; @@ -1009,12 +1017,12 @@ gst_opt_scheduler_loop_wrapper (GstPad *sinkpad, GstBuffer *buffer) GST_PAD_BUFLIST (GST_RPAD_PEER (sinkpad)) = g_list_append (GST_PAD_BUFLIST (GST_RPAD_PEER (sinkpad)), buffer); if (!(group->flags & GST_OPT_SCHEDULER_GROUP_RUNNING)) { ref_group (group); - GST_INFO (GST_CAT_SCHEDULING, "adding %p to runqueue", group); + GST_LOG ("adding %p to runqueue", group); osched->runqueue = g_list_append (osched->runqueue, group); } #endif - GST_INFO (GST_CAT_SCHEDULING, "after loop wrapper buflist %d", + GST_LOG ("after loop wrapper buflist %d", g_list_length (GST_PAD_BUFLIST (GST_RPAD_PEER (sinkpad)))); } @@ -1029,15 +1037,15 @@ gst_opt_scheduler_get_wrapper (GstPad *srcpad) GstOptScheduler *osched; gboolean disabled; - GST_INFO (GST_CAT_SCHEDULING, "get wrapper, removing buffer from bufpen"); + GST_LOG ("get wrapper, removing buffer from bufpen"); /* first try to grab a queued buffer */ if (GST_PAD_BUFLIST (srcpad)) { buffer = GST_PAD_BUFLIST (srcpad)->data; GST_PAD_BUFLIST (srcpad) = g_list_remove (GST_PAD_BUFLIST (srcpad), buffer); - GST_INFO (GST_CAT_SCHEDULING, "get wrapper, returning queued buffer %d", - g_list_length (GST_PAD_BUFLIST (srcpad))); + GST_LOG ("get wrapper, returning queued buffer %d", + g_list_length (GST_PAD_BUFLIST (srcpad))); return buffer; } @@ -1056,9 +1064,9 @@ gst_opt_scheduler_get_wrapper (GstPad *srcpad) ref_group_by_count (group, 2); osched->runqueue = g_list_append (osched->runqueue, group); - GST_INFO (GST_CAT_SCHEDULING, "recursing into scheduler group %p", group); + GST_LOG_OBJECT (osched, "recursing into scheduler group %p", group); gst_opt_scheduler_schedule_run_queue (osched); - GST_INFO (GST_CAT_SCHEDULING, "return from recurse group %p", group); + GST_LOG_OBJECT (osched, "return from recurse group %p", group); /* if the other group was disabled we might have to break out of the loop */ disabled = GST_OPT_SCHEDULER_GROUP_IS_DISABLED (group); @@ -1080,7 +1088,7 @@ gst_opt_scheduler_get_wrapper (GstPad *srcpad) /* if the scheduler interrupted, make sure we send an INTERRUPTED event to the * loop based element */ if (osched->state == GST_OPT_SCHEDULER_STATE_INTERRUPTED) { - GST_INFO (GST_CAT_SCHEDULING, "scheduler interrupted, return interrupt event"); + GST_INFO ( "scheduler interrupted, return interrupt event"); buffer = GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT)); } else { @@ -1096,7 +1104,7 @@ gst_opt_scheduler_get_wrapper (GstPad *srcpad) } while (buffer == NULL); - GST_INFO (GST_CAT_SCHEDULING, "get wrapper, returning buffer %p, queue length %d", + GST_LOG ("get wrapper, returning buffer %p, queue length %d", buffer, g_list_length (GST_PAD_BUFLIST (srcpad))); return buffer; @@ -1127,7 +1135,7 @@ pad_clear_queued (GstPad *srcpad, gpointer user_data) GList *buflist = GST_PAD_BUFLIST (srcpad); if (buflist) { - GST_INFO (GST_CAT_SCHEDULING, "need to clear some buffers"); + GST_INFO ( "need to clear some buffers"); g_list_foreach (buflist, (GFunc) clear_queued, NULL); g_list_free (buflist); GST_PAD_BUFLIST (srcpad) = NULL; @@ -1139,8 +1147,8 @@ gst_opt_scheduler_event_wrapper (GstPad *srcpad, GstEvent *event) { gboolean flush; - GST_INFO (GST_CAT_SCHEDULING, "intercepting event %d on pad %s:%s", - GST_EVENT_TYPE (event), GST_DEBUG_PAD_NAME (srcpad)); + GST_LOG ("intercepting event %d on pad %s:%s", + GST_EVENT_TYPE (event), GST_DEBUG_PAD_NAME (srcpad)); /* figure out if this is a flush event */ switch (GST_EVENT_TYPE (event)) { @@ -1157,7 +1165,7 @@ gst_opt_scheduler_event_wrapper (GstPad *srcpad, GstEvent *event) } if (flush) { - GST_INFO (GST_CAT_SCHEDULING, "event is flush"); + GST_LOG ("event is flush"); pad_clear_queued (srcpad, NULL); } @@ -1205,24 +1213,24 @@ gst_opt_scheduler_state_transition (GstScheduler *sched, GstElement *element, gi GstOptSchedulerGroup *group; GstElementStateReturn res = GST_STATE_SUCCESS; - GST_INFO (GST_CAT_SCHEDULING, "element \"%s\" state change %d", GST_ELEMENT_NAME (element), transition); + GST_INFO ( "element \"%s\" state change %d", GST_ELEMENT_NAME (element), transition); /* we check the state of the managing pipeline here */ if (GST_IS_BIN (element)) { if (GST_SCHEDULER_PARENT (sched) == element) { - GST_INFO (GST_CAT_SCHEDULING, "parent \"%s\" changed state", GST_ELEMENT_NAME (element)); + GST_INFO ( "parent \"%s\" changed state", GST_ELEMENT_NAME (element)); switch (transition) { case GST_STATE_PLAYING_TO_PAUSED: - GST_INFO (GST_CAT_SCHEDULING, "setting scheduler state to stopped"); + GST_INFO ( "setting scheduler state to stopped"); GST_SCHEDULER_STATE (sched) = GST_SCHEDULER_STATE_STOPPED; break; case GST_STATE_PAUSED_TO_PLAYING: - GST_INFO (GST_CAT_SCHEDULING, "setting scheduler state to running"); + GST_INFO ( "setting scheduler state to running"); GST_SCHEDULER_STATE (sched) = GST_SCHEDULER_STATE_RUNNING; break; default: - GST_INFO (GST_CAT_SCHEDULING, "no interesting state change, doing nothing"); + GST_INFO ( "no interesting state change, doing nothing"); } } return res; @@ -1240,7 +1248,7 @@ gst_opt_scheduler_state_transition (GstScheduler *sched, GstElement *element, gi /* an element withut a group has to be an unlinked src, sink * filter element */ if (!group) { - GST_INFO (GST_CAT_SCHEDULING, "element \"%s\" has no group", GST_ELEMENT_NAME (element)); + GST_INFO ( "element \"%s\" has no group", GST_ELEMENT_NAME (element)); res = GST_STATE_FAILURE; } /* else construct the scheduling context of this group and enable it */ @@ -1308,7 +1316,7 @@ group_elements (GstOptScheduler *osched, GstElement *element1, GstElement *eleme if (!group1 && !group2) { GstOptSchedulerChain *chain; - GST_INFO (GST_CAT_SCHEDULING, "creating new group to hold \"%s\" and \"%s\"", + GST_INFO ( "creating new group to hold \"%s\" and \"%s\"", GST_ELEMENT_NAME (element1), GST_ELEMENT_NAME (element2)); chain = create_chain (osched); @@ -1317,7 +1325,7 @@ group_elements (GstOptScheduler *osched, GstElement *element1, GstElement *eleme } /* the first element has a group */ else if (group1) { - GST_INFO (GST_CAT_SCHEDULING, "adding \"%s\" to \"%s\"'s group", + GST_INFO ( "adding \"%s\" to \"%s\"'s group", GST_ELEMENT_NAME (element2), GST_ELEMENT_NAME (element1)); /* the second element also has a group, merge */ @@ -1333,7 +1341,7 @@ group_elements (GstOptScheduler *osched, GstElement *element1, GstElement *eleme /* element1 has no group, element2 does. Add element1 to the * group of element2 */ else { - GST_INFO (GST_CAT_SCHEDULING, "adding \"%s\" to \"%s\"'s group", + GST_INFO ( "adding \"%s\" to \"%s\"'s group", GST_ELEMENT_NAME (element1), GST_ELEMENT_NAME (element2)); add_to_group (group2, element1); group = group2; @@ -1359,7 +1367,7 @@ group_inc_link (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) if (IS_GROUP_LINK (link, group1, group2)) { /* we found a link to this group, increment the link count */ link->count++; - GST_INFO (GST_CAT_SCHEDULING, "incremented group link count between %p and %p to %d", + GST_INFO ( "incremented group link count between %p and %p to %d", group1, group2, link->count); done = TRUE; } @@ -1375,7 +1383,7 @@ group_inc_link (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) group1->group_links = g_slist_prepend (group1->group_links, link); group2->group_links = g_slist_prepend (group2->group_links, link); - GST_INFO (GST_CAT_SCHEDULING, "added group link count between %p and %p", + GST_INFO ( "added group link count between %p and %p", group1, group2); } } @@ -1396,13 +1404,13 @@ group_dec_link (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) if (IS_GROUP_LINK (link, group1, group2)) { link->count--; - GST_INFO (GST_CAT_SCHEDULING, "link count between %p and %p is now %d", + GST_INFO ( "link count between %p and %p is now %d", group1, group2, link->count); if (link->count == 0) { group1->group_links = g_slist_remove (group1->group_links, link); group2->group_links = g_slist_remove (group2->group_links, link); g_free (link); - GST_INFO (GST_CAT_SCHEDULING, "removed group link between %p and %p", + GST_INFO ( "removed group link between %p and %p", group1, group2); res = TRUE; } @@ -1434,7 +1442,7 @@ gst_opt_scheduler_setup (GstScheduler *sched) /* first create thread context */ if (osched->context == NULL) { - GST_DEBUG (GST_CAT_SCHEDULING, "initializing cothread context"); + GST_DEBUG ( "initializing cothread context"); osched->context = do_cothread_context_init (); } #endif @@ -1472,7 +1480,7 @@ gst_opt_scheduler_add_element (GstScheduler *sched, GstElement *element) GstOptScheduler *osched = GST_OPT_SCHEDULER_CAST (sched); GstOptSchedulerCtx *ctx; - GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element)); + GST_INFO ( "adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element)); /* decoupled elements are not added to the scheduler lists */ if (GST_ELEMENT_IS_DECOUPLED (element)) @@ -1494,7 +1502,7 @@ gst_opt_scheduler_add_element (GstScheduler *sched, GstElement *element) group->entry = element; group->type = GST_OPT_SCHEDULER_GROUP_LOOP; - GST_INFO (GST_CAT_SCHEDULING, "added element \"%s\" as loop based entry", GST_ELEMENT_NAME (element)); + GST_INFO ( "added element \"%s\" as loop based entry", GST_ELEMENT_NAME (element)); } } @@ -1503,7 +1511,7 @@ gst_opt_scheduler_remove_element (GstScheduler *sched, GstElement *element) { GstOptSchedulerGroup *group; - GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from scheduler", GST_ELEMENT_NAME (element)); + GST_INFO ( "removing element \"%s\" from scheduler", GST_ELEMENT_NAME (element)); /* decoupled elements are not added to the scheduler lists and should therefore * no be removed */ @@ -1556,7 +1564,7 @@ gst_opt_scheduler_yield (GstScheduler *sched, GstElement *element) static gboolean gst_opt_scheduler_interrupt (GstScheduler *sched, GstElement *element) { - GST_INFO (GST_CAT_SCHEDULING, "interrupt from \"%s\"", + GST_INFO ( "interrupt from \"%s\"", GST_ELEMENT_NAME (element)); #ifdef USE_COTHREADS @@ -1566,7 +1574,7 @@ gst_opt_scheduler_interrupt (GstScheduler *sched, GstElement *element) { GstOptScheduler *osched = GST_OPT_SCHEDULER_CAST (sched); - GST_INFO (GST_CAT_SCHEDULING, "scheduler set interrupted state"); + GST_INFO ( "scheduler set interrupted state"); osched->state = GST_OPT_SCHEDULER_STATE_INTERRUPTED; } return TRUE; @@ -1593,7 +1601,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad LinkType type = GST_OPT_INVALID; GstElement *element1, *element2; - GST_INFO (GST_CAT_SCHEDULING, "pad link between \"%s:%s\" and \"%s:%s\"", + GST_INFO ( "pad link between \"%s:%s\" and \"%s:%s\"", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); element1 = GST_PAD_PARENT (srcpad); @@ -1659,7 +1667,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad { GstOptSchedulerGroup *group = NULL; - GST_INFO (GST_CAT_SCHEDULING, "get to chain based link"); + GST_INFO ( "get to chain based link"); /* setup get/chain handlers */ GST_RPAD_GETHANDLER (srcpad) = GST_RPAD_GETFUNC (srcpad); @@ -1680,14 +1688,14 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad group->entry = element1; group->type = GST_OPT_SCHEDULER_GROUP_GET; - GST_INFO (GST_CAT_SCHEDULING, "setting \"%s\" as entry point of _get-based group %p", + GST_INFO ( "setting \"%s\" as entry point of _get-based group %p", GST_ELEMENT_NAME (element1), group); } break; } case GST_OPT_LOOP_TO_CHAIN: case GST_OPT_CHAIN_TO_CHAIN: - GST_INFO (GST_CAT_SCHEDULING, "loop/chain to chain based link"); + GST_INFO ( "loop/chain to chain based link"); if (GST_ELEMENT_IS_EVENT_AWARE (element2)) GST_RPAD_CHAINHANDLER (sinkpad) = GST_RPAD_CHAINFUNC (sinkpad); @@ -1703,7 +1711,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad group_elements (osched, element1, element2); break; case GST_OPT_GET_TO_LOOP: - GST_INFO (GST_CAT_SCHEDULING, "get to loop based link"); + GST_INFO ( "get to loop based link"); GST_RPAD_GETHANDLER (srcpad) = GST_RPAD_GETFUNC (srcpad); GST_RPAD_EVENTHANDLER (srcpad) = GST_RPAD_EVENTFUNC (srcpad); @@ -1720,7 +1728,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad { GstOptSchedulerGroup *group1, *group2; - GST_INFO (GST_CAT_SCHEDULING, "chain/loop to loop based link"); + GST_INFO ( "chain/loop to loop based link"); GST_RPAD_CHAINHANDLER (sinkpad) = gst_opt_scheduler_loop_wrapper; GST_RPAD_GETHANDLER (srcpad) = gst_opt_scheduler_get_wrapper; @@ -1739,7 +1747,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad if (!group1) { /* create a new group for element1 as it cannot be merged into another group * here. we create the group in the same chain as the loop-based element. */ - GST_INFO (GST_CAT_SCHEDULING, "creating new group for element %s", GST_ELEMENT_NAME (element1)); + GST_INFO ( "creating new group for element %s", GST_ELEMENT_NAME (element1)); group1 = create_group (group2->chain, element1); } else { @@ -1810,18 +1818,18 @@ group_can_reach_group (GstOptSchedulerGroup *group, GstOptSchedulerGroup *target gboolean reachable = FALSE; const GSList *links = group->group_links; - GST_INFO (GST_CAT_SCHEDULING, "checking if group %p can reach %p", + GST_INFO ( "checking if group %p can reach %p", group, target); /* seems like we found the target element */ if (group == target) { - GST_INFO (GST_CAT_SCHEDULING, "found way to reach %p", target); + GST_INFO ( "found way to reach %p", target); return TRUE; } /* if the group is marked as visited, we don't need to check here */ if (GST_OPT_SCHEDULER_GROUP_IS_FLAG_SET (group, GST_OPT_SCHEDULER_GROUP_VISITED)) { - GST_INFO (GST_CAT_SCHEDULING, "already visited %p", group); + GST_INFO ( "already visited %p", group); return FALSE; } @@ -1837,7 +1845,7 @@ group_can_reach_group (GstOptSchedulerGroup *group, GstOptSchedulerGroup *target /* find other group in this link */ other = OTHER_GROUP_LINK (link, group); - GST_INFO (GST_CAT_SCHEDULING, "found link from %p to %p, count %d", + GST_INFO ( "found link from %p to %p, count %d", group, other, link->count); /* check if we can reach the target recursiveley */ @@ -1849,7 +1857,7 @@ group_can_reach_group (GstOptSchedulerGroup *group, GstOptSchedulerGroup *target * all groups are checked. */ GST_OPT_SCHEDULER_GROUP_UNSET_FLAG (group, GST_OPT_SCHEDULER_GROUP_VISITED); - GST_INFO (GST_CAT_SCHEDULING, "leaving group %p with %s", group, (reachable ? "TRUE":"FALSE")); + GST_INFO ( "leaving group %p with %s", group, (reachable ? "TRUE":"FALSE")); return reachable; } @@ -1861,7 +1869,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp GstElement *element1, *element2; GstOptSchedulerGroup *group1, *group2; - GST_INFO (GST_CAT_SCHEDULING, "pad unlink between \"%s:%s\" and \"%s:%s\"", + GST_INFO ( "pad unlink between \"%s:%s\" and \"%s:%s\"", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); element1 = GST_PAD_PARENT (srcpad); @@ -1882,7 +1890,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* if one the elements has no group (anymore) we don't really care * about the link */ if (!group1 || !group2) { - GST_INFO (GST_CAT_SCHEDULING, "one (or both) of the elements is not in a group, not interesting"); + GST_INFO ( "one (or both) of the elements is not in a group, not interesting"); return; } @@ -1890,7 +1898,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp if (group1 != group2) { gboolean zero; - GST_INFO (GST_CAT_SCHEDULING, "elements are in different groups"); + GST_INFO ( "elements are in different groups"); /* we can remove the links between the groups now */ zero = group_dec_link (group1, group2); @@ -1904,17 +1912,17 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* see if group1 and group2 are still connected in any indirect way */ still_link = group_can_reach_group (group1, group2); - GST_INFO (GST_CAT_SCHEDULING, "group %p %s reach group %p", group1, (still_link ? "can":"can't"), group2); + GST_INFO ( "group %p %s reach group %p", group1, (still_link ? "can":"can't"), group2); if (!still_link) { /* groups are really disconnected, migrate one group to a new chain */ chain = create_chain (osched); chain_recursively_migrate_group (chain, group1); - GST_INFO (GST_CAT_SCHEDULING, "migrated group %p to new chain %p", group1, chain); + GST_INFO ( "migrated group %p to new chain %p", group1, chain); } } else { - GST_INFO (GST_CAT_SCHEDULING, "group %p still has direct link with group %p", group1, group2); + GST_INFO ( "group %p still has direct link with group %p", group1, group2); } } /* hard part, groups are equal */ @@ -1925,7 +1933,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* since group1 == group2, it doesn't matter which group we take */ group = group1; - GST_INFO (GST_CAT_SCHEDULING, "elements are in the same group %p", group); + GST_INFO ( "elements are in the same group %p", group); /* check if the element is still linked to some other element in the group, * we pass the pad that is broken up as an arg because a link on that pad @@ -1938,7 +1946,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* if there is still a link, we don't need to break this group */ if (still_link1 && still_link2) { - GST_INFO (GST_CAT_SCHEDULING, "elements still have links with other elements in the group"); + GST_INFO ( "elements still have links with other elements in the group"); /* FIXME it's possible that we have to break the group/chain. This heppens when * the src element recursiveley has links with other elements in the group but not * with all elements. */ @@ -1954,11 +1962,11 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp group->type == GST_OPT_SCHEDULER_GROUP_LOOP) && !GST_ELEMENT_IS_DECOUPLED (element1)) { - GST_INFO (GST_CAT_SCHEDULING, "element1 is separated from the group"); + GST_INFO ( "element1 is separated from the group"); remove_from_group (group, element1); } else { - GST_INFO (GST_CAT_SCHEDULING, "element1 is decoupled or entry in loop based group"); + GST_INFO ( "element1 is decoupled or entry in loop based group"); } } if (!still_link2) { @@ -1968,11 +1976,11 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp group->type == GST_OPT_SCHEDULER_GROUP_LOOP) && !GST_ELEMENT_IS_DECOUPLED (element2)) { - GST_INFO (GST_CAT_SCHEDULING, "element2 is separated from the group"); + GST_INFO ( "element2 is separated from the group"); remove_from_group (group, element2); } else { - GST_INFO (GST_CAT_SCHEDULING, "element2 is decoupled or entry in loop based group"); + GST_INFO ( "element2 is decoupled or entry in loop based group"); } } } @@ -2021,15 +2029,15 @@ gst_opt_scheduler_iterate (GstScheduler *sched) /* don't schedule any more chains when in error */ if (osched->state == GST_OPT_SCHEDULER_STATE_ERROR) { - GST_INFO (GST_CAT_SCHEDULING, "scheduler %p is in error", sched); + GST_ERROR_OBJECT (sched, "in error state"); break; } else if (osched->state == GST_OPT_SCHEDULER_STATE_INTERRUPTED) { - GST_INFO (GST_CAT_SCHEDULING, "scheduler %p is interrupted, continue with next chain", sched); + GST_DEBUG_OBJECT (osched, "got interrupted, continue with next chain"); osched->state = GST_OPT_SCHEDULER_STATE_RUNNING; } - GST_INFO (GST_CAT_SCHEDULING, "iterate scheduled %p", chain); + GST_LOG_OBJECT (sched, "iterate scheduled %p", chain); chains = g_slist_next (chains); unref_chain (chain); @@ -2142,4 +2150,3 @@ gst_opt_scheduler_set_property (GObject *object, guint prop_id, break; } } - diff --git a/gst/types/gsttypes.c b/gst/types/gsttypes.c index e3408a61f7..45ab1baa21 100644 --- a/gst/types/gsttypes.c +++ b/gst/types/gsttypes.c @@ -38,7 +38,7 @@ plugin_init (GModule *module, GstPlugin *plugin) factory = gst_type_factory_new (&_definitions[i]); gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - GST_DEBUG(0, "added factory #%d '%s'", i, _definitions[i].name); + GST_DEBUG ( "added factory #%d '%s'", i, _definitions[i].name); i++; } diff --git a/libs/gst/bytestream/bstest.c b/libs/gst/bytestream/bstest.c index 0a5b41eb9c..b04598f296 100644 --- a/libs/gst/bytestream/bstest.c +++ b/libs/gst/bytestream/bstest.c @@ -20,6 +20,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include "bytestream.h" diff --git a/libs/gst/bytestream/bytestream.c b/libs/gst/bytestream/bytestream.c index ce942ccbb3..0de8bc2ced 100644 --- a/libs/gst/bytestream/bytestream.c +++ b/libs/gst/bytestream/bytestream.c @@ -19,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include @@ -26,29 +30,8 @@ #include #include "bytestream.h" -/* #define BS_DEBUG */ - -#ifdef G_HAVE_ISO_VARARGS - -#ifdef BS_DEBUG -# define bs_print(...) GST_DEBUG (GST_CAT_BUFFER, __VA_ARGS__) -# define bs_status(bs) gst_bytestream_print_status(bs) -#else -# define bs_print(...) -# define bs_status(bs) -#endif - -#elif defined(G_HAVE_GNUC_VARARGS) - -#ifdef BS_DEBUG -# define bs_print(format,args...) GST_DEBUG (GST_CAT_BUFFER, format, ## args) -# define bs_status(bs) gst_bytestream_print_status(bs) -#else -# define bs_print(format,args...) -# define bs_status(bs) -#endif - -#endif +GST_DEBUG_CATEGORY_STATIC(debug_bs); +#define GST_CAT_DEFAULT debug_bs static guint8 *gst_bytestream_assemble (GstByteStream * bs, guint32 len); @@ -93,6 +76,8 @@ gst_bytestream_new (GstPad * pad) { GstByteStream *bs = g_new (GstByteStream, 1); + GST_DEBUG_CATEGORY_INIT (debug_bs, "bytestream", 0, "bytestream library"); + bs->pad = pad; gst_bytestream_init (bs); @@ -164,7 +149,7 @@ gst_bytestream_get_next_buf (GstByteStream *bs) if (bs->event) return FALSE; - bs_print ("get_next_buf: pulling buffer"); + GST_DEBUG ("get_next_buf: pulling buffer"); nextbuf = gst_pad_pull (bs->pad); if (!nextbuf) @@ -178,11 +163,11 @@ gst_bytestream_get_next_buf (GstByteStream *bs) if (GST_BUFFER_TIMESTAMP_IS_VALID (nextbuf)) bs->last_ts = GST_BUFFER_TIMESTAMP (nextbuf); - bs_print ("get_next_buf: got buffer of %d bytes", GST_BUFFER_SIZE (nextbuf)); + GST_DEBUG ("get_next_buf: got buffer of %d bytes", GST_BUFFER_SIZE (nextbuf)); /* first see if there are any buffers in the list at all */ if (bs->buflist) { - bs_print ("gst_next_buf: there is at least one buffer in the list"); + GST_DEBUG ("gst_next_buf: there is at least one buffer in the list"); /* now find the end of the list */ end = g_slist_last (bs->buflist); /* get the buffer that's there */ @@ -190,7 +175,7 @@ gst_bytestream_get_next_buf (GstByteStream *bs) /* see if we can marge cheaply */ if (gst_buffer_is_span_fast (lastbuf, nextbuf)) { - bs_print ("get_next_buf: merging new buffer with last buf on list"); + GST_DEBUG ("get_next_buf: merging new buffer with last buf on list"); /* it is, let's merge them (this is really an append, but...) */ end->data = gst_buffer_merge (lastbuf, nextbuf); /* add to the length of the list */ @@ -207,7 +192,7 @@ gst_bytestream_get_next_buf (GstByteStream *bs) /* if we can't, we just append this buffer */ } else { - bs_print ("get_next_buf: adding new buffer to the end of the list"); + GST_DEBUG ("get_next_buf: adding new buffer to the end of the list"); end = g_slist_append (end, nextbuf); /* also need to increment length of list and buffer count */ bs->listavail += GST_BUFFER_SIZE (nextbuf); @@ -216,7 +201,7 @@ gst_bytestream_get_next_buf (GstByteStream *bs) /* if there are no buffers in the list */ } else { - bs_print ("get_next_buf: buflist is empty, adding new buffer to list"); + GST_DEBUG ("get_next_buf: buflist is empty, adding new buffer to list"); /* put this on the end of the list */ bs->buflist = g_slist_append (bs->buflist, nextbuf); /* and increment the number of bytes in the list */ @@ -239,7 +224,7 @@ gst_bytestream_fill_bytes (GstByteStream *bs, guint32 len) { /* as long as we don't have enough, we get more buffers */ while (bs->listavail < len) { - bs_print ("fill_bytes: there are %d bytes in the list, we need %d", bs->listavail, len); + GST_DEBUG ("fill_bytes: there are %d bytes in the list, we need %d", bs->listavail, len); if (!gst_bytestream_get_next_buf (bs)) return FALSE; } @@ -269,10 +254,10 @@ gst_bytestream_peek (GstByteStream *bs, GstBuffer **buf, guint32 len) g_return_val_if_fail (bs != NULL, 0); g_return_val_if_fail (len > 0, 0); - bs_print ("peek: asking for %d bytes", len); + GST_DEBUG ("peek: asking for %d bytes", len); /* make sure we have enough */ - bs_print ("peek: there are %d bytes in the list", bs->listavail); + GST_DEBUG ("peek: there are %d bytes in the list", bs->listavail); if (len > bs->listavail) { if (!gst_bytestream_fill_bytes (bs, len)) { /* we must have an event coming up */ @@ -286,17 +271,17 @@ gst_bytestream_peek (GstByteStream *bs, GstBuffer **buf, guint32 len) return 0; } } - bs_print ("peek: there are now %d bytes in the list", bs->listavail); + GST_DEBUG ("peek: there are now %d bytes in the list", bs->listavail); } - bs_status (bs); + gst_bytestream_print_status (bs); /* extract the head buffer */ headbuf = GST_BUFFER (bs->buflist->data); /* if the requested bytes are in the current buffer */ - bs_print ("peek: headbufavail is %d", bs->headbufavail); + GST_DEBUG ("peek: headbufavail is %d", bs->headbufavail); if (len <= bs->headbufavail) { - bs_print ("peek: there are enough bytes in headbuf (need %d, have %d)", len, bs->headbufavail); + GST_DEBUG ("peek: there are enough bytes in headbuf (need %d, have %d)", len, bs->headbufavail); /* create a sub-buffer of the headbuf */ retbuf = gst_buffer_create_sub (headbuf, GST_BUFFER_SIZE (headbuf) - bs->headbufavail, len); GST_BUFFER_OFFSET (retbuf) = GST_BUFFER_OFFSET (headbuf) + GST_BUFFER_SIZE (headbuf) - bs->headbufavail; @@ -304,7 +289,7 @@ gst_bytestream_peek (GstByteStream *bs, GstBuffer **buf, guint32 len) } /* otherwise we need to figure out how to assemble one */ else { - bs_print ("peek: current buffer is not big enough for len %d", len); + GST_DEBUG ("peek: current buffer is not big enough for len %d", len); retbuf = gst_buffer_new (); GST_BUFFER_SIZE (retbuf) = len; @@ -342,7 +327,7 @@ gst_bytestream_peek_bytes (GstByteStream *bs, guint8** data, guint32 len) g_return_val_if_fail (bs != NULL, 0); g_return_val_if_fail (len > 0, 0); - bs_print ("peek_bytes: asking for %d bytes", len); + GST_DEBUG ("peek_bytes: asking for %d bytes", len); if (bs->assembled) { if (bs->assembled_len >= len) { *data = bs->assembled; @@ -353,7 +338,7 @@ gst_bytestream_peek_bytes (GstByteStream *bs, guint8** data, guint32 len) } /* make sure we have enough */ - bs_print ("peek_bytes: there are %d bytes in the list", bs->listavail); + GST_DEBUG ("peek_bytes: there are %d bytes in the list", bs->listavail); if (len > bs->listavail) { if (!gst_bytestream_fill_bytes (bs, len)){ /* we must have an event coming up */ @@ -367,24 +352,24 @@ gst_bytestream_peek_bytes (GstByteStream *bs, guint8** data, guint32 len) return 0; } } - bs_print ("peek_bytes: there are now %d bytes in the list", bs->listavail); + GST_DEBUG ("peek_bytes: there are now %d bytes in the list", bs->listavail); } - bs_status (bs); + gst_bytestream_print_status (bs); /* extract the head buffer */ headbuf = GST_BUFFER (bs->buflist->data); /* if the requested bytes are in the current buffer */ - bs_print ("peek_bytes: headbufavail is %d", bs->headbufavail); + GST_DEBUG ("peek_bytes: headbufavail is %d", bs->headbufavail); if (len <= bs->headbufavail) { - bs_print ("peek_bytes: there are enough bytes in headbuf (need %d, have %d)", len, bs->headbufavail); + GST_DEBUG ("peek_bytes: there are enough bytes in headbuf (need %d, have %d)", len, bs->headbufavail); /* create a sub-buffer of the headbuf */ *data = GST_BUFFER_DATA (headbuf) + (GST_BUFFER_SIZE (headbuf) - bs->headbufavail); } /* otherwise we need to figure out how to assemble one */ else { - bs_print ("peek_bytes: current buffer is not big enough for len %d", len); + GST_DEBUG ("peek_bytes: current buffer is not big enough for len %d", len); *data = gst_bytestream_assemble (bs, len); bs->assembled = *data; @@ -404,7 +389,7 @@ gst_bytestream_assemble (GstByteStream *bs, guint32 len) /* copy the data from the curbuf */ buf = GST_BUFFER (bs->buflist->data); - bs_print ("assemble: copying %d bytes from curbuf at %d to *data", bs->headbufavail, + GST_DEBUG ("assemble: copying %d bytes from curbuf at %d to *data", bs->headbufavail, GST_BUFFER_SIZE (buf) - bs->headbufavail); memcpy (data, GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf) - bs->headbufavail, bs->headbufavail); copied += bs->headbufavail; @@ -414,12 +399,12 @@ gst_bytestream_assemble (GstByteStream *bs, guint32 len) while (copied < len) { buf = GST_BUFFER (walk->data); if (GST_BUFFER_SIZE (buf) < (len - copied)) { - bs_print ("assemble: copying %d bytes from buf to output offset %d", GST_BUFFER_SIZE (buf), copied); + GST_DEBUG ("assemble: copying %d bytes from buf to output offset %d", GST_BUFFER_SIZE (buf), copied); memcpy (data + copied, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); copied += GST_BUFFER_SIZE (buf); } else { - bs_print ("assemble: copying %d bytes from buf to output offset %d", len - copied, copied); + GST_DEBUG ("assemble: copying %d bytes from buf to output offset %d", len - copied, copied); memcpy (data + copied, GST_BUFFER_DATA (buf), len - copied); copied = len; } @@ -445,18 +430,18 @@ gst_bytestream_assemble (GstByteStream *bs, guint32 len) gboolean gst_bytestream_flush (GstByteStream *bs, guint32 len) { - bs_print ("flush: flushing %d bytes", len); + GST_DEBUG ("flush: flushing %d bytes", len); if (len == 0) return TRUE; /* make sure we have enough */ - bs_print ("flush: there are %d bytes in the list", bs->listavail); + GST_DEBUG ("flush: there are %d bytes in the list", bs->listavail); if (len > bs->listavail) { if (!gst_bytestream_fill_bytes (bs, len)) { return FALSE; } - bs_print ("flush: there are now %d bytes in the list", bs->listavail); + GST_DEBUG ("flush: there are now %d bytes in the list", bs->listavail); } gst_bytestream_flush_fast (bs, len); @@ -496,13 +481,13 @@ gst_bytestream_flush_fast (GstByteStream *bs, guint32 len) while (len > 0) { headbuf = GST_BUFFER (bs->buflist->data); - bs_print ("flush: analyzing buffer that's %d bytes long, offset %llu", GST_BUFFER_SIZE (headbuf), + GST_DEBUG ("flush: analyzing buffer that's %d bytes long, offset %llu", GST_BUFFER_SIZE (headbuf), GST_BUFFER_OFFSET (headbuf)); /* if there's enough to complete the flush */ if (bs->headbufavail > len) { /* just trim it off */ - bs_print ("flush: trimming %d bytes off end of headbuf", len); + GST_DEBUG ("flush: trimming %d bytes off end of headbuf", len); bs->headbufavail -= len; bs->listavail -= len; len = 0; @@ -510,7 +495,7 @@ gst_bytestream_flush_fast (GstByteStream *bs, guint32 len) /* otherwise we have to trim the whole buffer */ } else { - bs_print ("flush: removing head buffer completely"); + GST_DEBUG ("flush: removing head buffer completely"); /* remove it from the list */ bs->buflist = g_slist_delete_link (bs->buflist, bs->buflist); /* trim it from the avail size */ @@ -523,14 +508,14 @@ gst_bytestream_flush_fast (GstByteStream *bs, guint32 len) /* record the new headbufavail */ if (bs->buflist) { bs->headbufavail = GST_BUFFER_SIZE (GST_BUFFER (bs->buflist->data)); - bs_print ("flush: next headbuf is %d bytes", bs->headbufavail); + GST_DEBUG ("flush: next headbuf is %d bytes", bs->headbufavail); } else { - bs_print ("flush: no more bytes at all"); + GST_DEBUG ("flush: no more bytes at all"); } } - bs_print ("flush: bottom of while(), len is now %d", len); + GST_DEBUG ("flush: bottom of while(), len is now %d", len); } } @@ -557,7 +542,7 @@ gst_bytestream_seek (GstByteStream *bs, gint64 offset, GstSeekType method) peer = GST_RPAD_PEER (bs->pad); - bs_print ("bs: send event\n"); + GST_DEBUG ("bs: send event\n"); if (gst_pad_send_event (GST_PAD (peer), gst_event_new_seek ( GST_FORMAT_BYTES | (method & GST_SEEK_METHOD_MASK) | @@ -572,7 +557,7 @@ gst_bytestream_seek (GstByteStream *bs, gint64 offset, GstSeekType method) return TRUE; } - bs_print ("bs: send event failed\n"); + GST_DEBUG ("bs: send event failed\n"); return FALSE; } @@ -722,11 +707,11 @@ gst_bytestream_get_timestamp (GstByteStream *bs) g_return_val_if_fail (bs != NULL, 0); - bs_print ("get_timestamp: getting timestamp"); + GST_DEBUG ("get_timestamp: getting timestamp"); /* make sure we have a buffer */ if (bs->listavail == 0) { - bs_print ("gst_timestamp: fetching a buffer"); + GST_DEBUG ("gst_timestamp: fetching a buffer"); if (!gst_bytestream_fill_bytes (bs, 1)) return 0; } @@ -750,14 +735,14 @@ gst_bytestream_print_status (GstByteStream * bs) GSList *walk; GstBuffer *buf; - bs_print ("STATUS: head buffer has %d bytes available", bs->headbufavail); - bs_print ("STATUS: list has %d bytes available", bs->listavail); + GST_DEBUG ("STATUS: head buffer has %d bytes available", bs->headbufavail); + GST_DEBUG ("STATUS: list has %d bytes available", bs->listavail); walk = bs->buflist; while (walk) { buf = GST_BUFFER (walk->data); walk = g_slist_next (walk); - bs_print ("STATUS: buffer starts at %llu and is %d bytes long", + GST_DEBUG ("STATUS: buffer starts at %llu and is %d bytes long", GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf)); } } diff --git a/libs/gst/control/control.c b/libs/gst/control/control.c index 0666c7ed8c..a7073b6126 100644 --- a/libs/gst/control/control.c +++ b/libs/gst/control/control.c @@ -19,10 +19,15 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "control.h" +GST_DEBUG_CATEGORY(_gst_control_debug); + void gst_control_init (int *argc, char **argv[]) { + GST_DEBUG_CATEGORY_INIT (_gst_control_debug, "control", 0, "libgstcontrol"); _gst_dpman_initialize (); _gst_unitconv_initialize (); } diff --git a/libs/gst/control/dparam.c b/libs/gst/control/dparam.c index d94371cdfb..3be284beb4 100644 --- a/libs/gst/control/dparam.c +++ b/libs/gst/control/dparam.c @@ -19,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include @@ -26,6 +30,8 @@ #include "dparam.h" #include "dparammanager.h" +GST_DEBUG_CATEGORY_EXTERN(_gst_control_debug); + static void gst_dparam_class_init (GstDParamClass *klass); static void gst_dparam_init (GstDParam *dparam); static void gst_dparam_dispose (GObject *object); @@ -170,21 +176,21 @@ gst_dparam_set_property (GObject *object, guint prop_id, const GValue *value, GP switch (prop_id) { case ARG_VALUE_FLOAT: - GST_DEBUG(GST_CAT_PARAMS, "setting value from %f to %f", dparam->value_float, g_value_get_float (value)); + GST_DEBUG ("setting value from %f to %f", dparam->value_float, g_value_get_float (value)); dparam->value_float = g_value_get_float (value); GST_DPARAM_NEXT_UPDATE_TIMESTAMP(dparam) = GST_DPARAM_LAST_UPDATE_TIMESTAMP(dparam); GST_DPARAM_READY_FOR_UPDATE(dparam) = TRUE; break; case ARG_VALUE_INT: - GST_DEBUG(GST_CAT_PARAMS, "setting value from %d to %d", dparam->value_int, g_value_get_int (value)); + GST_DEBUG ("setting value from %d to %d", dparam->value_int, g_value_get_int (value)); dparam->value_int = g_value_get_int (value); GST_DPARAM_NEXT_UPDATE_TIMESTAMP(dparam) = GST_DPARAM_LAST_UPDATE_TIMESTAMP(dparam); GST_DPARAM_READY_FOR_UPDATE(dparam) = TRUE; break; case ARG_VALUE_INT64: - GST_DEBUG(GST_CAT_PARAMS, "setting value from %" + GST_DEBUG ("setting value from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT, dparam->value_int64, g_value_get_int64 (value)); @@ -208,7 +214,7 @@ gst_dparam_do_update_default (GstDParam *dparam, gint64 timestamp, GValue *value GST_DPARAM_LOCK(dparam); g_return_if_fail (G_VALUE_TYPE(value) == GST_DPARAM_TYPE(dparam)); - GST_DEBUG(GST_CAT_PARAMS, "updating value for %s(%p)",GST_DPARAM_NAME (dparam),dparam); + GST_DEBUG ("updating value for %s(%p)",GST_DPARAM_NAME (dparam),dparam); switch (G_VALUE_TYPE(value)) { case G_TYPE_FLOAT: @@ -240,7 +246,7 @@ gst_dparam_dispose (GObject *object) GstDParam *dparam = GST_DPARAM(object); gchar *dparam_name = g_strdup(GST_DPARAM_NAME(dparam)); - GST_DEBUG (GST_CAT_PLUGIN_INFO, "disposing of %s", dparam_name); + GST_DEBUG ("disposing of %s", dparam_name); if (GST_DPARAM_MANAGER(dparam)){ gst_dpman_detach_dparam(GST_DPARAM_MANAGER(dparam), dparam_name); } @@ -270,7 +276,7 @@ gst_dparam_attach (GstDParam *dparam, GstDParamManager *manager, GParamSpec *par GST_DPARAM_MANAGER(dparam) = manager; GST_DPARAM_UNIT_NAME(dparam) = unit_name; GST_DPARAM_IS_LOG(dparam) = gst_unitconv_unit_is_logarithmic(unit_name); - GST_DEBUG(GST_CAT_PARAMS, "attaching %s to dparam %p",GST_DPARAM_NAME (dparam),dparam); + GST_DEBUG ("attaching %s to dparam %p",GST_DPARAM_NAME (dparam),dparam); } @@ -287,12 +293,9 @@ gst_dparam_detach (GstDParam *dparam) g_return_if_fail (dparam != NULL); g_return_if_fail (GST_IS_DPARAM (dparam)); - GST_DEBUG(GST_CAT_PARAMS, "detaching %s from dparam %p",GST_DPARAM_NAME (dparam),dparam); + GST_DEBUG ("detaching %s from dparam %p",GST_DPARAM_NAME (dparam),dparam); GST_DPARAM_NAME(dparam) = NULL; GST_DPARAM_PARAM_SPEC(dparam) = NULL; GST_DPARAM_MANAGER(dparam) = NULL; } - - - diff --git a/libs/gst/control/dparam_smooth.c b/libs/gst/control/dparam_smooth.c index 747d0fb6ac..ed6a4e50af 100644 --- a/libs/gst/control/dparam_smooth.c +++ b/libs/gst/control/dparam_smooth.c @@ -19,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include @@ -26,6 +30,8 @@ #include "dparam_smooth.h" #include "dparammanager.h" +GST_DEBUG_CATEGORY_EXTERN(_gst_control_debug); + static void gst_dpsmooth_class_init (GstDParamSmoothClass *klass); static void gst_dpsmooth_init (GstDParamSmooth *dparam); static void gst_dpsmooth_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); @@ -157,7 +163,7 @@ gst_dpsmooth_set_property (GObject *object, guint prop_id, const GValue *value, case ARG_SLOPE_TIME: dpsmooth->slope_time = g_value_get_int64 (value); - GST_DEBUG(GST_CAT_PARAMS, "dpsmooth->slope_time:%" + GST_DEBUG ("dpsmooth->slope_time:%" G_GINT64_FORMAT, dpsmooth->slope_time); GST_DPARAM_READY_FOR_UPDATE(dparam) = TRUE; @@ -221,7 +227,7 @@ gst_dpsmooth_value_changed_float (GstDParam *dparam) dpsmooth->need_interp_times = TRUE; - GST_DEBUG(GST_CAT_PARAMS, "%f to %f ratio:%f duration:%" + GST_DEBUG ("%f to %f ratio:%f duration:%" G_GINT64_FORMAT "\n", dpsmooth->start_float, dparam->value_float, time_ratio, dpsmooth->duration_interp); } @@ -249,7 +255,7 @@ gst_dpsmooth_do_update_float (GstDParam *dparam, gint64 timestamp, GValue *value } dpsmooth->current_float = dparam->value_float; - GST_DEBUG(GST_CAT_PARAMS, "interp finished at %" + GST_DEBUG ("interp finished at %" G_GINT64_FORMAT, timestamp); GST_DPARAM_LAST_UPDATE_TIMESTAMP(dparam) = timestamp; @@ -270,7 +276,7 @@ gst_dpsmooth_do_update_float (GstDParam *dparam, gint64 timestamp, GValue *value GST_DPARAM_LAST_UPDATE_TIMESTAMP(dparam) = timestamp; GST_DPARAM_NEXT_UPDATE_TIMESTAMP(dparam) = dpsmooth->start_interp + dpsmooth->update_period; - GST_DEBUG(GST_CAT_PARAMS, "interp started at %" G_GINT64_FORMAT, timestamp); + GST_DEBUG ("interp started at %" G_GINT64_FORMAT, timestamp); GST_DPARAM_UNLOCK(dparam); return; @@ -279,8 +285,8 @@ gst_dpsmooth_do_update_float (GstDParam *dparam, gint64 timestamp, GValue *value time_ratio = (gfloat)(timestamp - dpsmooth->start_interp) / (gfloat)dpsmooth->duration_interp; - GST_DEBUG(GST_CAT_PARAMS, "start:%" G_GINT64_FORMAT " current:%" G_GINT64_FORMAT " end:%" G_GINT64_FORMAT " ratio%f", dpsmooth->start_interp, timestamp, dpsmooth->end_interp, time_ratio); - GST_DEBUG(GST_CAT_PARAMS, "pre start:%f current:%f target:%f", dpsmooth->start_float, dpsmooth->current_float, dparam->value_float); + GST_DEBUG ("start:%" G_GINT64_FORMAT " current:%" G_GINT64_FORMAT " end:%" G_GINT64_FORMAT " ratio%f", dpsmooth->start_interp, timestamp, dpsmooth->end_interp, time_ratio); + GST_DEBUG ("pre start:%f current:%f target:%f", dpsmooth->start_float, dpsmooth->current_float, dparam->value_float); dpsmooth->current_float = dpsmooth->start_float + (dpsmooth->diff_float * time_ratio); @@ -298,8 +304,7 @@ gst_dpsmooth_do_update_float (GstDParam *dparam, gint64 timestamp, GValue *value g_value_set_float(value, dpsmooth->current_float); } - GST_DEBUG(GST_CAT_PARAMS, "post start:%f current:%f target:%f", dpsmooth->start_float, dpsmooth->current_float, dparam->value_float); + GST_DEBUG ("post start:%f current:%f target:%f", dpsmooth->start_float, dpsmooth->current_float, dparam->value_float); GST_DPARAM_UNLOCK(dparam); } - diff --git a/libs/gst/control/dparammanager.c b/libs/gst/control/dparammanager.c index 522919aa9f..207fb61655 100644 --- a/libs/gst/control/dparammanager.c +++ b/libs/gst/control/dparammanager.c @@ -23,6 +23,8 @@ #include #include +GST_DEBUG_CATEGORY_EXTERN(_gst_control_debug); + static GHashTable *_element_registry = NULL; static gboolean _gst_dpman_init_done = FALSE; @@ -185,7 +187,7 @@ gst_dpman_add_required_dparam_callback (GstDParamManager *dpman, g_return_val_if_fail (dpwrap != NULL, FALSE); - GST_DEBUG(GST_CAT_PARAMS,"adding required callback dparam '%s'", g_param_spec_get_name(param_spec)); + GST_DEBUG ("adding required callback dparam '%s'", g_param_spec_get_name(param_spec)); dpwrap->update_func = update_func; dpwrap->update_data = update_data; @@ -218,7 +220,7 @@ gst_dpman_add_required_dparam_direct (GstDParamManager *dpman, g_return_val_if_fail (dpwrap != NULL, FALSE); - GST_DEBUG(GST_CAT_PARAMS,"adding required direct dparam '%s'", g_param_spec_get_name(param_spec)); + GST_DEBUG ("adding required direct dparam '%s'", g_param_spec_get_name(param_spec)); dpwrap->update_data = update_data; @@ -251,7 +253,7 @@ gst_dpman_add_required_dparam_array (GstDParamManager *dpman, g_return_val_if_fail (dpwrap != NULL, FALSE); - GST_DEBUG(GST_CAT_PARAMS,"adding required array dparam '%s'", g_param_spec_get_name(param_spec)); + GST_DEBUG ("adding required array dparam '%s'", g_param_spec_get_name(param_spec)); dpwrap->update_data = update_data; @@ -280,7 +282,7 @@ gst_dpman_remove_required_dparam (GstDParamManager *dpman, gchar *dparam_name) g_return_if_fail(dpwrap != NULL); g_return_if_fail(dpwrap->dparam == NULL); - GST_DEBUG(GST_CAT_PARAMS, "removing required dparam: %s", dparam_name); + GST_DEBUG ("removing required dparam: %s", dparam_name); g_hash_table_remove(GST_DPMAN_DPARAMS(dpman), dparam_name); GST_DPMAN_DPARAMS_LIST(dpman) = g_list_remove(GST_DPMAN_DPARAMS_LIST(dpman), dpwrap); @@ -463,7 +465,7 @@ gst_dpman_register_mode (GstDParamManagerClass *klass, mode->teardownfunc = teardownfunc; g_hash_table_insert(klass->modes, modename, mode); - GST_DEBUG(GST_CAT_PARAMS, "mode '%s' registered", modename); + GST_DEBUG ("mode '%s' registered", modename); } /** @@ -489,11 +491,11 @@ gst_dpman_set_mode(GstDParamManager *dpman, gchar *modename) g_return_val_if_fail (mode != NULL, FALSE); if (GST_DPMAN_MODE(dpman) == mode) { - GST_DEBUG(GST_CAT_PARAMS, "mode %s already set", modename); + GST_DEBUG ("mode %s already set", modename); return TRUE; } - GST_DEBUG(GST_CAT_PARAMS, "setting mode to %s", modename); + GST_DEBUG ("setting mode to %s", modename); if (GST_DPMAN_MODE(dpman) && GST_DPMAN_TEARDOWNFUNC(dpman)){ GST_DPMAN_TEARDOWNFUNC(dpman)(dpman); } @@ -625,7 +627,7 @@ gst_dpman_state_change (GstElement *element, gint old_state, gint new_state, Gst g_return_if_fail (GST_IS_DPMAN (dpman)); if (new_state == GST_STATE_PLAYING){ - GST_DEBUG(GST_CAT_PARAMS, "initialising params"); + GST_DEBUG ("initialising params"); /* force all params to be updated */ @@ -688,7 +690,7 @@ gst_dpman_preprocess_synchronous(GstDParamManager *dpman, guint frames, gint64 t /* direct method - set the value directly in the struct of the element */ case GST_DPMAN_DIRECT: GST_DPARAM_DO_UPDATE(dpwrap->dparam, timestamp, dpwrap->value, dpwrap->update_info); - GST_DEBUG(GST_CAT_PARAMS, "doing direct update"); + GST_DEBUG ("doing direct update"); gst_dpman_inline_direct_update(dpwrap->value, dpwrap->update_data); break; @@ -696,7 +698,7 @@ gst_dpman_preprocess_synchronous(GstDParamManager *dpman, guint frames, gint64 t /* callback method - call the element's callback so it can do what it likes */ case GST_DPMAN_CALLBACK: GST_DPARAM_DO_UPDATE(dpwrap->dparam, timestamp, dpwrap->value, dpwrap->update_info); - GST_DEBUG(GST_CAT_PARAMS, "doing callback update"); + GST_DEBUG ("doing callback update"); GST_DPMAN_CALLBACK_UPDATE(dpwrap, dpwrap->value); break; @@ -784,13 +786,13 @@ gst_dpman_preprocess_asynchronous(GstDParamManager *dpman, guint frames, gint64 /* direct method - set the value directly in the struct of the element */ case GST_DPMAN_DIRECT: - GST_DEBUG(GST_CAT_PARAMS, "doing direct update"); + GST_DEBUG ("doing direct update"); gst_dpman_inline_direct_update(dpwrap->value, dpwrap->update_data); break; /* callback method - call the element's callback so it can do what it likes */ case GST_DPMAN_CALLBACK: - GST_DEBUG(GST_CAT_PARAMS, "doing callback update"); + GST_DEBUG ("doing callback update"); GST_DPMAN_CALLBACK_UPDATE(dpwrap, dpwrap->value); break; default: @@ -810,7 +812,7 @@ gst_dpman_preprocess_asynchronous(GstDParamManager *dpman, guint frames, gint64 dpwrap->next_update_frame = (guint)(current_time - timestamp) / dpman->rate_ratio; updates_pending = TRUE; - GST_DEBUG(GST_CAT_PARAMS, "timestamp start: %" + GST_DEBUG ("timestamp start: %" G_GINT64_FORMAT " end: %" G_GINT64_FORMAT " current: %" G_GINT64_FORMAT, @@ -827,7 +829,7 @@ gst_dpman_preprocess_asynchronous(GstDParamManager *dpman, guint frames, gint64 dpman->next_update_frame = dpwrap->next_update_frame; dpman->frames_to_process = dpman->next_update_frame; - GST_DEBUG(GST_CAT_PARAMS, "next update frame %u, frames to process %u", dpman->next_update_frame, dpman->frames_to_process); + GST_DEBUG ("next update frame %u, frames to process %u", dpman->next_update_frame, dpman->frames_to_process); return TRUE; } @@ -847,7 +849,7 @@ gst_dpman_process_asynchronous(GstDParamManager *dpman, guint frame_count) dwraps = GST_DPMAN_DPARAMS_LIST(dpman); dpwrap = (GstDParamWrapper*)dwraps->data; - GST_DEBUG(GST_CAT_PARAMS, "in gst_dpman_process_asynchronous"); + GST_DEBUG ("in gst_dpman_process_asynchronous"); if (frame_count >= dpman->num_frames){ g_warning("there is no more buffer to process"); @@ -869,13 +871,13 @@ gst_dpman_process_asynchronous(GstDParamManager *dpman, guint frame_count) /* direct method - set the value directly in the struct of the element */ case GST_DPMAN_DIRECT: - GST_DEBUG(GST_CAT_PARAMS, "doing direct update"); + GST_DEBUG ("doing direct update"); gst_dpman_inline_direct_update(dpwrap->value, dpwrap->update_data); break; /* callback method - call the element's callback so it can do what it likes */ case GST_DPMAN_CALLBACK: - GST_DEBUG(GST_CAT_PARAMS, "doing callback update"); + GST_DEBUG ("doing callback update"); GST_DPMAN_CALLBACK_UPDATE(dpwrap, dpwrap->value); break; default: @@ -911,12 +913,12 @@ gst_dpman_process_asynchronous(GstDParamManager *dpman, guint frame_count) if (dpwrap->next_update_frame == dpman->num_frames){ dpman->next_update_frame = dpman->num_frames; dpman->frames_to_process = dpman->num_frames - frame_count; - GST_DEBUG(GST_CAT_PARAMS, "no more updates, frames to process %u", dpman->frames_to_process); + GST_DEBUG ("no more updates, frames to process %u", dpman->frames_to_process); } else { dpman->next_update_frame = dpwrap->next_update_frame; dpman->frames_to_process = dpman->next_update_frame - frame_count; - GST_DEBUG(GST_CAT_PARAMS, "next update frame %u, frames to process %u", dpman->next_update_frame, dpman->frames_to_process); + GST_DEBUG ("next update frame %u, frames to process %u", dpman->next_update_frame, dpman->frames_to_process); } return TRUE; @@ -972,4 +974,3 @@ gst_dpman_teardown_disabled(GstDParamManager *dpman){ g_return_if_fail (GST_IS_DPMAN (dpman)); } - diff --git a/libs/gst/control/unitconvert.c b/libs/gst/control/unitconvert.c index e79cd6ff0f..1b9bc50d11 100644 --- a/libs/gst/control/unitconvert.c +++ b/libs/gst/control/unitconvert.c @@ -19,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "unitconvert.h" #include @@ -301,7 +305,7 @@ gst_unitconv_register_unit(const gchar *domain_name, g_hash_table_lookup(_gst_unit_domain_defaults, domain_name) == NULL, FALSE); } - GST_DEBUG (GST_CAT_PARAMS,"creating unit: %s", unit_name); + GST_DEBUG ("creating unit: %s", unit_name); unit = g_new0(GstUnit,1); @@ -341,7 +345,7 @@ gst_unitconv_register_convert_func(gchar *from_unit_named, gchar *to_unit_named, g_return_val_if_fail ( g_hash_table_lookup(convert_funcs, to_unit) == NULL, FALSE); - GST_DEBUG (GST_CAT_PARAMS,"adding unit converter from %s to %s\n", + GST_DEBUG ("adding unit converter from %s to %s\n", g_param_spec_get_name(from_unit->unit_spec), g_param_spec_get_name(to_unit->unit_spec)); @@ -423,4 +427,3 @@ gst_unitconv_add_core_converters(void){ gst_unitconv_register_convert_func("scalar", "percent", gst_unitconv_magnitude_scalar_to_percent); gst_unitconv_register_convert_func("percent", "scalar", gst_unitconv_magnitude_percent_to_scalar); } - diff --git a/libs/gst/getbits/gstgetbits_generic.c b/libs/gst/getbits/gstgetbits_generic.c index c630311341..f1b01a6adb 100644 --- a/libs/gst/getbits/gstgetbits_generic.c +++ b/libs/gst/getbits/gstgetbits_generic.c @@ -50,7 +50,7 @@ unsigned long _gst_get1bit_int(gst_getbits_t *gb, unsigned long bits) { gb->ptr += (gb->bits>>3); gb->bits &= 0x7; - GST_DEBUG (0,"getbits%ld, %08x", bits, rval); + GST_DEBUG ("getbits%ld, %08x", bits, rval); return rval>>7; } @@ -68,7 +68,7 @@ unsigned long _gst_getbits_int(gst_getbits_t *gb, unsigned long bits) { gb->ptr += (gb->bits>>3); gb->bits &= 0x7; - GST_DEBUG (0,"getbits%ld, %08lx", bits, rval); + GST_DEBUG ("getbits%ld, %08lx", bits, rval); return rval; } @@ -84,7 +84,7 @@ unsigned long _gst_getbits_fast_int(gst_getbits_t *gb, unsigned long bits) { gb->ptr += (gb->bits>>3); gb->bits &= 0x7; - GST_DEBUG (0,"getbits%ld, %08lx", bits, rval); + GST_DEBUG ("getbits%ld, %08lx", bits, rval); return rval; } @@ -97,7 +97,7 @@ unsigned long _gst_showbits_int(gst_getbits_t *gb, unsigned long bits) { rval <<= gb->bits; rval >>= (32-bits); - GST_DEBUG (0,"showbits%ld, %08lx", bits, rval); + GST_DEBUG ("showbits%ld, %08lx", bits, rval); return rval; } @@ -105,7 +105,7 @@ void _gst_flushbits_int(gst_getbits_t *gb, unsigned long bits) { gb->bits += bits; gb->ptr += (gb->bits>>3); gb->bits &= 0x7; - GST_DEBUG (0,"flushbits%ld", bits); + GST_DEBUG ("flushbits%ld", bits); } void _gst_getbits_back_int(gst_getbits_t *gb, unsigned long bits) { diff --git a/plugins/elements/gstaggregator.c b/plugins/elements/gstaggregator.c index b8882def21..2506d26391 100644 --- a/plugins/elements/gstaggregator.c +++ b/plugins/elements/gstaggregator.c @@ -20,8 +20,14 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gstaggregator.h" +GST_DEBUG_CATEGORY (gst_aggregator_debug); +#define GST_CAT_DEFAULT gst_aggregator_debug GstElementDetails gst_aggregator_details = { "Aggregator pipe fitting", @@ -354,4 +360,3 @@ gst_aggregator_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/plugins/elements/gstaggregator.h b/plugins/elements/gstaggregator.h index cd73803b37..e53b8540c5 100644 --- a/plugins/elements/gstaggregator.h +++ b/plugins/elements/gstaggregator.h @@ -29,6 +29,7 @@ G_BEGIN_DECLS extern GstElementDetails gst_aggregator_details; +GST_DEBUG_CATEGORY_EXTERN(gst_aggregator_debug); typedef enum { AGGREGATOR_LOOP = 1, diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c index 0b07efe751..78413f2161 100644 --- a/plugins/elements/gstelements.c +++ b/plugins/elements/gstelements.c @@ -21,8 +21,13 @@ */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include +#include "gstfilesrc.h" #include "gstfilesink.h" #include "gstidentity.h" #include "gstfakesink.h" @@ -75,7 +80,22 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_plugin_set_longname (plugin, "Standard GST Elements"); - while (_elements[i].name) { + GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug, "fakesrc", 0, "fakesrc element"); + GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element"); + GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element"); + GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "fakesink", 0, "filesink element"); + GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element"); + GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element"); + GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug, "fdsink", 0, "fdsink element"); + GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element"); + GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0, "pipefilter element"); + GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element"); + GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0, "aggregator element"); + GST_DEBUG_CATEGORY_INIT (gst_shaper_debug, "shaper", 0, "shaper element"); + GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0, "statistics element"); + GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug, "md5sink", 0, "md5sink element"); + + while (_elements[i].name) { factory = gst_element_factory_new (_elements[i].name, (_elements[i].type) (), _elements[i].details); @@ -107,4 +127,3 @@ GstPluginDesc plugin_desc = { "gstelements", plugin_init }; - diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 444d00afa1..84f23f89dc 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -21,8 +21,14 @@ */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "gstfakesink.h" + +GST_DEBUG_CATEGORY (gst_fakesink_debug); +#define GST_CAT_DEFAULT gst_fakesink_debug GstElementDetails gst_fakesink_details = { "Fake Sink", diff --git a/plugins/elements/gstfakesink.h b/plugins/elements/gstfakesink.h index 6d2efe1099..4228dbc333 100644 --- a/plugins/elements/gstfakesink.h +++ b/plugins/elements/gstfakesink.h @@ -24,14 +24,12 @@ #ifndef __GST_FAKESINK_H__ #define __GST_FAKESINK_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fakesink_details; - +extern GstElementDetails gst_fakesink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fakesink_debug); #define GST_TYPE_FAKESINK \ (gst_fakesink_get_type()) diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index a6141b4f6f..f4d0d89a69 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -24,12 +24,19 @@ #include #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstfakesrc.h" #define DEFAULT_SIZEMIN 0 #define DEFAULT_SIZEMAX 4096 #define DEFAULT_PARENTSIZE 4096*10 +GST_DEBUG_CATEGORY (gst_fakesrc_debug); +#define GST_CAT_DEFAULT gst_fakesrc_debug + GstElementDetails gst_fakesrc_details = { "Fake Source", "Source", @@ -502,7 +509,7 @@ gst_fakesrc_set_property (GObject *object, guint prop_id, const GValue *value, G break; case ARG_EOS: src->eos = g_value_get_boolean (value); - GST_INFO (0, "will EOS on next buffer"); + GST_INFO ( "will EOS on next buffer"); break; case ARG_SILENT: src->silent = g_value_get_boolean (value); @@ -753,7 +760,7 @@ gst_fakesrc_get(GstPad *pad) } if (src->eos) { - GST_INFO (0, "fakesrc is setting eos on pad"); + GST_INFO ( "fakesrc is setting eos on pad"); return GST_BUFFER(gst_event_new (GST_EVENT_EOS)); } @@ -770,10 +777,10 @@ gst_fakesrc_get(GstPad *pad) g_object_notify (G_OBJECT (src), "last_message"); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, src, "pre handoff emit"); + GST_LOG_OBJECT (src, "pre handoff emit"); g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0, buf, pad); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, src, "post handoff emit"); + GST_LOG_OBJECT (src, "post handoff emit"); return buf; } @@ -866,4 +873,3 @@ gst_fakesrc_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/plugins/elements/gstfakesrc.h b/plugins/elements/gstfakesrc.h index 61c64840ad..c6964cb700 100644 --- a/plugins/elements/gstfakesrc.h +++ b/plugins/elements/gstfakesrc.h @@ -24,13 +24,12 @@ #ifndef __GST_FAKESRC_H__ #define __GST_FAKESRC_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fakesrc_details; +extern GstElementDetails gst_fakesrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fakesrc_debug); typedef enum { FAKESRC_FIRST_LAST_LOOP = 1, diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index d888f222e8..b25f377d80 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -20,9 +20,15 @@ * Boston, MA 02111-1307, USA. */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstfdsink.h" #include +GST_DEBUG_CATEGORY (gst_fdsink_debug); +#define GST_CAT_DEFAULT gst_fdsink_debug GstElementDetails gst_fdsink_details = { "Filedescriptor Sink", @@ -122,7 +128,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf) g_return_if_fail (fdsink->fd >= 0); if (GST_BUFFER_DATA (buf)) { - GST_DEBUG (0,"writing %d bytes to file descriptor %d",GST_BUFFER_SIZE (buf), fdsink->fd); + GST_DEBUG ("writing %d bytes to file descriptor %d",GST_BUFFER_SIZE (buf), fdsink->fd); write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); } diff --git a/plugins/elements/gstfdsink.h b/plugins/elements/gstfdsink.h index 2b4f385c2d..4f6dfb69cc 100644 --- a/plugins/elements/gstfdsink.h +++ b/plugins/elements/gstfdsink.h @@ -24,14 +24,12 @@ #ifndef __GST_FDSINK_H__ #define __GST_FDSINK_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fdsink_details; - +extern GstElementDetails gst_fdsink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fdsink_debug); #define GST_TYPE_FDSINK \ (gst_fdsink_get_type()) diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index f36d1c2fc2..5b2bc91c27 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -27,10 +27,17 @@ #include #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstfdsrc.h" #define DEFAULT_BLOCKSIZE 4096 +GST_DEBUG_CATEGORY (gst_fdsrc_debug); +#define GST_CAT_DEFAULT gst_fdsrc_debug + GstElementDetails gst_fdsrc_details = { "Disk Source", diff --git a/plugins/elements/gstfdsrc.h b/plugins/elements/gstfdsrc.h index dfa49b660a..a17b2d5805 100644 --- a/plugins/elements/gstfdsrc.h +++ b/plugins/elements/gstfdsrc.h @@ -24,14 +24,12 @@ #ifndef __GST_FDSRC_H__ #define __GST_FDSRC_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_fdsrc_details; - +extern GstElementDetails gst_fdsrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_fdsrc_debug); #define GST_TYPE_FDSRC \ (gst_fdsrc_get_type()) diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 23d46efeae..c82ee1e4a4 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -21,11 +21,18 @@ */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include "gstfilesink.h" #include +GST_DEBUG_CATEGORY (gst_filesink_debug); +#define GST_CAT_DEFAULT gst_filesink_debug + GstElementDetails gst_filesink_details = { "File Sink", "Sink/File", diff --git a/plugins/elements/gstfilesink.h b/plugins/elements/gstfilesink.h index d9ffa5ba43..99e38eb650 100644 --- a/plugins/elements/gstfilesink.h +++ b/plugins/elements/gstfilesink.h @@ -24,14 +24,12 @@ #ifndef __GST_FILESINK_H__ #define __GST_FILESINK_H__ - -#include #include G_BEGIN_DECLS -GstElementDetails gst_filesink_details; - +extern GstElementDetails gst_filesink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_filesink_debug); #define GST_TYPE_FILESINK \ (gst_filesink_get_type()) diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index aa45f7cdaa..23715a37b1 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -20,8 +20,11 @@ * Boston, MA 02111-1307, USA. */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include #include "gstfilesrc.h" #include @@ -69,6 +72,9 @@ */ +GST_DEBUG_CATEGORY (gst_filesrc_debug); +#define GST_CAT_DEFAULT gst_filesrc_debug + GstElementDetails gst_filesrc_details = { "File Source", "Source/File", @@ -299,7 +305,7 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G src->mapsize = g_value_get_ulong (value); g_object_notify (G_OBJECT (src), "mmapsize"); } else { - GST_INFO (0, "invalid mapsize, must a multiple of pagesize, which is %d", + GST_INFO ( "invalid mapsize, must a multiple of pagesize, which is %d", src->pagesize); } break; @@ -369,7 +375,7 @@ gst_filesrc_free_parent_mmap (GstBuffer *buf) munmap (GST_BUFFER_DATA (buf), GST_BUFFER_MAXSIZE (buf)); /* cast to unsigned long, since there's no gportable way to print * guint64 as hex */ - GST_DEBUG (0, "unmapped region %08lx+%08lx at %p", + GST_DEBUG ( "unmapped region %08lx+%08lx at %p", (unsigned long) GST_BUFFER_OFFSET (buf), (unsigned long) GST_BUFFER_MAXSIZE (buf), GST_BUFFER_DATA (buf)); @@ -400,7 +406,7 @@ gst_filesrc_map_region (GstFileSrc *src, off_t offset, size_t size) size, src->fd, offset, strerror (errno)); return NULL; } - GST_DEBUG (0, "mapped region %08lx+%08lx from file into memory at %p", + GST_DEBUG ( "mapped region %08lx+%08lx from file into memory at %p", (unsigned long)offset, (unsigned long)size, mmapregion); /* time to allocate a new mapbuf */ @@ -504,7 +510,7 @@ gst_filesrc_get (GstPad *pad) GstEvent *event; src->seek_happened = FALSE; - GST_DEBUG (GST_CAT_EVENT, "filesrc sending discont"); + GST_DEBUG ("filesrc sending discont"); event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, NULL); src->need_flush = FALSE; return GST_BUFFER (event); @@ -512,14 +518,14 @@ gst_filesrc_get (GstPad *pad) /* check for flush */ if (src->need_flush) { src->need_flush = FALSE; - GST_DEBUG (GST_CAT_EVENT, "filesrc sending flush"); + GST_DEBUG ("filesrc sending flush"); return GST_BUFFER (gst_event_new_flush ()); } /* check for EOF */ if (src->curoffset == src->filelen) { - GST_DEBUG (0, "filesrc eos %" G_GINT64_FORMAT - " %" G_GINT64_FORMAT, src->curoffset, src->filelen); + GST_DEBUG ("filesrc eos %" G_GINT64_FORMAT" %" G_GINT64_FORMAT, + src->curoffset, src->filelen); gst_element_set_eos (GST_ELEMENT (src)); return GST_BUFFER (gst_event_new (GST_EVENT_EOS)); } @@ -537,9 +543,9 @@ gst_filesrc_get (GstPad *pad) readend = src->curoffset + readsize; } - GST_DEBUG (0, "attempting to read %08lx, %08lx, %08lx, %08lx", - (unsigned long)readsize, (unsigned long)readend, - (unsigned long)mapstart, (unsigned long)mapend); + GST_LOG ("attempting to read %08lx, %08lx, %08lx, %08lx", + (unsigned long)readsize, (unsigned long)readend, + (unsigned long)mapstart, (unsigned long)mapend); /* if the start is past the mapstart */ if (src->curoffset >= mapstart) { @@ -649,7 +655,7 @@ gst_filesrc_open_file (GstFileSrc *src) { g_return_val_if_fail (!GST_FLAG_IS_SET (src ,GST_FILESRC_OPEN), FALSE); - GST_DEBUG(0, "opening file %s",src->filename); + GST_DEBUG ( "opening file %s",src->filename); /* open the file */ src->fd = open (src->filename, O_RDONLY); @@ -779,7 +785,7 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event) { GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad)); - GST_DEBUG(0, "event %d", GST_EVENT_TYPE (event)); + GST_DEBUG ( "event %d", GST_EVENT_TYPE (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: @@ -797,19 +803,19 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event) if (offset > src->filelen) goto error; src->curoffset = offset; - GST_DEBUG(0, "seek set pending to %" G_GINT64_FORMAT, src->curoffset); + GST_DEBUG ( "seek set pending to %" G_GINT64_FORMAT, src->curoffset); break; case GST_SEEK_METHOD_CUR: if (offset + src->curoffset > src->filelen) goto error; src->curoffset += offset; - GST_DEBUG(0, "seek cur pending to %" G_GINT64_FORMAT, src->curoffset); + GST_DEBUG ( "seek cur pending to %" G_GINT64_FORMAT, src->curoffset); break; case GST_SEEK_METHOD_END: if (ABS (offset) > src->filelen) goto error; src->curoffset = src->filelen - ABS (offset); - GST_DEBUG(0, "seek end pending to %" G_GINT64_FORMAT, src->curoffset); + GST_DEBUG ( "seek end pending to %" G_GINT64_FORMAT, src->curoffset); break; default: goto error; diff --git a/plugins/elements/gstfilesrc.h b/plugins/elements/gstfilesrc.h index 25d27b0145..8065210c93 100644 --- a/plugins/elements/gstfilesrc.h +++ b/plugins/elements/gstfilesrc.h @@ -30,6 +30,9 @@ G_BEGIN_DECLS +extern GstElementDetails gst_filesrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_filesrc_debug); + #define GST_TYPE_FILESRC \ (gst_filesrc_get_type()) #define GST_FILESRC(obj) \ diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 29b20bc2b3..df42d70bd2 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -22,8 +22,15 @@ #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstidentity.h" + +GST_DEBUG_CATEGORY (gst_identity_debug); +#define GST_CAT_DEFAULT gst_identity_debug GstElementDetails gst_identity_details = { "Identity", @@ -282,7 +289,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf) gst_pad_push (identity->srcpad, buf); if (identity->sleep_time) - usleep (identity->sleep_time); + g_usleep (identity->sleep_time); } } diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h index 42ce65f1cd..dd04364c9f 100644 --- a/plugins/elements/gstidentity.h +++ b/plugins/elements/gstidentity.h @@ -25,13 +25,12 @@ #define __GST_IDENTITY_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_identity_details; - +extern GstElementDetails gst_identity_details; +GST_DEBUG_CATEGORY_EXTERN(gst_identity_debug); #define GST_TYPE_IDENTITY \ (gst_identity_get_type()) diff --git a/plugins/elements/gstmd5sink.c b/plugins/elements/gstmd5sink.c index ca43fc23b2..15dc9d1996 100644 --- a/plugins/elements/gstmd5sink.c +++ b/plugins/elements/gstmd5sink.c @@ -25,11 +25,16 @@ #include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include #include "gstmd5sink.h" +GST_DEBUG_CATEGORY (gst_md5sink_debug); +#define GST_CAT_DEFAULT gst_md5sink_debug + /* MD5Sink signals and args */ enum { /* FILL ME */ @@ -519,4 +524,3 @@ gst_md5sink_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/plugins/elements/gstmd5sink.h b/plugins/elements/gstmd5sink.h index 2ad4fdb6d4..5d24df69d5 100644 --- a/plugins/elements/gstmd5sink.h +++ b/plugins/elements/gstmd5sink.h @@ -25,13 +25,12 @@ #define __GST_MD5SINK_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_md5sink_details; - +extern GstElementDetails gst_md5sink_details; +GST_DEBUG_CATEGORY_EXTERN(gst_md5sink_debug); #define GST_TYPE_MD5SINK \ (gst_md5sink_get_type()) diff --git a/plugins/elements/gstmultidisksrc.c b/plugins/elements/gstmultidisksrc.c index 629993bed8..a561588abf 100644 --- a/plugins/elements/gstmultidisksrc.c +++ b/plugins/elements/gstmultidisksrc.c @@ -27,10 +27,15 @@ #include #include -/*#define GST_DEBUG_ENABLED*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "gstmultidisksrc.h" +GST_DEBUG_CATEGORY (gst_multidisksrc_debug); +#define GST_CAT_DEFAULT gst_multidisksrc_debug + GstElementDetails gst_multidisksrc_details = { "Multi Disk Source", "Source/File", diff --git a/plugins/elements/gstmultidisksrc.h b/plugins/elements/gstmultidisksrc.h index eca04e155b..07e83980d3 100644 --- a/plugins/elements/gstmultidisksrc.h +++ b/plugins/elements/gstmultidisksrc.h @@ -28,7 +28,8 @@ G_BEGIN_DECLS -GstElementDetails gst_multidisksrc_details; +extern GstElementDetails gst_multidisksrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug); #define GST_TYPE_MULTIDISKSRC \ (gst_multidisksrc_get_type()) diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c index 629993bed8..a561588abf 100644 --- a/plugins/elements/gstmultifilesrc.c +++ b/plugins/elements/gstmultifilesrc.c @@ -27,10 +27,15 @@ #include #include -/*#define GST_DEBUG_ENABLED*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "gstmultidisksrc.h" +GST_DEBUG_CATEGORY (gst_multidisksrc_debug); +#define GST_CAT_DEFAULT gst_multidisksrc_debug + GstElementDetails gst_multidisksrc_details = { "Multi Disk Source", "Source/File", diff --git a/plugins/elements/gstmultifilesrc.h b/plugins/elements/gstmultifilesrc.h index eca04e155b..07e83980d3 100644 --- a/plugins/elements/gstmultifilesrc.h +++ b/plugins/elements/gstmultifilesrc.h @@ -28,7 +28,8 @@ G_BEGIN_DECLS -GstElementDetails gst_multidisksrc_details; +extern GstElementDetails gst_multidisksrc_details; +GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug); #define GST_TYPE_MULTIDISKSRC \ (gst_multidisksrc_get_type()) diff --git a/plugins/elements/gstpipefilter.c b/plugins/elements/gstpipefilter.c index 7ac2d5f456..65a2a7fc2d 100644 --- a/plugins/elements/gstpipefilter.c +++ b/plugins/elements/gstpipefilter.c @@ -29,9 +29,14 @@ #include #include -/*#define DEBUG_ENABLED*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gstpipefilter.h" +GST_DEBUG_CATEGORY (gst_pipefilter_debug); +#define GST_CAT_DEFAULT gst_pipefilter_debug GstElementDetails gst_pipefilter_details = { "Pipefilter", @@ -141,7 +146,7 @@ gst_pipefilter_handle_event (GstPad *pad, GstEvent *event) pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad)); - GST_DEBUG (0,"pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter)); + GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter)); if (close (pipefilter->fdin[1]) < 0) perror("close"); if (close (pipefilter->fdout[0]) < 0) @@ -169,9 +174,9 @@ gst_pipefilter_get (GstPad *pad) g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, NULL); /* read it in from the file */ - GST_DEBUG (0,"attemting to read %ld bytes", pipefilter->bytes_per_read); + GST_DEBUG ("attemting to read %ld bytes", pipefilter->bytes_per_read); readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read); - GST_DEBUG (0,"read %ld bytes", readbytes); + GST_DEBUG ("read %ld bytes", readbytes); if (readbytes < 0) { perror("read"); gst_element_error(GST_ELEMENT(pipefilter),"reading"); @@ -207,9 +212,9 @@ gst_pipefilter_chain (GstPad *pad,GstBuffer *buf) data = GST_BUFFER_DATA(buf); size = GST_BUFFER_SIZE(buf); - GST_DEBUG (0,"attemting to write %ld bytes", size); + GST_DEBUG ("attemting to write %ld bytes", size); writebytes = write(pipefilter->fdin[1],data,size); - GST_DEBUG (0,"written %ld bytes", writebytes); + GST_DEBUG ("written %ld bytes", writebytes); if (writebytes < 0) { perror("write"); gst_element_error(GST_ELEMENT(pipefilter),"writing"); diff --git a/plugins/elements/gstpipefilter.h b/plugins/elements/gstpipefilter.h index 7699f4e28d..9516482c18 100644 --- a/plugins/elements/gstpipefilter.h +++ b/plugins/elements/gstpipefilter.h @@ -27,11 +27,10 @@ #include #include -#include "config.h" - G_BEGIN_DECLS -GstElementDetails gst_pipefilter_details; +extern GstElementDetails gst_pipefilter_details; +GST_DEBUG_CATEGORY_EXTERN(gst_pipefilter_debug); #define GST_TYPE_PIPEFILTER \ (gst_pipefilter_get_type()) diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index c01deb3cd4..b201639680 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -21,23 +21,13 @@ * Boston, MA 02111-1307, USA. */ -/* #define DEBUG_ENABLED */ -/* #define STATUS_ENABLED */ -#ifdef STATUS_ENABLED -#define STATUS(A) GST_DEBUG(GST_CAT_DATAFLOW, A, GST_ELEMENT_NAME(queue)) -#else -#define STATUS(A) -#endif - - -#include "config.h" #include "gst_private.h" #include "gstqueue.h" #include "gstscheduler.h" #include "gstevent.h" -#include "gstlog.h" +#include "gstinfo.h" GstElementDetails gst_queue_details = { "Queue", @@ -253,7 +243,7 @@ gst_queue_init (GstQueue *queue) queue->not_full = g_cond_new (); queue->events = g_async_queue_new(); queue->queue = g_queue_new (); - GST_DEBUG_ELEMENT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions"); + GST_CAT_DEBUG_OBJECT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions"); } static void @@ -286,7 +276,7 @@ gst_queue_get_bufferpool (GstPad *pad) static void gst_queue_cleanup_data (gpointer data, const gpointer user_data) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p", data); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p", data); gst_data_unref (GST_DATA (data)); } @@ -324,17 +314,17 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf) g_async_queue_lock(queue->events); while (g_async_queue_length_unlocked(queue->events) > 0){ GstEvent *event = (GstEvent*)g_async_queue_pop_unlocked(queue->events); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "sending event upstream\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "sending event upstream\n"); gst_pad_event_default (pad, event); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "event sent\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "event sent\n"); } g_async_queue_unlock(queue->events); restart: /* we have to lock the queue since we span threads */ - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); g_mutex_lock (queue->qlock); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ()); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p", g_thread_self ()); /* assume don't need to flush this buffer when the queue is filled */ queue->flush = FALSE; @@ -342,11 +332,11 @@ restart: if (GST_IS_EVENT (buf)) { switch (GST_EVENT_TYPE (buf)) { case GST_EVENT_FLUSH: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); gst_queue_locked_flush (queue); break; case GST_EVENT_EOS: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "eos in on %s %d\n", + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "eos in on %s %d\n", GST_ELEMENT_NAME (queue), queue->level_buffers); break; default: @@ -355,7 +345,7 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d",buf,GST_BUFFER_SIZE(buf)); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d",buf,GST_BUFFER_SIZE(buf)); if (queue->level_buffers == queue->size_buffers) { g_mutex_unlock (queue->qlock); @@ -367,7 +357,7 @@ restart: /* 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"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end"); if (GST_IS_EVENT (buf)) fprintf(stderr, "Error: queue [%s] leaked an event, type:%d\n", GST_ELEMENT_NAME(GST_ELEMENT(queue)), @@ -381,7 +371,7 @@ restart: gpointer front; GstBuffer *leakbuf; - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end"); front = g_queue_pop_head (queue->queue); leakbuf = (GstBuffer *)(front); @@ -397,24 +387,24 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); 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 (queue->interrupt) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted!!"); g_mutex_unlock (queue->qlock); if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad), GST_ELEMENT (queue))) goto out_unref; /* if we got here because we were unlocked after a flush, we don't need * to add the buffer to the queue again */ if (queue->flush) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "not adding pending buffer after flush"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "not adding pending buffer after flush"); goto out_unref; } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding pending buffer after interrupt"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "adding pending buffer after interrupt"); goto restart; } if (GST_STATE (queue) != GST_STATE_PLAYING) { @@ -432,12 +422,12 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d buffers, %d bytes", + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); g_cond_wait (queue->not_full, queue->qlock); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_full signal"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "got not_full signal"); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); } @@ -450,11 +440,11 @@ restart: /* this assertion _has_ to hold */ g_assert (queue->queue->length == queue->level_buffers); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d buffers, %d bytes", GST_DEBUG_PAD_NAME(pad), queue->level_buffers, queue->size_buffers, queue->level_bytes); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_empty"); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling not_empty"); g_cond_signal (queue->not_empty); g_mutex_unlock (queue->qlock); @@ -481,11 +471,11 @@ gst_queue_get (GstPad *pad) restart: /* have to lock for thread-safety */ - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locking t:%p", g_thread_self ()); g_mutex_lock (queue->qlock); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%p %p", g_thread_self (), queue->not_empty); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "locked t:%p %p", g_thread_self (), queue->not_empty); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); while (queue->level_buffers == 0) { /* if there's a pending state change for this queue or its manager, switch @@ -493,7 +483,7 @@ restart: */ //while (GST_STATE_PENDING (queue) != GST_STATE_VOID_PENDING) { if (queue->interrupt) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "interrupted!!"); g_mutex_unlock (queue->qlock); if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad), GST_ELEMENT (queue))) return GST_BUFFER (gst_event_new (GST_EVENT_INTERRUPT)); @@ -511,7 +501,7 @@ restart: } } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d buffers, %d bytes", + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); /* if (queue->block_timeout > -1){ */ @@ -528,26 +518,26 @@ restart: else { g_cond_wait (queue->not_empty, queue->qlock); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_empty signal"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "got not_empty signal"); } - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d buffers, %d bytes", queue->level_buffers, queue->size_buffers, queue->level_bytes); front = g_queue_pop_head (queue->queue); buf = (GstBuffer *)(front); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue", buf); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue", buf); queue->level_buffers--; queue->level_bytes -= GST_BUFFER_SIZE(buf); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d buffers, %d bytes", + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d buffers, %d bytes", GST_DEBUG_PAD_NAME(pad), queue->level_buffers, queue->size_buffers, queue->level_bytes); /* this assertion _has_ to hold */ g_assert (queue->queue->length == queue->level_buffers); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_full"); + GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue, "signalling not_full"); g_cond_signal (queue->not_full); g_mutex_unlock (queue->qlock); @@ -557,7 +547,7 @@ restart: GstEvent *event = GST_EVENT(buf); switch (GST_EVENT_TYPE(event)) { case GST_EVENT_EOS: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos", GST_ELEMENT_NAME (queue)); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos", GST_ELEMENT_NAME (queue)); gst_element_set_eos (GST_ELEMENT (queue)); break; default: @@ -599,7 +589,7 @@ gst_queue_handle_src_event (GstPad *pad, GstEvent *event) switch (event_type) { case GST_EVENT_FLUSH: - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); + GST_CAT_DEBUG_OBJECT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n"); gst_queue_locked_flush (queue); break; case GST_EVENT_SEEK: @@ -641,7 +631,7 @@ gst_queue_change_state (GstElement *element) queue = GST_QUEUE (element); - GST_DEBUG_ENTER("('%s')", GST_ELEMENT_NAME (element)); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "starting state change"); /* lock the queue so another thread (not in sync with this thread's state) * can't call this queue's _get (or whatever) @@ -656,7 +646,7 @@ gst_queue_change_state (GstElement *element) break; case GST_STATE_PAUSED_TO_PLAYING: if (!GST_PAD_IS_LINKED (queue->sinkpad)) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, queue, "queue %s is not linked", GST_ELEMENT_NAME (queue)); + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue, "queue %s is not linked", GST_ELEMENT_NAME (queue)); /* FIXME can this be? */ g_cond_signal (queue->not_empty); @@ -670,7 +660,7 @@ gst_queue_change_state (GstElement *element) sink_sched = gst_pad_get_scheduler (GST_PAD_CAST (queue->sinkpad)); if (src_sched == sink_sched) { - GST_DEBUG_ELEMENT (GST_CAT_STATES, queue, "queue %s does not connect different schedulers", + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue, "queue %s does not connect different schedulers", GST_ELEMENT_NAME (queue)); g_warning ("queue %s does not connect different schedulers", @@ -696,7 +686,7 @@ gst_queue_change_state (GstElement *element) error: g_mutex_unlock (queue->qlock); - GST_DEBUG_LEAVE("('%s')", GST_ELEMENT_NAME (element)); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "done with state change"); return ret; } diff --git a/plugins/elements/gstshaper.c b/plugins/elements/gstshaper.c index eaa6ae8f0d..cf981c8f50 100644 --- a/plugins/elements/gstshaper.c +++ b/plugins/elements/gstshaper.c @@ -22,7 +22,15 @@ #include -#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstshaper.h" + +GST_DEBUG_CATEGORY (gst_shaper_debug); +#define GST_CAT_DEFAULT gst_shaper_debug GstElementDetails gst_shaper_details = { "Shaper", @@ -380,4 +388,3 @@ gst_shaper_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/plugins/elements/gstshaper.h b/plugins/elements/gstshaper.h index 40540b1767..71995ae26d 100644 --- a/plugins/elements/gstshaper.h +++ b/plugins/elements/gstshaper.h @@ -25,13 +25,12 @@ #define __GST_SHAPER_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_shaper_details; - +extern GstElementDetails gst_shaper_details; +GST_DEBUG_CATEGORY_EXTERN(gst_shaper_debug); #define GST_TYPE_SHAPER \ (gst_shaper_get_type()) diff --git a/plugins/elements/gststatistics.c b/plugins/elements/gststatistics.c index 57dbebf1e7..a18e64b2c2 100644 --- a/plugins/elements/gststatistics.c +++ b/plugins/elements/gststatistics.c @@ -21,8 +21,14 @@ */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "gststatistics.h" + +GST_DEBUG_CATEGORY (gst_statistics_debug); +#define GST_CAT_DEFAULT gst_statistics_debug GstElementDetails gst_statistics_details = { "Statistics", @@ -299,9 +305,9 @@ gst_statistics_chain (GstPad *pad, GstBuffer *buf) if (update) { if (statistics->update) { - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, statistics, "pre update emit\n"); + GST_DEBUG ("[%s]: pre update emit", GST_ELEMENT_NAME (statistics)); g_signal_emit (G_OBJECT (statistics), gst_statistics_signals[SIGNAL_UPDATE], 0); - GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, statistics, "post update emit\n"); + GST_DEBUG ("[%s]: post update emit", GST_ELEMENT_NAME (statistics)); } if (!statistics->silent) { gst_statistics_print(statistics); diff --git a/plugins/elements/gststatistics.h b/plugins/elements/gststatistics.h index ae0242f0d3..aedf00adf2 100644 --- a/plugins/elements/gststatistics.h +++ b/plugins/elements/gststatistics.h @@ -24,13 +24,12 @@ #define __GST_STATISTICS_H__ -#include #include G_BEGIN_DECLS -GstElementDetails gst_statistics_details; - +extern GstElementDetails gst_statistics_details; +GST_DEBUG_CATEGORY_EXTERN(gst_statistics_debug); #define GST_TYPE_STATISTICS \ (gst_statistics_get_type()) diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index 1db945c07c..2d9f4b1073 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -20,8 +20,14 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gsttee.h" +GST_DEBUG_CATEGORY (gst_tee_debug); +#define GST_CAT_DEFAULT gst_tee_debug GstElementDetails gst_tee_details = { "Tee pipe fitting", @@ -127,7 +133,7 @@ gst_tee_sinklink (GstPad *pad, GstCaps *caps) GstPadLinkReturn set_retval; GstCaps *caps1; - GST_DEBUG (0, "gst_tee_sinklink caps=%s", gst_caps_to_string(caps)); + GST_DEBUG ( "gst_tee_sinklink caps=%s", gst_caps_to_string(caps)); tee = GST_TEE (gst_pad_get_parent (pad)); @@ -162,7 +168,7 @@ gst_tee_srclink (GstPad *pad, GstCaps *caps) { GstTee *tee; - GST_DEBUG (0, "gst_tee_srclink caps=%s", gst_caps_to_string(caps)); + GST_DEBUG ( "gst_tee_srclink caps=%s", gst_caps_to_string(caps)); tee = GST_TEE (gst_pad_get_parent (pad)); @@ -176,7 +182,7 @@ gst_tee_getcaps (GstPad *pad, GstCaps *filter) GstTee *tee; const GList *pads; - GST_DEBUG (0, "gst_tee_getcaps"); + GST_DEBUG ( "gst_tee_getcaps"); tee = GST_TEE (gst_pad_get_parent (pad)); @@ -380,4 +386,3 @@ gst_tee_factory_init (GstElementFactory *factory) return TRUE; } - diff --git a/plugins/elements/gsttee.h b/plugins/elements/gsttee.h index 68b541daf2..0193bb0fa8 100644 --- a/plugins/elements/gsttee.h +++ b/plugins/elements/gsttee.h @@ -29,6 +29,7 @@ G_BEGIN_DECLS extern GstElementDetails gst_tee_details; +GST_DEBUG_CATEGORY_EXTERN(gst_tee_debug); #define GST_TYPE_TEE \ (gst_tee_get_type()) diff --git a/plugins/indexers/gstfileindex.c b/plugins/indexers/gstfileindex.c index cb967dfee0..8311e8f10b 100644 --- a/plugins/indexers/gstfileindex.c +++ b/plugins/indexers/gstfileindex.c @@ -17,16 +17,14 @@ * Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include +#include #include #include #include #include #include +#include #define GST_TYPE_FILE_INDEX \ (gst_file_index_get_type ()) @@ -193,7 +191,7 @@ gst_file_index_class_init (GstFileIndexClass *klass) static void gst_file_index_init (GstFileIndex *index) { - GST_DEBUG(0, "created new file index"); + GST_DEBUG ( "created new file index"); index->id_index = g_hash_table_new (g_int_hash, g_int_equal); } @@ -789,11 +787,7 @@ show_entry (GstIndexEntry *entry) static void gst_file_index_add_entry (GstIndex *index, GstIndexEntry *entry) { - GstFileIndex *fileindex = GST_FILE_INDEX (index); - - GST_DEBUG (0, "adding entry %p\n", fileindex); - - //show_entry (entry); + GST_LOG_OBJECT (index, "adding this entry"); switch (entry->type){ case GST_INDEX_ENTRY_ID: diff --git a/plugins/indexers/gstmemindex.c b/plugins/indexers/gstmemindex.c index bc5d59fa08..80856c4637 100644 --- a/plugins/indexers/gstmemindex.c +++ b/plugins/indexers/gstmemindex.c @@ -17,10 +17,7 @@ * Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include +#include #define GST_TYPE_MEM_INDEX \ (gst_index_get_type ()) @@ -158,7 +155,7 @@ gst_mem_index_class_init (GstMemIndexClass *klass) static void gst_mem_index_init (GstMemIndex *index) { - GST_DEBUG(0, "created new mem index"); + GST_DEBUG ( "created new mem index"); index->associations = NULL; index->id_index = g_hash_table_new (g_int_hash, g_int_equal); @@ -260,9 +257,7 @@ gst_mem_index_add_format (GstIndex *index, GstIndexEntry *entry) static void gst_mem_index_add_entry (GstIndex *index, GstIndexEntry *entry) { - GstMemIndex *memindex = GST_MEM_INDEX (index); - - GST_DEBUG (0, "adding entry %p\n", memindex); + GST_LOG_OBJECT (index, "added this entry"); switch (entry->type){ case GST_INDEX_ENTRY_ID: diff --git a/tests/bufspeed/gstbuffer.c b/tests/bufspeed/gstbuffer.c index d5b189874b..cb2cfe89cf 100644 --- a/tests/bufspeed/gstbuffer.c +++ b/tests/bufspeed/gstbuffer.c @@ -87,7 +87,7 @@ gst_buffer_new (void) buffer = gst_mem_pool_alloc (_gst_buffer_pool); - GST_INFO (GST_CAT_BUFFER,"creating new buffer %p",buffer); + GST_CAT_INFO (GST_CAT_BUFFER,"creating new buffer %p",buffer); #ifdef HAVE_ATOMIC_H atomic_set (&buffer->refcount, 1); @@ -130,7 +130,7 @@ gst_buffer_new_from_pool (GstBufferPool *pool, guint32 offset, guint32 size) buffer->free = pool->buffer_free; buffer->copy = pool->buffer_copy; - GST_INFO (GST_CAT_BUFFER,"creating new buffer %p from pool %p (size %x, offset %x)", + GST_CAT_INFO (GST_CAT_BUFFER,"creating new buffer %p from pool %p (size %x, offset %x)", buffer, pool, size, offset); return buffer; @@ -161,7 +161,7 @@ gst_buffer_create_sub (GstBuffer *parent, buffer = gst_mem_pool_alloc (_gst_buffer_pool); GST_DATA_TYPE(buffer) = _gst_buffer_type; - GST_INFO (GST_CAT_BUFFER,"creating new subbuffer %p from parent %p (size %u, offset %u)", + GST_CAT_INFO (GST_CAT_BUFFER,"creating new subbuffer %p from parent %p (size %u, offset %u)", buffer, parent, size, offset); #ifdef HAVE_ATOMIC_H @@ -226,7 +226,7 @@ gst_buffer_append (GstBuffer *buffer, g_return_val_if_fail (GST_BUFFER_REFCOUNT(buffer) > 0, NULL); g_return_val_if_fail (GST_BUFFER_REFCOUNT(append) > 0, NULL); - GST_INFO (GST_CAT_BUFFER,"appending buffers %p and %p",buffer,append); + GST_CAT_INFO (GST_CAT_BUFFER,"appending buffers %p and %p",buffer,append); GST_BUFFER_LOCK (buffer); /* the buffer is not used by anyone else */ @@ -265,7 +265,7 @@ gst_buffer_destroy (GstBuffer *buffer) g_return_if_fail (buffer != NULL); - GST_INFO (GST_CAT_BUFFER, "freeing %sbuffer %p", + GST_CAT_INFO (GST_CAT_BUFFER, "freeing %sbuffer %p", (buffer->parent?"sub":""), buffer); @@ -301,7 +301,7 @@ gst_buffer_ref (GstBuffer *buffer) g_return_if_fail (buffer != NULL); g_return_if_fail (GST_BUFFER_REFCOUNT(buffer) > 0); - GST_INFO (GST_CAT_BUFFER, "ref buffer %p\n", buffer); + GST_CAT_INFO (GST_CAT_BUFFER, "ref buffer %p\n", buffer); #ifdef HAVE_ATOMIC_H atomic_inc (&(buffer->refcount)); @@ -327,7 +327,7 @@ gst_buffer_unref (GstBuffer *buffer) g_return_if_fail (buffer != NULL); g_return_if_fail (GST_BUFFER_REFCOUNT(buffer) > 0); - GST_INFO (GST_CAT_BUFFER, "unref buffer %p\n", buffer); + GST_CAT_INFO (GST_CAT_BUFFER, "unref buffer %p\n", buffer); #ifdef HAVE_ATOMIC_H zero = atomic_dec_and_test (&(buffer->refcount)); diff --git a/tests/memchunk/gmemchunktest.c b/tests/memchunk/gmemchunktest.c index 961d6c750e..62183843af 100644 --- a/tests/memchunk/gmemchunktest.c +++ b/tests/memchunk/gmemchunktest.c @@ -35,7 +35,8 @@ run_test (void *threadid) { gint i; gpointer chunk; - sleep(1); + + g_usleep (G_USEC_PER_SEC); for (i = 0; ipipe); /* request pads and link to adder */ - GST_INFO (0, "requesting pad\n"); + GST_INFO ( "requesting pad\n"); pad = gst_element_get_request_pad (adder, "sink%d"); printf ("\tGot new adder sink pad %s\n", gst_pad_get_name (pad)); sprintf (buffer, "channel%d", i); @@ -242,7 +242,7 @@ create_input_channel (int id, char* location) GstElement *new_element; GstElement *decoder; - GST_DEBUG (0, "c_i_p : creating channel with id %d for file %s", + GST_DEBUG ( "c_i_p : creating channel with id %d for file %s", id, location); /* allocate channel */ @@ -256,7 +256,7 @@ create_input_channel (int id, char* location) /* create channel */ - GST_DEBUG (0, "c_i_p : creating pipeline"); + GST_DEBUG ( "c_i_p : creating pipeline"); sprintf (buffer, "pipeline%d", id); channel->pipe = gst_bin_new (buffer); @@ -264,13 +264,13 @@ create_input_channel (int id, char* location) /* create elements */ - GST_DEBUG(0, "c_i_p : creating filesrc"); + GST_DEBUG ( "c_i_p : creating filesrc"); sprintf (buffer, "filesrc%d", id); channel->filesrc = gst_element_factory_make ("filesrc", buffer); g_assert(channel->filesrc != NULL); - GST_DEBUG(0, "c_i_p : setting location"); + GST_DEBUG ( "c_i_p : setting location"); g_object_set(G_OBJECT(channel->filesrc),"location", location, NULL); /* add filesrc to the bin before autoplug */ diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c index 9d12f2d066..9609a4b45d 100644 --- a/tests/old/examples/plugins/example.c +++ b/tests/old/examples/plugins/example.c @@ -30,7 +30,7 @@ static GstElementDetails example_details = { "An example plugin", "Example/FirstExample", "Shows the basic structure of a plugin", - VERSION, + "0.1", "your name ", "(C) 2001", }; diff --git a/tests/old/testsuite/Makefile.am b/tests/old/testsuite/Makefile.am index 9f068af9db..45130bdd4e 100644 --- a/tests/old/testsuite/Makefile.am +++ b/tests/old/testsuite/Makefile.am @@ -4,8 +4,14 @@ else GST_PARSE_DIRS = parse endif +if GST_DISABLE_GST_DEBUG +GST_DEBUG_DIRS = +else +GST_DEBUG_DIRS = debug +endif + # FIXME : threads bytestream -SUBDIRS = caps plugin elements clock refcounting threads indexers $(GST_PARSE_DIRS) ## cleanup dynparams +SUBDIRS = caps plugin elements clock refcounting threads indexers $(GST_PARSE_DIRS) $(GST_DEBUG_DIRS) ## cleanup dynparams TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml diff --git a/tests/old/testsuite/clock/clock2.c b/tests/old/testsuite/clock/clock2.c index 6e07b486c3..2a092b676e 100644 --- a/tests/old/testsuite/clock/clock2.c +++ b/tests/old/testsuite/clock/clock2.c @@ -29,11 +29,11 @@ main (int argc, char *argv[]) g_assert (clock != NULL); gst_clock_debug (clock); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_clock_debug (clock); gst_clock_set_active (clock, TRUE); gst_clock_debug (clock); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_clock_debug (clock); id = gst_clock_new_single_shot_id (clock, GST_SECOND * 2); @@ -46,7 +46,7 @@ main (int argc, char *argv[]) gst_clock_set_active (clock, FALSE); gst_clock_debug (clock); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_clock_debug (clock); /* success */ diff --git a/tests/old/testsuite/debug/Makefile.am b/tests/old/testsuite/debug/Makefile.am new file mode 100644 index 0000000000..9056cec138 --- /dev/null +++ b/tests/old/testsuite/debug/Makefile.am @@ -0,0 +1,9 @@ +testprogs = global output commandline category + +TESTS = $(testprogs) + +check_PROGRAMS = $(testprogs) + +# we have nothing but apps here, we can do this safely +LIBS = $(GST_LIBS) +AM_CFLAGS = $(GST_CFLAGS) diff --git a/tests/old/testsuite/debug/category.c b/tests/old/testsuite/debug/category.c new file mode 100644 index 0000000000..07b3fd8d35 --- /dev/null +++ b/tests/old/testsuite/debug/category.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * category.c: test the categories + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +GST_DEBUG_CATEGORY (cat); +#define GST_CAT_DEFAULT cat +GST_DEBUG_CATEGORY_STATIC (cat_static); + +gint +main (gint argc, gchar *argv[]) +{ + GSList *before, *after; + + unsetenv ("GST_DEBUG"); + gst_init (&argc, &argv); + + before = gst_debug_get_all_categories (); + GST_DEBUG_CATEGORY_INIT (cat, "cat", GST_DEBUG_FG_GREEN, "default category for this test"); + GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", + GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_RED, + "static category for this test"); + after = gst_debug_get_all_categories (); + + g_print ("removing default log function\n"); + g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); + g_print ("checking, if the two new categories are put into the category list correctly...\n"); + g_assert (g_slist_length (after) - g_slist_length (before) == 2); + /* check the _get stuff */ + g_print ("checking, if the gst_debug_category_get_* stuff works with the categories...\n"); + g_assert (strcmp (gst_debug_category_get_name (cat), "cat") == 0); + g_assert (gst_debug_category_get_color (cat) == GST_DEBUG_FG_GREEN); + g_assert (strcmp (gst_debug_category_get_description (cat), "default category for this test") == 0); + g_assert (gst_debug_category_get_threshold (cat) == gst_debug_get_default_threshold()); + g_assert (strcmp (gst_debug_category_get_name (cat_static), "cat_static") == 0); + g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_FG_GREEN); + g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BG_RED); + g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BOLD); + g_assert (strcmp (gst_debug_category_get_description (cat_static), "static category for this test") == 0); + g_assert (gst_debug_category_get_threshold (cat_static) == gst_debug_get_default_threshold()); + /* check if setting levels for names work */ + g_print ("checking if changing threshold for names affects existing categories...\n"); + gst_debug_set_threshold_for_name ("cat", GST_LEVEL_DEBUG); + g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG); + g_assert (gst_debug_category_get_threshold (cat_static) == gst_debug_get_default_threshold()); + gst_debug_set_threshold_for_name ("cat_static", GST_LEVEL_INFO); + g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG); + g_assert (gst_debug_category_get_threshold (cat_static) == GST_LEVEL_INFO); + + g_print ("everything ok.\n"); + return 0; +} diff --git a/tests/old/testsuite/debug/commandline.c b/tests/old/testsuite/debug/commandline.c new file mode 100644 index 0000000000..a08aa2961f --- /dev/null +++ b/tests/old/testsuite/debug/commandline.c @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * commandline.c: Test if the command line arguments work + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +GST_DEBUG_CATEGORY (cat); +GST_DEBUG_CATEGORY_STATIC (cat_static); + +static const gchar* lines[] = { + "--gst-disable-debug", + "--gst-debug-no-color", + "--gst-debug-level=4", + "--gst-debug=cat=4:cat_*=3", + "--gst-debug-level=4 --gst-debug=cat_*=5" +}; + +static void +debug_not_reached (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer thread) +{ + g_assert_not_reached (); +} +gint +main (gint argc, gchar *argv[]) +{ + if (argc == 1) { + /* this is the main run that calls the others */ + gint i, runs, exit; + gchar *command; + + unsetenv ("GST_DEBUG"); + gst_init (&argc, &argv); + runs = G_N_ELEMENTS (lines); + for (i = 0; i < runs; i++) { + command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i); + g_print ("running \"%s\"\n", command); + g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit, NULL) == TRUE); + g_assert (exit == 0); + g_print ("\"%s\" worked as expected.\n", command); + g_free (command); + } + + return 0; + } else { + gst_init (&argc, &argv); + if (argc != 2) { + g_print ("something funny happened to the command line arguments, aborting.\n"); + return 1; + } + gst_debug_remove_log_function (gst_debug_log_default); + GST_DEBUG_CATEGORY_INIT (cat, "cat", 0, "non-static category"); + GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", 0, "static category"); + switch (argv[1][0]) { + case '0': + g_assert (gst_debug_is_active () == FALSE); + gst_debug_add_log_function (debug_not_reached, NULL); + GST_ERROR ("This will not be seen"); + return 0; + case '1': + return gst_debug_is_colored () ? 1 : 0; + case '2': + g_assert (gst_debug_get_default_threshold () == 4); + g_assert (gst_debug_category_get_threshold (cat) == 4); + return 0; + case '3': + g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); + g_assert (gst_debug_category_get_threshold (cat) == 4); + g_assert (gst_debug_category_get_threshold (cat_static) == 3); + return 0; + case '4': + g_assert (gst_debug_get_default_threshold () == 4); + g_assert (gst_debug_category_get_threshold (cat) == 4); + g_assert (gst_debug_category_get_threshold (cat_static) == 5); + return 0; + default: + g_print ("usupported command, aborting...\n"); + return -1; + } + } + g_assert_not_reached (); +} diff --git a/tests/old/testsuite/debug/global.c b/tests/old/testsuite/debug/global.c new file mode 100644 index 0000000000..8644c5d547 --- /dev/null +++ b/tests/old/testsuite/debug/global.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * global.c: Test global parameter setting/getting + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#define THREAD_COUNT 5 +#define ITERATIONS 20 + +/* stupid logging functions */ +static void gst_debug_log_one (GstDebugCategory * category, + GstDebugLevel level, + const gchar * file, + const gchar * function, + gint line, + GObject * object, + gchar * message, + gpointer thread) G_GNUC_NO_INSTRUMENT; +static void gst_debug_log_two (GstDebugCategory * category, + GstDebugLevel level, + const gchar * file, + const gchar * function, + gint line, + GObject * object, + gchar * message, + gpointer thread) G_GNUC_NO_INSTRUMENT; + +static void +gst_debug_log_one (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer thread) +{ +} +static void +gst_debug_log_two (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer thread) +{ +} + +static gpointer +thread_main (gpointer threadnum) +{ + gint num; + gint i; + + num = GPOINTER_TO_INT (threadnum); + for (i = 0; i < ITERATIONS; i++) { + g_print ("iteration %d of thread %d starting\n", i, num); + /* do some stuff with global settings */ + gst_debug_set_default_threshold (GST_LEVEL_DEBUG); + gst_debug_add_log_function (gst_debug_log_one, g_thread_self()); + gst_debug_add_log_function (gst_debug_log_two, NULL); + + /* reset all the stuff we did */ + gst_debug_set_default_threshold (GST_LEVEL_DEFAULT); + g_assert (gst_debug_remove_log_function_by_data (g_thread_self()) == 1); + } + + g_print ("Thread %d is done.\n", num); + return threadnum; +} +gint +main (gint argc, gchar *argv[]) +{ + gint i; + GThread *threads[THREAD_COUNT]; + + g_print ("initializing GStreamer\n"); + gst_init (&argc, &argv); + g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); + + /* some checks for defaults */ + g_print ("Doing startup checks\n"); + g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); + + g_print ("creating %d threads\n", THREAD_COUNT); + for (i = 0; i < THREAD_COUNT; i++) { + g_assert ((threads[i] = g_thread_create (thread_main, GINT_TO_POINTER (i), TRUE, NULL))); + } + g_print ("joining %d threads\n", THREAD_COUNT); + for (i = 0; i < THREAD_COUNT; i++) { + g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i); + } + + /* some checks if everything worked */ + g_print ("Doing shutdown checks\n"); + g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); + g_assert (gst_debug_remove_log_function (gst_debug_log_two) == THREAD_COUNT * ITERATIONS); + + return 0; +} diff --git a/tests/old/testsuite/debug/output.c b/tests/old/testsuite/debug/output.c new file mode 100644 index 0000000000..2df2d5db9f --- /dev/null +++ b/tests/old/testsuite/debug/output.c @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * output.c: Test if the debugging output macros work + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +GST_DEBUG_CATEGORY_STATIC (cat_default); +#define GST_CAT_DEFAULT cat_default +GST_DEBUG_CATEGORY_STATIC (cat2); + +static gint count = -1; +static GstElement *pipeline; + +static void +check_message (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer unused) +{ + gint temp; + + /* these checks require count to be set right. So the order in the main + funtion is actually important. */ + /* <0 means no checks */ + if (count < 0) return; + + g_print ("expecting \"%s\"...", message); + /* level */ + temp = (count % 5) + 1; + g_assert (level == temp); + /* category */ + temp = (count % 10) / 5; + g_assert (category == (temp ? cat2 : cat_default)); + /* object */ + temp = (count % 20) / 10; + g_assert (object == (GObject *) (temp ? pipeline : NULL)); + g_print ("[OK]\n"); +} + +gint +main (gint argc, gchar *argv[]) +{ + + gst_init (&argc, &argv); + + GST_DEBUG_CATEGORY_INIT (cat_default, "GST_Check_default", 0, "default category for this test"); + GST_DEBUG_CATEGORY_INIT (cat2, "GST_Check_2", 0, "second category for this test"); + g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); + gst_debug_add_log_function (check_message, NULL); + + count = 0; + GST_ERROR ("This is an error."); + ++count; + GST_WARNING ("This is a warning."); + ++count; + GST_INFO ("This is an info message."); + ++count; + GST_DEBUG ("This is a debug message."); + ++count; + GST_LOG ("This is a log message."); + ++count; + GST_CAT_ERROR (cat2, "This is an error with category."); + ++count; + GST_CAT_WARNING (cat2, "This is a warning with category."); + ++count; + GST_CAT_INFO (cat2, "This is an info message with category."); + ++count; + GST_CAT_DEBUG (cat2, "This is a debug message with category."); + ++count; + GST_CAT_LOG (cat2, "This is a log message with category."); + count = -1; + pipeline = gst_element_factory_make ("pipeline", "testelement"); + count = 10; + GST_ERROR_OBJECT (pipeline, "This is an error with object."); + ++count; + GST_WARNING_OBJECT (pipeline, "This is a warning with object."); + ++count; + GST_INFO_OBJECT (pipeline, "This is an info message with object."); + ++count; + GST_DEBUG_OBJECT (pipeline, "This is a debug message with object."); + ++count; + GST_LOG_OBJECT (pipeline, "This is a log message with object."); + ++count; + GST_CAT_ERROR_OBJECT (cat2, pipeline, "This is an error with category and object."); + ++count; + GST_CAT_WARNING_OBJECT (cat2, pipeline, "This is a warning with category and object."); + ++count; + GST_CAT_INFO_OBJECT (cat2, pipeline, "This is an info message with category and object."); + ++count; + GST_CAT_DEBUG_OBJECT (cat2, pipeline, "This is a debug message with category and object."); + ++count; + GST_CAT_LOG_OBJECT (cat2, pipeline, "This is a log message with category and object."); + count = -1; + + g_assert (gst_debug_remove_log_function (check_message) == 1); + + return 0; +} diff --git a/tests/old/testsuite/threads/Makefile.am b/tests/old/testsuite/threads/Makefile.am index 97112c8323..76cc2e41da 100644 --- a/tests/old/testsuite/threads/Makefile.am +++ b/tests/old/testsuite/threads/Makefile.am @@ -1,8 +1,8 @@ TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml -testprogs = thread1 thread2 thread3 thread5 threadb -testsfailing = threadc threadd threade threadf thread4 +testprogs = thread1 thread2 thread3 threadb +testsfailing = threadc threadd threade threadf thread5 thread4 TESTS = $(testprogs) diff --git a/tests/old/testsuite/threads/thread.c b/tests/old/testsuite/threads/thread.c index 87dab97f78..ee6712428a 100644 --- a/tests/old/testsuite/threads/thread.c +++ b/tests/old/testsuite/threads/thread.c @@ -105,6 +105,7 @@ main (gint argc, gchar *argv[]) gst_element_set_state (pipeline, GST_STATE_NULL); } if (TESTNUM == 5) { + /* I don't this test is supposed to work */ GstElement *sink; sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); diff --git a/tests/old/testsuite/threads/threadf.c b/tests/old/testsuite/threads/threadf.c index 330be4e831..e5e0ab8869 100644 --- a/tests/old/testsuite/threads/threadf.c +++ b/tests/old/testsuite/threads/threadf.c @@ -78,7 +78,7 @@ main (gint argc, gchar *argv[]) g_thread_create ((GThreadFunc) thread, NULL, FALSE, NULL); g_print ("main: created GThread\n"); - while (!done) sleep (1); + while (!done) g_usleep (G_USEC_PER_SEC); g_print ("main: done\n"); return 0; } diff --git a/tests/sched/interrupt1.c b/tests/sched/interrupt1.c index 0b05fdb496..2fae69af46 100644 --- a/tests/sched/interrupt1.c +++ b/tests/sched/interrupt1.c @@ -26,13 +26,12 @@ int main (int argc, char *argv[]) gst_element_link_pads (queue, "src", sink, "sink"); gst_element_set_state (pipeline, GST_STATE_PLAYING); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_element_set_state (pipeline, GST_STATE_PAUSED); gst_element_set_state (pipeline, GST_STATE_PLAYING); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_element_set_state (pipeline, GST_STATE_PAUSED); return 0; } - diff --git a/tests/sched/interrupt2.c b/tests/sched/interrupt2.c index 8108be49c3..4e2551bfc1 100644 --- a/tests/sched/interrupt2.c +++ b/tests/sched/interrupt2.c @@ -30,13 +30,12 @@ int main (int argc, char *argv[]) gst_element_link_pads (identity, "src", sink, "sink"); gst_element_set_state (pipeline, GST_STATE_PLAYING); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_element_set_state (pipeline, GST_STATE_PAUSED); gst_element_set_state (pipeline, GST_STATE_PLAYING); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_element_set_state (pipeline, GST_STATE_PAUSED); return 0; } - diff --git a/tests/sched/interrupt3.c b/tests/sched/interrupt3.c index 04fb9fa618..38f06e5184 100644 --- a/tests/sched/interrupt3.c +++ b/tests/sched/interrupt3.c @@ -33,13 +33,12 @@ int main (int argc, char *argv[]) gst_element_link_pads (adder, "src", sink, "sink"); gst_element_set_state (pipeline, GST_STATE_PLAYING); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_element_set_state (pipeline, GST_STATE_PAUSED); gst_element_set_state (pipeline, GST_STATE_PLAYING); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_element_set_state (pipeline, GST_STATE_PAUSED); return 0; } - diff --git a/tests/sched/runxml.c b/tests/sched/runxml.c index 309f68d317..d1b2a6dfe2 100644 --- a/tests/sched/runxml.c +++ b/tests/sched/runxml.c @@ -79,7 +79,7 @@ int main(int argc,char *argv[]) gst_element_set_state(bin, GST_STATE_PLAYING); if (GST_IS_THREAD (bin)) { - sleep (1); + g_usleep (G_USEC_PER_SEC); } else { gst_bin_iterate(GST_BIN(bin)); @@ -95,4 +95,3 @@ int main(int argc,char *argv[]) exit(0); } - diff --git a/tests/threadstate/threadstate1.c b/tests/threadstate/threadstate1.c index b1f8949f62..309bf37a07 100644 --- a/tests/threadstate/threadstate1.c +++ b/tests/threadstate/threadstate1.c @@ -29,13 +29,12 @@ int main(int argc,char *argv[]) for (x = 0 ; x < 10 ; x++){ g_print("playing %d\n", x); gst_element_set_state(GST_ELEMENT(thread), GST_STATE_PLAYING); - sleep(1); + g_usleep (G_USEC_PER_SEC); g_print("pausing %d\n", x); gst_element_set_state(GST_ELEMENT(thread), GST_STATE_PAUSED); - sleep(1); + g_usleep (G_USEC_PER_SEC); } exit(0); } - diff --git a/tests/threadstate/threadstate2.c b/tests/threadstate/threadstate2.c index aafc6d78fb..ca5fd003f1 100644 --- a/tests/threadstate/threadstate2.c +++ b/tests/threadstate/threadstate2.c @@ -56,13 +56,12 @@ int main(int argc,char *argv[]) for (x = 0 ; x < 10 ; x++){ g_print ("playing %d\n", x); gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING); - sleep (2); + g_usleep (G_USEC_PER_SEC * 2); g_print ("pausing %d\n", x); gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PAUSED); - sleep (2); + g_usleep (G_USEC_PER_SEC * 2); } exit (0); } - diff --git a/tests/threadstate/threadstate3.c b/tests/threadstate/threadstate3.c index ab9c73568b..21a8ab6f86 100644 --- a/tests/threadstate/threadstate3.c +++ b/tests/threadstate/threadstate3.c @@ -33,12 +33,11 @@ int main(int argc,char *argv[]) for (x = 0 ; x < 10 ; x++){ g_print("playing %d\n", x); gst_element_set_state(GST_ELEMENT(thread), GST_STATE_PLAYING); - sleep(1); + g_usleep (G_USEC_PER_SEC); g_print("nulling %d\n", x); gst_element_set_state(GST_ELEMENT(thread), GST_STATE_NULL); - sleep(1); + g_usleep (G_USEC_PER_SEC); } exit(0); } - diff --git a/tests/threadstate/threadstate4.c b/tests/threadstate/threadstate4.c index cf47638b3a..6776e49a65 100644 --- a/tests/threadstate/threadstate4.c +++ b/tests/threadstate/threadstate4.c @@ -39,13 +39,12 @@ int main(int argc,char *argv[]) for (x = 0 ; x < 10 ; x++){ g_print("playing %d\n", x); gst_element_set_state(thread, GST_STATE_PLAYING); - sleep(1); + g_usleep (G_USEC_PER_SEC); g_print("nulling %d\n", x); gst_element_set_state(thread, GST_STATE_NULL); - sleep(1); + g_usleep (G_USEC_PER_SEC); } exit(0); } - diff --git a/tests/threadstate/threadstate5.c b/tests/threadstate/threadstate5.c index bf1ae0c2c9..f9953b76c8 100644 --- a/tests/threadstate/threadstate5.c +++ b/tests/threadstate/threadstate5.c @@ -39,13 +39,12 @@ int main(int argc,char *argv[]) for (x = 0 ; x < 10 ; x++){ g_print("playing %d\n", x); gst_element_set_state(thread, GST_STATE_PLAYING); - sleep(1); + g_usleep (G_USEC_PER_SEC); g_print("nulling %d\n", x); gst_element_set_state(thread, GST_STATE_NULL); - sleep(1); + g_usleep (G_USEC_PER_SEC); } exit(0); } - diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 9f068af9db..45130bdd4e 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -4,8 +4,14 @@ else GST_PARSE_DIRS = parse endif +if GST_DISABLE_GST_DEBUG +GST_DEBUG_DIRS = +else +GST_DEBUG_DIRS = debug +endif + # FIXME : threads bytestream -SUBDIRS = caps plugin elements clock refcounting threads indexers $(GST_PARSE_DIRS) ## cleanup dynparams +SUBDIRS = caps plugin elements clock refcounting threads indexers $(GST_PARSE_DIRS) $(GST_DEBUG_DIRS) ## cleanup dynparams TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml diff --git a/testsuite/clock/clock2.c b/testsuite/clock/clock2.c index 6e07b486c3..2a092b676e 100644 --- a/testsuite/clock/clock2.c +++ b/testsuite/clock/clock2.c @@ -29,11 +29,11 @@ main (int argc, char *argv[]) g_assert (clock != NULL); gst_clock_debug (clock); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_clock_debug (clock); gst_clock_set_active (clock, TRUE); gst_clock_debug (clock); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_clock_debug (clock); id = gst_clock_new_single_shot_id (clock, GST_SECOND * 2); @@ -46,7 +46,7 @@ main (int argc, char *argv[]) gst_clock_set_active (clock, FALSE); gst_clock_debug (clock); - sleep (1); + g_usleep (G_USEC_PER_SEC); gst_clock_debug (clock); /* success */ diff --git a/testsuite/debug/Makefile.am b/testsuite/debug/Makefile.am new file mode 100644 index 0000000000..9056cec138 --- /dev/null +++ b/testsuite/debug/Makefile.am @@ -0,0 +1,9 @@ +testprogs = global output commandline category + +TESTS = $(testprogs) + +check_PROGRAMS = $(testprogs) + +# we have nothing but apps here, we can do this safely +LIBS = $(GST_LIBS) +AM_CFLAGS = $(GST_CFLAGS) diff --git a/testsuite/debug/category.c b/testsuite/debug/category.c new file mode 100644 index 0000000000..07b3fd8d35 --- /dev/null +++ b/testsuite/debug/category.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * category.c: test the categories + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +GST_DEBUG_CATEGORY (cat); +#define GST_CAT_DEFAULT cat +GST_DEBUG_CATEGORY_STATIC (cat_static); + +gint +main (gint argc, gchar *argv[]) +{ + GSList *before, *after; + + unsetenv ("GST_DEBUG"); + gst_init (&argc, &argv); + + before = gst_debug_get_all_categories (); + GST_DEBUG_CATEGORY_INIT (cat, "cat", GST_DEBUG_FG_GREEN, "default category for this test"); + GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", + GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_RED, + "static category for this test"); + after = gst_debug_get_all_categories (); + + g_print ("removing default log function\n"); + g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); + g_print ("checking, if the two new categories are put into the category list correctly...\n"); + g_assert (g_slist_length (after) - g_slist_length (before) == 2); + /* check the _get stuff */ + g_print ("checking, if the gst_debug_category_get_* stuff works with the categories...\n"); + g_assert (strcmp (gst_debug_category_get_name (cat), "cat") == 0); + g_assert (gst_debug_category_get_color (cat) == GST_DEBUG_FG_GREEN); + g_assert (strcmp (gst_debug_category_get_description (cat), "default category for this test") == 0); + g_assert (gst_debug_category_get_threshold (cat) == gst_debug_get_default_threshold()); + g_assert (strcmp (gst_debug_category_get_name (cat_static), "cat_static") == 0); + g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_FG_GREEN); + g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BG_RED); + g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BOLD); + g_assert (strcmp (gst_debug_category_get_description (cat_static), "static category for this test") == 0); + g_assert (gst_debug_category_get_threshold (cat_static) == gst_debug_get_default_threshold()); + /* check if setting levels for names work */ + g_print ("checking if changing threshold for names affects existing categories...\n"); + gst_debug_set_threshold_for_name ("cat", GST_LEVEL_DEBUG); + g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG); + g_assert (gst_debug_category_get_threshold (cat_static) == gst_debug_get_default_threshold()); + gst_debug_set_threshold_for_name ("cat_static", GST_LEVEL_INFO); + g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG); + g_assert (gst_debug_category_get_threshold (cat_static) == GST_LEVEL_INFO); + + g_print ("everything ok.\n"); + return 0; +} diff --git a/testsuite/debug/commandline.c b/testsuite/debug/commandline.c new file mode 100644 index 0000000000..a08aa2961f --- /dev/null +++ b/testsuite/debug/commandline.c @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * commandline.c: Test if the command line arguments work + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +GST_DEBUG_CATEGORY (cat); +GST_DEBUG_CATEGORY_STATIC (cat_static); + +static const gchar* lines[] = { + "--gst-disable-debug", + "--gst-debug-no-color", + "--gst-debug-level=4", + "--gst-debug=cat=4:cat_*=3", + "--gst-debug-level=4 --gst-debug=cat_*=5" +}; + +static void +debug_not_reached (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer thread) +{ + g_assert_not_reached (); +} +gint +main (gint argc, gchar *argv[]) +{ + if (argc == 1) { + /* this is the main run that calls the others */ + gint i, runs, exit; + gchar *command; + + unsetenv ("GST_DEBUG"); + gst_init (&argc, &argv); + runs = G_N_ELEMENTS (lines); + for (i = 0; i < runs; i++) { + command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i); + g_print ("running \"%s\"\n", command); + g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit, NULL) == TRUE); + g_assert (exit == 0); + g_print ("\"%s\" worked as expected.\n", command); + g_free (command); + } + + return 0; + } else { + gst_init (&argc, &argv); + if (argc != 2) { + g_print ("something funny happened to the command line arguments, aborting.\n"); + return 1; + } + gst_debug_remove_log_function (gst_debug_log_default); + GST_DEBUG_CATEGORY_INIT (cat, "cat", 0, "non-static category"); + GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", 0, "static category"); + switch (argv[1][0]) { + case '0': + g_assert (gst_debug_is_active () == FALSE); + gst_debug_add_log_function (debug_not_reached, NULL); + GST_ERROR ("This will not be seen"); + return 0; + case '1': + return gst_debug_is_colored () ? 1 : 0; + case '2': + g_assert (gst_debug_get_default_threshold () == 4); + g_assert (gst_debug_category_get_threshold (cat) == 4); + return 0; + case '3': + g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); + g_assert (gst_debug_category_get_threshold (cat) == 4); + g_assert (gst_debug_category_get_threshold (cat_static) == 3); + return 0; + case '4': + g_assert (gst_debug_get_default_threshold () == 4); + g_assert (gst_debug_category_get_threshold (cat) == 4); + g_assert (gst_debug_category_get_threshold (cat_static) == 5); + return 0; + default: + g_print ("usupported command, aborting...\n"); + return -1; + } + } + g_assert_not_reached (); +} diff --git a/testsuite/debug/global.c b/testsuite/debug/global.c new file mode 100644 index 0000000000..8644c5d547 --- /dev/null +++ b/testsuite/debug/global.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * global.c: Test global parameter setting/getting + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#define THREAD_COUNT 5 +#define ITERATIONS 20 + +/* stupid logging functions */ +static void gst_debug_log_one (GstDebugCategory * category, + GstDebugLevel level, + const gchar * file, + const gchar * function, + gint line, + GObject * object, + gchar * message, + gpointer thread) G_GNUC_NO_INSTRUMENT; +static void gst_debug_log_two (GstDebugCategory * category, + GstDebugLevel level, + const gchar * file, + const gchar * function, + gint line, + GObject * object, + gchar * message, + gpointer thread) G_GNUC_NO_INSTRUMENT; + +static void +gst_debug_log_one (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer thread) +{ +} +static void +gst_debug_log_two (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer thread) +{ +} + +static gpointer +thread_main (gpointer threadnum) +{ + gint num; + gint i; + + num = GPOINTER_TO_INT (threadnum); + for (i = 0; i < ITERATIONS; i++) { + g_print ("iteration %d of thread %d starting\n", i, num); + /* do some stuff with global settings */ + gst_debug_set_default_threshold (GST_LEVEL_DEBUG); + gst_debug_add_log_function (gst_debug_log_one, g_thread_self()); + gst_debug_add_log_function (gst_debug_log_two, NULL); + + /* reset all the stuff we did */ + gst_debug_set_default_threshold (GST_LEVEL_DEFAULT); + g_assert (gst_debug_remove_log_function_by_data (g_thread_self()) == 1); + } + + g_print ("Thread %d is done.\n", num); + return threadnum; +} +gint +main (gint argc, gchar *argv[]) +{ + gint i; + GThread *threads[THREAD_COUNT]; + + g_print ("initializing GStreamer\n"); + gst_init (&argc, &argv); + g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); + + /* some checks for defaults */ + g_print ("Doing startup checks\n"); + g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); + + g_print ("creating %d threads\n", THREAD_COUNT); + for (i = 0; i < THREAD_COUNT; i++) { + g_assert ((threads[i] = g_thread_create (thread_main, GINT_TO_POINTER (i), TRUE, NULL))); + } + g_print ("joining %d threads\n", THREAD_COUNT); + for (i = 0; i < THREAD_COUNT; i++) { + g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i); + } + + /* some checks if everything worked */ + g_print ("Doing shutdown checks\n"); + g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); + g_assert (gst_debug_remove_log_function (gst_debug_log_two) == THREAD_COUNT * ITERATIONS); + + return 0; +} diff --git a/testsuite/debug/output.c b/testsuite/debug/output.c new file mode 100644 index 0000000000..2df2d5db9f --- /dev/null +++ b/testsuite/debug/output.c @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2003 Benjamin Otte + * + * output.c: Test if the debugging output macros work + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +GST_DEBUG_CATEGORY_STATIC (cat_default); +#define GST_CAT_DEFAULT cat_default +GST_DEBUG_CATEGORY_STATIC (cat2); + +static gint count = -1; +static GstElement *pipeline; + +static void +check_message (GstDebugCategory *category, GstDebugLevel level, const gchar *file, + const gchar *function, gint line, GObject *object, gchar *message, + gpointer unused) +{ + gint temp; + + /* these checks require count to be set right. So the order in the main + funtion is actually important. */ + /* <0 means no checks */ + if (count < 0) return; + + g_print ("expecting \"%s\"...", message); + /* level */ + temp = (count % 5) + 1; + g_assert (level == temp); + /* category */ + temp = (count % 10) / 5; + g_assert (category == (temp ? cat2 : cat_default)); + /* object */ + temp = (count % 20) / 10; + g_assert (object == (GObject *) (temp ? pipeline : NULL)); + g_print ("[OK]\n"); +} + +gint +main (gint argc, gchar *argv[]) +{ + + gst_init (&argc, &argv); + + GST_DEBUG_CATEGORY_INIT (cat_default, "GST_Check_default", 0, "default category for this test"); + GST_DEBUG_CATEGORY_INIT (cat2, "GST_Check_2", 0, "second category for this test"); + g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); + gst_debug_add_log_function (check_message, NULL); + + count = 0; + GST_ERROR ("This is an error."); + ++count; + GST_WARNING ("This is a warning."); + ++count; + GST_INFO ("This is an info message."); + ++count; + GST_DEBUG ("This is a debug message."); + ++count; + GST_LOG ("This is a log message."); + ++count; + GST_CAT_ERROR (cat2, "This is an error with category."); + ++count; + GST_CAT_WARNING (cat2, "This is a warning with category."); + ++count; + GST_CAT_INFO (cat2, "This is an info message with category."); + ++count; + GST_CAT_DEBUG (cat2, "This is a debug message with category."); + ++count; + GST_CAT_LOG (cat2, "This is a log message with category."); + count = -1; + pipeline = gst_element_factory_make ("pipeline", "testelement"); + count = 10; + GST_ERROR_OBJECT (pipeline, "This is an error with object."); + ++count; + GST_WARNING_OBJECT (pipeline, "This is a warning with object."); + ++count; + GST_INFO_OBJECT (pipeline, "This is an info message with object."); + ++count; + GST_DEBUG_OBJECT (pipeline, "This is a debug message with object."); + ++count; + GST_LOG_OBJECT (pipeline, "This is a log message with object."); + ++count; + GST_CAT_ERROR_OBJECT (cat2, pipeline, "This is an error with category and object."); + ++count; + GST_CAT_WARNING_OBJECT (cat2, pipeline, "This is a warning with category and object."); + ++count; + GST_CAT_INFO_OBJECT (cat2, pipeline, "This is an info message with category and object."); + ++count; + GST_CAT_DEBUG_OBJECT (cat2, pipeline, "This is a debug message with category and object."); + ++count; + GST_CAT_LOG_OBJECT (cat2, pipeline, "This is a log message with category and object."); + count = -1; + + g_assert (gst_debug_remove_log_function (check_message) == 1); + + return 0; +} diff --git a/testsuite/threads/Makefile.am b/testsuite/threads/Makefile.am index 97112c8323..76cc2e41da 100644 --- a/testsuite/threads/Makefile.am +++ b/testsuite/threads/Makefile.am @@ -1,8 +1,8 @@ TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml -testprogs = thread1 thread2 thread3 thread5 threadb -testsfailing = threadc threadd threade threadf thread4 +testprogs = thread1 thread2 thread3 threadb +testsfailing = threadc threadd threade threadf thread5 thread4 TESTS = $(testprogs) diff --git a/testsuite/threads/thread.c b/testsuite/threads/thread.c index 87dab97f78..ee6712428a 100644 --- a/testsuite/threads/thread.c +++ b/testsuite/threads/thread.c @@ -105,6 +105,7 @@ main (gint argc, gchar *argv[]) gst_element_set_state (pipeline, GST_STATE_NULL); } if (TESTNUM == 5) { + /* I don't this test is supposed to work */ GstElement *sink; sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); diff --git a/testsuite/threads/threadf.c b/testsuite/threads/threadf.c index 330be4e831..e5e0ab8869 100644 --- a/testsuite/threads/threadf.c +++ b/testsuite/threads/threadf.c @@ -78,7 +78,7 @@ main (gint argc, gchar *argv[]) g_thread_create ((GThreadFunc) thread, NULL, FALSE, NULL); g_print ("main: created GThread\n"); - while (!done) sleep (1); + while (!done) g_usleep (G_USEC_PER_SEC); g_print ("main: done\n"); return 0; } diff --git a/tools/gst-complete.c b/tools/gst-complete.c index 4091e54658..8e25255cb9 100644 --- a/tools/gst-complete.c +++ b/tools/gst-complete.c @@ -2,9 +2,11 @@ #include #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif -#include +#include typedef struct { diff --git a/tools/gst-compprep.c b/tools/gst-compprep.c index 75d5de9217..f277b528aa 100644 --- a/tools/gst-compprep.c +++ b/tools/gst-compprep.c @@ -1,5 +1,11 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include -#include "config.h" + +GST_DEBUG_CATEGORY_STATIC(debug_compprep); +#define GST_CAT_DEFAULT debug_compprep int main(int argc,char *argv[]) { xmlDocPtr doc; @@ -12,9 +18,8 @@ int main(int argc,char *argv[]) { GParamSpec **property_specs; guint num_properties,i; - gst_debug_set_categories(0); - gst_info_set_categories(0); gst_init(&argc,&argv); + GST_DEBUG_CATEGORY_INIT (debug_compprep, "compprep", GST_DEBUG_BOLD, "gst-compprep application"); doc = xmlNewDoc("1.0"); doc->xmlRootNode = xmlNewDocNode(doc, NULL, "GST-CompletionRegistry", NULL); @@ -44,11 +49,10 @@ int main(int argc,char *argv[]) { GST_PLUGIN_FEATURE_NAME(factory)); element = gst_element_factory_create(factory,NULL); - GST_DEBUG(GST_CAT_PLUGIN_LOADING, "adding factory %s", - GST_PLUGIN_FEATURE_NAME(factory)); + GST_DEBUG ("adding factory %s", GST_PLUGIN_FEATURE_NAME(factory)); if (element == NULL) { - fprintf(stderr,"couldn't construct element from factory %s\n", - gst_object_get_name (GST_OBJECT (factory))); + GST_ERROR ("couldn't construct element from factory %s\n", + gst_object_get_name (GST_OBJECT (factory))); return 1; } diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 951229323a..84699061b3 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 87ea9663b3..c58dde7cb1 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -1,6 +1,11 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include +#include #include #include @@ -174,13 +179,13 @@ fault_spin (void) /* FIXME how do we know if we were run by libtool? */ g_print ("Spinning. Please run 'gdb gst-launch %d' to continue debugging, " "Ctrl-C to quit, or Ctrl-\\ to dump core.\n", - getpid ()); - while (spinning) usleep (1000000); + (gint) getpid ()); + while (spinning) g_usleep (1000000); #else /* This spawns a gdb and attaches it to gst-launch. */ { char str[40]; - sprintf (str, "gdb -quiet gst-launch %d", getpid ()); + sprintf (str, "gdb -quiet gst-launch %d", (gint) getpid ()); system (str); } diff --git a/tools/gst-md5sum.c b/tools/gst-md5sum.c index c916873f13..12e45ed30f 100644 --- a/tools/gst-md5sum.c +++ b/tools/gst-md5sum.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include diff --git a/tools/gst-register.c b/tools/gst-register.c index 8a445e45e7..6f32e3f43d 100644 --- a/tools/gst-register.c +++ b/tools/gst-register.c @@ -20,6 +20,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include @@ -30,8 +34,6 @@ #include #include -#include "config.h" - extern gboolean _gst_registry_auto_load; static gint num_features = 0; static gint num_plugins = 0; @@ -106,4 +108,3 @@ int main (int argc,char *argv[]) return (0); } - diff --git a/tools/gst-typefind.c b/tools/gst-typefind.c index 29416b2313..75ad0a5289 100644 --- a/tools/gst-typefind.c +++ b/tools/gst-typefind.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include @@ -36,7 +40,10 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); - if (argc < 2) { g_error ("Please give a filename to typefind"); } + if (argc < 2) { + g_print ("Please give a filename to typefind\n\n"); + exit (1); + } pipeline = gst_pipeline_new (NULL); source = gst_element_factory_make ("filesrc", "source"); g_assert (GST_IS_ELEMENT (source)); @@ -58,4 +65,3 @@ main (int argc, char *argv[]) } return 0; } - diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c index 9b97bcae40..ed35ab1c16 100644 --- a/tools/gst-xmlinspect.c +++ b/tools/gst-xmlinspect.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include