]> git.sesse.net Git - cubemap/blobdiff - input.cpp
Force input encoding for UDP streams to raw already at config parsing.
[cubemap] / input.cpp
index 102207f955deabdc8861ffbd9798fcefd1542e29..dba6cf38b26b3ca87a6a953c8842600012e0124b 100644 (file)
--- a/input.cpp
+++ b/input.cpp
@@ -63,7 +63,6 @@ bool parse_url(const string &url, string *protocol, string *user, string *host,
        if (split == rest.size()) {
                // http://foo
                split_user_host(rest, user, host);
-               fprintf(stderr, "ooo user='%s' host='%s'\n", user->c_str(), host->c_str());
                *port = *protocol;
                *path = "/";
                return true;
@@ -95,26 +94,27 @@ bool parse_url(const string &url, string *protocol, string *user, string *host,
        return true;
 }
 
-Input *create_input(const std::string &url)
+Input *create_input(const string &url, Input::Encoding encoding)
 {
        string protocol, user, host, port, path;
        if (!parse_url(url, &protocol, &user, &host, &port, &path)) {
-               return NULL;
+               return nullptr;
        }
        if (protocol == "http") {
-               return new HTTPInput(url);
+               return new HTTPInput(url, encoding);
        }
        if (protocol == "udp") {
+               assert(encoding == Input::INPUT_ENCODING_RAW);
                return new UDPInput(url);
        }
-       return NULL;
+       return nullptr;
 }
 
 Input *create_input(const InputProto &serialized)
 {
        string protocol, user, host, port, path;
        if (!parse_url(serialized.url(), &protocol, &user, &host, &port, &path)) {
-               return NULL;
+               return nullptr;
        }
        if (protocol == "http") {
                return new HTTPInput(serialized);
@@ -122,7 +122,7 @@ Input *create_input(const InputProto &serialized)
        if (protocol == "udp") {
                return new UDPInput(serialized);
        }
-       return NULL;
+       return nullptr;
 }
 
 Input::~Input() {}