2018-07-13 09:28:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
2019-04-12 05:27:20 +00:00
|
|
|
#include "streaming/video/decoder.h"
|
2019-02-13 02:43:38 +00:00
|
|
|
#include "streaming/video/overlaymanager.h"
|
|
|
|
|
2018-07-13 09:28:10 +00:00
|
|
|
extern "C" {
|
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
}
|
|
|
|
|
2019-02-13 02:43:38 +00:00
|
|
|
class IFFmpegRenderer : public Overlay::IOverlayRenderer {
|
2018-07-13 09:28:10 +00:00
|
|
|
public:
|
2018-12-25 20:57:00 +00:00
|
|
|
enum FramePacingConstraint {
|
|
|
|
PACING_FORCE_OFF,
|
|
|
|
PACING_FORCE_ON,
|
|
|
|
PACING_ANY
|
2018-09-04 00:57:09 +00:00
|
|
|
};
|
|
|
|
|
2019-04-12 05:27:20 +00:00
|
|
|
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
|
2018-07-13 09:28:10 +00:00
|
|
|
virtual bool prepareDecoderContext(AVCodecContext* context) = 0;
|
2019-02-16 03:31:01 +00:00
|
|
|
virtual void renderFrame(AVFrame* frame) = 0;
|
2019-04-13 05:12:53 +00:00
|
|
|
|
|
|
|
virtual bool needsTestFrame() {
|
|
|
|
// No test frame required by default
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual int getDecoderCapabilities() {
|
|
|
|
// No special capabilities by default
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual FramePacingConstraint getFramePacingConstraint() {
|
|
|
|
// No pacing preference
|
|
|
|
return PACING_ANY;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool isRenderThreadSupported() {
|
|
|
|
// Render thread is supported by default
|
|
|
|
return true;
|
|
|
|
}
|
2019-02-13 02:43:38 +00:00
|
|
|
|
2019-04-13 05:54:21 +00:00
|
|
|
virtual bool isDirectRenderingSupported() {
|
|
|
|
// The renderer can render directly to the display
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-04-16 04:56:01 +00:00
|
|
|
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) {
|
|
|
|
// Planar YUV 4:2:0
|
|
|
|
SDL_assert(videoFormat != VIDEO_FORMAT_H265_MAIN10);
|
|
|
|
return AV_PIX_FMT_YUV420P;
|
|
|
|
}
|
|
|
|
|
2019-02-13 02:43:38 +00:00
|
|
|
// IOverlayRenderer
|
|
|
|
virtual void notifyOverlayUpdated(Overlay::OverlayType) override {
|
|
|
|
// Nothing
|
|
|
|
}
|
2018-07-13 09:28:10 +00:00
|
|
|
};
|