From: Jaroslav Kysela Date: Sun, 3 Sep 2017 08:07:50 +0000 (+0200) Subject: libav: try to fix the log trouble with NULL logctx X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b580b6b0e1895d1492ec9bbd6ae40a4ceafff4c6;p=thirdparty%2Ftvheadend.git libav: try to fix the log trouble with NULL logctx --- diff --git a/src/libav.c b/src/libav.c index 6531eca9e..5a6b0ea18 100644 --- a/src/libav.c +++ b/src/libav.c @@ -17,7 +17,7 @@ libav_log_callback(void *ptr, int level, const char *fmt, va_list vl) if (level != AV_LOG_QUIET && ((level <= AV_LOG_INFO) || (tvhlog_options & TVHLOG_OPT_LIBAV))) { - class_name = av_default_item_name(ptr); + class_name = ptr ? av_default_item_name(ptr) : ""; l1 = strlen(fmt); l2 = strlen(class_name); @@ -26,7 +26,8 @@ libav_log_callback(void *ptr, int level, const char *fmt, va_list vl) return; strcpy(fmt1, class_name); - strcat(fmt1, ": "); + if (class_name[0]) + strcat(fmt1, ": "); strcat(fmt1, fmt); /* remove trailing newline */ diff --git a/src/transcoding/transcode/context.c b/src/transcoding/transcode/context.c index 7ce2a7c5a..5543defbd 100644 --- a/src/transcoding/transcode/context.c +++ b/src/transcoding/transcode/context.c @@ -486,6 +486,13 @@ tvh_context_open_filters(TVHContext *self, const char *source_name, const char *source_args, const char *filters, const char *sink_name, ...) { + static const AVClass logclass = { + .class_name = "TVHGraph", + .version = 1, + }; + struct { + const AVClass *class; + } logctx = { &logclass }; AVFilter *iavflt = NULL, *oavflt = NULL; AVFilterInOut *iavfltio = NULL, *oavfltio = NULL; AVBufferSrcParameters *par = NULL; @@ -591,7 +598,7 @@ tvh_context_open_filters(TVHContext *self, avfilter_graph_set_auto_convert(self->avfltgraph, AVFILTER_AUTO_CONVERT_NONE); - if ((ret = avfilter_graph_config(self->avfltgraph, NULL)) < 0) { + if ((ret = avfilter_graph_config(self->avfltgraph, &logctx)) < 0) { tvh_context_log(self, LOG_ERR, "filters: failed to config filter graph"); }