Added ID and comment header support for theora and vorbis
This commit is contained in:
parent
8f8b3694b0
commit
35ee722f81
2 changed files with 45 additions and 0 deletions
|
@ -178,6 +178,9 @@ namespace DTSC {
|
|||
int width;
|
||||
int height;
|
||||
int fpks;
|
||||
//vorbis and theora only
|
||||
std::string idHeader;
|
||||
std::string commentHeader;
|
||||
};
|
||||
|
||||
class Track : public readOnlyTrack {
|
||||
|
|
|
@ -166,6 +166,10 @@ namespace DTSC {
|
|||
height = trackRef["height"].asInt();
|
||||
fpks = trackRef["fpks"].asInt();
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
idHeader = trackRef["idheader"].asString();
|
||||
commentHeader = trackRef["commentheader"].asString();
|
||||
}
|
||||
}
|
||||
|
||||
Track::Track(){}
|
||||
|
@ -186,6 +190,8 @@ namespace DTSC {
|
|||
width = rhs.width;
|
||||
height = rhs.height;
|
||||
fpks = rhs.fpks;
|
||||
idHeader = rhs.idHeader;
|
||||
commentHeader = rhs.commentHeader;
|
||||
if (rhs.fragments && rhs.fragLen){
|
||||
fragments = std::deque<Fragment>(rhs.fragments, rhs.fragments + rhs.fragLen);
|
||||
}
|
||||
|
@ -229,6 +235,10 @@ namespace DTSC {
|
|||
height = trackRef["height"].asInt();
|
||||
fpks = trackRef["fpks"].asInt();
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
idHeader = trackRef["idheader"].asString();
|
||||
commentHeader = trackRef["commentheader"].asString();
|
||||
}
|
||||
}
|
||||
|
||||
void Track::update(JSON::Value & pack){
|
||||
|
@ -459,6 +469,10 @@ namespace DTSC {
|
|||
}else if (type == "video"){
|
||||
result += 48;
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
result += 15 + idHeader.size();//idheader
|
||||
result += 20 + commentHeader.size();//commentheader
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -472,6 +486,10 @@ namespace DTSC {
|
|||
}else if (type == "video"){
|
||||
result += 48;
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
result += 15 + idHeader.size();//idheader
|
||||
result += 20 + commentHeader.size();//commentheader
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -522,6 +540,14 @@ namespace DTSC {
|
|||
conn.SendNow("\000\004fpks\001", 7);
|
||||
conn.SendNow(convertLongLong(fpks), 8);
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
conn.SendNow("\000\010idheader\002", 11);
|
||||
conn.SendNow(convertInt(idHeader.size()), 4);
|
||||
conn.SendNow(idHeader);
|
||||
conn.SendNow("\000\015commentheader\002", 16);
|
||||
conn.SendNow(convertInt(commentHeader.size()), 4);
|
||||
conn.SendNow(commentHeader);
|
||||
}
|
||||
conn.SendNow("\000\000\356", 3);//End this track Object
|
||||
}
|
||||
|
||||
|
@ -578,6 +604,14 @@ namespace DTSC {
|
|||
conn.SendNow("\000\004fpks\001", 7);
|
||||
conn.SendNow(convertLongLong(fpks), 8);
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
conn.SendNow("\000\010idheader\002", 11);
|
||||
conn.SendNow(convertInt(idHeader.size()), 4);
|
||||
conn.SendNow(idHeader);
|
||||
conn.SendNow("\000\015commentheader\002", 16);
|
||||
conn.SendNow(convertInt(commentHeader.size()), 4);
|
||||
conn.SendNow(commentHeader);
|
||||
}
|
||||
conn.SendNow("\000\000\356", 3);//End this track Object
|
||||
}
|
||||
|
||||
|
@ -670,6 +704,10 @@ namespace DTSC {
|
|||
result["height"] = height;
|
||||
result["fpks"] = fpks;
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
result["idheader"] = idHeader;
|
||||
result["commentheader"] = commentHeader;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -713,6 +751,10 @@ namespace DTSC {
|
|||
result["height"] = height;
|
||||
result["fpks"] = fpks;
|
||||
}
|
||||
if (codec == "vorbis" || codec == "theora"){
|
||||
result["idheader"] = idHeader;
|
||||
result["commentheader"] = commentHeader;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue