New Meta commit
This commit is contained in:
parent
fccf66fba2
commit
2b99f2f5ea
183 changed files with 13333 additions and 14421 deletions
|
@ -59,6 +59,26 @@ int main(int argc, char *argv[]){
|
|||
config.addOption("json", opt);
|
||||
}
|
||||
|
||||
capa["codecs"][0u][0u].append("H264");
|
||||
capa["codecs"][0u][0u].append("HEVC");
|
||||
capa["codecs"][0u][0u].append("VP8");
|
||||
capa["codecs"][0u][0u].append("VP9");
|
||||
capa["codecs"][0u][0u].append("theora");
|
||||
capa["codecs"][0u][0u].append("MPEG2");
|
||||
capa["codecs"][0u][0u].append("AV1");
|
||||
capa["codecs"][0u][1u].append("AAC");
|
||||
capa["codecs"][0u][1u].append("vorbis");
|
||||
capa["codecs"][0u][1u].append("opus");
|
||||
capa["codecs"][0u][1u].append("PCM");
|
||||
capa["codecs"][0u][1u].append("ALAW");
|
||||
capa["codecs"][0u][1u].append("ULAW");
|
||||
capa["codecs"][0u][1u].append("MP2");
|
||||
capa["codecs"][0u][1u].append("MP3");
|
||||
capa["codecs"][0u][1u].append("FLOAT");
|
||||
capa["codecs"][0u][1u].append("AC3");
|
||||
capa["codecs"][0u][1u].append("DTS");
|
||||
capa["codecs"][0u][2u].append("+JSON");
|
||||
|
||||
if (!(config.parseArgs(argc, argv))){return 1;}
|
||||
if (config.getBool("json")){
|
||||
|
||||
|
@ -82,6 +102,14 @@ int main(int argc, char *argv[]){
|
|||
capa["optional"]["track_select"]["validate"][0u] = "track_selector";
|
||||
capa["optional"]["track_select"]["default"] = "audio=all&video=all";
|
||||
|
||||
capa["optional"]["track_inhibit"]["name"] = "Track inhibitor(s)";
|
||||
capa["optional"]["track_inhibit"]["help"] =
|
||||
"What tracks to use as inhibitors. If this track selector is able to select a track, the "
|
||||
"process does not start. Defaults to none.";
|
||||
capa["optional"]["track_inhibit"]["type"] = "string";
|
||||
capa["optional"]["track_inhibit"]["validate"][0u] = "track_selector";
|
||||
capa["optional"]["track_inhibit"]["default"] = "audio=none&video=none&subtitle=none";
|
||||
|
||||
std::cout << capa.toString() << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
@ -111,6 +139,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
// stream which connects to input
|
||||
tthread::thread source(sourceThread, 0);
|
||||
Util::sleep(500);
|
||||
|
||||
// needs to pass through encoder to outputEBML
|
||||
tthread::thread sink(sinkThread, 0);
|
||||
|
@ -162,7 +191,7 @@ namespace Mist{
|
|||
// exec command
|
||||
char exec_cmd[10240];
|
||||
strncpy(exec_cmd, opt["exec"].asString().c_str(), 10240);
|
||||
MEDIUM_MSG("Executing command: %s", exec_cmd);
|
||||
INFO_MSG("Executing command: %s", exec_cmd);
|
||||
uint8_t argCnt = 0;
|
||||
char *startCh = 0;
|
||||
char *args[1280];
|
||||
|
@ -188,11 +217,11 @@ namespace Mist{
|
|||
while (conf.is_active && p.isRunning(execd_proc)){Util::sleep(200);}
|
||||
|
||||
while (p.isRunning(execd_proc)){
|
||||
MEDIUM_MSG("Stopping process...");
|
||||
INFO_MSG("Stopping process...");
|
||||
p.StopAll();
|
||||
Util::sleep(200);
|
||||
}
|
||||
|
||||
MEDIUM_MSG("Closing process clean");
|
||||
INFO_MSG("Closing process clean");
|
||||
}
|
||||
}// namespace Mist
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "../output/output_ebml.h"
|
||||
#include <mist/defines.h>
|
||||
#include <mist/json.h>
|
||||
#include <mist/stream.h>
|
||||
|
||||
namespace Mist{
|
||||
bool getFirst = false;
|
||||
|
@ -21,30 +22,29 @@ namespace Mist{
|
|||
class ProcessSink : public InputEBML{
|
||||
public:
|
||||
ProcessSink(Util::Config *cfg) : InputEBML(cfg){};
|
||||
void getNext(bool smart = true){
|
||||
void getNext(size_t idx = INVALID_TRACK_ID){
|
||||
static bool recurse = false;
|
||||
if (recurse){return InputEBML::getNext(smart);}
|
||||
if (recurse){return InputEBML::getNext(idx);}
|
||||
recurse = true;
|
||||
InputEBML::getNext(smart);
|
||||
InputEBML::getNext(idx);
|
||||
recurse = false;
|
||||
if (!getFirst){
|
||||
packetTimeDiff = sendPacketTime - thisPacket.getTime();
|
||||
getFirst = true;
|
||||
if (thisPacket){
|
||||
if (!getFirst){
|
||||
packetTimeDiff = sendPacketTime - thisPacket.getTime();
|
||||
getFirst = true;
|
||||
}
|
||||
uint64_t packTime = thisPacket.getTime() + packetTimeDiff;
|
||||
// change packettime
|
||||
char *data = thisPacket.getData();
|
||||
Bit::htobll(data + 12, packTime);
|
||||
}
|
||||
uint64_t tmpLong;
|
||||
uint64_t packTime = thisPacket.getTime() + packetTimeDiff;
|
||||
// change packettime
|
||||
char *data = thisPacket.getData();
|
||||
tmpLong = htonl((int)(packTime >> 32));
|
||||
memcpy(data + 12, (char *)&tmpLong, 4);
|
||||
tmpLong = htonl((int)(packTime & 0xFFFFFFFF));
|
||||
memcpy(data + 16, (char *)&tmpLong, 4);
|
||||
}
|
||||
void setInFile(int stdin_val){
|
||||
inFile = fdopen(stdin_val, "r");
|
||||
streamName = opt["sink"].asString();
|
||||
if (!streamName.size()){streamName = opt["source"].asString();}
|
||||
nProxy.streamName = streamName;
|
||||
Util::streamVariables(streamName, opt["source"].asString());
|
||||
Util::Config::streamName = opt["source"].asString() + "➡️" + streamName;
|
||||
}
|
||||
bool needsLock(){return false;}
|
||||
bool isSingular(){return false;}
|
||||
|
@ -52,11 +52,25 @@ namespace Mist{
|
|||
|
||||
class ProcessSource : public OutEBML{
|
||||
public:
|
||||
ProcessSource(Socket::Connection &c) : OutEBML(c){};
|
||||
ProcessSource(Socket::Connection &c) : OutEBML(c){realTime = 1000;};
|
||||
void sendNext(){
|
||||
extraKeepAway = 0;
|
||||
needsLookAhead = 0;
|
||||
maxSkipAhead = 0;
|
||||
if (!sendFirst){
|
||||
sendPacketTime = thisPacket.getTime();
|
||||
sendFirst = true;
|
||||
/*
|
||||
uint64_t maxJitter = 1;
|
||||
for (std::map<size_t, Comms::Users>::iterator ti = userSelect.begin(); ti !=
|
||||
userSelect.end(); ++ti){if (!M.trackValid(ti->first)){continue;
|
||||
}// ignore missing tracks
|
||||
if (M.getMinKeepAway(ti->first) > maxJitter){
|
||||
maxJitter = M.getMinKeepAway(ti->first);
|
||||
}
|
||||
}
|
||||
DTSC::veryUglyJitterOverride = maxJitter;
|
||||
*/
|
||||
}
|
||||
OutEBML::sendNext();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <fstream>
|
||||
#include <mist/defines.h>
|
||||
#include <mist/procs.h>
|
||||
#include <mist/stream.h>
|
||||
#include <mist/tinythread.h>
|
||||
#include <mist/util.h>
|
||||
#include <ostream>
|
||||
|
@ -48,9 +49,9 @@ void sourceThread(void *){
|
|||
conf.getOption("streamname", true).append(opt["source"].c_str());
|
||||
|
||||
if (Enc.isAudio){
|
||||
conf.getOption("target", true).append("-?audio=" + opt["source_track"].asString() + "&video=0");
|
||||
conf.getOption("target", true).append("-?audio=" + opt["source_track"].asString() + "&video=-1");
|
||||
}else if (Enc.isVideo){
|
||||
conf.getOption("target", true).append("-?video=" + opt["source_track"].asString() + "&audio=0");
|
||||
conf.getOption("target", true).append("-?video=" + opt["source_track"].asString() + "&audio=-1");
|
||||
}else{
|
||||
FAIL_MSG("Cannot set target option parameters");
|
||||
return;
|
||||
|
@ -208,6 +209,34 @@ int main(int argc, char *argv[]){
|
|||
capa["optional"]["sources"]["sort"] = "n";
|
||||
capa["optional"]["sources"]["dependent"]["x-LSP-kind"] = "video";
|
||||
|
||||
capa["optional"]["track_inhibit"]["name"] = "Track inhibitor(s)";
|
||||
capa["optional"]["track_inhibit"]["help"] =
|
||||
"What tracks to use as inhibitors. If this track selector is able to select a track, the "
|
||||
"process does not start. Defaults to none.";
|
||||
capa["optional"]["track_inhibit"]["type"] = "string";
|
||||
capa["optional"]["track_inhibit"]["validate"][0u] = "track_selector";
|
||||
capa["optional"]["track_inhibit"]["default"] = "audio=none&video=none&subtitle=none";
|
||||
|
||||
capa["codecs"][0u][0u].append("H264");
|
||||
capa["codecs"][0u][0u].append("HEVC");
|
||||
capa["codecs"][0u][0u].append("VP8");
|
||||
capa["codecs"][0u][0u].append("VP9");
|
||||
capa["codecs"][0u][0u].append("theora");
|
||||
capa["codecs"][0u][0u].append("MPEG2");
|
||||
capa["codecs"][0u][0u].append("AV1");
|
||||
capa["codecs"][0u][1u].append("AAC");
|
||||
capa["codecs"][0u][1u].append("vorbis");
|
||||
capa["codecs"][0u][1u].append("opus");
|
||||
capa["codecs"][0u][1u].append("PCM");
|
||||
capa["codecs"][0u][1u].append("ALAW");
|
||||
capa["codecs"][0u][1u].append("ULAW");
|
||||
capa["codecs"][0u][1u].append("MP2");
|
||||
capa["codecs"][0u][1u].append("MP3");
|
||||
capa["codecs"][0u][1u].append("FLOAT");
|
||||
capa["codecs"][0u][1u].append("AC3");
|
||||
capa["codecs"][0u][1u].append("DTS");
|
||||
capa["codecs"][0u][2u].append("+JSON");
|
||||
|
||||
JSON::Value &grp = capa["optional"]["sources"]["optional"];
|
||||
grp["src"]["name"] = "Source";
|
||||
grp["src"]["help"] =
|
||||
|
@ -314,30 +343,33 @@ int main(int argc, char *argv[]){
|
|||
|
||||
namespace Mist{
|
||||
|
||||
void EncodeInputEBML::getNext(bool smart){
|
||||
void EncodeInputEBML::getNext(size_t idx){
|
||||
static bool recurse = false;
|
||||
|
||||
// getNext is called recursively, only process the first call
|
||||
if (recurse){return InputEBML::getNext(smart);}
|
||||
if (recurse){return InputEBML::getNext(idx);}
|
||||
|
||||
recurse = true;
|
||||
InputEBML::getNext(smart);
|
||||
InputEBML::getNext(idx);
|
||||
|
||||
if (!getFirst){
|
||||
packetTimeDiff = sendPacketTime - thisPacket.getTime();
|
||||
getFirst = true;
|
||||
if (thisPacket){
|
||||
|
||||
if (!getFirst){
|
||||
packetTimeDiff = sendPacketTime - thisPacket.getTime();
|
||||
getFirst = true;
|
||||
}
|
||||
|
||||
uint64_t tmpLong;
|
||||
uint64_t packTime = thisPacket.getTime() + packetTimeDiff;
|
||||
|
||||
// change packettime
|
||||
char *data = thisPacket.getData();
|
||||
tmpLong = htonl((int)(packTime >> 32));
|
||||
memcpy(data + 12, (char *)&tmpLong, 4);
|
||||
tmpLong = htonl((int)(packTime & 0xFFFFFFFF));
|
||||
memcpy(data + 16, (char *)&tmpLong, 4);
|
||||
}
|
||||
|
||||
uint64_t tmpLong;
|
||||
uint64_t packTime = thisPacket.getTime() + packetTimeDiff;
|
||||
|
||||
// change packettime
|
||||
char *data = thisPacket.getData();
|
||||
tmpLong = htonl((int)(packTime >> 32));
|
||||
memcpy(data + 12, (char *)&tmpLong, 4);
|
||||
tmpLong = htonl((int)(packTime & 0xFFFFFFFF));
|
||||
memcpy(data + 16, (char *)&tmpLong, 4);
|
||||
|
||||
recurse = false;
|
||||
}
|
||||
|
||||
|
@ -345,22 +377,31 @@ namespace Mist{
|
|||
inFile = fdopen(stdin_val, "r");
|
||||
streamName = opt["sink"].asString();
|
||||
if (!streamName.size()){streamName = opt["source"].asString();}
|
||||
nProxy.streamName = streamName;
|
||||
Util::streamVariables(streamName, opt["source"].asString());
|
||||
Util::Config::streamName = opt["source"].asString() + "➡️" + streamName;
|
||||
}
|
||||
|
||||
std::string EncodeOutputEBML::getTrackType(int tid){
|
||||
DTSC::Track &Trk = myMeta.tracks[tid];
|
||||
return Trk.type;
|
||||
std::string EncodeOutputEBML::getTrackType(int tid){return M.getType(tid);}
|
||||
|
||||
void EncodeOutputEBML::setVideoTrack(std::string tid){
|
||||
std::set<size_t> tracks = Util::findTracks(M, "video", tid);
|
||||
for (std::set<size_t>::iterator it = tracks.begin(); it != tracks.end(); it++){
|
||||
userSelect[*it].reload(streamName, *it);
|
||||
}
|
||||
}
|
||||
|
||||
void EncodeOutputEBML::setVideoTrack(std::string tid){selectTrack("video", tid);}
|
||||
|
||||
void EncodeOutputEBML::setAudioTrack(std::string tid){selectTrack("audio", tid);}
|
||||
void EncodeOutputEBML::setAudioTrack(std::string tid){
|
||||
std::set<size_t> tracks = Util::findTracks(M, "audio", tid);
|
||||
for (std::set<size_t>::iterator it = tracks.begin(); it != tracks.end(); it++){
|
||||
userSelect[*it].reload(streamName, *it);
|
||||
}
|
||||
}
|
||||
|
||||
void EncodeOutputEBML::sendHeader(){
|
||||
realTime = 0;
|
||||
res_x = myMeta.tracks[getMainSelectedTrack()].width;
|
||||
res_y = myMeta.tracks[getMainSelectedTrack()].height;
|
||||
size_t idx = getMainSelectedTrack();
|
||||
res_x = M.getWidth(idx);
|
||||
res_y = M.getHeight(idx);
|
||||
Enc.setResolution(res_x, res_y);
|
||||
OutEBML::sendHeader();
|
||||
}
|
||||
|
@ -403,7 +444,9 @@ namespace Mist{
|
|||
bool OutENC::buildAudioCommand(){
|
||||
std::string samplerate;
|
||||
if (sample_rate){samplerate = "-ar " + JSON::Value(sample_rate).asString();}
|
||||
snprintf(ffcmd, 10240, "ffmpeg -hide_banner -loglevel warning -i - -acodec %s %s -strict -2 -ac 2 %s -f matroska -live 1 -cluster_time_limit 100 - ",
|
||||
snprintf(ffcmd, 10240,
|
||||
"ffmpeg -hide_banner -loglevel warning -i - -acodec %s %s -strict -2 -ac 2 %s %s -f "
|
||||
"matroska -live 1 -cluster_time_limit 100 - ",
|
||||
codec.c_str(), samplerate.c_str(), getBitrateSetting().c_str(), flags.c_str());
|
||||
|
||||
return true;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Mist{
|
|||
class EncodeInputEBML : public InputEBML{
|
||||
public:
|
||||
EncodeInputEBML(Util::Config *cfg) : InputEBML(cfg){};
|
||||
void getNext(bool smart = true);
|
||||
void getNext(size_t idx = INVALID_TRACK_ID);
|
||||
void setInFile(int stdin_val);
|
||||
bool needsLock(){return false;}
|
||||
bool isSingular(){return false;}
|
||||
|
@ -51,7 +51,7 @@ namespace Mist{
|
|||
|
||||
class EncodeOutputEBML : public OutEBML{
|
||||
public:
|
||||
EncodeOutputEBML(Socket::Connection &c) : OutEBML(c){};
|
||||
EncodeOutputEBML(Socket::Connection &c) : OutEBML(c){}; // realTime = 0;};
|
||||
void setVideoTrack(std::string tid);
|
||||
void setAudioTrack(std::string tid);
|
||||
void sendNext();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue