[gst-devel] question re: debugging

Benjamin Otte in7y118 at public.uni-hamburg.de
Tue Dec 23 05:23:01 CET 2003


On Mon, 22 Dec 2003, Thomas Vander Stichele wrote:

> a) Should the mapping explicitly be: one feature -> one or more
> categories ? Or can I use one category for a complete plug-in (say, all
> of the oss elements) I'm asking because I think that if each element
> would have it's own category, the output of --gst-debug-help is going to
> be pretty long.
>
I don't care about the length of --gst-debug-help. The important thing is
to group functionality. You want to use
--gst-debug=the_catrgory_i_care_about=5 and have it output exactly what
you want.
So I'd probably use different categories for ossclock and osselement for
example. Or different categories for caps nego, events, plugging and
renego in an autoplugger.

> b) In the case where one category can be used for multiple elements,
> what's the best way to register categories ? Ie, where is the define,
> where the DEBUG_CATEGORY_INIT, and where the registering call ?
>
In the case where I have global categories, I put the _INIT call in the
plugin_init function. In other cases I put them in the class's _get_type
function. In such a case you want a GST_DEBUG_CATEGORY_EXTERN in the
header and a GST_DEBUG_CATEGORY in one of the source files. (Probably in
the one with the _INIT call.

> c) Going through the code, it looks to me like having multiple _INIT
> calls with the same name would result in different entries.  Should I
> try to add code that makes sure a category name is registered only once
> ? How does code in a second element registering the same category name
> "know" what variable to pass to the debugging system ?
>
It's a different category in that case and it should be. If you pick the
same name by accident (which shouldn't be possible if you follow the
docs - see next question) you'll figure out soon enough and fix it or keep
it because you want exactly that.
It's a feature, not a bug.

> c) Why are the core's debug categories in capitals, and the plugin's
> debug categories not ? Should external libs/programs use capitals or not
> ?
>
There is a lengthy paragraph in the API docs about naming issues. In
short:
- differentiate between plugin and app categories.
- yes, libs use all capitals, apps only capitalize the first letter.

Benjamin





More information about the gstreamer-devel mailing list