]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
define a new logging scheme for transcoding
authorUkn Unknown <4031821+uknunknown@users.noreply.github.com>
Mon, 22 Sep 2025 03:36:45 +0000 (20:36 -0700)
committerFlole <Flole998@users.noreply.github.com>
Sat, 18 Oct 2025 01:39:17 +0000 (03:39 +0200)
This PR transitions the logging and dictionary-setting macros from using the old av_dict_set_int() macro to the new function codec_av_dict_set_int(), and updates various log subsystem references accordingly. Key changes include:
- Removing the LS_VAAPI logging entry in favor of transcoding-specific logging functions.
- Updating dictionary-setting macros across multiple codec source files with an additional subsystem parameter.
- Adjusting subsystem identifiers (e.g., LS_VAAPI → LS_LIBAV) in selected logging calls.

22 files changed:
src/libav.c
src/transcoding/codec/codecs/aac.c
src/transcoding/codec/codecs/flac.c
src/transcoding/codec/codecs/libs/libfdk_aac.c
src/transcoding/codec/codecs/libs/libopus.c
src/transcoding/codec/codecs/libs/libtheora.c
src/transcoding/codec/codecs/libs/libvorbis.c
src/transcoding/codec/codecs/libs/libvpx.c
src/transcoding/codec/codecs/libs/libx26x.c
src/transcoding/codec/codecs/libs/nvenc.c
src/transcoding/codec/codecs/libs/omx.c
src/transcoding/codec/codecs/libs/vaapi.c
src/transcoding/codec/codecs/mp2.c
src/transcoding/codec/codecs/mpeg2video.c
src/transcoding/codec/codecs/vorbis.c
src/transcoding/codec/internals.h
src/transcoding/codec/profile_audio_class.c
src/transcoding/codec/profile_class.c
src/transcoding/codec/profile_video_class.c
src/transcoding/transcode/hwaccels/vaapi.c
src/tvhlog.c
src/tvhlog.h

index c633d05c920336fa2937aff18ba3eeeb6f850f9b..04f5dd23f37a0aece0b1864f9740dc82762cbb90 100644 (file)
@@ -238,7 +238,7 @@ static void libav_va_log(int severity, const char *msg)
   l = strlen(s);
   if (s[l-1] == '\n')
     s[l-1] = '\0';
-  tvhlog(severity, LS_VAAPI, "%s", s);
+  tvhlog(severity, LS_LIBAV, "%s", s);
 }
 
 #if VA_CHECK_VERSION(1, 0, 0)
index 63239083aab03856b868113b80b9f9dc9c3dd67f..07ef1d6cd588bfa87aefb4dfc0db4cf386210172 100644 (file)
@@ -69,12 +69,12 @@ tvh_codec_profile_aac_open(tvh_codec_profile_aac_t *self, AVDictionary **opts)
 {
     // bit_rate or global_quality
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_AAC, opts, self->bit_rate);
     }
     else {
-        AV_DICT_SET_GLOBAL_QUALITY(opts, self->qscale, 1);
+        AV_DICT_SET_GLOBAL_QUALITY(LST_AAC, opts, self->qscale, 1);
     }
-    AV_DICT_SET(opts, "aac_coder", self->coder, 0);
+    AV_DICT_SET(LST_AAC, opts, "aac_coder", self->coder, 0);
     return 0;
 }
 
index 3bb62c45453dd25fae29ab84f7754d979ae7c079..6022f537b5e3f4d8b68612f40e276c9abc48dc8d 100644 (file)
@@ -60,7 +60,7 @@ typedef struct {
 static int
 tvh_codec_profile_flac_open(tvh_codec_profile_flac_t *self, AVDictionary **opts)
 {
-    AV_DICT_SET_INT(opts, "compression_level", self->compression_level, 0);
+    AV_DICT_SET_INT(LST_FLAC, opts, "compression_level", self->compression_level, 0);
     return 0;
 }
 
index 6aeeb43d294dbe3c7d8632080fd1f1a509ed3e28..ba8efa6cb5c9a35549e1325fbf46d1cec48db191 100644 (file)
@@ -36,17 +36,17 @@ static int
 tvh_codec_profile_libfdk_aac_open(tvh_codec_profile_libfdk_aac_t *self,
                                   AVDictionary **opts)
 {
-    AV_DICT_SET_FLAGS_GLOBAL_HEADER(opts);
+    AV_DICT_SET_FLAGS_GLOBAL_HEADER(LST_LIBFDKAAC, opts);
     // bit_rate or vbr
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_LIBFDKAAC, opts, self->bit_rate);
     }
     else {
-        AV_DICT_SET_INT(opts, "vbr", self->vbr ? self->vbr : 3, 0);
+        AV_DICT_SET_INT(LST_LIBFDKAAC, opts, "vbr", self->vbr ? self->vbr : 3, 0);
     }
-    AV_DICT_SET_INT(opts, "afterburner", self->afterburner, 0);
-    AV_DICT_SET_INT(opts, "eld_sbr", self->eld_sbr, 0);
-    AV_DICT_SET_INT(opts, "signaling", self->signaling, 0);
+    AV_DICT_SET_INT(LST_LIBFDKAAC, opts, "afterburner", self->afterburner, 0);
+    AV_DICT_SET_INT(LST_LIBFDKAAC, opts, "eld_sbr", self->eld_sbr, 0);
+    AV_DICT_SET_INT(LST_LIBFDKAAC, opts, "signaling", self->signaling, 0);
     return 0;
 }
 
index 0efdca617d6bfd76c60595fe7d341c6fdb249fc7..bc4f14589eeb1b87e7fb69b11dd2a37752a613b5 100644 (file)
@@ -37,10 +37,10 @@ static int
 tvh_codec_profile_libopus_open(tvh_codec_profile_libopus_t *self,
                                AVDictionary **opts)
 {
-    AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
-    AV_DICT_SET_INT(opts, "vbr", self->vbr, 0);
-    AV_DICT_SET_INT(opts, "application", self->application, 0);
-    AV_DICT_SET_INT(opts, "compression_level", self->complexity, 0);
+    AV_DICT_SET_BIT_RATE(LST_LIBOPUS, opts, self->bit_rate);
+    AV_DICT_SET_INT(LST_LIBOPUS, opts, "vbr", self->vbr, 0);
+    AV_DICT_SET_INT(LST_LIBOPUS, opts, "application", self->application, 0);
+    AV_DICT_SET_INT(LST_LIBOPUS, opts, "compression_level", self->complexity, 0);
     return 0;
 }
 
index cc64ed0af419a687205f5234cc92831e700a392b..46e5561948de4d405c3eed1f6beb8087b5129edb 100644 (file)
@@ -28,10 +28,10 @@ tvh_codec_profile_libtheora_open(TVHCodecProfile *self, AVDictionary **opts)
 {
     // bit_rate or global_quality
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_LIBTHEORA, opts, self->bit_rate);
     }
     else {
-        AV_DICT_SET_GLOBAL_QUALITY(opts, self->qscale, 6);
+        AV_DICT_SET_GLOBAL_QUALITY(LST_LIBTHEORA, opts, self->qscale, 6);
     }
     return 0;
 }
index cc66aad3ac3cd182c6567eb53bb8ade75504451a..50cede84b0766d6ce3fc07e6aa3a5273f1a36398 100644 (file)
@@ -64,10 +64,10 @@ tvh_codec_profile_libvorbis_open(TVHCodecProfile *self, AVDictionary **opts)
 {
     // bit_rate or global_quality
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_LIBVORBIS, opts, self->bit_rate);
     }
     else {
-        AV_DICT_SET_GLOBAL_QUALITY(opts, self->qscale, 5);
+        AV_DICT_SET_GLOBAL_QUALITY(LST_LIBVORBIS, opts, self->qscale, 5);
     }
     return 0;
 }
index ee9445f3cce3461442f1d5b65fc190c403c5ab61..8e7d464fe189e72f26ac782cb88b3edd0b7e3cb5 100644 (file)
@@ -37,15 +37,15 @@ static int
 tvh_codec_profile_libvpx_open(tvh_codec_profile_libvpx_t *self,
                               AVDictionary **opts)
 {
-    AV_DICT_SET_TVH_REQUIRE_META(opts, 0);
-    AV_DICT_SET_BIT_RATE(opts, self->bit_rate ? self->bit_rate : 2560);
+    AV_DICT_SET_TVH_REQUIRE_META(LST_LIBVPX, opts, 0);
+    AV_DICT_SET_BIT_RATE(LST_LIBVPX, opts, self->bit_rate ? self->bit_rate : 2560);
     if (self->crf) {
-        AV_DICT_SET_CRF(opts, self->crf, 10);
+        AV_DICT_SET_CRF(LST_LIBVPX, opts, self->crf, 10);
     }
-    AV_DICT_SET_INT(opts, "deadline", self->deadline, 0);
-    AV_DICT_SET_INT(opts, "cpu-used", self->cpu_used, 0);
-    AV_DICT_SET_INT(opts, "tune", self->tune, 0);
-    AV_DICT_SET_INT(opts, "threads", 0, 0);
+    AV_DICT_SET_INT(LST_LIBVPX, opts, "deadline", self->deadline, 0);
+    AV_DICT_SET_INT(LST_LIBVPX, opts, "cpu-used", self->cpu_used, 0);
+    AV_DICT_SET_INT(LST_LIBVPX, opts, "tune", self->tune, 0);
+    AV_DICT_SET_INT(LST_LIBVPX, opts, "threads", 0, 0);
     return 0;
 }
 
index abe3ca443289f03fbba951328e693d73fa2b1c7e..f142fa537a3ad6a6d9c86f0cb619cc91b598dabb 100644 (file)
@@ -58,8 +58,8 @@ static int
 tvh_codec_profile_libx26x_open(tvh_codec_profile_libx26x_t *self,
                                AVDictionary **opts)
 {
-    AV_DICT_SET(opts, "preset", self->preset, 0);
-    AV_DICT_SET(opts, "tune", self->tune, 0);
+    AV_DICT_SET(LST_LIBX26X, opts, "preset", self->preset, 0);
+    AV_DICT_SET(LST_LIBX26X, opts, "tune", self->tune, 0);
     return 0;
 }
 
@@ -132,14 +132,14 @@ tvh_codec_profile_libx264_open(tvh_codec_profile_libx26x_t *self,
 {
     // bit_rate or crf
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_LIBX26X, opts, self->bit_rate);
     }
     else {
-        AV_DICT_SET_CRF(opts, self->crf, 15);
+        AV_DICT_SET_CRF(LST_LIBX26X, opts, self->crf, 15);
     }
     // params
     if (self->params && strlen(self->params)) {
-        AV_DICT_SET(opts, "x264-params", self->params, 0);
+        AV_DICT_SET(LST_LIBX26X, opts, "x264-params", self->params, 0);
     }
     return 0;
 }
@@ -231,14 +231,14 @@ tvh_codec_profile_libx265_open(tvh_codec_profile_libx26x_t *self,
 {
     // bit_rate or crf
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_LIBX26X, opts, self->bit_rate);
     }
     else {
-        AV_DICT_SET_CRF(opts, self->crf, 18);
+        AV_DICT_SET_CRF(LST_LIBX26X, opts, self->crf, 18);
     }
     // params
     if (self->params && strlen(self->params)) {
-        AV_DICT_SET(opts, "x265-params", self->params, 0);
+        AV_DICT_SET(LST_LIBX26X, opts, "x265-params", self->params, 0);
     }
     return 0;
 }
index 914fb5ac2b8ce7b09663808b882059f816f347bc..4eaa6fb936d658b847d3a801d0ff2c20141326e6 100644 (file)
@@ -89,7 +89,7 @@
 #define NV_ENC_LEVEL_HEVC_62                        186
 
 #define AV_DICT_SET_CQ(d, v, a) \
-    AV_DICT_SET_INT((d), "cq", (v) ? (v) : (a), AV_DICT_DONT_OVERWRITE)
+    AV_DICT_SET_INT(LST_NVENC, (d), "cq", (v) ? (v) : (a), AV_DICT_DONT_OVERWRITE)
 
 
 /* nvenc ==================================================================== */
@@ -132,19 +132,19 @@ tvh_codec_profile_nvenc_open(tvh_codec_profile_nvenc_t *self,
     };
     const char *s;
 
-    AV_DICT_SET_INT(opts, "gpu", MINMAX(self->devicenum, 0, 15), 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "gpu", MINMAX(self->devicenum, 0, 15), 0);
     if (self->preset != PRESET_DEFAULT &&
         (s = val2str(self->profile, presettab)) != NULL) {
-        AV_DICT_SET(opts, "preset", s, 0);
+        AV_DICT_SET(LST_NVENC, opts, "preset", s, 0);
     }
     if (self->rc != NV_ENC_PARAMS_RC_AUTO &&
         (s = val2str(self->rc, rctab)) != NULL) {
-        AV_DICT_SET(opts, "rc", s, 0);
+        AV_DICT_SET(LST_NVENC, opts, "rc", s, 0);
     }
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_NVENC, opts, self->bit_rate);
     }
-    AV_DICT_SET_INT(opts, "quality", self->quality, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "quality", self->quality, 0);
     return 0;
 }
 
@@ -318,23 +318,23 @@ tvh_codec_profile_nvenc_h264_open(tvh_codec_profile_nvenc_t *self,
 
     if (self->level != NV_ENC_LEVEL_AUTOSELECT &&
         (s = val2str(self->level, leveltab)) != NULL) {
-        AV_DICT_SET(opts, "level", s, 0);
+        AV_DICT_SET(LST_NVENC, opts, "level", s, 0);
     }
 
     if (self->nvenc_profile != FF_AV_PROFILE_UNKNOWN &&
         (s = val2str(self->nvenc_profile, profiletab)) != NULL) {
-        AV_DICT_SET(opts, "profile", s, 0);
+        AV_DICT_SET(LST_NVENC, opts, "profile", s, 0);
     }
     
     // ------ Set Defaults ---------
-    AV_DICT_SET_INT(opts, "qmin", -1, 0);
-    AV_DICT_SET_INT(opts, "qmax", -1, 0);
-    AV_DICT_SET_INT(opts, "qdiff", -1, 0);
-    AV_DICT_SET_INT(opts, "qblur", -1, 0);
-    AV_DICT_SET_INT(opts, "qcomp", -1, 0);
-    AV_DICT_SET_INT(opts, "g", 250, 0);
-    AV_DICT_SET_INT(opts, "bf", 0, 0);
-    AV_DICT_SET_INT(opts, "refs", 0, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qmin", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qmax", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qdiff", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qblur", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qcomp", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "g", 250, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "bf", 0, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "refs", 0, 0);
     return 0;
 }
 
@@ -438,23 +438,23 @@ tvh_codec_profile_nvenc_hevc_open(tvh_codec_profile_nvenc_t *self,
 
     if (self->level != NV_ENC_LEVEL_AUTOSELECT &&
         (s = val2str(self->level, leveltab)) != NULL) {
-        AV_DICT_SET(opts, "level", s, 0);
+        AV_DICT_SET(LST_NVENC, opts, "level", s, 0);
         }
 
     if (self->nvenc_profile != FF_AV_PROFILE_UNKNOWN &&
         (s = val2str(self->nvenc_profile, profiletab)) != NULL) {
-        AV_DICT_SET(opts, "profile", s, 0);
+        AV_DICT_SET(LST_NVENC, opts, "profile", s, 0);
         }
     
     // ------ Set Defaults ---------
-    AV_DICT_SET_INT(opts, "qmin", -1, 0);
-    AV_DICT_SET_INT(opts, "qmax", -1, 0);
-    AV_DICT_SET_INT(opts, "qdiff", -1, 0);
-    AV_DICT_SET_INT(opts, "qblur", -1, 0);
-    AV_DICT_SET_INT(opts, "qcomp", -1, 0);
-    AV_DICT_SET_INT(opts, "g", 250, 0);
-    AV_DICT_SET_INT(opts, "bf", 0, 0);
-    AV_DICT_SET_INT(opts, "refs", 0, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qmin", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qmax", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qdiff", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qblur", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "qcomp", -1, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "g", 250, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "bf", 0, 0);
+    AV_DICT_SET_INT(LST_NVENC, opts, "refs", 0, 0);
     return 0;
 }
 
index 916fcddbbd8fd90f73d4036fc3fe71fc8a3e28df..b6dc4b19d178d7c2b79433fdac14f22b343a0129 100644 (file)
@@ -34,18 +34,18 @@ typedef struct {
 static int
 tvh_codec_profile_omx_open(tvh_codec_profile_omx_t *self, AVDictionary **opts)
 {
-    AV_DICT_SET_FLAGS_GLOBAL_HEADER(opts);
+    AV_DICT_SET_FLAGS_GLOBAL_HEADER(LST_OMX, opts);
     // bit_rate
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_OMX, opts, self->bit_rate);
     }
     if (self->libname && strlen(self->libname)) {
-        AV_DICT_SET(opts, "omx_libname", self->libname, 0);
+        AV_DICT_SET(LST_OMX, opts, "omx_libname", self->libname, 0);
     }
     if (self->libprefix && strlen(self->libprefix)) {
-        AV_DICT_SET(opts, "omx_libprefix", self->libprefix, 0);
+        AV_DICT_SET(LST_OMX, opts, "omx_libprefix", self->libprefix, 0);
     }
-    AV_DICT_SET_INT(opts, "zerocopy", self->zerocopy, 0);
+    AV_DICT_SET_INT(LST_OMX, opts, "zerocopy", self->zerocopy, 0);
     return 0;
 }
 
index 1cc77fae36d15dbefe88c82034d1f00c751a4483..32324252e012ff782ea757894ba258f89971e13e 100644 (file)
@@ -309,7 +309,7 @@ tvh_codec_profile_vaapi_open(tvh_codec_profile_vaapi_t *self,
                              AVDictionary **opts)
 {
     // pix_fmt
-    AV_DICT_SET_PIX_FMT(opts, self->pix_fmt, AV_PIX_FMT_VAAPI);
+    AV_DICT_SET_PIX_FMT(LST_VAAPI, opts, self->pix_fmt, AV_PIX_FMT_VAAPI);
     return 0;
 }
 
@@ -533,10 +533,10 @@ tvh_codec_profile_vaapi_h264_open(tvh_codec_profile_vaapi_t *self,
     int int_max_bitrate = (int)((double)(self->max_bit_rate) * 1024.0 * (1.0 + (self->bit_rate_scale_factor * ((double)(self->size.den) - 480.0) / 480.0)));
     // force max_bitrate to be >= with bitrate (to avoid crash)
     if (int_bitrate > int_max_bitrate) {
-        tvherror(LS_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
+        tvherror_transcode(LST_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
         int_max_bitrate = int_bitrate;
     }
-    tvhinfo(LS_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
+    tvhinfo_transcode(LST_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
     // https://wiki.libav.org/Hardware/vaapi
     // https://blog.wmspanel.com/2017/03/vaapi-libva-support-nimble-streamer.html
     // to find available parameters use:
@@ -590,7 +590,7 @@ tvh_codec_profile_vaapi_h264_open(tvh_codec_profile_vaapi_t *self,
     //    6.1             61           E..V.......
     //    6.2             62           E..V.......
     if (self->rc_mode != VAAPI_ENC_PARAMS_RC_SKIP) {
-        AV_DICT_SET_INT(opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
+        AV_DICT_SET_INT(LST_VAAPI, opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
     }
     int tempSupport = 0;
     switch (self->platform) {
@@ -599,39 +599,39 @@ tvh_codec_profile_vaapi_h264_open(tvh_codec_profile_vaapi_t *self,
             // this mode is usefull fur future platform and for debugging.
             if (self->b_reference) {
                 // b_depth
-                AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
             }
             if (self->desired_b_depth >= 0) {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->level != -100) {
-                AV_DICT_SET_INT(opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_INTEL:
@@ -645,16 +645,16 @@ tvh_codec_profile_vaapi_h264_open(tvh_codec_profile_vaapi_t *self,
             if (tempSupport) {
                 if (self->b_reference) {
                     // b_depth
-                    AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                    AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
                 }
                 if (self->desired_b_depth >= 0) {
                     // max_b_frames
-                    AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                    AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
                 }
             }
             else {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", 0, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", 0, AV_DICT_DONT_OVERWRITE);
             }
 
             switch (self->rc_mode) {
@@ -663,54 +663,54 @@ tvh_codec_profile_vaapi_h264_open(tvh_codec_profile_vaapi_t *self,
                 case VAAPI_ENC_PARAMS_RC_AUTO:
                     // for auto --> let the driver decide as requested by documentation
                     if (self->bit_rate) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->max_bit_rate) {
-                            AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                            AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                         }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CONSTQP:
                 case VAAPI_ENC_PARAMS_RC_ICQ:
                     // for constant quality: CQP and ICQ we use qp
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CBR:
                     // for constant bitrate: CBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_VBR:
                     // for variable bitrate: VBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_QVBR:
                     // for variable bitrate: QVBR we use bitrate + qp
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_AVBR:
                     // for variable bitrate: AVBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
             }
@@ -721,22 +721,22 @@ tvh_codec_profile_vaapi_h264_open(tvh_codec_profile_vaapi_t *self,
                 tempSupport = vainfo_encoder_maxQuality(VAINFO_H264);
             }
             if (tempSupport && (self->quality >= 0)) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->level != -100) {
-                AV_DICT_SET_INT(opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_AMD:
@@ -744,38 +744,38 @@ tvh_codec_profile_vaapi_h264_open(tvh_codec_profile_vaapi_t *self,
             // I am unable to confirm this platform because I don't have the HW
             // Is only going to override bf to 0 (as highlited by the previous implementation)
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
-            AV_DICT_SET_INT(opts, "bf", 0, 0);
+            AV_DICT_SET_INT(LST_VAAPI, opts, "bf", 0, 0);
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->level != -100) {
-                AV_DICT_SET_INT(opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
     }
     // force keyframe every 3 sec.
-    AV_DICT_SET(opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
+    AV_DICT_SET(LST_VAAPI, opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
     return 0;
 }
 
@@ -858,10 +858,10 @@ tvh_codec_profile_vaapi_hevc_open(tvh_codec_profile_vaapi_t *self,
     int int_max_bitrate = (int)((double)(self->max_bit_rate) * 1024.0 * (1.0 + (self->bit_rate_scale_factor * ((double)(self->size.den) - 480.0) / 480.0)));
     // force max_bitrate to be >= with bitrate (to avoid crash)
     if (int_bitrate > int_max_bitrate) {
-        tvherror(LS_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
+        tvherror_transcode(LST_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
         int_max_bitrate = int_bitrate;
     }
-    tvhinfo(LS_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
+    tvhinfo_transcode(LST_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
     // https://wiki.libav.org/Hardware/vaapi
     // to find available parameters use:
     // ffmpeg -hide_banner -h encoder=hevc_vaapi
@@ -905,7 +905,7 @@ tvh_codec_profile_vaapi_hevc_open(tvh_codec_profile_vaapi_t *self,
     // -tiles             <image_size> E..V....... Tile columns x rows
 
     if (self->rc_mode != VAAPI_ENC_PARAMS_RC_SKIP) {
-        AV_DICT_SET_INT(opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
+        AV_DICT_SET_INT(LST_VAAPI, opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
     }
     switch (self->platform) {
         case VAAPI_ENC_PLATFORM_UNCONSTRAINED:
@@ -913,53 +913,53 @@ tvh_codec_profile_vaapi_hevc_open(tvh_codec_profile_vaapi_t *self,
             // this mode is usefull fur future platform and for debugging.
             if (self->b_reference) {
                 // b_depth
-                AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
             }
             if (self->desired_b_depth >= 0) {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
             if (self->tier >= 0) {
-                AV_DICT_SET_INT(opts, "tier", self->tier, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "tier", self->tier, AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->level != -100) {
-                AV_DICT_SET_INT(opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_INTEL:
             // Intel
             if (self->b_reference) {
                 // b_depth
-                AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
             }
             if (self->desired_b_depth >= 0) {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
             }
             switch (self->rc_mode) {
                 case VAAPI_ENC_PARAMS_RC_SKIP:
@@ -967,77 +967,77 @@ tvh_codec_profile_vaapi_hevc_open(tvh_codec_profile_vaapi_t *self,
                 case VAAPI_ENC_PARAMS_RC_AUTO:
                     // for auto --> let the driver decide as requested by documentation
                     if (self->bit_rate) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->max_bit_rate) {
-                            AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                            AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                         }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CONSTQP:
                 case VAAPI_ENC_PARAMS_RC_ICQ:
                     // for constant quality: CQP and ICQ we use qp
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CBR:
                     // for constant bitrate: CBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_VBR:
                     // for variable bitrate: VBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_QVBR:
                     // for variable bitrate: QVBR we use bitrate + qp
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_AVBR:
                     // for variable bitrate: AVBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
             }
             if (self->tier >= 0) {
-                AV_DICT_SET_INT(opts, "tier", self->tier, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "tier", self->tier, AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->level != -100) {
-                AV_DICT_SET_INT(opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_AMD:
@@ -1045,41 +1045,41 @@ tvh_codec_profile_vaapi_hevc_open(tvh_codec_profile_vaapi_t *self,
             // I am unable to confirm this platform because I don't have the HW
             // Is only going to override bf to 0 (as highlited by the previous implementation)
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
-            AV_DICT_SET_INT(opts, "bf", 0, 0);
+            AV_DICT_SET_INT(LST_VAAPI, opts, "bf", 0, 0);
             if (self->tier >= 0) {
-                AV_DICT_SET_INT(opts, "tier", self->tier, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "tier", self->tier, AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->level != -100) {
-                AV_DICT_SET_INT(opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "level", self->level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
     }
     // force keyframe every 3 sec.
-    AV_DICT_SET(opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
+    AV_DICT_SET(LST_VAAPI, opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
     return 0;
 }
 
@@ -1170,10 +1170,10 @@ tvh_codec_profile_vaapi_vp8_open(tvh_codec_profile_vaapi_t *self,
     int int_max_bitrate = (int)((double)(self->max_bit_rate) * 1024.0 * (1.0 + (self->bit_rate_scale_factor * ((double)(self->size.den) - 480.0) / 480.0)));
     // force max_bitrate to be >= with bitrate (to avoid crash)
     if (int_bitrate > int_max_bitrate) {
-        tvherror(LS_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
+        tvherror_transcode(LST_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
         int_max_bitrate = int_bitrate;
     }
-    tvhinfo(LS_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
+    tvhinfo_transcode(LST_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
     // https://wiki.libav.org/Hardware/vaapi
     // to find available parameters use:
     // ffmpeg -hide_banner -h encoder=vp8_vaapi
@@ -1193,7 +1193,7 @@ tvh_codec_profile_vaapi_vp8_open(tvh_codec_profile_vaapi_t *self,
     // -loop_filter_sharpness <int>        E..V....... Loop filter sharpness (from 0 to 15) (default 4)
 
     if (self->rc_mode != VAAPI_ENC_PARAMS_RC_SKIP) {
-        AV_DICT_SET_INT(opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
+        AV_DICT_SET_INT(LST_VAAPI, opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
     }
     switch (self->platform) {
         case VAAPI_ENC_PLATFORM_UNCONSTRAINED:
@@ -1201,62 +1201,62 @@ tvh_codec_profile_vaapi_vp8_open(tvh_codec_profile_vaapi_t *self,
             // this mode is usefull fur future platform and for debugging.
             if (self->b_reference) {
                 // b_depth
-                AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
             }
             if (self->desired_b_depth >= 0) {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->global_quality >= 0) {
-                AV_DICT_SET_INT(opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_level >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_sharpness >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_INTEL:
             // Intel
             if (self->b_reference) {
                 // b_depth
-                AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
             }
             if (self->desired_b_depth >= 0) {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->global_quality >= 0) {
-                AV_DICT_SET_INT(opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
             }
             switch (self->rc_mode) {
                 case VAAPI_ENC_PARAMS_RC_SKIP:
@@ -1264,74 +1264,74 @@ tvh_codec_profile_vaapi_vp8_open(tvh_codec_profile_vaapi_t *self,
                 case VAAPI_ENC_PARAMS_RC_AUTO:
                     // for auto --> let the driver decide as requested by documentation
                     if (self->bit_rate) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->max_bit_rate) {
-                            AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                            AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                         }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CONSTQP:
                 case VAAPI_ENC_PARAMS_RC_ICQ:
                     // for constant quality: CQP we use qp
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CBR:
                     // for constant bitrate: CBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_VBR:
                     // for variable bitrate: VBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_QVBR:
                     // for variable bitrate: QVBR we use bitrate + qp
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_AVBR:
                     // for variable bitrate: AVBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_level >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_sharpness >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_AMD:
@@ -1339,44 +1339,44 @@ tvh_codec_profile_vaapi_vp8_open(tvh_codec_profile_vaapi_t *self,
             // I am unable to confirm this platform because I don't have the HW
             // Is only going to override bf to 0 (as highlited by the previous implementation)
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
-            AV_DICT_SET_INT(opts, "bf", 0, 0);
+            AV_DICT_SET_INT(LST_VAAPI, opts, "bf", 0, 0);
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->global_quality >= 0) {
-                AV_DICT_SET_INT(opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_level >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_sharpness >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
     }
     // force keyframe every 3 sec.
-    AV_DICT_SET(opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
+    AV_DICT_SET(LST_VAAPI, opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
     return 0;
 }
 
@@ -1478,10 +1478,10 @@ tvh_codec_profile_vaapi_vp9_open(tvh_codec_profile_vaapi_t *self,
     int int_max_bitrate = (int)((double)(self->max_bit_rate) * 1024.0 * (1.0 + (self->bit_rate_scale_factor * ((double)(self->size.den) - 480.0) / 480.0)));
     // force max_bitrate to be >= with bitrate (to avoid crash)
     if (int_bitrate > int_max_bitrate) {
-        tvherror(LS_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
+        tvherror_transcode(LST_VAAPI, "Bitrate %d kbps is greater than Max bitrate %d kbps, increase Max bitrate to %d kbps", int_bitrate / 1024, int_max_bitrate / 1024, int_bitrate / 1024);
         int_max_bitrate = int_bitrate;
     }
-    tvhinfo(LS_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
+    tvhinfo_transcode(LST_VAAPI, "Bitrate = %d kbps; Buffer size = %d kbps; Max bitrate = %d kbps", int_bitrate / 1024, int_buffer_size / 1024, int_max_bitrate / 1024);
     // https://wiki.libav.org/Hardware/vaapi
     // to find available parameters use:
     // ffmpeg -hide_banner -h encoder=vp9_vaapi
@@ -1501,7 +1501,7 @@ tvh_codec_profile_vaapi_vp9_open(tvh_codec_profile_vaapi_t *self,
     // -loop_filter_sharpness <int>        E..V....... Loop filter sharpness (from 0 to 15) (default 4)
 
     if (self->rc_mode != VAAPI_ENC_PARAMS_RC_SKIP) {
-        AV_DICT_SET_INT(opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
+        AV_DICT_SET_INT(LST_VAAPI, opts, "rc_mode", self->rc_mode, AV_DICT_DONT_OVERWRITE);
     }
     switch (self->platform) {
         case VAAPI_ENC_PLATFORM_UNCONSTRAINED:
@@ -1509,72 +1509,72 @@ tvh_codec_profile_vaapi_vp9_open(tvh_codec_profile_vaapi_t *self,
             // this mode is usefull fur future platform and for debugging.
             if (self->b_reference) {
                 // b_depth
-                AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
             }
             if (self->desired_b_depth >= 0) {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->super_frame) {
                 // according to example from https://trac.ffmpeg.org/wiki/Hardware/VAAPI
                 // -bsf:v vp9_raw_reorder,vp9_superframe
-                AV_DICT_SET(opts, "bsf", "vp9_raw_reorder,vp9_superframe", AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET(LST_VAAPI, opts, "bsf", "vp9_raw_reorder,vp9_superframe", AV_DICT_DONT_OVERWRITE);
             }
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->global_quality >= 0) {
-                AV_DICT_SET_INT(opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_level >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_sharpness >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_INTEL:
             // Intel
             if (self->b_reference) {
                 // b_depth
-                AV_DICT_SET_INT(opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b_depth", self->b_reference, AV_DICT_DONT_OVERWRITE);
             }
             if (self->desired_b_depth >= 0) {
                 // max_b_frames
-                AV_DICT_SET_INT(opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bf", self->desired_b_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->super_frame) {
                 // according to example from https://trac.ffmpeg.org/wiki/Hardware/VAAPI
                 // -bsf:v vp9_raw_reorder,vp9_superframe
-                AV_DICT_SET(opts, "bsf", "vp9_raw_reorder,vp9_superframe", AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET(LST_VAAPI, opts, "bsf", "vp9_raw_reorder,vp9_superframe", AV_DICT_DONT_OVERWRITE);
             }
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->global_quality >= 0) {
-                AV_DICT_SET_INT(opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
             }
             switch (self->rc_mode) {
                 case VAAPI_ENC_PARAMS_RC_SKIP:
@@ -1582,74 +1582,74 @@ tvh_codec_profile_vaapi_vp9_open(tvh_codec_profile_vaapi_t *self,
                 case VAAPI_ENC_PARAMS_RC_AUTO:
                     // for auto --> let the driver decide as requested by documentation
                     if (self->bit_rate) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->max_bit_rate) {
-                            AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                            AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                         }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CONSTQP:
                 case VAAPI_ENC_PARAMS_RC_ICQ:
                     // for constant quality: CQP we use qp
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_CBR:
                     // for constant bitrate: CBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_VBR:
                     // for variable bitrate: VBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_QVBR:
                     // for variable bitrate: QVBR we use bitrate + qp
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
                     }
                     if (self->qp) {
-                        AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
                 case VAAPI_ENC_PARAMS_RC_AVBR:
                     // for variable bitrate: AVBR we use bitrate
                     if (self->bit_rate && self->buff_factor) {
-                        AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                        AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                        AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
                     }
                     break;
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_level >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_sharpness >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
         case VAAPI_ENC_PLATFORM_AMD:
@@ -1657,44 +1657,44 @@ tvh_codec_profile_vaapi_vp9_open(tvh_codec_profile_vaapi_t *self,
             // I am unable to confirm this platform because I don't have the HW
             // Is only going to override bf to 0 (as highlited by the previous implementation)
             if (self->bit_rate) {
-                AV_DICT_SET_INT(opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
-                AV_DICT_SET_INT(opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "b", int_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "bufsize", int_buffer_size, AV_DICT_DONT_OVERWRITE);
             }
             if (self->max_bit_rate) {
-                AV_DICT_SET_INT(opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "maxrate", int_max_bitrate, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qp) {
-                AV_DICT_SET_INT(opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qp", self->qp, AV_DICT_DONT_OVERWRITE);
             }
-            AV_DICT_SET_INT(opts, "bf", 0, 0);
+            AV_DICT_SET_INT(LST_VAAPI, opts, "bf", 0, 0);
             if (self->quality >= 0) {
-                AV_DICT_SET_INT(opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "quality", self->quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->global_quality >= 0) {
-                AV_DICT_SET_INT(opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "global_quality", self->global_quality, AV_DICT_DONT_OVERWRITE);
             }
             if (self->low_power) {
-                AV_DICT_SET_INT(opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "low_power", self->low_power, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_level >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_level", self->loop_filter_level, AV_DICT_DONT_OVERWRITE);
             }
             if (self->loop_filter_sharpness >= 0) {
-                AV_DICT_SET_INT(opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "loop_filter_sharpness", self->loop_filter_sharpness, AV_DICT_DONT_OVERWRITE);
             }
             if (self->async_depth) {
-                AV_DICT_SET_INT(opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "async_depth", self->async_depth, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmin) {
-                AV_DICT_SET_INT(opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmin", self->qmin, AV_DICT_DONT_OVERWRITE);
             }
             if (self->qmax) {
-                AV_DICT_SET_INT(opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
+                AV_DICT_SET_INT(LST_VAAPI, opts, "qmax", self->qmax, AV_DICT_DONT_OVERWRITE);
             }
             break;
     }
     // force keyframe every 3 sec.
-    AV_DICT_SET(opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
+    AV_DICT_SET(LST_VAAPI, opts, "force_key_frames", "expr:gte(t,n_forced*3)", AV_DICT_DONT_OVERWRITE);
     return 0;
 }
 
index e26ad3eb89f211c813dd7638bf36b2249e22a344..7cd2f22fbc2dab40d37f8cfe213225b58a4760ce 100644 (file)
 static int
 tvh_codec_profile_mp2_open(TVHCodecProfile *self, AVDictionary **opts)
 {
-    AV_DICT_SET_TVH_REQUIRE_META(opts, 0);
+    AV_DICT_SET_TVH_REQUIRE_META(LST_MP2, opts, 0);
     // bit_rate
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_MP2, opts, self->bit_rate);
     }
     return 0;
 }
index d50601f87b6622cefe3ce3744b4fabf7b00020ed..6662f6dd8c3db993fe4debd64a03be31eb3a76d3 100644 (file)
@@ -28,10 +28,10 @@ tvh_codec_profile_mpeg2video_open(TVHCodecProfile *self, AVDictionary **opts)
 {
     // bit_rate or global_quality
     if (self->bit_rate) {
-        AV_DICT_SET_BIT_RATE(opts, self->bit_rate);
+        AV_DICT_SET_BIT_RATE(LST_MPEG2VIDEO, opts, self->bit_rate);
     }
     else {
-        AV_DICT_SET_GLOBAL_QUALITY(opts, self->qscale, 5);
+        AV_DICT_SET_GLOBAL_QUALITY(LST_MPEG2VIDEO, opts, self->qscale, 5);
     }
     return 0;
 }
index 17a718c88bb0b947be24334e648e13b59142e0ce..4d084e56582186605a1e6781cf46701f202389c1 100644 (file)
@@ -26,7 +26,7 @@
 static int
 tvh_codec_profile_vorbis_open(TVHCodecProfile *self, AVDictionary **opts)
 {
-    AV_DICT_SET_GLOBAL_QUALITY(opts, self->qscale, 5);
+    AV_DICT_SET_GLOBAL_QUALITY(LST_VORBIS, opts, self->qscale, 5);
     return 0;
 }
 
index f60b77be425ce074cc8556c523876bf2dcd9923e..34add314de627a39ea727be3f710097084932822 100644 (file)
     _tvh_codec_getattr(c, a, AVMEDIA_TYPE_AUDIO, TVHAudioCodec)
 
 
-#define AV_DICT_SET(d, k, v, f) \
+#define tvhdebug_transcode(s, ...) \
     do { \
-        if (av_dict_set((d), (k), (v), (f)) < 0) { \
+        char log_out[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX]; \
+        tvh_concatenate_subsystem_with_logs(log_out, (s), ##__VA_ARGS__); \
+        tvhdebug( LS_TRANSCODE, "%s", log_out); \
+    } while (0)
+
+#define tvhinfo_transcode(s, ...) \
+    do { \
+        char log_out[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX]; \
+        tvh_concatenate_subsystem_with_logs(log_out, (s), ##__VA_ARGS__); \
+        tvhinfo( LS_TRANSCODE, "%s", log_out); \
+    } while (0)
+
+#define tvhwarn_transcode(s, ...) \
+    do { \
+        char log_out[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX]; \
+        tvh_concatenate_subsystem_with_logs(log_out, (s), ##__VA_ARGS__); \
+        tvhwarn( LS_TRANSCODE, "%s", log_out); \
+    } while (0)
+
+#define tvhnotice_transcode(s, ...) \
+    do { \
+        char log_out[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX]; \
+        tvh_concatenate_subsystem_with_logs(log_out, (s), ##__VA_ARGS__); \
+        tvhnotice( LS_TRANSCODE, "%s", log_out); \
+    } while (0)
+
+#define tvherror_transcode(s, ...) \
+    do { \
+        char log_out[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX]; \
+        tvh_concatenate_subsystem_with_logs(log_out, (s), ##__VA_ARGS__); \
+        tvherror( LS_TRANSCODE, "%s", log_out); \
+    } while (0)
+
+#define tvhalert_transcode(s, ...) \
+    do { \
+        char log_out[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX]; \
+        tvh_concatenate_subsystem_with_logs(log_out, (s), ##__VA_ARGS__); \
+        tvhalert( LS_TRANSCODE, "%s", log_out); \
+    } while (0)
+
+#define tvhtrace_transcode(s, ...) \
+    do { \
+        char log_out[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX]; \
+        tvh_concatenate_subsystem_with_logs(log_out, (s), ##__VA_ARGS__); \
+        tvhtrace( LS_TRANSCODE, "%s", log_out); \
+    } while (0)
+
+#define AV_DICT_SET(s, d, k, v, f) \
+    do { \
+        int ret = av_dict_set((d), (k), (v), (f)); \
+        if (ret < 0) { \
+            tvherror_transcode((s), "Unable to write key '%s' with value '%s' due to error '%s'" , (k), (v), av_err2str((ret)));\
             return -1; \
         } \
     } while (0)
 
-#define AV_DICT_SET_INT(d, k, v, f) \
+#define AV_DICT_SET_INT(s, d, k, v, f) \
     do { \
-        if (av_dict_set_int((d), (k), (v), (f)) < 0) { \
+        int ret = av_dict_set_int((d), (k), (int64_t)(v), (f)); \
+        if (ret < 0) { \
+            tvherror_transcode((s), "Unable to write key '%s' with value %"PRId64" due to error '%s'" , (k), (int64_t)(v), av_err2str((ret)));\
             return -1; \
         } \
     } while (0)
 
-#define AV_DICT_SET_TVH_REQUIRE_META(d, v) \
-    AV_DICT_SET_INT((d), "tvh_require_meta", (v), AV_DICT_DONT_OVERWRITE)
+#define AV_DICT_SET_TVH_REQUIRE_META(s, d, v) \
+    AV_DICT_SET_INT((s), (d), "tvh_require_meta", (v), AV_DICT_DONT_OVERWRITE)
 
-#define AV_DICT_SET_FLAGS(d, v) \
-    AV_DICT_SET((d), "flags", (v), AV_DICT_APPEND)
+#define AV_DICT_SET_FLAGS(s, d, v) \
+    AV_DICT_SET((s), (d), "flags", (v), AV_DICT_APPEND)
 
-#define AV_DICT_SET_FLAGS_GLOBAL_HEADER(d) \
-    AV_DICT_SET_FLAGS((d), "+global_header")
+#define AV_DICT_SET_FLAGS_GLOBAL_HEADER(s, d) \
+    AV_DICT_SET_FLAGS((s), (d), "+global_header")
 
-#define AV_DICT_SET_BIT_RATE(d, v) \
-    AV_DICT_SET_INT((d), "b", (v) * 1000, AV_DICT_DONT_OVERWRITE)
+#define AV_DICT_SET_BIT_RATE(s, d, v) \
+    do { \
+        int64_t bitrate = 0; \
+        if ((v) <= (INT64_MAX / 1000) && (v) >= 0) \
+            bitrate = (int64_t)((v) * 1000); \
+        else \
+            tvherror_transcode((s), "bitrate value too large to fit in int64_t: %g or negative", (v) * 1000); \
+        AV_DICT_SET_INT((s), (d), "b", bitrate, AV_DICT_DONT_OVERWRITE); \
+    } while (0)
 
-#define AV_DICT_SET_GLOBAL_QUALITY(d, v, a) \
+#define AV_DICT_SET_GLOBAL_QUALITY(s, d, v, a) \
     do { \
-        AV_DICT_SET_FLAGS((d), "+qscale"); \
-        AV_DICT_SET_INT((d), "global_quality", ((v) ? (v) : (a)) * FF_QP2LAMBDA, \
-                        AV_DICT_DONT_OVERWRITE); \
+        AV_DICT_SET_FLAGS((s), (d), "+qscale"); \
+        int64_t global_quality = 0; \
+        if (((v) <= (INT64_MAX / FF_QP2LAMBDA) && (v) > 0) || ((v) == 0 && (a) <= (INT64_MAX / FF_QP2LAMBDA))) \
+            global_quality = (int64_t)(((v) ? (v) : (a)) * FF_QP2LAMBDA); \
+        else \
+            tvherror_transcode((s), "global_quality value too large to fit in int64_t: %g", ((v) ? (v) : (a)) * FF_QP2LAMBDA); \
+        AV_DICT_SET_INT((s), (d), "global_quality", global_quality, AV_DICT_DONT_OVERWRITE); \
     } while (0)
 
-#define AV_DICT_SET_CRF(d, v, a) \
-    AV_DICT_SET_INT((d), "crf", (v) ? (v) : (a), AV_DICT_DONT_OVERWRITE)
+#define AV_DICT_SET_CRF(s, d, v, a) \
+    AV_DICT_SET_INT((s), (d), "crf", (v) ? (v) : (a), AV_DICT_DONT_OVERWRITE)
 
-#define AV_DICT_SET_PIX_FMT(d, v, a) \
-    AV_DICT_SET_INT((d), "pix_fmt", ((v) != AV_PIX_FMT_NONE) ? (v) : (a), \
+#define AV_DICT_SET_PIX_FMT(s, d, v, a) \
+    AV_DICT_SET_INT((s), (d), "pix_fmt", ((v) != AV_PIX_FMT_NONE) ? (v) : (a), \
                     AV_DICT_DONT_OVERWRITE)
 
 #define HWACCEL_AUTO        0
index f82a68a0b1c5f741d45d0ca18a35970581ad514d..8896d26ed34045e2f1dae9f52bc2dfce46892590 100644 (file)
@@ -171,18 +171,18 @@ static int
 tvh_codec_profile_audio_open(TVHAudioCodecProfile *self, AVDictionary **opts)
 {
     if (self->sample_fmt != AV_SAMPLE_FMT_NONE) {
-        AV_DICT_SET_INT(opts, "sample_fmt", self->sample_fmt,
+        AV_DICT_SET_INT(LST_AUDIO, opts, "sample_fmt", self->sample_fmt,
                         AV_DICT_DONT_OVERWRITE);
     }
     if (self->sample_rate) {
-        AV_DICT_SET_INT(opts, "sample_rate", self->sample_rate,
+        AV_DICT_SET_INT(LST_AUDIO, opts, "sample_rate", self->sample_rate,
                         AV_DICT_DONT_OVERWRITE);
     }
     if (self->channel_layout) {
 #if LIBAVCODEC_VERSION_MAJOR > 59
-        AV_DICT_SET_INT(opts, "ch_layout_u_mask", self->channel_layout, AV_DICT_DONT_OVERWRITE);
+        AV_DICT_SET_INT(LST_AUDIO, opts, "ch_layout_u_mask", self->channel_layout, AV_DICT_DONT_OVERWRITE);
 #else
-        AV_DICT_SET_INT(opts, "channel_layout", self->channel_layout, AV_DICT_DONT_OVERWRITE);
+        AV_DICT_SET_INT(LST_AUDIO, opts, "channel_layout", self->channel_layout, AV_DICT_DONT_OVERWRITE);
 #endif
     }
     return 0;
index c093a43b64bad609e0f0b9f8f68715143eee50ad..e9ef4ec37c334f284e2535f8d64c201530992d46 100644 (file)
@@ -78,10 +78,10 @@ tvh_codec_profile_base_is_copy(TVHCodecProfile *self, tvh_ssc_t *ssc)
 static int
 tvh_codec_profile_base_open(TVHCodecProfile *self, AVDictionary **opts)
 {
-    AV_DICT_SET_TVH_REQUIRE_META(opts, 1);
+    AV_DICT_SET_TVH_REQUIRE_META(LST_NONE, opts, 1);
     // profile
     if (self->profile != FF_AV_PROFILE_UNKNOWN) {
-        AV_DICT_SET_INT(opts, "profile", self->profile, 0);
+        AV_DICT_SET_INT(LST_CODEC, opts, "profile", self->profile, 0);
     }
     return 0;
 }
index 20f87dd6e7b0580e678a57a07ac96b523bb83914..bab238daa92f03ac071af17667fe0b102af18773 100644 (file)
@@ -171,14 +171,14 @@ static int
 tvh_codec_profile_video_open(TVHVideoCodecProfile *self, AVDictionary **opts)
 {
     // video_size
-    AV_DICT_SET_INT(opts, "width", self->size.num, 0);
-    AV_DICT_SET_INT(opts, "height", self->size.den, 0);
+    AV_DICT_SET_INT(LST_VIDEO, opts, "width", self->size.num, 0);
+    AV_DICT_SET_INT(LST_VIDEO, opts, "height", self->size.den, 0);
     // crf
     if (self->crf) {
-        AV_DICT_SET_INT(opts, "crf", self->crf, AV_DICT_DONT_OVERWRITE);
+        AV_DICT_SET_INT(LST_VIDEO, opts, "crf", self->crf, AV_DICT_DONT_OVERWRITE);
     }
     // pix_fmt
-    AV_DICT_SET_PIX_FMT(opts, self->pix_fmt, AV_PIX_FMT_YUV420P);
+    AV_DICT_SET_PIX_FMT(LST_VIDEO, opts, self->pix_fmt, AV_PIX_FMT_YUV420P);
     return 0;
 }
 
index 15473773efa2b73aaa76a2ebb860fe08375fe260..6f447c469e14992082cf2f978e03958ebdfd5df7 100644 (file)
@@ -99,14 +99,14 @@ tvhva_init(const char *device)
     }
     if (vad->hw_device_ref)
         return vad->hw_device_ref;
-    tvhtrace(LS_VAAPI, "trying device: %s", device);
+    tvhtrace_transcode(LST_VAAPI, "trying device: %s", device);
     if (av_hwdevice_ctx_create(&vad->hw_device_ref, AV_HWDEVICE_TYPE_VAAPI,
                                device, NULL, 0)) {
-        tvherror(LS_VAAPI,
+        tvherror_transcode(LST_VAAPI,
                  "failed to create a context for device: %s", device);
         return NULL;
     }
-    tvhtrace(LS_VAAPI, "successful context creation for device: %s", device);
+    tvhtrace_transcode(LST_VAAPI, "successful context creation for device: %s", device);
     return vad->hw_device_ref;
 }
 
@@ -262,7 +262,7 @@ tvhva_context_profile(TVHVAContext *self, AVCodecContext *avctx)
             profiles[j] = VAProfileNone;
         }
         if (profiles_max == 0) {
-            tvherror(LS_VAAPI, "%s: vaMaxNumProfiles() returned %d; vaapi doesn't have any profiles available, run: $ vainfo", self->logpref, profiles_max);
+            tvherror_transcode(LST_VAAPI, "%s: vaMaxNumProfiles() returned %d; vaapi doesn't have any profiles available, run: $ vainfo", self->logpref, profiles_max);
         }
         va_res = vaQueryConfigProfiles(self->display,
                                        profiles, &profiles_len);
@@ -275,7 +275,7 @@ tvhva_context_profile(TVHVAContext *self, AVCodecContext *avctx)
             }
         }
         else {
-            tvherror(LS_VAAPI, "%s: va_res != VA_STATUS_SUCCESS; Failed to query profiles: %d (%s), run: $ vainfo", self->logpref, va_res, vaErrorStr(va_res));
+            tvherror_transcode(LST_VAAPI, "%s: va_res != VA_STATUS_SUCCESS; Failed to query profiles: %d (%s), run: $ vainfo", self->logpref, va_res, vaErrorStr(va_res));
         }
         free(profiles);
     }
@@ -305,7 +305,7 @@ tvhva_context_check_profile(TVHVAContext *self, VAProfile profile)
             }
         }
         else {
-            tvherror(LS_VAAPI, "%s: va_res != VA_STATUS_SUCCESS; Failed to query entrypoints: %d (%s), run: $ vainfo", self->logpref, va_res, vaErrorStr(va_res));
+            tvherror_transcode(LST_VAAPI, "%s: va_res != VA_STATUS_SUCCESS; Failed to query entrypoints: %d (%s), run: $ vainfo", self->logpref, va_res, vaErrorStr(va_res));
         }
         if (res != 0) {
             // before giving up we swap VAEntrypointEncSliceLP with VAEntrypointEncSlice or viceversa
@@ -339,7 +339,7 @@ tvhva_context_check_profile(TVHVAContext *self, VAProfile profile)
         free(entrypoints);
     }
     else {
-        tvherror(LS_VAAPI, "%s: vaMaxNumEntrypoints() returned %d; vaapi doesn't have any entrypoints available, run: $ vainfo", self->logpref, entrypoints_max);
+        tvherror_transcode(LST_VAAPI, "%s: vaMaxNumEntrypoints() returned %d; vaapi doesn't have any entrypoints available, run: $ vainfo", self->logpref, entrypoints_max);
     }
     return res;
 }
@@ -374,19 +374,19 @@ tvhva_context_config(TVHVAContext *self, VAProfile profile, unsigned int format)
     va_res = vaGetConfigAttributes(self->display, profile, self->entrypoint,
                                    &attrib, 1);
     if (va_res != VA_STATUS_SUCCESS) {
-        tvherror(LS_VAAPI, "%s: vaGetConfigAttributes: %s",
+        tvherror_transcode(LST_VAAPI, "%s: vaGetConfigAttributes: %s",
                  self->logpref, vaErrorStr(va_res));
         return -1;
     }
     if (attrib.value == VA_ATTRIB_NOT_SUPPORTED || !(attrib.value & format)) {
-        tvherror(LS_VAAPI, "%s: unsupported VA_RT_FORMAT", self->logpref);
+        tvherror_transcode(LST_VAAPI, "%s: unsupported VA_RT_FORMAT", self->logpref);
         return -1;
     }
     attrib.value = format;
     va_res = vaCreateConfig(self->display, profile, self->entrypoint,
                             &attrib, 1, &self->config_id);
     if (va_res != VA_STATUS_SUCCESS) {
-        tvherror(LS_VAAPI, "%s: vaCreateConfig: %s",
+        tvherror_transcode(LST_VAAPI, "%s: vaCreateConfig: %s",
                  self->logpref, vaErrorStr(va_res));
         return -1;
     }
@@ -404,7 +404,7 @@ tvhva_context_check_constraints(TVHVAContext *self)
     int i, ret = 0;
 
     if (!(va_config = av_hwdevice_hwconfig_alloc(self->hw_device_ref))) {
-        tvherror(LS_VAAPI, "%s: failed to allocate hwconfig", self->logpref);
+        tvherror_transcode(LST_VAAPI, "%s: failed to allocate hwconfig", self->logpref);
         return AVERROR(ENOMEM);
     }
     va_config->config_id = self->config_id;
@@ -412,7 +412,7 @@ tvhva_context_check_constraints(TVHVAContext *self)
     hw_constraints =
         av_hwdevice_get_hwframe_constraints(self->hw_device_ref, va_config);
     if (!hw_constraints) {
-        tvherror(LS_VAAPI, "%s: failed to get constraints", self->logpref);
+        tvherror_transcode(LST_VAAPI, "%s: failed to get constraints", self->logpref);
         av_freep(&va_config);
         return -1;
     }
@@ -440,7 +440,7 @@ tvhva_context_check_constraints(TVHVAContext *self)
         }
     }
     if (self->sw_format == AV_PIX_FMT_NONE) {
-        tvherror(LS_VAAPI, "%s: VAAPI hardware does not support pixel format: %s",
+        tvherror_transcode(LST_VAAPI, "%s: VAAPI hardware does not support pixel format: %s",
                  self->logpref, av_get_pix_fmt_name(self->io_format));
         ret = AVERROR(EINVAL);
         goto end;
@@ -451,7 +451,7 @@ tvhva_context_check_constraints(TVHVAContext *self)
         self->height < hw_constraints->min_height ||
         self->width > hw_constraints->max_width ||
         self->height > hw_constraints->max_height) {
-        tvherror(LS_VAAPI, "%s: VAAPI hardware does not support image "
+        tvherror_transcode(LST_VAAPI, "%s: VAAPI hardware does not support image "
                  "size %dx%d (constraints: width %d-%d height %d-%d).",
                  self->logpref, self->width, self->height,
                  hw_constraints->min_width, hw_constraints->max_width,
@@ -484,20 +484,20 @@ tvhva_context_setup(TVHVAContext *self, AVCodecContext *avctx)
     profile = tvhva_context_profile(self, avctx);
 
     if (profile == VAProfileNone) {
-        tvherror(LS_VAAPI, "%s: tvhva_context_profile() returned VAProfileNone for %s",
+        tvherror_transcode(LST_VAAPI, "%s: tvhva_context_profile() returned VAProfileNone for %s",
                  self->logpref,
                  avctx->codec->name);
         return -1;
     }
 
     if (tvhva_context_check_profile(self, profile)) {
-        tvherror(LS_VAAPI, "%s: tvhva_context_check_profile() check failed for codec: %s --> codec not available",
+        tvherror_transcode(LST_VAAPI, "%s: tvhva_context_check_profile() check failed for codec: %s --> codec not available",
                  self->logpref,
                  avctx->codec->name);
         return -1;
     }
     if (!(format = tvhva_get_format(self->io_format))) {
-        tvherror(LS_VAAPI, "%s: unsupported pixel format: %s",
+        tvherror_transcode(LST_VAAPI, "%s: unsupported pixel format: %s",
                  self->logpref,
                  av_get_pix_fmt_name(self->io_format));
         return -1;
@@ -509,7 +509,7 @@ tvhva_context_setup(TVHVAContext *self, AVCodecContext *avctx)
     }
 
     if (!(self->hw_frames_ref = av_hwframe_ctx_alloc(self->hw_device_ref))) {
-        tvherror(LS_VAAPI, "%s: failed to create VAAPI frame context.",
+        tvherror_transcode(LST_VAAPI, "%s: failed to create VAAPI frame context.",
                  self->logpref);
         return AVERROR(ENOMEM);
     }
@@ -521,7 +521,7 @@ tvhva_context_setup(TVHVAContext *self, AVCodecContext *avctx)
     hw_frames_ctx->initial_pool_size = 32;
 
     if (av_hwframe_ctx_init(self->hw_frames_ref) < 0) {
-        tvherror(LS_VAAPI, "%s: failed to initialise VAAPI frame context",
+        tvherror_transcode(LST_VAAPI, "%s: failed to initialise VAAPI frame context",
                  self->logpref);
         return -1;
     }
@@ -535,7 +535,7 @@ tvhva_context_setup(TVHVAContext *self, AVCodecContext *avctx)
                                  va_frames->surface_ids, va_frames->nb_surfaces,
                                  &self->context_id);
         if (va_res != VA_STATUS_SUCCESS) {
-            tvherror(LS_VAAPI, "%s: vaCreateContext: %s",
+            tvherror_transcode(LST_VAAPI, "%s: vaCreateContext: %s",
                      self->logpref, vaErrorStr(va_res));
             return -1;
         }
@@ -560,7 +560,7 @@ tvhva_context_create(const char *logpref,
     enum AVPixelFormat pix_fmt;
 
     if (!(self = calloc(1, sizeof(TVHVAContext)))) {
-        tvherror(LS_VAAPI, "%s: failed to allocate vaapi context", logpref);
+        tvherror_transcode(LST_VAAPI, "%s: failed to allocate vaapi context", logpref);
         return NULL;
     }
     self->logpref = logpref;
@@ -578,7 +578,7 @@ tvhva_context_create(const char *logpref,
         self->io_format = pix_fmt;
     }
     if (self->io_format == AV_PIX_FMT_NONE) {
-        tvherror(LS_VAAPI, "%s: failed to get pix_fmt for vaapi context "
+        tvherror_transcode(LST_VAAPI, "%s: failed to get pix_fmt for vaapi context "
                            "(sw_pix_fmt: %s, pix_fmt: %s)",
                            logpref,
                            av_get_pix_fmt_name(avctx->sw_pix_fmt),
@@ -622,13 +622,13 @@ vaapi_decode_setup_context(AVCodecContext *avctx)
     int ret = -1;
 
     if (!(self = calloc(1, sizeof(TVHVAContext)))) {
-        tvherror(LS_VAAPI, "Decode: Failed to allocate VAAPI context (TVHVAContext)");
+        tvherror_transcode(LST_VAAPI, "Decode: Failed to allocate VAAPI context (TVHVAContext)");
         return AVERROR(ENOMEM);
     }
     // lifted from ffmpeg-6.1.1/doc/examples/vaapi_transcode.c line 237
     /* Open VAAPI device and create an AVHWDeviceContext for it*/
     if ((ret = av_hwdevice_ctx_create(&self->hw_device_ref, AV_HWDEVICE_TYPE_VAAPI, ctx->hw_accel_device, NULL, 0)) < 0) {
-        tvherror(LS_VAAPI, "Decode: Failed to Open VAAPI device and create an AVHWDeviceContext for device: "
+        tvherror_transcode(LST_VAAPI, "Decode: Failed to Open VAAPI device and create an AVHWDeviceContext for device: "
                             "%s with error code: %s", 
                             ctx->hw_accel_device, av_err2str(ret));
         free(self);
@@ -639,7 +639,7 @@ vaapi_decode_setup_context(AVCodecContext *avctx)
     /* set hw_frames_ctx for decoder's AVCodecContext */
     avctx->hw_device_ctx = av_buffer_ref(self->hw_device_ref);
     if (!avctx->hw_device_ctx) {
-        tvherror(LS_VAAPI, "Decode: Failed to create a hardware device reference for device: %s.", 
+        tvherror_transcode(LST_VAAPI, "Decode: Failed to create a hardware device reference for device: %s.", 
                         ctx->hw_accel_device);
         // unref hw_device_ref
         av_buffer_unref(&self->hw_device_ref);
@@ -736,7 +736,7 @@ static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx)
     int err = 0;
 
     if (!(hw_frames_ref = av_hwframe_ctx_alloc(hw_device_ctx))) {
-        tvherror(LS_VAAPI, "Encode: Failed to create VAAPI frame context.");
+        tvherror_transcode(LST_VAAPI, "Encode: Failed to create VAAPI frame context.");
         return AVERROR(ENOMEM);
     }
     frames_ctx = (AVHWFramesContext *)(hw_frames_ref->data);
@@ -746,7 +746,7 @@ static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx)
     frames_ctx->height    = ctx->height;
     frames_ctx->initial_pool_size = 20;
     if ((err = av_hwframe_ctx_init(hw_frames_ref)) < 0) {
-        tvherror(LS_VAAPI, "Encode: Failed to initialize VAAPI frame context."
+        tvherror_transcode(LST_VAAPI, "Encode: Failed to initialize VAAPI frame context."
                 "Error code: %s",av_err2str(err));
         av_buffer_unref(&hw_frames_ref);
         return err;
@@ -754,7 +754,7 @@ static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx)
     ctx->hw_frames_ctx = av_buffer_ref(hw_frames_ref);
     if (!ctx->hw_frames_ctx) {
         err = AVERROR(ENOMEM);
-        tvherror(LS_VAAPI, "Encode: Failed to create a hardware device reference."
+        tvherror_transcode(LST_VAAPI, "Encode: Failed to create a hardware device reference."
                 "Error code: %s",av_err2str(err));
     }
     av_buffer_unref(&hw_frames_ref);
@@ -772,14 +772,14 @@ vaapi_encode_setup_context(AVCodecContext *avctx)
     // lifted from ffmpeg-6.1.1/doc/examples/vaapi_encode.c line 127
     /* Open VAAPI device and create an AVHWDeviceContext for it*/
     if ((ret = av_hwdevice_ctx_create(&ctx->hw_device_octx, AV_HWDEVICE_TYPE_VAAPI, NULL, NULL, 0)) < 0) {
-        tvherror(LS_VAAPI, "Encode: Failed to open VAAPI device and create an AVHWDeviceContext for it."
+        tvherror_transcode(LST_VAAPI, "Encode: Failed to open VAAPI device and create an AVHWDeviceContext for it."
                 "Error code: %s",av_err2str(ret));
         return ret;
     }
     // lifted from ffmpeg-6.1.1/doc/examples/vaapi_encode.c line 152
     /* set hw_frames_ctx for encoder's AVCodecContext */
     if ((ret = set_hwframe_ctx(avctx, ctx->hw_device_octx)) < 0) {
-        tvherror(LS_VAAPI, "Encode: Failed to set hwframe context."
+        tvherror_transcode(LST_VAAPI, "Encode: Failed to set hwframe context."
                 "Error code: %s",av_err2str(ret));
         av_buffer_unref(&ctx->hw_device_octx);
     }
index bc67e40dc36a3c8f58c116dbc37be4d1b547edc0..303b70f895f817f5d9a1f903f8c8627479215111 100644 (file)
@@ -179,7 +179,6 @@ tvhlog_subsys_t tvhlog_subsystems[] = {
   [LS_TSFILE]        = { "tsfile",        N_("MPEG-TS File") },
   [LS_TSDEBUG]       = { "tsdebug",       N_("MPEG-TS Input Debug") },
   [LS_CODEC]         = { "codec",         N_("Codec") },
-  [LS_VAAPI]         = { "vaapi",         N_("VA-API") },
   [LS_VAINFO]        = { "vainfo",        N_("VAINFO") },
 #if ENABLE_DDCI
   [LS_DDCI]          = { "ddci",          N_("DD-CI") },
@@ -189,6 +188,60 @@ tvhlog_subsys_t tvhlog_subsystems[] = {
 
 };
 
+/*
+ * logging transcoding
+ */
+#define SUB_SYSTEM_TRANSCODE_NAME_LENGHT_MAX 64
+// name (2nd parameter) has max 64 chars
+tvhlog_subsys_t tvhlog_transcode_subsystems[] = {
+    [LST_NONE]          = { "",              N_("") },
+    [LST_AUDIO]         = { "audio",         N_("Audio") },
+    [LST_VIDEO]         = { "video",         N_("Video") },
+    [LST_CODEC]         = { "codec",         N_("Codec") },
+    [LST_MP2]           = { "mp2",           N_("MP2") },
+    [LST_AAC]           = { "aac",           N_("AAC") },
+    [LST_FLAC]          = { "flac",          N_("FLAC") },
+    [LST_LIBFDKAAC]     = { "libfdk-aac",    N_("LIB FDK_AAC") },
+    [LST_LIBOPUS]       = { "libopus",       N_("LIB OPUS") },
+    [LST_LIBTHEORA]     = { "libtheora",     N_("LIB THEORA") },
+    [LST_LIBVORBIS]     = { "libvorbis",     N_("LIB VORBIS") },
+    [LST_VORBIS]        = { "vorbis",        N_("VORBIS") },
+    [LST_MPEG2VIDEO]    = { "mpeg2video",    N_("MPEG2 VIDEO") },
+    [LST_LIBVPX]        = { "libvpx",        N_("LIB VPX") },
+    [LST_LIBX26X]       = { "libx26x",       N_("LIB x264_x265") },
+    [LST_NVENC]         = { "nvenc",         N_("NVENC") },
+    [LST_OMX]           = { "omx",           N_("OMX") },
+    [LST_VAAPI]         = { "vaapi",         N_("VA-API") },
+};
+
+// delimiter ': ' has 2 chars
+#define SUB_SYSTEM_TRANSCODE_DELIMITER_LENGTH 2
+
+void
+tvh_concatenate_subsystem_with_logsv(char* buf, int subsys, const char *fmt, va_list *args)
+{
+  // to store the subsystem codec name
+  char subsystem[SUB_SYSTEM_TRANSCODE_NAME_LENGHT_MAX];
+  // to store (temporary buffer)
+  char log[SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX - SUB_SYSTEM_TRANSCODE_NAME_LENGHT_MAX - SUB_SYSTEM_TRANSCODE_DELIMITER_LENGTH];
+  if (args)
+    vsnprintf(log, sizeof(log), fmt, *args);
+  else
+    snprintf(log, sizeof(log), "%s", fmt);
+  snprintf(subsystem, sizeof(subsystem), "%s", tvhlog_transcode_subsystems[subsys].name);
+  // concatenate strings with delimited ': '
+  snprintf(buf, SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX, "%s: %s", subsystem, log);
+}
+
+void 
+tvh_concatenate_subsystem_with_logs(char* buf, int subsys, const char *fmt, ... )
+{
+  va_list args;
+  va_start(args, fmt);
+  tvh_concatenate_subsystem_with_logsv(buf, subsys, fmt, &args);
+  va_end(args);
+}
+
 static void
 tvhlog_get_subsys ( bitops_ulong_t *ss, char *subsys, size_t len )
 {
index 481d362e019726b47fafabec01e8cb2693fe936f..ad4969f5de0e3f9a8aa837ed45b422b2e27b12bf 100644 (file)
@@ -49,6 +49,10 @@ extern int              tvhlog_options;
 extern tvh_mutex_t      tvhlog_mutex;
 extern tvhlog_subsys_t  tvhlog_subsystems[];
 
+/* used in logging for transcoding */
+void tvh_concatenate_subsystem_with_logsv(char* buf, int subsys, const char *fmt, va_list *args);
+void tvh_concatenate_subsystem_with_logs(char* buf, int subsys, const char *fmt, ... ) __attribute__((format(printf,3,4)));
+
 /* Initialise */
 void tvhlog_init       ( int level, int options, const char *path );
 void tvhlog_start      ( void );
@@ -194,7 +198,6 @@ enum {
   LS_TSFILE,
   LS_TSDEBUG,
   LS_CODEC,
-  LS_VAAPI,
   LS_VAINFO,
 #if ENABLE_DDCI
   LS_DDCI,
@@ -204,6 +207,29 @@ enum {
   LS_LAST     /* keep this last */
 };
 
+/* transcode Subsystems */
+enum {
+    LST_NONE,
+    LST_AUDIO,
+    LST_VIDEO,
+    LST_CODEC,
+    LST_MP2,
+    LST_AAC,
+    LST_FLAC,
+    LST_LIBFDKAAC,
+    LST_LIBOPUS,
+    LST_LIBTHEORA,
+    LST_LIBVORBIS,
+    LST_VORBIS,
+    LST_MPEG2VIDEO,
+    LST_LIBVPX,
+    LST_LIBX26X,
+    LST_NVENC,
+    LST_OMX,
+    LST_VAAPI,
+    LST_LAST     /* keep this last */
+};
+
 /* Macros */
 #define tvhlog(severity, subsys, fmt, ...)\
   _tvhlog(__FILE__, __LINE__, severity | LOG_TVH_NOTIFY, subsys, fmt, ##__VA_ARGS__)
@@ -253,5 +279,7 @@ void tvhdbg(int subsys, const char *fmt, ...);
 #else
 static inline void tvhdbg(int subsys, const char *fmt, ...) {};
 #endif
+// max log per line for transcoding (1024)
+#define SUB_SYSTEM_TRANSCODE_LOG_LENGTH_MAX 1024
 
 #endif /* __TVH_LOGGING_H__ */