mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 23:14:46 +00:00
gst/gst.c (parse_debug_list): Accept e.g. GST_DEBUG=4 to mean the same thing as GST_DEBUG=*:4.
Original commit message from CVS: 2005-08-24 Andy Wingo <wingo@pobox.com> * gst/gst.c (parse_debug_list): Accept e.g. GST_DEBUG=4 to mean the same thing as GST_DEBUG=*:4. (parse_debug_level, parse_debug_category): New helper parsers.
This commit is contained in:
parent
6519d7bfba
commit
76fffe8fc5
3 changed files with 81 additions and 18 deletions
|
@ -1,3 +1,9 @@
|
|||
2005-08-24 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* gst/gst.c (parse_debug_list): Accept e.g. GST_DEBUG=4 to mean
|
||||
the same thing as GST_DEBUG=*:4.
|
||||
(parse_debug_level, parse_debug_category): New helper parsers.
|
||||
|
||||
2005-08-24 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
|
||||
|
|
|
@ -93,6 +93,12 @@ various utility functions
|
|||
parent_type_as_macro:
|
||||
@\
|
||||
parent_type_as_macro:
|
||||
@\
|
||||
parent_type_as_macro:
|
||||
@\
|
||||
parent_type_as_macro:
|
||||
@\
|
||||
parent_type_as_macro:
|
||||
@\
|
||||
parent_type_as_macro:
|
||||
@interface_type:
|
||||
|
@ -109,6 +115,12 @@ various utility functions
|
|||
interface_as_function:
|
||||
@\
|
||||
interface_as_function:
|
||||
@\
|
||||
interface_as_function:
|
||||
@\
|
||||
interface_as_function:
|
||||
@\
|
||||
interface_as_function:
|
||||
@\
|
||||
interface_as_function:
|
||||
|
||||
|
|
81
gst/gst.c
81
gst/gst.c
|
@ -169,6 +169,51 @@ enum
|
|||
ARG_REGISTRY
|
||||
};
|
||||
|
||||
/* debug-spec ::= category-spec [, category-spec]*
|
||||
* category-spec ::= category:val | val
|
||||
* category ::= [^:]+
|
||||
* val ::= [0-5]
|
||||
*/
|
||||
|
||||
#ifndef NUL
|
||||
#define NUL '\0'
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
parse_debug_category (gchar * str, const gchar ** category)
|
||||
{
|
||||
if (!str)
|
||||
return FALSE;
|
||||
|
||||
/* works in place */
|
||||
g_strstrip (str);
|
||||
|
||||
if (str[0] != NUL) {
|
||||
*category = str;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_debug_level (gchar * str, gint * level)
|
||||
{
|
||||
if (!str)
|
||||
return FALSE;
|
||||
|
||||
/* works in place */
|
||||
g_strstrip (str);
|
||||
|
||||
if (str[0] != NUL && str[1] == NUL
|
||||
&& str[0] >= '0' && str[0] < '0' + GST_LEVEL_COUNT) {
|
||||
*level = str[0] - '0';
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
parse_debug_list (const gchar * list)
|
||||
{
|
||||
|
@ -177,33 +222,33 @@ parse_debug_list (const gchar * list)
|
|||
|
||||
g_return_if_fail (list != NULL);
|
||||
|
||||
walk = split = g_strsplit (list, ",", 0);
|
||||
split = g_strsplit (list, ",", 0);
|
||||
|
||||
while (walk[0]) {
|
||||
gchar **values = g_strsplit (walk[0], ":", 2);
|
||||
for (walk = split; *walk; walk++) {
|
||||
if (strchr (*walk, ':')) {
|
||||
gchar **values = g_strsplit (*walk, ":", 2);
|
||||
|
||||
if (values[0] && values[1]) {
|
||||
gint level = 0;
|
||||
if (values[0] && values[1]) {
|
||||
gint level;
|
||||
const gchar *category;
|
||||
|
||||
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);
|
||||
if (parse_debug_category (values[0], &category)
|
||||
&& parse_debug_level (values[1], &level))
|
||||
gst_debug_set_threshold_for_name (category, level);
|
||||
}
|
||||
|
||||
g_strfreev (values);
|
||||
} else {
|
||||
gint level;
|
||||
|
||||
if (parse_debug_level (*walk, &level))
|
||||
gst_debug_set_default_threshold (level);
|
||||
}
|
||||
g_strfreev (values);
|
||||
walk++;
|
||||
}
|
||||
|
||||
g_strfreev (split);
|
||||
}
|
||||
|
||||
#ifndef NUL
|
||||
#define NUL '\0'
|
||||
#endif
|
||||
|
||||
/**
|
||||
* gst_init_get_popt_table:
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue