+ InputWithRefcount iwr;
+ iwr.input = create_input(src);
+ if (iwr.input == NULL) {
+ log(ERROR, "did not understand URL '%s', clients will not get any data.",
+ src.c_str());
+ return;
+ }
+ iwr.refcount = 0;
+ inputs->insert(make_pair(src, iwr));
+}
+
+// Find all streams in the configuration file, and create inputs for them.
+void create_config_inputs(const Config &config, multimap<string, InputWithRefcount> *inputs)
+{
+ for (unsigned i = 0; i < config.streams.size(); ++i) {
+ const StreamConfig &stream_config = config.streams[i];
+ create_config_input(stream_config.src, inputs);
+ }
+ for (unsigned i = 0; i < config.udpstreams.size(); ++i) {
+ const UDPStreamConfig &udpstream_config = config.udpstreams[i];
+ create_config_input(udpstream_config.src, inputs);
+ }
+}
+
+void create_streams(const Config &config,
+ const set<string> &deserialized_urls,
+ multimap<string, InputWithRefcount> *inputs)
+{
+ for (unsigned i = 0; i < config.mark_pools.size(); ++i) {
+ const MarkPoolConfig &mp_config = config.mark_pools[i];
+ mark_pools.push_back(new MarkPool(mp_config.from, mp_config.to));
+ }
+
+ // HTTP streams.
+ set<string> expecting_urls = deserialized_urls;
+ for (unsigned i = 0; i < config.streams.size(); ++i) {
+ const StreamConfig &stream_config = config.streams[i];
+ int stream_index;
+ if (deserialized_urls.count(stream_config.url) == 0) {
+ stream_index = servers->add_stream(stream_config.url,
+ stream_config.backlog_size,
+ Stream::Encoding(stream_config.encoding));
+ } else {
+ stream_index = servers->lookup_stream_by_url(stream_config.url);
+ assert(stream_index != -1);
+ servers->set_backlog_size(stream_index, stream_config.backlog_size);
+ servers->set_encoding(stream_index,
+ Stream::Encoding(stream_config.encoding));