1 | #ifndef ENGINE_SHARED_VIDEO_H |
2 | #define ENGINE_SHARED_VIDEO_H |
3 | |
4 | #include <base/system.h> |
5 | |
6 | #include <functional> |
7 | |
8 | typedef std::function<void(short *pFinalOut, unsigned Frames)> ISoundMixFunc; |
9 | |
10 | class IVideo |
11 | { |
12 | public: |
13 | virtual ~IVideo(){}; |
14 | |
15 | virtual bool Start() = 0; |
16 | virtual void Stop() = 0; |
17 | virtual void Pause(bool Pause) = 0; |
18 | virtual bool IsRecording() = 0; |
19 | |
20 | virtual void NextVideoFrame() = 0; |
21 | virtual void NextVideoFrameThread() = 0; |
22 | |
23 | virtual void NextAudioFrame(ISoundMixFunc Mix) = 0; |
24 | virtual void NextAudioFrameTimeline(ISoundMixFunc Mix) = 0; |
25 | |
26 | static IVideo *Current() { return ms_pCurrentVideo; } |
27 | |
28 | static int64_t Time() { return ms_Time; } |
29 | static float LocalTime() { return ms_LocalTime; } |
30 | static void SetLocalStartTime(int64_t LocalStartTime) { ms_LocalStartTime = LocalStartTime; } |
31 | static void SetFPS(int FPS) { ms_TickTime = time_freq() / FPS; } |
32 | |
33 | protected: |
34 | static IVideo *ms_pCurrentVideo; |
35 | static int64_t ms_Time; |
36 | static int64_t ms_LocalStartTime; |
37 | static float ms_LocalTime; |
38 | static int64_t ms_TickTime; |
39 | }; |
40 | |
41 | #endif |
42 | |