diff --git a/src/output/output_httpts.cpp b/src/output/output_httpts.cpp index 7d4cdfc4..cab1c7a8 100644 --- a/src/output/output_httpts.cpp +++ b/src/output/output_httpts.cpp @@ -4,12 +4,24 @@ #include #include -namespace Mist { +namespace Mist{ OutHTTPTS::OutHTTPTS(Socket::Connection & conn) : TSOutput(conn){ sendRepeatingHeaders = 500;//PAT/PMT every 500ms (DVB spec) } - OutHTTPTS::~OutHTTPTS() {} + OutHTTPTS::~OutHTTPTS(){} + + void OutHTTPTS::initialSeek(){ + //Adds passthrough support to the regular initialSeek function + if (targetParams.count("passthrough")){ + selectedTracks.clear(); + for (std::map::iterator it = myMeta.tracks.begin(); + it != myMeta.tracks.end(); it++){ + selectedTracks.insert(it->first); + } + } + Output::initialSeek(); + } void OutHTTPTS::init(Util::Config * cfg){ HTTPOutput::init(cfg); diff --git a/src/output/output_httpts.h b/src/output/output_httpts.h index de36f182..1013da7d 100644 --- a/src/output/output_httpts.h +++ b/src/output/output_httpts.h @@ -9,6 +9,7 @@ namespace Mist { static void init(Util::Config * cfg); void onHTTP(); void sendTS(const char * tsData, unsigned int len=188); + void initialSeek(); private: bool isRecording(); bool isFileTarget(){return isRecording();} diff --git a/src/output/output_ts.cpp b/src/output/output_ts.cpp index 9fc594d8..68cc6f07 100644 --- a/src/output/output_ts.cpp +++ b/src/output/output_ts.cpp @@ -29,12 +29,8 @@ namespace Mist { } pushOut = true; udpSize = 5; - if (target.find('?') != std::string::npos){ - std::map vars; - HTTP::parseVars(target.substr(target.find('?')+1), vars); - if (vars.count("tracks")){tracks = vars["tracks"];} - if (vars.count("pkts")){udpSize = atoi(vars["pkts"].c_str());} - } + if (targetParams.count("tracks")){tracks = targetParams["tracks"];} + if (targetParams.count("pkts")){udpSize = atoi(targetParams["pkts"].c_str());} packetBuffer.reserve(188*udpSize); int port = atoi(target.substr(target.find(":") + 1).c_str()); target.erase(target.find(":"));//strip all after the colon @@ -97,6 +93,18 @@ namespace Mist { cfg->addOption("target", opt); } + void OutTS::initialSeek(){ + //Adds passthrough support to the regular initialSeek function + if (targetParams.count("passthrough")){ + selectedTracks.clear(); + for (std::map::iterator it = myMeta.tracks.begin(); + it != myMeta.tracks.end(); it++){ + selectedTracks.insert(it->first); + } + } + Output::initialSeek(); + } + void OutTS::sendTS(const char * tsData, unsigned int len){ if (pushOut){ static int curFilled = 0; diff --git a/src/output/output_ts.h b/src/output/output_ts.h index a307662f..45dc71b3 100644 --- a/src/output/output_ts.h +++ b/src/output/output_ts.h @@ -8,6 +8,7 @@ namespace Mist { static void init(Util::Config * cfg); void sendTS(const char * tsData, unsigned int len=188); static bool listenMode(); + void initialSeek(); private: unsigned int udpSize; bool pushOut; diff --git a/src/output/output_ts_base.cpp b/src/output/output_ts_base.cpp index 3e16063e..a8b76e74 100644 --- a/src/output/output_ts_base.cpp +++ b/src/output/output_ts_base.cpp @@ -3,8 +3,6 @@ namespace Mist { TSOutput::TSOutput(Socket::Connection & conn) : TS_BASECLASS(conn){ packCounter=0; - haveAvcc = false; - haveHvcc = false; ts_from = 0; setBlocking(true); sendRepeatingHeaders = 0; @@ -89,19 +87,15 @@ namespace Mist { } if (keyframe){ if (Trk.codec == "H264"){ - if (!haveAvcc){ - avccbox.setPayload(Trk.init); - haveAvcc = true; - } + MP4::AVCC avccbox; + avccbox.setPayload(Trk.init); bs = avccbox.asAnnexB(); extraSize += bs.size(); } /*LTS-START*/ if (Trk.codec == "HEVC"){ - if (!haveHvcc){ - hvccbox.setPayload(Trk.init); - haveHvcc = true; - } + MP4::HVCC hvccbox; + hvccbox.setPayload(Trk.init); bs = hvccbox.asAnnexB(); extraSize += bs.size(); } @@ -128,12 +122,16 @@ namespace Mist { } if (keyframe){ if (Trk.codec == "H264"){ + MP4::AVCC avccbox; + avccbox.setPayload(Trk.init); bs = avccbox.asAnnexB(); fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg); alreadySent += bs.size(); } /*LTS-START*/ if (Trk.codec == "HEVC"){ + MP4::HVCC hvccbox; + hvccbox.setPayload(Trk.init); bs = hvccbox.asAnnexB(); fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg); alreadySent += bs.size(); diff --git a/src/output/output_ts_base.h b/src/output/output_ts_base.h index 20394b7d..d1b041ef 100644 --- a/src/output/output_ts_base.h +++ b/src/output/output_ts_base.h @@ -25,13 +25,7 @@ namespace Mist { int contSDT; unsigned int packCounter; ///\todo update constructors? TS::Packet packData; - bool haveAvcc; - MP4::AVCC avccbox; bool appleCompat; - /*LTS-START*/ - bool haveHvcc; - MP4::HVCC hvccbox; - /*LTS-END*/ uint64_t sendRepeatingHeaders; ///< Amount of ms between PAT/PMT. Zero means do not repeat. uint64_t lastHeaderTime; ///< Timestamp last PAT/PMT were sent. uint64_t ts_from; ///< Starting time to subtract from timestamps