[FFmpeg-cvslog] avcodec/libdav1d: route dav1d internal logs through av_log()

James Almer git at videolan.org
Wed Mar 13 00:24:26 EET 2019


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Mar  1 14:48:35 2019 -0300| [dcf64b599d3132bec3a9f52139de716d70f0fb4e] | committer: James Almer

avcodec/libdav1d: route dav1d internal logs through av_log()

Bump the minimum required version to the first one with the logger API callback.

Reviewed-by: Vittorio Giovara <vittorio.giovara at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dcf64b599d3132bec3a9f52139de716d70f0fb4e
---

 configure             | 2 +-
 libavcodec/libdav1d.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index dcead3a300..938ff10da5 100755
--- a/configure
+++ b/configure
@@ -6142,7 +6142,7 @@ enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
                                die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
 enabled libcaca           && require_pkg_config libcaca caca caca.h caca_create_canvas
 enabled libcodec2         && require libcodec2 codec2/codec2.h codec2_create -lcodec2
-enabled libdav1d          && require_pkg_config libdav1d "dav1d >= 0.1.0" "dav1d/dav1d.h" dav1d_version
+enabled libdav1d          && require_pkg_config libdav1d "dav1d >= 0.2.1" "dav1d/dav1d.h" dav1d_version
 enabled libdavs2          && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
 enabled libdc1394         && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
 enabled libdrm            && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index ed02da4ebf..459bbae687 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -37,6 +37,13 @@ typedef struct Libdav1dContext {
     int apply_grain;
 } Libdav1dContext;
 
+static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl)
+{
+    AVCodecContext *c = opaque;
+
+    av_vlog(c, AV_LOG_ERROR, fmt, vl);
+}
+
 static av_cold int libdav1d_init(AVCodecContext *c)
 {
     Libdav1dContext *dav1d = c->priv_data;
@@ -46,6 +53,8 @@ static av_cold int libdav1d_init(AVCodecContext *c)
     av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version());
 
     dav1d_default_settings(&s);
+    s.logger.cookie = c;
+    s.logger.callback = libdav1d_log_callback;
     s.n_tile_threads = dav1d->tile_threads;
     s.apply_grain = dav1d->apply_grain;
     s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS);



More information about the ffmpeg-cvslog mailing list