diff --git a/lib/mp4.cpp b/lib/mp4.cpp index ee0aa703..85ded767 100644 --- a/lib/mp4.cpp +++ b/lib/mp4.cpp @@ -187,7 +187,7 @@ void ABST::SetVersion( bool NewVersion) { } void ABST::SetReserved( ) { - Container->SetPayload((uint32_t)4,Box::uint32_to_uint8(0)); + SetPayload((uint32_t)4,Box::uint32_to_uint8(0)); } void ABST::WriteContent( ) { @@ -393,7 +393,7 @@ std::string GenerateLiveBootstrap( uint32_t CurMediaTime ) { abst.AddServerEntry(""); abst.AddQualityEntry(""); abst.WriteContent(); - + std::string Result; Result.append((char*)abst.GetBoxedData(), (int)abst.GetBoxedDataSize()); return Result; diff --git a/lib/mp4.h b/lib/mp4.h index b4ec5417..0ef24659 100644 --- a/lib/mp4.h +++ b/lib/mp4.h @@ -75,7 +75,6 @@ namespace MP4{ std::vector Qualities; std::vector SegmentRunTables; std::vector FragmentRunTables; - Box * Container; };//ABST Box struct afrt_fragmentrunentry { diff --git a/src/conn_http.cpp b/src/conn_http.cpp index 961d4c34..42606450 100644 --- a/src/conn_http.cpp +++ b/src/conn_http.cpp @@ -164,7 +164,6 @@ namespace Connector_HTTP{ int ReqFragment = -1; int temp; int Flash_RequestPending = 0; - bool Flash_ManifestSent = false; unsigned int lastStats = 0; //int CurrentFragment = -1; later herbruiken? @@ -172,7 +171,9 @@ namespace Connector_HTTP{ //only parse input if available or not yet init'ed if (HTTP_R.Read(conn, ready4data)){ handler = HANDLER_PROGRESSIVE; + #if DEBUG >= 4 std::cout << "Received request: " << HTTP_R.url << std::endl; + #endif if ((HTTP_R.url.find("Seg") != std::string::npos) && (HTTP_R.url.find("Frag") != std::string::npos)){handler = HANDLER_FLASH;} if (HTTP_R.url.find("f4m") != std::string::npos){handler = HANDLER_FLASH;} if (HTTP_R.url == "/crossdomain.xml"){ @@ -185,7 +186,7 @@ namespace Connector_HTTP{ printf("Sending crossdomain.xml file\n"); #endif } - if (HTTP_R.url.substr(0, 7) == "/embed_" && HTTP_R.url.substr(HTTP_R.url.length() - 3, 3) == ".js"){ + if (HTTP_R.url.length() > 10 && HTTP_R.url.substr(0, 7) == "/embed_" && HTTP_R.url.substr(HTTP_R.url.length() - 3, 3) == ".js"){ streamname = HTTP_R.url.substr(7, HTTP_R.url.length() - 10); JSON::Value ServConf = JSON::fromFile("/tmp/mist/streamlist"); std::string response; @@ -218,24 +219,29 @@ namespace Connector_HTTP{ temp = HTTP_R.url.find("Frag") + 4; ReqFragment = atoi( HTTP_R.url.substr(temp).c_str() ); #if DEBUG >= 4 - printf( "URL: %s\n", HTTP_R.url.c_str()); - printf( "Movie: %s, Quality: %s, Seg %d Frag %d\n", Movie.c_str(), Quality.c_str(), Segment, ReqFragment); + printf( "Quality: %s, Seg %d Frag %d\n", Quality.c_str(), Segment, ReqFragment); #endif Flash_RequestPending++; }else{ Movie = HTTP_R.url.substr(1); Movie = Movie.substr(0,Movie.find("/")); - } - streamname = Movie; - if( !Flash_ManifestSent ) { HTTP_S.Clean(); HTTP_S.SetHeader("Content-Type","text/xml"); HTTP_S.SetHeader("Cache-Control","no-cache"); - HTTP_S.SetBody(BuildManifest(Movie)); + std::string manifest = BuildManifest(Movie); + #if DEBUG >= 4 + printf("Manifest: %s\n", manifest.c_str()); + #endif + HTTP_S.SetBody(manifest); HTTP_S.SendResponse(conn, "200", "OK"); - Flash_ManifestSent = true;//stop manifest from being sent multiple times - std::cout << "Sent manifest" << std::endl; + #if DEBUG >= 3 + printf("Sent manifest\n"); + #endif } + #if DEBUG >= 4 + printf( "Movie: %s\n", Movie.c_str()); + #endif + streamname = Movie; ready4data = true; }//FLASH handler if (handler == HANDLER_PROGRESSIVE){ @@ -244,6 +250,9 @@ namespace Connector_HTTP{ streamname = HTTP_R.url.substr(0, HTTP_R.url.size()-4);//strip the extension /// \todo VoD streams will need support for position reading from the URL parameters ready4data = true; + #if DEBUG >= 4 + printf( "Opening progressive stream: %s\n", streamname.c_str()); + #endif }//PROGRESSIVE handler HTTP_R.CleanForNext(); //clean for any possinble next requests } diff --git a/src/server_setup.h b/src/server_setup.h index 1e22d1a9..af7dec29 100644 --- a/src/server_setup.h +++ b/src/server_setup.h @@ -60,7 +60,6 @@ void signal_handler (int signum){ /// Any incoming connections will be accepted and start up the function #MAINHANDLER, /// which should be defined before including server_setup.cpp. /// The default port is set by define #DEFAULT_PORT. -/// The configuration file section is set by define #CONFIGSECT. int main(int argc, char ** argv){ Socket::Connection S;//placeholder for incoming connections