AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
AM_CONDITIONAL([HAVE_VAAPI_WL], [test "${have_vaapi_wl}" = "yes"])
-
-have_avcodec_vaapi="no"
-AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
- VLC_SAVE_FLAGS
- CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
- CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
- AC_CHECK_HEADERS([libavcodec/vaapi.h], [
- AC_MSG_NOTICE([VA API acceleration activated])
- have_avcodec_vaapi="yes"
- ],[
- AS_IF([test -n "${enable_libva}"], [
- AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
- ], [
- AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
- ])
- ])
- VLC_RESTORE_FLAGS
-])
-AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
+AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"])
dnl
dnl dxva2 needs avcodec
codec/avcodec/vaapi.c hw/vaapi/vlc_vaapi.c hw/vaapi/vlc_vaapi.h
libvaapi_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
libvaapi_plugin_la_CFLAGS = $(AM_CFLAGS) $(AVCODEC_CFLAGS)
-libvaapi_plugin_la_LIBADD = $(LIBVA_LIBS)
+libvaapi_plugin_la_LIBADD = $(LIBVA_LIBS) $(AVCODEC_LIBS)
if HAVE_AVCODEC_VAAPI
if HAVE_VAAPI_DRM
codec_LTLIBRARIES += libvaapi_drm_plugin.la
# include <va/va_drm.h>
#endif
#include <libavcodec/avcodec.h>
+#if FF_API_STRUCT_VAAPI_CONTEXT
#include <libavcodec/vaapi.h>
+#else
+#include <libavutil/hwcontext_vaapi.h>
+#endif
#include "avcodec.h"
#include "va.h"
#include "../../hw/vaapi/vlc_vaapi.h"
+#if !FF_API_STRUCT_VAAPI_CONTEXT
+struct vaapi_context
+{
+ VADisplay display;
+ VAConfigID config_id;
+ VAContextID context_id;
+};
+#endif
+
struct vlc_va_sys_t
{
struct vlc_vaapi_instance *va_inst;
(void) hwctx;
- vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
- vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
+ if (sys->hw_ctx.context_id != VA_INVALID_ID)
+ vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
+ if (sys->hw_ctx.config_id != VA_INVALID_ID)
+ vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
vlc_vaapi_ReleaseInstance(sys->va_inst);
free(sys);
}
sys->hw_ctx.config_id = VA_INVALID_ID;
sys->hw_ctx.context_id = VA_INVALID_ID;
+#if FF_API_STRUCT_VAAPI_CONTEXT
sys->hw_ctx.config_id =
vlc_vaapi_CreateConfigChecked(o, sys->hw_ctx.display, i_profile,
VAEntrypointVLD, i_vlc_chroma);
goto error;
ctx->hwaccel_context = &sys->hw_ctx;
+#else
+ AVBufferRef *hwdev_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
+ if (hwdev_ref == NULL)
+ goto error;
+
+ AVHWDeviceContext *hwdev_ctx = (void *) hwdev_ref->data;
+ AVVAAPIDeviceContext *vadev_ctx = hwdev_ctx->hwctx;
+ vadev_ctx->display = va_dpy;
+
+ if (av_hwdevice_ctx_init(hwdev_ref) < 0)
+ {
+ av_buffer_unref(&hwdev_ref);
+ goto error;
+ }
+
+ ctx->hw_device_ctx = hwdev_ref;
+#endif
+
va->sys = sys;
va->description = vaQueryVendorString(sys->hw_ctx.display);
va->get = Get;