+Input *create_input(const std::string &url)
+{
+ string protocol, user, host, port, path;
+ if (!parse_url(url, &protocol, &user, &host, &port, &path)) {
+ return NULL;
+ }
+ if (protocol == "http") {
+ return new HTTPInput(url);
+ }
+ if (protocol == "udp") {
+ return new UDPInput(url);
+ }
+ return NULL;
+}
+
+Input *create_input(const InputProto &serialized)
+{
+ string protocol, user, host, port, path;
+ if (!parse_url(serialized.url(), &protocol, &user, &host, &port, &path)) {
+ return NULL;
+ }
+ if (protocol == "http") {
+ return new HTTPInput(serialized);
+ }
+ if (protocol == "udp") {
+ return new UDPInput(serialized);
+ }
+ return NULL;
+}
+