9 Input(const std::string &stream_id, const std::string &url);
11 // Connect to the given URL and start streaming.
14 // Stop streaming. NOTE: Does not currently work!
18 // Recovers the this pointer and calls do_work().
19 static void *do_work_thunk(void *arg);
21 // Actually does the download.
24 // Recovers the this pointer and calls curl_callback().
25 static size_t curl_callback_thunk(char *ptr, size_t size, size_t nmemb, void *userdata);
27 // Stores the given data, looks for Metacube blocks (skipping data if needed),
28 // and calls process_block() for each one.
29 void curl_callback(char *ptr, size_t bytes);
30 void process_block(const char *data, uint32_t size, uint32_t flags);
32 // Drops <num_bytes> bytes from the head of <pending_data>,
33 // and outputs a warning.
34 void drop_pending_data(size_t num_bytes);
36 std::string stream_id;
39 // Data we have received but not fully processed yet.
40 std::vector<char> pending_data;
42 // If <pending_data> starts with a Metacube header,
44 bool has_metacube_header;
46 pthread_t worker_thread;
48 // Whether we should stop or not.
49 volatile bool should_stop;
52 #endif // !defined(_INPUT_H)