2018-08-03 02:11:44 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <vdpau/vdpau.h>
|
|
|
|
#include <vdpau/vdpau_x11.h>
|
|
|
|
#include <libavutil/hwcontext_vdpau.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
class VDPAURenderer : public IFFmpegRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VDPAURenderer();
|
2019-04-12 22:12:53 -07:00
|
|
|
virtual ~VDPAURenderer() override;
|
|
|
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
2020-02-08 17:47:26 -08:00
|
|
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
2019-04-12 22:12:53 -07:00
|
|
|
virtual void renderFrame(AVFrame* frame) override;
|
|
|
|
virtual bool needsTestFrame() override;
|
2019-12-16 18:02:11 -08:00
|
|
|
virtual int getDecoderColorspace() override;
|
2018-08-03 02:11:44 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t m_VideoWidth, m_VideoHeight;
|
|
|
|
uint32_t m_DisplayWidth, m_DisplayHeight;
|
|
|
|
AVBufferRef* m_HwContext;
|
|
|
|
VdpPresentationQueueTarget m_PresentationQueueTarget;
|
|
|
|
VdpPresentationQueue m_PresentationQueue;
|
|
|
|
VdpVideoMixer m_VideoMixer;
|
|
|
|
VdpRGBAFormat m_OutputSurfaceFormat;
|
2018-08-05 16:33:08 -07:00
|
|
|
VdpDevice m_Device;
|
2018-08-03 02:11:44 -07:00
|
|
|
|
|
|
|
#define OUTPUT_SURFACE_COUNT 3
|
|
|
|
VdpOutputSurface m_OutputSurface[OUTPUT_SURFACE_COUNT];
|
|
|
|
int m_NextSurfaceIndex;
|
|
|
|
|
|
|
|
#define OUTPUT_SURFACE_FORMAT_COUNT 2
|
2019-11-05 17:09:44 -08:00
|
|
|
static const VdpRGBAFormat k_OutputFormats8Bit[OUTPUT_SURFACE_FORMAT_COUNT];
|
|
|
|
static const VdpRGBAFormat k_OutputFormats10Bit[OUTPUT_SURFACE_FORMAT_COUNT];
|
2018-08-03 02:11:44 -07:00
|
|
|
|
|
|
|
VdpGetErrorString* m_VdpGetErrorString;
|
|
|
|
VdpPresentationQueueTargetDestroy* m_VdpPresentationQueueTargetDestroy;
|
|
|
|
VdpVideoMixerCreate* m_VdpVideoMixerCreate;
|
|
|
|
VdpVideoMixerDestroy* m_VdpVideoMixerDestroy;
|
|
|
|
VdpVideoMixerRender* m_VdpVideoMixerRender;
|
|
|
|
VdpPresentationQueueCreate* m_VdpPresentationQueueCreate;
|
|
|
|
VdpPresentationQueueDestroy* m_VdpPresentationQueueDestroy;
|
|
|
|
VdpPresentationQueueDisplay* m_VdpPresentationQueueDisplay;
|
|
|
|
VdpPresentationQueueSetBackgroundColor* m_VdpPresentationQueueSetBackgroundColor;
|
|
|
|
VdpPresentationQueueBlockUntilSurfaceIdle* m_VdpPresentationQueueBlockUntilSurfaceIdle;
|
|
|
|
VdpOutputSurfaceCreate* m_VdpOutputSurfaceCreate;
|
|
|
|
VdpOutputSurfaceDestroy* m_VdpOutputSurfaceDestroy;
|
|
|
|
VdpOutputSurfaceQueryCapabilities* m_VdpOutputSurfaceQueryCapabilities;
|
2018-08-05 16:33:08 -07:00
|
|
|
VdpVideoSurfaceGetParameters* m_VdpVideoSurfaceGetParameters;
|
2018-09-20 21:23:16 -07:00
|
|
|
VdpGetInformationString* m_VdpGetInformationString;
|
2018-08-03 02:11:44 -07:00
|
|
|
|
|
|
|
// X11 stuff
|
|
|
|
VdpPresentationQueueTargetCreateX11* m_VdpPresentationQueueTargetCreateX11;
|
|
|
|
};
|
|
|
|
|
|
|
|
|