From b55a219498eeceb63a98dcfdc7597b7c40d6977c Mon Sep 17 00:00:00 2001 From: oskwon Date: Sun, 29 Jun 2014 16:12:10 +0900 Subject: Support backward compatibility. --- src/Http.cpp | 19 ++++++++++++++++--- src/Http.h | 3 ++- src/main.cpp | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Http.cpp b/src/Http.cpp index 1f410c0..161b288 100644 --- a/src/Http.cpp +++ b/src/Http.cpp @@ -62,8 +62,13 @@ bool HttpHeader::parse_request(std::string header) } } - if (page == "/file_stream") { - type = HttpHeader::TRANSCODING_FILE; + if (page == "/file") { + if (page_params["check"] == "valid") { + type = HttpHeader::TRANSCODING_FILE_CHECK; + } + else { + type = HttpHeader::TRANSCODING_FILE; + } } else if (page == "/m3u") { type = HttpHeader::M3U; @@ -87,6 +92,14 @@ std::string HttpHeader::build_response(Mpeg *source) std::ostringstream oss; switch(type) { + case HttpHeader::TRANSCODING_FILE_CHECK: { + oss << http_ok; + oss << http_connection; + oss << "Content-Type: text/plain\r\n"; + oss << http_server; + oss << http_done; + } + break; case HttpHeader::TRANSCODING_FILE: { std::string range = params["Range"]; off_t seek_offset = 0, content_length = 0; @@ -130,7 +143,7 @@ std::string HttpHeader::build_response(Mpeg *source) std::ostringstream m3u_oss; m3u_oss << "#EXTM3U\n"; m3u_oss << "#EXTVLCOPT--http-reconnect=true\n"; - m3u_oss << "http://" << params["Host"] << "/file_stream?file=" << page_params["file"]; + m3u_oss << "http://" << params["Host"] << "/file?file=" << page_params["file"]; if (page_params["position"] != "") { m3u_oss << "&position=" << page_params["position"]; } diff --git a/src/Http.h b/src/Http.h index 69f7a09..6c54d95 100644 --- a/src/Http.h +++ b/src/Http.h @@ -21,7 +21,8 @@ public: UNKNOWN = 0, TRANSCODING_LIVE, TRANSCODING_FILE, - M3U + M3U, + TRANSCODING_FILE_CHECK }; int type; diff --git a/src/main.cpp b/src/main.cpp index 4d5da36..93197bd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -105,6 +105,7 @@ int main(int argc, char **argv) throw(e); } break; + case HttpHeader::TRANSCODING_FILE_CHECK: case HttpHeader::M3U: try { std::string response = header.build_response((Mpeg*) source); -- cgit