Commit 46d084ac authored by Alexandre Julliard's avatar Alexandre Julliard

winegstreamer: Respect debug channels configuration for error output.

Avoids spamming stderr when debug output is disabled.
parent db4ea9ef
...@@ -68,6 +68,8 @@ struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buff ...@@ -68,6 +68,8 @@ struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buff
{ {
.type = type, .type = type,
.unlimited_buffering = unlimited_buffering, .unlimited_buffering = unlimited_buffering,
.err_on = ERR_ON(quartz),
.warn_on = WARN_ON(quartz),
}; };
TRACE("type %#x, unlimited_buffering %d.\n", type, unlimited_buffering); TRACE("type %#x, unlimited_buffering %d.\n", type, unlimited_buffering);
......
...@@ -157,6 +157,8 @@ struct wg_parser_create_params ...@@ -157,6 +157,8 @@ struct wg_parser_create_params
struct wg_parser *parser; struct wg_parser *parser;
enum wg_parser_type type; enum wg_parser_type type;
bool unlimited_buffering; bool unlimited_buffering;
bool err_on;
bool warn_on;
}; };
struct wg_parser_connect_params struct wg_parser_connect_params
......
...@@ -76,6 +76,7 @@ struct wg_parser ...@@ -76,6 +76,7 @@ struct wg_parser
pthread_cond_t init_cond; pthread_cond_t init_cond;
bool no_more_pads, has_duration, error; bool no_more_pads, has_duration, error;
bool err_on, warn_on;
pthread_cond_t read_cond, read_done_cond; pthread_cond_t read_cond, read_done_cond;
struct struct
...@@ -1071,8 +1072,11 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use ...@@ -1071,8 +1072,11 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use
{ {
case GST_MESSAGE_ERROR: case GST_MESSAGE_ERROR:
gst_message_parse_error(msg, &err, &dbg_info); gst_message_parse_error(msg, &err, &dbg_info);
if (parser->err_on)
{
fprintf(stderr, "winegstreamer error: %s: %s\n", GST_OBJECT_NAME(msg->src), err->message); fprintf(stderr, "winegstreamer error: %s: %s\n", GST_OBJECT_NAME(msg->src), err->message);
fprintf(stderr, "winegstreamer error: %s: %s\n", GST_OBJECT_NAME(msg->src), dbg_info); fprintf(stderr, "winegstreamer error: %s: %s\n", GST_OBJECT_NAME(msg->src), dbg_info);
}
g_error_free(err); g_error_free(err);
g_free(dbg_info); g_free(dbg_info);
pthread_mutex_lock(&parser->mutex); pthread_mutex_lock(&parser->mutex);
...@@ -1083,8 +1087,11 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use ...@@ -1083,8 +1087,11 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use
case GST_MESSAGE_WARNING: case GST_MESSAGE_WARNING:
gst_message_parse_warning(msg, &err, &dbg_info); gst_message_parse_warning(msg, &err, &dbg_info);
if (parser->warn_on)
{
fprintf(stderr, "winegstreamer warning: %s: %s\n", GST_OBJECT_NAME(msg->src), err->message); fprintf(stderr, "winegstreamer warning: %s: %s\n", GST_OBJECT_NAME(msg->src), err->message);
fprintf(stderr, "winegstreamer warning: %s: %s\n", GST_OBJECT_NAME(msg->src), dbg_info); fprintf(stderr, "winegstreamer warning: %s: %s\n", GST_OBJECT_NAME(msg->src), dbg_info);
}
g_error_free(err); g_error_free(err);
g_free(dbg_info); g_free(dbg_info);
break; break;
...@@ -1571,7 +1578,8 @@ static NTSTATUS wg_parser_create(void *args) ...@@ -1571,7 +1578,8 @@ static NTSTATUS wg_parser_create(void *args)
pthread_cond_init(&parser->read_done_cond, NULL); pthread_cond_init(&parser->read_done_cond, NULL);
parser->init_gst = init_funcs[params->type]; parser->init_gst = init_funcs[params->type];
parser->unlimited_buffering = params->unlimited_buffering; parser->unlimited_buffering = params->unlimited_buffering;
parser->err_on = params->err_on;
parser->warn_on = params->warn_on;
GST_DEBUG("Created winegstreamer parser %p.", parser); GST_DEBUG("Created winegstreamer parser %p.", parser);
params->parser = parser; params->parser = parser;
return S_OK; return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment