Opus in TS input/output support

This commit is contained in:
Thulinma 2020-06-16 19:32:59 +02:00
parent 1c47e9cdfc
commit 97752f2c2d
9 changed files with 240 additions and 27 deletions

View file

@ -94,6 +94,10 @@ std::string AnalyserTS::printPES(const std::string &d, size_t PID){
res << " [Audio " << (int)(d[3] & 0x1F) << "]";
known = true;
}
if (!known && d[3] == 0xBD){
res << " [Private Stream 1]";
known = true;
}
if (!known){res << " [Unknown stream ID: " << (int)d[3] << "]";}
if (d[0] != 0 || d[1] != 0 || d[2] != 1){
res << " [!!! INVALID START CODE: " << (int)d[0] << " " << (int)d[1] << " " << (int)d[2] << " ]";

View file

@ -172,6 +172,7 @@ namespace Mist{
capa["codecs"][0u][1u].append("AAC");
capa["codecs"][0u][1u].append("AC3");
capa["codecs"][0u][1u].append("MP2");
capa["codecs"][0u][1u].append("opus");
inFile = NULL;
inputProcess = 0;
isFinished = false;

View file

@ -70,6 +70,7 @@ namespace Mist{
capa["codecs"][0u][1u].append("+MP3");
capa["codecs"][0u][1u].append("+AC3");
capa["codecs"][0u][1u].append("+MP2");
capa["codecs"][0u][1u].append("+opus");
capa["methods"][0u]["handler"] = "http";
capa["methods"][0u]["type"] = "html5/video/mpeg";
capa["methods"][0u]["priority"] = 1;

View file

@ -110,6 +110,7 @@ namespace Mist{
capa["codecs"][0u][1u].append("MP3");
capa["codecs"][0u][1u].append("AC3");
capa["codecs"][0u][1u].append("MP2");
capa["codecs"][0u][1u].append("opus");
cfg->addConnectorOptions(8888, capa);
config = cfg;
capa["push_urls"].append("tsudp://*");

View file

@ -164,11 +164,21 @@ namespace Mist{
packTime = aacSamples * 90000 / freq;
}
}
bs = TS::Packet::getPESAudioLeadIn(tempLen, packTime, M.getBps(thisIdx));
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);
if (codec == "AAC"){
bs = TS::getAudioHeader(dataLen, M.getInit(thisIdx));
if (codec == "opus"){
tempLen += 3 + (dataLen/255);
bs = TS::Packet::getPESPS1LeadIn(tempLen, packTime, M.getBps(thisIdx));
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);
bs = "\177\340";
bs.append(dataLen/255, (char)255);
bs.append(1, (char)(dataLen-255*(dataLen/255)));
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);
}else{
bs = TS::Packet::getPESAudioLeadIn(tempLen, packTime, M.getBps(thisIdx));
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);
if (codec == "AAC"){
bs = TS::getAudioHeader(dataLen, M.getInit(thisIdx));
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);
}
}
fillPacket(dataPointer, dataLen, firstPack, video, keyframe, pkgPid, contPkg);
}else if (type == "meta"){