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

55 lines
1.7 KiB
C
Raw Normal View History

#pragma once
#include "decoder.h"
#include "ffmpeg-renderers/renderer.h"
2018-08-16 06:57:03 +00:00
#include "ffmpeg-renderers/pacer/pacer.h"
extern "C" {
#include <libavcodec/avcodec.h>
}
class FFmpegVideoDecoder : public IVideoDecoder {
public:
FFmpegVideoDecoder();
virtual ~FFmpegVideoDecoder();
virtual bool initialize(StreamingPreferences::VideoDecoderSelection vds,
SDL_Window* window,
int videoFormat,
int width,
int height,
int maxFps,
bool enableVsync) override;
virtual bool isHardwareAccelerated() override;
virtual int getDecoderCapabilities() override;
virtual int submitDecodeUnit(PDECODE_UNIT du) override;
virtual void renderFrame(SDL_UserEvent* event) override;
virtual void dropFrame(SDL_UserEvent* event) override;
2018-08-03 05:28:59 +00:00
virtual IFFmpegRenderer* getRenderer();
private:
2018-08-16 06:57:03 +00:00
bool completeInitialization(AVCodec* decoder, SDL_Window* window,
int videoFormat, int width, int height,
int maxFps, bool enableVsync, bool testOnly);
IFFmpegRenderer* createAcceleratedRenderer(const AVCodecHWConfig* hwDecodeCfg);
void reset();
static
enum AVPixelFormat ffGetFormat(AVCodecContext* context,
const enum AVPixelFormat* pixFmts);
AVPacket m_Pkt;
AVCodecContext* m_VideoDecoderCtx;
QByteArray m_DecodeBuffer;
const AVCodecHWConfig* m_HwDecodeCfg;
IFFmpegRenderer* m_Renderer;
SDL_atomic_t m_QueuedFrames;
int m_ConsecutiveFailedDecodes;
2018-08-16 06:57:03 +00:00
Pacer* m_Pacer;
static const uint8_t k_H264TestFrame[];
static const uint8_t k_HEVCTestFrame[];
};