5 #include "video_stream.h"
7 #include <condition_variable>
15 Player(JPEGFrameView *destination);
17 void play_clip(const Clip &clip, unsigned stream_idx);
18 void override_angle(unsigned stream_idx); // For the current clip only.
20 // Not thread-safe to set concurrently with playing.
21 // Will be called back from the player thread.
22 using done_callback_func = std::function<void()>;
23 void set_done_callback(done_callback_func cb) { done_callback = cb; }
27 void open_output_stream();
28 static int write_packet2_thunk(void *opaque, uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
29 int write_packet2(uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
31 JPEGFrameView *destination;
32 done_callback_func done_callback;
35 Clip current_clip; // Under mu. Can have pts_in = -1 for no clip.
36 unsigned current_stream_idx; // Under mu.
38 std::mutex queue_state_mu;
39 std::condition_variable new_clip_changed;
40 bool new_clip_ready = false; // Under queue_state_mu.
41 bool playing = false; // Under queue_state_mu.
42 int override_stream_idx = -1; // Under queue_state_mu.
44 VideoStream video_stream;
47 #endif // !defined(_PLAYER_H)