2018-07-21 07:16:03 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
2018-08-12 03:19:20 +00:00
|
|
|
// Avoid X11 if SDL was built without it
|
|
|
|
#ifndef SDL_VIDEO_DRIVER_X11
|
|
|
|
#warning Unable to use libva-x11 without SDL support
|
|
|
|
#undef HAVE_LIBVA_X11
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Avoid Wayland if SDL was built without it
|
|
|
|
#ifndef SDL_VIDEO_DRIVER_WAYLAND
|
|
|
|
#warning Unable to use libva-wayland without SDL support
|
|
|
|
#undef HAVE_LIBVA_WAYLAND
|
|
|
|
#endif
|
|
|
|
|
2018-07-21 07:16:03 +00:00
|
|
|
extern "C" {
|
|
|
|
#include <va/va.h>
|
2018-08-12 02:43:36 +00:00
|
|
|
#ifdef HAVE_LIBVA_X11
|
2018-07-21 07:16:03 +00:00
|
|
|
#include <va/va_x11.h>
|
2018-08-12 02:43:36 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LIBVA_WAYLAND
|
|
|
|
#include <va/va_wayland.h>
|
|
|
|
#endif
|
2019-07-07 22:31:15 +00:00
|
|
|
#ifdef HAVE_LIBVA_DRM
|
|
|
|
#include <va/va_drm.h>
|
|
|
|
#endif
|
2018-07-21 07:16:03 +00:00
|
|
|
#include <libavutil/hwcontext_vaapi.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
class VAAPIRenderer : public IFFmpegRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VAAPIRenderer();
|
2019-04-13 05:12:53 +00:00
|
|
|
virtual ~VAAPIRenderer() override;
|
|
|
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
|
|
|
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
|
|
|
virtual void renderFrame(AVFrame* frame) override;
|
|
|
|
virtual bool needsTestFrame() override;
|
2019-04-13 05:54:21 +00:00
|
|
|
virtual bool isDirectRenderingSupported() override;
|
2018-07-21 07:16:03 +00:00
|
|
|
|
|
|
|
private:
|
2018-08-12 02:43:36 +00:00
|
|
|
int m_WindowSystem;
|
2018-07-21 07:16:03 +00:00
|
|
|
AVBufferRef* m_HwContext;
|
2019-07-07 22:31:15 +00:00
|
|
|
int m_DrmFd;
|
2018-08-12 02:43:36 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBVA_X11
|
|
|
|
Window m_XWindow;
|
|
|
|
#endif
|
|
|
|
|
2018-07-21 07:16:03 +00:00
|
|
|
int m_VideoWidth;
|
|
|
|
int m_VideoHeight;
|
|
|
|
int m_DisplayWidth;
|
|
|
|
int m_DisplayHeight;
|
|
|
|
};
|