mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-15 05:42:28 +00:00
40 lines
813 B
C++
40 lines
813 B
C++
#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);
|
|
|
|
bool initialize(SDL_Window* window, int maxVideoFps, bool enableVsync);
|
|
|
|
void vsyncCallback(int timeUntilNextVsyncMillis);
|
|
|
|
bool isUsingFrameQueue();
|
|
|
|
private:
|
|
QQueue<AVFrame*> m_FrameQueue;
|
|
QQueue<int> m_FrameQueueHistory;
|
|
SDL_SpinLock m_FrameQueueLock;
|
|
|
|
IVsyncSource* m_VsyncSource;
|
|
IFFmpegRenderer* m_VsyncRenderer;
|
|
int m_MaxVideoFps;
|
|
int m_DisplayFps;
|
|
bool m_EnableVsync;
|
|
PVIDEO_STATS m_VideoStats;
|
|
};
|