Separate FFmpeg decoder from the Session class (#4)

This commit is contained in:
Cameron Gutman
2018-07-17 20:00:16 -07:00
committed by GitHub
parent ec68f2ae89
commit a89cadc520
12 changed files with 276 additions and 166 deletions
+8 -31
View File
@@ -7,13 +7,7 @@
#include "backend/computermanager.h"
#include "settings/streamingpreferences.h"
#include "input.hpp"
#include "renderers/renderer.h"
extern "C" {
#include <libavcodec/avcodec.h>
}
#define SDL_CODE_FRAME_READY 0
#include "video/decoder.h"
class Session : public QObject
{
@@ -45,26 +39,14 @@ private:
int sdlDetermineAudioConfiguration();
static
bool chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
SDL_Window* window,
int videoFormat,
int width, int height,
AVCodec*& chosenDecoder,
const AVCodecHWConfig*& chosenHwConfig,
IRenderer*& newRenderer);
static
enum AVPixelFormat getHwFormat(AVCodecContext*,
const enum AVPixelFormat* pixFmts);
static
bool isHardwareDecodeAvailable(StreamingPreferences::VideoDecoderSelection vds,
int videoFormat, int width, int height);
int videoFormat, int width, int height, int frameRate);
void renderFrame(SDL_UserEvent* event);
void dropFrame(SDL_UserEvent* event);
static
bool chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
SDL_Window* window, int videoFormat, int width, int height,
int frameRate, IVideoDecoder*& chosenDecoder);
static
void clStageStarting(int stage);
@@ -110,13 +92,8 @@ private:
NvComputer* m_Computer;
NvApp m_App;
SDL_Window* m_Window;
static AVPacket s_Pkt;
static AVCodecContext* s_VideoDecoderCtx;
static QByteArray s_DecodeBuffer;
static AVBufferRef* s_HwDeviceCtx;
static const AVCodecHWConfig* s_HwDecodeCfg;
static IRenderer* s_Renderer;
IVideoDecoder* m_VideoDecoder;
SDL_SpinLock m_DecoderLock;
static SDL_AudioDeviceID s_AudioDevice;
static OpusMSDecoder* s_OpusDecoder;