From: Jaroslav Kysela Date: Wed, 8 Nov 2017 08:05:38 +0000 (+0100) Subject: vaapi: add support for library version 2.0, fixes #4679 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ebabde707086cb5e6f061420aad775b05976c747;p=thirdparty%2Ftvheadend.git vaapi: add support for library version 2.0, fixes #4679 --- diff --git a/src/libav.c b/src/libav.c index e8867c49a..3b41112fd 100644 --- a/src/libav.c +++ b/src/libav.c @@ -242,12 +242,20 @@ static void libav_va_log(int severity, const char *msg) 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); } @@ -268,6 +276,22 @@ libav_vaapi_init(void) #endif } +/** + * + */ +void +libav_vaapi_init_context(void *context) +{ +#if ENABLE_VAAPI +#ifdef VA_FOURCC_I010 +#if VA_CHECK_VERSION(1, 0, 0) + vaSetErrorCallback(context, libav_va_error_callback, NULL); + vaSetInfoCallback(context, libav_va_info_callback, NULL); +#endif +#endif +#endif +} + /** * */ diff --git a/src/libav.h b/src/libav.h index ba8b092b8..57d861726 100644 --- a/src/libav.h +++ b/src/libav.h @@ -58,12 +58,14 @@ enum AVCodecID streaming_component_type2codec_id(streaming_component_type_t type streaming_component_type_t codec_id2streaming_component_type(enum AVCodecID id); int libav_is_encoder(AVCodec *codec); void libav_set_loglevel(void); +void libav_vaapi_init_context(void *context); void libav_init(void); void libav_done(void); #else static inline void libav_set_loglevel(void) { }; +static inline void libav_vaapi_init_context(void *) { }; static inline void libav_init(void) { }; static inline void libav_done(void) { }; diff --git a/src/transcoding/transcode/hwaccels/vaapi.c b/src/transcoding/transcode/hwaccels/vaapi.c index b3db8dffa..2e6684d45 100644 --- a/src/transcoding/transcode/hwaccels/vaapi.c +++ b/src/transcoding/transcode/hwaccels/vaapi.c @@ -409,6 +409,9 @@ tvhva_context_setup(TVHVAContext *self, AVCodecContext *avctx) if (!(self->display = tvhva_context_display(self, avctx))) { return -1; } + + libav_vaapi_init_context(self->display); + 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",