1 #ifndef _VIDEO_STREAM_H
2 #define _VIDEO_STREAM_H 1
8 #include <libavformat/avio.h>
11 #include <condition_variable>
24 void schedule_original_frame(int64_t output_pts, unsigned stream_idx, int64_t input_pts);
25 void schedule_interpolated_frame(int64_t output_pts, unsigned stream_idx, int64_t input_first_pts, int64_t input_second_pts, float alpha);
28 void encode_thread_func();
29 std::thread encode_thread;
31 static int write_packet2_thunk(void *opaque, uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
32 int write_packet2(uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time);
36 enum Type { ORIGINAL, INTERPOLATED } type;
38 int64_t input_first_pts; // The only pts for original frames.
40 // For interpolated frames only.
41 int64_t input_second_pts;
44 GLuint fence; // Set when the flow is done computing.
46 std::deque<QueuedFrame> frame_queue; // Under <queue_lock>.
47 std::mutex queue_lock;
48 std::condition_variable queue_nonempty;
50 std::unique_ptr<Mux> stream_mux; // To HTTP.
51 std::string stream_mux_header;
52 bool seen_sync_markers = false;
55 #endif // !defined(_VIDEO_STREAM_H)