Some minor optimalizations and fixes to controller.
This commit is contained in:
parent
6d4fa4d1ef
commit
221cd15b07
8 changed files with 101 additions and 138 deletions
|
@ -230,11 +230,11 @@ namespace Connector_HTTP {
|
|||
//find out which connectors are enabled
|
||||
std::set<std::string> conns;
|
||||
for (JSON::ArrIter it = ServConf["config"]["protocols"].ArrBegin(); it != ServConf["config"]["protocols"].ArrEnd(); it++){
|
||||
conns.insert(( *it)["connector"].asString());
|
||||
conns.insert(( *it)["connector"].asStringRef());
|
||||
}
|
||||
//first, see if we have RTMP working and output all the RTMP.
|
||||
for (JSON::ArrIter it = ServConf["config"]["protocols"].ArrBegin(); it != ServConf["config"]["protocols"].ArrEnd(); it++){
|
||||
if (( *it)["connector"].asString() == "RTMP"){
|
||||
if (( *it)["connector"].asStringRef() == "RTMP"){
|
||||
if (( *it)["port"].asInt() == 0){
|
||||
( *it)["port"] = 1935ll;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ namespace Connector_HTTP {
|
|||
/// \todo Add raw MPEG2 TS support here?
|
||||
//then, see if we have HTTP working and output all the HTTP.
|
||||
for (JSON::ArrIter it = ServConf["config"]["protocols"].ArrBegin(); it != ServConf["config"]["protocols"].ArrEnd(); it++){
|
||||
if (( *it)["connector"].asString() == "HTTP"){
|
||||
if (( *it)["connector"].asStringRef() == "HTTP"){
|
||||
if (( *it)["port"].asInt() == 0){
|
||||
( *it)["port"] = 8080ll;
|
||||
}
|
||||
|
|
|
@ -36,14 +36,14 @@ namespace Connector_HTTP {
|
|||
std::string audioName;
|
||||
bool defAudio = false;//set default audio track;
|
||||
for (JSON::ObjIter trackIt = metadata["tracks"].ObjBegin(); trackIt != metadata["tracks"].ObjEnd(); trackIt++){
|
||||
if (trackIt->second["type"].asString() == "audio"){
|
||||
if (trackIt->second["type"].asStringRef() == "audio"){
|
||||
audioId = trackIt->second["trackid"].asInt();
|
||||
audioName = trackIt->first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (JSON::ObjIter trackIt = metadata["tracks"].ObjBegin(); trackIt != metadata["tracks"].ObjEnd(); trackIt++){
|
||||
if (trackIt->second["type"].asString() == "video"){
|
||||
if (trackIt->second["type"].asStringRef() == "video"){
|
||||
int bWidth = trackIt->second["maxbps"].asInt();
|
||||
if (audioId != -1){
|
||||
bWidth += (metadata["tracks"][audioName]["maxbps"].asInt() * 2);
|
||||
|
|
|
@ -126,10 +126,10 @@ namespace Connector_HTTP {
|
|||
}
|
||||
int byterate = 0;
|
||||
for (JSON::ObjIter objIt = Strm.metadata["tracks"].ObjBegin(); objIt != Strm.metadata["tracks"].ObjEnd(); objIt++){
|
||||
if (videoID == -1 && objIt->second["type"].asString() == "video"){
|
||||
if (videoID == -1 && objIt->second["type"].asStringRef() == "video"){
|
||||
videoID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
if (audioID == -1 && objIt->second["type"].asString() == "audio"){
|
||||
if (audioID == -1 && objIt->second["type"].asStringRef() == "audio"){
|
||||
audioID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,10 +560,10 @@ namespace Connector_RTMP {
|
|||
}
|
||||
//find first audio and video tracks
|
||||
for (JSON::ObjIter objIt = Strm.metadata["tracks"].ObjBegin(); objIt != Strm.metadata["tracks"].ObjEnd(); objIt++){
|
||||
if (videoID == -1 && objIt->second["type"].asString() == "video"){
|
||||
if (videoID == -1 && objIt->second["type"].asStringRef() == "video"){
|
||||
videoID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
if (audioID == -1 && objIt->second["type"].asString() == "audio"){
|
||||
if (audioID == -1 && objIt->second["type"].asStringRef() == "audio"){
|
||||
audioID = objIt->second["trackid"].asInt();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,14 +203,16 @@ int main(int argc, char ** argv){
|
|||
JSON::Value capa;
|
||||
capa["desc"] = "Enables the raw MPEG Transport Stream protocol over TCP.";
|
||||
capa["deps"] = "";
|
||||
capa["required"]["args"]["name"] = "Stream";
|
||||
capa["required"]["args"]["help"] = "What streamname to serve. For multiple streams, add this protocol multiple times using different ports.";
|
||||
capa["required"]["args"]["type"] = "str";
|
||||
capa["optional"]["tracks"]["name"] = "Tracks";
|
||||
capa["optional"]["tracks"]["help"] = "The track IDs of the stream that this connector will transmit separated by spaces";
|
||||
capa["optional"]["tracks"]["type"] = "str";
|
||||
capa["required"]["streamname"]["name"] = "Stream";
|
||||
capa["required"]["streamname"]["help"] = "What streamname to serve. For multiple streams, add this protocol multiple times using different ports.";
|
||||
capa["required"]["streamname"]["type"] = "str";
|
||||
capa["required"]["streamname"]["option"] = "--stream";
|
||||
capa["required"]["tracks"]["name"] = "Tracks";
|
||||
capa["required"]["tracks"]["help"] = "The track IDs of the stream that this connector will transmit separated by spaces";
|
||||
capa["required"]["tracks"]["type"] = "str";
|
||||
capa["required"]["tracks"]["option"] = "--tracks";
|
||||
conf.addOption("streamname",
|
||||
JSON::fromString("{\"arg\":\"string\",\"arg_num\":1,\"help\":\"The name of the stream that this connector will transmit.\"}"));
|
||||
JSON::fromString("{\"arg\":\"string\",\"arg_num\":1,\"short\":\"s\",\"long\":\"stream\",\"help\":\"The name of the stream that this connector will transmit.\"}"));
|
||||
conf.addOption("tracks",
|
||||
JSON::fromString("{\"arg\":\"string\",\"default\":\"\",\"short\": \"t\",\"long\":\"tracks\",\"help\":\"The track IDs of the stream that this connector will transmit separated by spaces.\"}"));
|
||||
conf.addConnectorOptions(8888, capa);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue