Changed pull mode detection to be internal to each input, made DTSC input compliant with JSON output styling guidelines.
This commit is contained in:
parent
7e82673a13
commit
6386060c10
5 changed files with 31 additions and 52 deletions
|
@ -83,7 +83,6 @@ namespace Mist {
|
|||
|
||||
singleton = this;
|
||||
isBuffer = false;
|
||||
streamMode = false;
|
||||
}
|
||||
|
||||
void Input::checkHeaderTimes(std::string streamFile) {
|
||||
|
@ -116,10 +115,6 @@ namespace Mist {
|
|||
}
|
||||
}
|
||||
|
||||
bool Input::needsLock() {
|
||||
return !(config->hasOption("pull") && config->getBool("pull"));
|
||||
}
|
||||
|
||||
int Input::run() {
|
||||
if (config->getBool("json")) {
|
||||
std::cout << capa.toString() << std::endl;
|
||||
|
@ -132,11 +127,6 @@ namespace Mist {
|
|||
streamName = config->getString("streamname");
|
||||
nProxy.streamName = streamName;
|
||||
|
||||
|
||||
streamMode = config->hasOption("pull") && config->getBool("pull");
|
||||
INFO_MSG("Stream %s in %s mode", streamName.c_str(), streamMode ? "stream" : "non-stream");
|
||||
|
||||
|
||||
if (!setup()) {
|
||||
std::cerr << config->getString("cmd") << " setup failed." << std::endl;
|
||||
return 0;
|
||||
|
@ -151,7 +141,7 @@ namespace Mist {
|
|||
|
||||
if (!streamName.size()) {
|
||||
convert();
|
||||
} else if (streamMode) {
|
||||
} else if (!needsLock()) {
|
||||
stream();
|
||||
}else{
|
||||
serve();
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Mist {
|
|||
virtual void argumentsParsed(){}
|
||||
virtual ~Input() {};
|
||||
|
||||
virtual bool needsLock();
|
||||
virtual bool needsLock(){return true;}
|
||||
protected:
|
||||
static void callbackWrapper(char * data, size_t len, unsigned int id);
|
||||
virtual bool setup() = 0;
|
||||
|
@ -46,7 +46,6 @@ namespace Mist {
|
|||
virtual void convert();
|
||||
virtual void serve();
|
||||
virtual void stream();
|
||||
bool streamMode;
|
||||
|
||||
|
||||
virtual void parseHeader();
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace Mist {
|
|||
capa["name"] = "DTSC";
|
||||
capa["desc"] = "Enables DTSC Input";
|
||||
capa["priority"] = 9ll;
|
||||
capa["source_match"] = "/*.dtsc";
|
||||
capa["stream_match"] = "dtsc://*";
|
||||
capa["source_match"].append("/*.dtsc");
|
||||
capa["source_match"].append("dtsc://*");
|
||||
capa["codecs"][0u][0u].append("H264");
|
||||
capa["codecs"][0u][0u].append("H263");
|
||||
capa["codecs"][0u][0u].append("VP6");
|
||||
|
@ -26,16 +26,11 @@ namespace Mist {
|
|||
capa["codecs"][0u][1u].append("AAC");
|
||||
capa["codecs"][0u][1u].append("MP3");
|
||||
capa["codecs"][0u][1u].append("vorbis");
|
||||
|
||||
|
||||
JSON::Value option;
|
||||
option["long"] = "pull";
|
||||
option["short"] = "p";
|
||||
option["help"] = "Start this input in pull mode.";
|
||||
option["value"].append(0ll);
|
||||
config->addOption("pull", option);
|
||||
}
|
||||
|
||||
bool inputDTSC::needsLock(){
|
||||
return config->getString("input").substr(0, 7) != "dtsc://";
|
||||
}
|
||||
|
||||
void parseDTSCURI(const std::string & src, std::string & host, uint16_t & port, std::string & password, std::string & streamName) {
|
||||
host = "";
|
||||
|
@ -166,7 +161,7 @@ namespace Mist {
|
|||
}
|
||||
|
||||
bool inputDTSC::setup() {
|
||||
if (streamMode) {
|
||||
if (!needsLock()) {
|
||||
return true;
|
||||
} else {
|
||||
if (config->getString("input") == "-") {
|
||||
|
@ -195,7 +190,7 @@ namespace Mist {
|
|||
}
|
||||
|
||||
bool inputDTSC::readHeader() {
|
||||
if (streamMode) {
|
||||
if (!needsLock()) {
|
||||
return true;
|
||||
}
|
||||
if (!inFile) {
|
||||
|
@ -217,7 +212,7 @@ namespace Mist {
|
|||
}
|
||||
|
||||
void inputDTSC::getNext(bool smart) {
|
||||
if (streamMode){
|
||||
if (!needsLock()){
|
||||
thisPacket.reInit(srcConn);
|
||||
if (thisPacket.getVersion() == DTSC::DTCM){
|
||||
std::string cmd;
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Mist {
|
|||
class inputDTSC : public Input {
|
||||
public:
|
||||
inputDTSC(Util::Config * cfg);
|
||||
bool needsLock();
|
||||
protected:
|
||||
//Private Functions
|
||||
bool openStreamSource();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue