--- src.old/libav.c 2017-10-13 17:18:13.697323440 -0400 +++ src/libav.c 2017-11-07 10:54:55.214736351 -0500 @@ -1,8 +1,5 @@ #include "transcoding/transcode.h" #include "libav.h" -#if ENABLE_VAAPI -#include -#endif /** * @@ -226,51 +223,6 @@ /** * */ -#if ENABLE_VAAPI -#ifdef VA_FOURCC_I010 -static void libav_va_log(int severity, const char *msg) -{ - char *s; - int l; - - if (msg == NULL || *msg == '\0') - return; - s = tvh_strdupa(msg); - l = strlen(s); - if (s[l-1] == '\n') - s[l-1] = '\0'; - tvhlog(severity, LS_VAAPI, "%s", s); -} - -static void libav_va_error_callback(const char *msg) -{ - libav_va_log(LOG_ERR, msg); -} - -static void libav_va_info_callback(const char *msg) -{ - libav_va_log(LOG_INFO, msg); -} -#endif -#endif - -/** - * - */ -static void -libav_vaapi_init(void) -{ -#if ENABLE_VAAPI -#ifdef VA_FOURCC_I010 - vaSetErrorCallback(libav_va_error_callback); - vaSetInfoCallback(libav_va_info_callback); -#endif -#endif -} - -/** - * - */ void libav_set_loglevel(void) { @@ -284,7 +236,6 @@ void libav_init(void) { - libav_vaapi_init(); libav_set_loglevel(); av_log_set_callback(libav_log_callback); av_register_all(); @@ -301,4 +252,4 @@ { transcode_done(); avformat_network_deinit(); -} \ No newline at end of file +} --- src.old/transcoding/transcode/hwaccels/vaapi.c 2017-10-13 17:18:13.704323335 -0400 +++ src/transcoding/transcode/hwaccels/vaapi.c 2017-11-07 09:22:02.316712298 -0500 @@ -51,6 +51,44 @@ static LIST_HEAD(, tvh_vaapi_device) tvhva_devices; +/** + * + */ +#ifdef VA_FOURCC_I010 +static void libav_va_log(int severity, const char *msg) +{ + char *s; + int l; + + if (msg == NULL || *msg == '\0') + return; + s = tvh_strdupa(msg); + l = strlen(s); + if (s[l-1] == '\n') + s[l-1] = '\0'; + tvhlog(severity, LS_VAAPI, "%s", s); +} + +#if VA_CHECK_VERSION(1, 0, 0) +static void libav_va_error_callback(void *context, const char *msg) +#else +static void libav_va_error_callback(const char *msg) +#endif +{ + libav_va_log(LOG_ERR, msg); +} + +#if VA_CHECK_VERSION(1, 0, 0) +static void libav_va_info_callback(void *context, const char *msg) +#else +static void libav_va_info_callback(const char *msg) +#endif +{ + libav_va_log(LOG_INFO, msg); +} +#endif + + static AVBufferRef * tvhva_init(const char *device) @@ -409,6 +447,17 @@ if (!(self->display = tvhva_context_display(self, avctx))) { return -1; } + +#ifdef VA_FOURCC_I010 +#if VA_CHECK_VERSION(1, 0, 0) + vaSetErrorCallback(self->display, libav_va_error_callback, NULL); + vaSetInfoCallback(self->display, libav_va_info_callback, NULL); +#else + vaSetErrorCallback(libav_va_error_callback); + vaSetInfoCallback(libav_va_info_callback); +#endif +#endif + if ((profile = tvhva_context_profile(self, avctx)) == VAProfileNone || tvhva_context_check_profile(self, profile)) { tvherror(LS_VAAPI, "%s: unsupported codec: %s and/or profile: %s",