From eca085cc495e7d0a40ce23b2cfb467c2c21bb276 Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Mon, 28 Oct 2013 09:18:09 +0100 Subject: [PATCH] Still not working Live HTTP Smooth. --- src/connectors/conn_http_smooth.cpp | 39 +++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/connectors/conn_http_smooth.cpp b/src/connectors/conn_http_smooth.cpp index d5db7940..23ed29a5 100644 --- a/src/connectors/conn_http_smooth.cpp +++ b/src/connectors/conn_http_smooth.cpp @@ -74,7 +74,7 @@ namespace Connector_HTTP { "QualityLevels=\"" << allAudio.size() << "\" " "Name=\"audio\" " "Chunks=\"" << allAudio.ObjBegin()->second["keys"].size() << "\" " - "Url=\"Q({bitrate})/A({start time})\">\n"; + "Url=\"Q({bitrate},{CustomAttributes})/A({start time})\">\n"; int index = 0; for (JSON::ObjIter oIt = allAudio.ObjBegin(); oIt != allAudio.ObjEnd(); oIt++){ Result << "\n"; + "FourCC=\"AACL\" >\n"; + Result << "\n" + "second["trackid"].asString() << "\" />" + ""; + Result << "\n"; index++; } - for (JSON::ArrIter keyIt = allAudio.ObjBegin()->second["keys"].ArrBegin(); keyIt != allAudio.ObjBegin()->second["keys"].ArrEnd(); keyIt++){ + for (JSON::ArrIter keyIt = allAudio.ObjBegin()->second["keys"].ArrBegin(); keyIt != ((allAudio.ObjBegin()->second["keys"].ArrEnd()) - 1); keyIt++){ Result << "second["keys"].ArrBegin()){ Result << "t=\"" << allAudio.ObjBegin()->second["firstms"].asInt() * 10000 << "\" "; @@ -109,7 +113,7 @@ namespace Connector_HTTP { "QualityLevels=\"" << allVideo.size() << "\" " "Name=\"video\" " "Chunks=\"" << allVideo.ObjBegin()->second["keys"].size() << "\" " - "Url=\"Q({bitrate})/V({start time})\" " + "Url=\"Q({bitrate},{CustomAttributes})/V({start time})\" " "MaxWidth=\"" << maxWidth << "\" " "MaxHeight=\"" << maxHeight << "\" " "DisplayWidth=\"" << maxWidth << "\" " @@ -130,13 +134,17 @@ namespace Connector_HTTP { Result << std::dec << "\" " "MaxWidth=\"" << oIt->second["width"].asInt() << "\" " "MaxHeight=\"" << oIt->second["height"].asInt() << "\" " - "FourCC=\"AVC1\" />\n"; + "FourCC=\"AVC1\" >\n"; + Result << "\n" + "second["trackid"].asString() << "\" />" + ""; + Result << "\n"; index++; } - for (JSON::ArrIter keyIt = allVideo.ObjBegin()->second["keys"].ArrBegin(); keyIt != allVideo.ObjBegin()->second["keys"].ArrEnd(); keyIt++){ + for (JSON::ArrIter keyIt = allVideo.ObjBegin()->second["keys"].ArrBegin(); keyIt != ((allVideo.ObjBegin()->second["keys"].ArrEnd()) - 1); keyIt++){ Result << "second["keys"].ArrBegin()){ - Result << "t=\"" << allVideo.ObjBegin()->second["firstms"].asInt() * 10000 << "\" "; + Result << "t=\"" << (*keyIt)["time"].asInt() * 10000 << "\" "; } Result << "d=\"" << (*keyIt)["len"].asInt() * 10000 << "\" />\n"; } @@ -228,7 +236,7 @@ namespace Connector_HTTP { if (HTTP_R.url.find("Manifest") == std::string::npos){ //We have a non-manifest request, parse it. - Quality = HTTP_R.url.substr(HTTP_R.url.find("/Q(", 8) + 3); + Quality = HTTP_R.url.substr(HTTP_R.url.find("TrackID=", 8) + 8); Quality = Quality.substr(0, Quality.find(")")); parseString = HTTP_R.url.substr(HTTP_R.url.find(")/") + 2); wantsAudio = false; @@ -242,11 +250,11 @@ namespace Connector_HTTP { parseString = parseString.substr(parseString.find("(") + 1); requestedTime = atoll(parseString.substr(0, parseString.find(")")).c_str()); JSON::Value myRef; - long long int selectedQuality = atoll(Quality.c_str()) / 8; + long long int selectedQuality = atoll(Quality.c_str()); if (wantsVideo){ //Select the correct track ID for (JSON::ObjIter vIt = allVideo.ObjBegin(); vIt != allVideo.ObjEnd(); vIt++){ - if (vIt->second["bps"].asInt() == selectedQuality){ + if (vIt->second["trackid"].asInt() == selectedQuality){ myRef = vIt->second; } } @@ -254,13 +262,12 @@ namespace Connector_HTTP { if (wantsAudio){ //Select the correct track ID for (JSON::ObjIter aIt = allAudio.ObjBegin(); aIt != allAudio.ObjEnd(); aIt++){ - if (aIt->second["bps"].asInt() == selectedQuality){ + if (aIt->second["trackid"].asInt() == selectedQuality){ myRef = aIt->second; } } } if (Strm.metadata.isMember("live")){ - ///\todo Fix this for live stuff int seekable = Strm.canSeekms(requestedTime / 10000); if (seekable == 0){ // iff the fragment in question is available, check if the next is available too @@ -404,10 +411,10 @@ namespace Connector_HTTP { fragref_box.setVersion(1); fragref_box.setFragmentCount(0); int fragCount = 0; - for (int i = 0; i < Strm.metadata["keytime"].size(); i++){ - if (Strm.metadata["keytime"][i].asInt() > (requestedTime / 10000)){ - fragref_box.setTime(fragCount, Strm.metadata["keytime"][i].asInt() * 10000); - fragref_box.setDuration(fragCount, Strm.metadata["keylen"][i].asInt() * 10000); + for (int i = 0; i < trackRef["keys"].size() - 1; i++){ + if (trackRef["keys"][i]["time"].asInt() > (requestedTime / 10000)){ + fragref_box.setTime(fragCount, trackRef["keys"][i]["time"].asInt() * 10000); + fragref_box.setDuration(fragCount, trackRef["keys"][i]["len"].asInt() * 10000); fragref_box.setFragmentCount(++fragCount); } }