]> git.sesse.net Git - nageru/blob - player.h
Some refactoring of the player code, and begin working on the playlist.
[nageru] / player.h
1 #ifndef _PLAYER_H
2 #define _PLAYER_H 1
3
4 #include "clip_list.h"
5
6 #include <condition_variable>
7 #include <mutex>
8
9 class JPEGFrameView;
10
11 class Player {
12 public:
13         Player(JPEGFrameView *destination);
14
15         void play_clip(const Clip &clip, unsigned stream_idx);
16
17 private:
18         void thread_func();
19
20         JPEGFrameView *destination;
21
22         std::mutex mu;
23         Clip current_clip;  // Under mu.
24         unsigned current_stream_idx;  // Under mu.
25
26         enum { PAUSED, PLAYING } cue_state = PAUSED;  // Under cue_state_mu.
27         std::mutex cue_state_mu;
28         std::condition_variable cue_is_playing;
29 };
30
31 #endif  // !defined(_PLAYER_H)