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

43 lines
1.2 KiB
C
Raw Normal View History

2018-07-13 09:28:10 +00:00
#pragma once
#include <SDL.h>
extern "C" {
#include <libavcodec/avcodec.h>
}
class IFFmpegRenderer {
2018-07-13 09:28:10 +00:00
public:
virtual ~IFFmpegRenderer() {}
2018-07-13 09:28:10 +00:00
virtual bool initialize(SDL_Window* window,
int videoFormat,
int width,
int height,
int maxFps,
bool enableVsync) = 0;
2018-07-13 09:28:10 +00:00
virtual bool prepareDecoderContext(AVCodecContext* context) = 0;
2018-08-16 06:57:03 +00:00
virtual void renderFrameAtVsync(AVFrame* frame) = 0;
virtual bool needsTestFrame() = 0;
virtual int getDecoderCapabilities() = 0;
2018-07-13 09:28:10 +00:00
};
class SdlRenderer : public IFFmpegRenderer {
2018-07-13 09:28:10 +00:00
public:
SdlRenderer();
virtual ~SdlRenderer();
virtual bool initialize(SDL_Window* window,
int videoFormat,
int width,
int height,
int maxFps,
bool enableVsync);
2018-07-13 09:28:10 +00:00
virtual bool prepareDecoderContext(AVCodecContext* context);
2018-08-16 06:57:03 +00:00
virtual void renderFrameAtVsync(AVFrame* frame);
virtual bool needsTestFrame();
virtual int getDecoderCapabilities();
2018-07-13 09:28:10 +00:00
private:
SDL_Renderer* m_Renderer;
SDL_Texture* m_Texture;
};