2018-07-13 09:28:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "renderer.h"
|
2018-08-16 06:20:56 +00:00
|
|
|
#include "pacer/pacer.h"
|
2018-07-13 09:28:10 +00:00
|
|
|
|
|
|
|
#include <d3d9.h>
|
2019-01-20 07:05:56 +00:00
|
|
|
#include <d3dx9.h>
|
2018-07-13 09:28:10 +00:00
|
|
|
#include <dxva2api.h>
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <libavcodec/dxva2.h>
|
|
|
|
}
|
|
|
|
|
2018-08-16 06:57:03 +00:00
|
|
|
class DXVA2Renderer : public IFFmpegRenderer
|
2018-07-13 09:28:10 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DXVA2Renderer();
|
2019-04-13 05:12:53 +00:00
|
|
|
virtual ~DXVA2Renderer() override;
|
2019-04-12 05:27:20 +00:00
|
|
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
2019-02-16 03:31:01 +00:00
|
|
|
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
|
|
|
virtual void renderFrame(AVFrame* frame) override;
|
2019-02-13 06:36:56 +00:00
|
|
|
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
2018-07-13 09:28:10 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool initializeDecoder();
|
|
|
|
bool initializeRenderer();
|
2018-08-21 01:19:42 +00:00
|
|
|
bool initializeDevice(SDL_Window* window, bool enableVsync);
|
2018-08-01 01:09:09 +00:00
|
|
|
bool isDecoderBlacklisted();
|
2019-01-29 03:18:43 +00:00
|
|
|
bool isDXVideoProcessorAPIBlacklisted();
|
2018-07-13 09:28:10 +00:00
|
|
|
|
|
|
|
static
|
|
|
|
AVBufferRef* ffPoolAlloc(void* opaque, int size);
|
|
|
|
|
|
|
|
static
|
|
|
|
void ffPoolDummyDelete(void*, uint8_t*);
|
|
|
|
|
|
|
|
static
|
|
|
|
int ffGetBuffer2(AVCodecContext* context, AVFrame* frame, int flags);
|
|
|
|
|
|
|
|
int m_VideoFormat;
|
2018-07-19 02:10:14 +00:00
|
|
|
int m_VideoWidth;
|
|
|
|
int m_VideoHeight;
|
|
|
|
|
|
|
|
int m_DisplayWidth;
|
|
|
|
int m_DisplayHeight;
|
2018-07-13 09:28:10 +00:00
|
|
|
|
|
|
|
struct dxva_context m_DXVAContext;
|
|
|
|
IDirect3DSurface9* m_DecSurfaces[19];
|
|
|
|
DXVA2_ConfigPictureDecode m_Config;
|
|
|
|
IDirectXVideoDecoderService* m_DecService;
|
|
|
|
IDirectXVideoDecoder* m_Decoder;
|
|
|
|
int m_SurfacesUsed;
|
|
|
|
AVBufferPool* m_Pool;
|
|
|
|
|
2018-08-20 04:53:39 +00:00
|
|
|
IDirect3DDevice9Ex* m_Device;
|
2018-07-13 09:28:10 +00:00
|
|
|
IDirect3DSurface9* m_RenderTarget;
|
|
|
|
IDirectXVideoProcessorService* m_ProcService;
|
|
|
|
IDirectXVideoProcessor* m_Processor;
|
|
|
|
DXVA2_ValueRange m_BrightnessRange;
|
|
|
|
DXVA2_ValueRange m_ContrastRange;
|
|
|
|
DXVA2_ValueRange m_HueRange;
|
|
|
|
DXVA2_ValueRange m_SaturationRange;
|
|
|
|
DXVA2_VideoDesc m_Desc;
|
|
|
|
REFERENCE_TIME m_FrameIndex;
|
2019-02-13 06:36:56 +00:00
|
|
|
LPD3DXFONT m_DebugOverlayFont;
|
2019-03-17 22:08:21 +00:00
|
|
|
LPD3DXFONT m_StatusOverlayFont;
|
2019-01-20 22:08:53 +00:00
|
|
|
bool m_BlockingPresent;
|
2018-07-13 09:28:10 +00:00
|
|
|
};
|