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

43 lines
855 B
C
Raw Normal View History

#pragma once
#include "../../decoder.h"
#include "../renderer.h"
#include <QQueue>
class IVsyncSource {
public:
virtual ~IVsyncSource() {}
virtual bool initialize(SDL_Window* window, int displayFps) = 0;
};
class Pacer
{
public:
Pacer(IFFmpegRenderer* renderer, PVIDEO_STATS videoStats);
~Pacer();
void submitFrame(AVFrame* frame);
2018-12-25 20:57:00 +00:00
bool initialize(SDL_Window* window, int maxVideoFps, bool enablePacing);
void vsyncCallback(int timeUntilNextVsyncMillis);
bool isUsingFrameQueue();
private:
void renderFrame(AVFrame* frame);
QQueue<AVFrame*> m_FrameQueue;
QQueue<int> m_FrameQueueHistory;
SDL_SpinLock m_FrameQueueLock;
bool m_DropNextFrame;
IVsyncSource* m_VsyncSource;
2018-08-16 06:57:03 +00:00
IFFmpegRenderer* m_VsyncRenderer;
int m_MaxVideoFps;
int m_DisplayFps;
PVIDEO_STATS m_VideoStats;
};