]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
libav: try to fix the log trouble with NULL logctx
authorJaroslav Kysela <perex@perex.cz>
Sun, 3 Sep 2017 08:07:50 +0000 (10:07 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sun, 3 Sep 2017 08:07:50 +0000 (10:07 +0200)
src/libav.c
src/transcoding/transcode/context.c

index 6531eca9e666f7f2693388bd99c4b43d27748623..5a6b0ea18006309d7913649c7f0141f5ec23fc5c 100644 (file)
@@ -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 */
index 7ce2a7c5a09fe12cff07a7bae6fd1e0771601642..5543defbdcba3e9b27659c7485fb7cb199f80c11 100644 (file)
@@ -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");
     }