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
|
2018-07-21 07:16:03 +00:00
|
|
|
#include <libavutil/hwcontext_vaapi.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
class VAAPIRenderer : public IFFmpegRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VAAPIRenderer();
|
|
|
|
virtual ~VAAPIRenderer();
|
|
|
|
virtual bool initialize(SDL_Window* window,
|
|
|
|
int videoFormat,
|
|
|
|
int width,
|
2018-08-16 03:41:19 +00:00
|
|
|
int height,
|
2018-08-21 01:19:42 +00:00
|
|
|
int maxFps,
|
|
|
|
bool enableVsync);
|
2018-07-21 07:16:03 +00:00
|
|
|
virtual bool prepareDecoderContext(AVCodecContext* context);
|
2019-02-16 03:31:01 +00:00
|
|
|
virtual void renderFrame(AVFrame* frame);
|
2018-08-19 07:59:04 +00:00
|
|
|
virtual bool needsTestFrame();
|
2018-08-25 19:38:04 +00:00
|
|
|
virtual int getDecoderCapabilities();
|
2018-12-25 20:57:00 +00:00
|
|
|
virtual FramePacingConstraint getFramePacingConstraint();
|
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;
|
2018-08-12 02:43:36 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBVA_X11
|
|
|
|
Window m_XWindow;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBVA_WAYLAND
|
|
|
|
struct wl_surface* m_WaylandSurface;
|
|
|
|
struct wl_display* m_WaylandDisplay;
|
|
|
|
#endif
|
|
|
|
|
2018-07-21 07:16:03 +00:00
|
|
|
int m_VideoWidth;
|
|
|
|
int m_VideoHeight;
|
|
|
|
int m_DisplayWidth;
|
|
|
|
int m_DisplayHeight;
|
|
|
|
};
|