2019-02-13 03:58:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
2021-12-14 03:41:00 +00:00
|
|
|
#ifdef HAVE_CUDA
|
|
|
|
#include "cuda.h"
|
|
|
|
#endif
|
|
|
|
|
2019-02-13 03:58:36 +00:00
|
|
|
class SdlRenderer : public IFFmpegRenderer {
|
|
|
|
public:
|
|
|
|
SdlRenderer();
|
2019-02-13 05:55:15 +00:00
|
|
|
virtual ~SdlRenderer() override;
|
2019-04-12 05:27:20 +00:00
|
|
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
2020-02-09 01:47:26 +00:00
|
|
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
2019-02-16 03:31:01 +00:00
|
|
|
virtual void renderFrame(AVFrame* frame) override;
|
2019-04-10 04:46:14 +00:00
|
|
|
virtual bool isRenderThreadSupported() override;
|
2020-01-26 23:02:29 +00:00
|
|
|
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) override;
|
2021-03-23 04:32:00 +00:00
|
|
|
virtual bool testRenderFrame(AVFrame* frame) override;
|
2019-02-13 03:58:36 +00:00
|
|
|
|
|
|
|
private:
|
2019-03-17 22:08:21 +00:00
|
|
|
void renderOverlay(Overlay::OverlayType type);
|
2022-01-02 19:41:36 +00:00
|
|
|
bool initializeReadBackFormat(AVBufferRef* hwFrameCtxRef, AVFrame* testFrame);
|
|
|
|
AVFrame* getSwFrameFromHwFrame(AVFrame* hwFrame);
|
2019-03-17 22:08:21 +00:00
|
|
|
|
2022-01-02 04:15:43 +00:00
|
|
|
int m_VideoFormat;
|
2019-02-13 03:58:36 +00:00
|
|
|
SDL_Renderer* m_Renderer;
|
|
|
|
SDL_Texture* m_Texture;
|
2022-01-02 04:15:43 +00:00
|
|
|
enum AVPixelFormat m_SwPixelFormat;
|
2022-01-13 07:16:09 +00:00
|
|
|
enum AVColorSpace m_ColorSpace;
|
2022-01-02 19:41:36 +00:00
|
|
|
bool m_MapFrame;
|
2019-03-17 22:08:21 +00:00
|
|
|
SDL_Texture* m_OverlayTextures[Overlay::OverlayMax];
|
|
|
|
SDL_Rect m_OverlayRects[Overlay::OverlayMax];
|
2021-12-14 03:41:00 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CUDA
|
|
|
|
CUDAGLInteropHelper* m_CudaGLHelper;
|
|
|
|
#endif
|
2019-02-13 03:58:36 +00:00
|
|
|
};
|
|
|
|
|