2018-08-16 05:02:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../renderer.h"
|
|
|
|
|
|
|
|
#include <QQueue>
|
|
|
|
|
|
|
|
class IVsyncSource {
|
|
|
|
public:
|
|
|
|
virtual ~IVsyncSource() {}
|
|
|
|
virtual bool initialize(SDL_Window* window) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Pacer
|
|
|
|
{
|
|
|
|
public:
|
2018-08-16 06:57:03 +00:00
|
|
|
Pacer(IFFmpegRenderer* renderer);
|
2018-08-16 05:02:15 +00:00
|
|
|
|
|
|
|
~Pacer();
|
|
|
|
|
|
|
|
void submitFrame(AVFrame* frame);
|
|
|
|
|
|
|
|
bool initialize(SDL_Window* window, int maxVideoFps);
|
|
|
|
|
|
|
|
void vsyncCallback();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QQueue<AVFrame*> m_FrameQueue;
|
|
|
|
QQueue<int> m_FrameQueueHistory;
|
|
|
|
SDL_SpinLock m_FrameQueueLock;
|
|
|
|
|
|
|
|
IVsyncSource* m_VsyncSource;
|
2018-08-16 06:57:03 +00:00
|
|
|
IFFmpegRenderer* m_VsyncRenderer;
|
2018-08-16 05:02:15 +00:00
|
|
|
int m_MaxVideoFps;
|
|
|
|
int m_DisplayFps;
|
|
|
|
};
|