Still not working Live HTTP Smooth.
This commit is contained in:
parent
9994d4a590
commit
eca085cc49
1 changed files with 23 additions and 16 deletions
|
@ -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 << "<QualityLevel "
|
||||
|
@ -90,10 +90,14 @@ namespace Connector_HTTP {
|
|||
"BitsPerSample=\"16\" "
|
||||
"PacketSize=\"4\" "
|
||||
"AudioTag=\"255\" "
|
||||
"FourCC=\"AACL\" />\n";
|
||||
"FourCC=\"AACL\" >\n";
|
||||
Result << "<CustomAttributes>\n"
|
||||
"<Attribute Name = \"TrackID\" Value = \"" << oIt->second["trackid"].asString() << "\" />"
|
||||
"</CustomAttributes>";
|
||||
Result << "</QualityLevel>\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 << "<c ";
|
||||
if (keyIt == allAudio.ObjBegin()->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 << "<CustomAttributes>\n"
|
||||
"<Attribute Name = \"TrackID\" Value = \"" << oIt->second["trackid"].asString() << "\" />"
|
||||
"</CustomAttributes>";
|
||||
Result << "</QualityLevel>\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 << "<c ";
|
||||
if (keyIt == allVideo.ObjBegin()->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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue