6 #include <condition_variable>
11 #include <libavformat/avio.h>
19 Player(JPEGFrameView *destination);
21 void play_clip(const Clip &clip, unsigned stream_idx);
22 void override_angle(unsigned stream_idx); // For the current clip only.
24 // Not thread-safe to set concurrently with playing.
25 // Will be called back from the player thread.
26 using done_callback_func = std::function<void()>;
27 void set_done_callback(done_callback_func cb) { done_callback = cb; }
31 void open_output_stream();
32 static int write_packet2_thunk(void *opaque, uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
33 int write_packet2(uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
35 JPEGFrameView *destination;
36 done_callback_func done_callback;
39 Clip current_clip; // Under mu. Can have pts_in = -1 for no clip.
40 unsigned current_stream_idx; // Under mu.
42 std::mutex queue_state_mu;
43 std::condition_variable new_clip_changed;
44 bool new_clip_ready = false; // Under queue_state_mu.
45 bool playing = false; // Under queue_state_mu.
46 int override_stream_idx = -1; // Under queue_state_mu.
49 std::unique_ptr<Mux> stream_mux; // To HTTP.
50 std::string stream_mux_header;
51 bool seen_sync_markers = false;
54 #endif // !defined(_PLAYER_H)