]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
vaapi: add support for library version 2.0, fixes #4679
authorJaroslav Kysela <perex@perex.cz>
Wed, 8 Nov 2017 08:05:38 +0000 (09:05 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 8 Nov 2017 08:05:38 +0000 (09:05 +0100)
src/libav.c
src/libav.h
src/transcoding/transcode/hwaccels/vaapi.c

index e8867c49adf47d263578549f6198048e8586553f..3b41112fd273d36f4f82eecca2f23da152c60148 100644 (file)
@@ -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
+}
+
 /**
  *
  */
index ba8b092b8a9177279fe8f955f38925331722d9bf..57d861726a54e6a8e4390d4fcb09ffa6d1d239df 100644 (file)
@@ -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) { };
 
index b3db8dffa530992d17167b764b0f90cc0011d2e9..2e6684d45c9a80410966fd378aeec4a4946b1852 100644 (file)
@@ -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",