moonlight-qt/app/streaming/video/ffmpeg-renderers/vaapi.h

61 lines
1.4 KiB
C
Raw Normal View History

2018-07-21 07:16:03 +00:00
#pragma once
#include "renderer.h"
// 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,
int height);
virtual bool prepareDecoderContext(AVCodecContext* context);
virtual void renderFrame(AVFrame* frame);
private:
2018-08-12 02:43:36 +00:00
static void vaapiLogError(void*, const char *message);
static void vaapiLogInfo(void*, const char *message);
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;
};