Fixed data inspection for progressive connectors.
This commit is contained in:
parent
9540273f19
commit
4f96d6ddef
3 changed files with 26 additions and 17 deletions
|
@ -74,8 +74,10 @@ namespace Connector_HTTP {
|
|||
//under 3 hours we assume seconds, otherwise byte position
|
||||
if (start < 10800){
|
||||
seek_sec = start * 1000; //ms, not s
|
||||
seek_byte = 0;
|
||||
}else{
|
||||
seek_byte = start; //divide by 1mbit, then *1000 for ms.
|
||||
seek_sec = 0;
|
||||
}
|
||||
ready4data = true;
|
||||
HTTP_R.Clean(); //clean for any possible next requests
|
||||
|
@ -158,8 +160,16 @@ namespace Connector_HTTP {
|
|||
}
|
||||
progressive_has_sent_header = true;
|
||||
}
|
||||
tag.DTSCLoader(Strm);
|
||||
conn.SendNow(tag.data, tag.len); //write the tag contents
|
||||
if (Strm.lastType() == DTSC::PAUSEMARK){
|
||||
conn.close();
|
||||
}
|
||||
if (Strm.lastType() == DTSC::AUDIO || Strm.lastType() == DTSC::VIDEO){
|
||||
std::string codec = Strm.getTrackById(Strm.getPacket()["trackid"].asInt())["codec"].asString();
|
||||
if (codec == "AAC" || codec == "MP3" || codec == "H264"){
|
||||
tag.DTSCLoader(Strm);
|
||||
conn.SendNow(tag.data, tag.len); //write the tag contents
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Util::sleep(1);
|
||||
|
|
|
@ -40,7 +40,6 @@ namespace Connector_HTTP {
|
|||
unsigned int seek_sec = 0;//Seek position in ms
|
||||
unsigned int seek_byte = 0;//Seek position in bytes
|
||||
|
||||
int videoID = -1;
|
||||
int audioID = -1;
|
||||
|
||||
while (conn.connected()){
|
||||
|
@ -98,10 +97,7 @@ namespace Connector_HTTP {
|
|||
Strm.waitForMeta(ss);
|
||||
int byterate = 0;
|
||||
for (JSON::ObjIter objIt = Strm.metadata["tracks"].ObjBegin(); objIt != Strm.metadata["tracks"].ObjEnd(); objIt++){
|
||||
if (videoID == -1 && objIt->second["type"].asString() == "video"){
|
||||
videoID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
if (audioID == -1 && objIt->second["type"].asString() == "audio"){
|
||||
if (audioID == -1 && objIt->second["codec"].asString() == "MP3"){
|
||||
audioID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
}
|
||||
|
@ -114,9 +110,6 @@ namespace Connector_HTTP {
|
|||
}
|
||||
std::stringstream cmd;
|
||||
cmd << "t";
|
||||
if (videoID != -1){
|
||||
cmd << " " << videoID;
|
||||
}
|
||||
if (audioID != -1){
|
||||
cmd << " " << audioID;
|
||||
}
|
||||
|
@ -139,6 +132,9 @@ namespace Connector_HTTP {
|
|||
conn.SendNow(HTTP_S.BuildResponse("200", "OK")); //no SetBody = unknown length - this is intentional, we will stream the entire file
|
||||
progressive_has_sent_header = true;
|
||||
}
|
||||
if(Strm.lastType() == DTSC::PAUSEMARK){
|
||||
conn.close();
|
||||
}
|
||||
if(Strm.lastType() == DTSC::AUDIO){
|
||||
conn.SendNow(Strm.lastData()); //write the MP3 contents
|
||||
}
|
||||
|
|
|
@ -46,8 +46,6 @@ namespace Connector_HTTP {
|
|||
unsigned int seek_sec = 0;//Seek position in ms
|
||||
unsigned int seek_byte = 0;//Seek position in bytes
|
||||
|
||||
bool isMP3 = false;//Indicates whether the request is audio-only mp3.
|
||||
|
||||
int videoID = -1;
|
||||
int audioID = -1;
|
||||
|
||||
|
@ -106,10 +104,10 @@ namespace Connector_HTTP {
|
|||
Strm.waitForMeta(ss);
|
||||
int byterate = 0;
|
||||
for (JSON::ObjIter objIt = Strm.metadata["tracks"].ObjBegin(); objIt != Strm.metadata["tracks"].ObjEnd(); objIt++){
|
||||
if (videoID == -1 && objIt->second["type"].asString() == "video"){
|
||||
if (videoID == -1 && objIt->second["codec"].asString() == "THEORA"){
|
||||
videoID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
if (audioID == -1 && objIt->second["type"].asString() == "audio"){
|
||||
if (audioID == -1 && objIt->second["codec"].asString() == "VORBIS"){
|
||||
audioID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
}
|
||||
|
@ -160,9 +158,14 @@ namespace Connector_HTTP {
|
|||
conn.SendNow((char*)curOggPage.getPage(), curOggPage.getPageSize());
|
||||
DTSCBuffer[temp].clear();
|
||||
}
|
||||
//long long unsigned int prevID = Strm.getPacket()["trackid"].asInt();
|
||||
DTSCBuffer[temp].push_back(Strm.getPacket());
|
||||
prevGran[temp] = Strm.getPacket()["granule"].asInt();
|
||||
if (Strm.lastType() == DTSC::PAUSEMARK){
|
||||
conn.close();
|
||||
}
|
||||
if (Strm.lastType() == DTSC::AUDIO || Strm.lastType() == DTSC::VIDEO){
|
||||
//long long unsigned int prevID = Strm.getPacket()["trackid"].asInt();
|
||||
DTSCBuffer[temp].push_back(Strm.getPacket());
|
||||
prevGran[temp] = Strm.getPacket()["granule"].asInt();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Util::sleep(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue