2018-08-16 05:02:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-09-25 07:47:59 +00:00
|
|
|
#include "../../decoder.h"
|
2018-08-16 05:02:15 +00:00
|
|
|
#include "../renderer.h"
|
|
|
|
|
|
|
|
#include <QQueue>
|
|
|
|
|
|
|
|
class IVsyncSource {
|
|
|
|
public:
|
|
|
|
virtual ~IVsyncSource() {}
|
2018-08-21 00:53:35 +00:00
|
|
|
virtual bool initialize(SDL_Window* window, int displayFps) = 0;
|
2018-08-16 05:02:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Pacer
|
|
|
|
{
|
|
|
|
public:
|
2018-09-25 07:47:59 +00:00
|
|
|
Pacer(IFFmpegRenderer* renderer, PVIDEO_STATS videoStats);
|
2018-08-16 05:02:15 +00:00
|
|
|
|
|
|
|
~Pacer();
|
|
|
|
|
|
|
|
void submitFrame(AVFrame* frame);
|
|
|
|
|
2018-12-25 20:57:00 +00:00
|
|
|
bool initialize(SDL_Window* window, int maxVideoFps, bool enablePacing);
|
2018-08-16 05:02:15 +00:00
|
|
|
|
2018-08-21 00:53:35 +00:00
|
|
|
void vsyncCallback(int timeUntilNextVsyncMillis);
|
2018-08-16 05:02:15 +00:00
|
|
|
|
2018-08-17 00:59:33 +00:00
|
|
|
bool isUsingFrameQueue();
|
|
|
|
|
2018-08-16 05:02:15 +00:00
|
|
|
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;
|
2018-09-25 07:47:59 +00:00
|
|
|
PVIDEO_STATS m_VideoStats;
|
2018-08-16 05:02:15 +00:00
|
|
|
};
|