Working codec capability support, not sorted yet.
This commit is contained in:
parent
75d6c7d474
commit
5aa34fff38
8 changed files with 107 additions and 36 deletions
|
@ -125,6 +125,63 @@ namespace Connector_HTTP {
|
||||||
conn->SendNow(H.BuildResponse("504", "Gateway Timeout"));
|
conn->SendNow(H.BuildResponse("504", "Gateway Timeout"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void addSource(const std::string & rel, JSON::Value & sources, std::string & host, const std::string & port, JSON::Value & conncapa, unsigned int most_simul, unsigned int total_matches){
|
||||||
|
JSON::Value tmp;
|
||||||
|
tmp["type"] = conncapa["type"];
|
||||||
|
tmp["relurl"] = rel;
|
||||||
|
tmp["priority"] = conncapa["priority"];
|
||||||
|
tmp["simul_tracks"] = most_simul;
|
||||||
|
tmp["total_matches"] = total_matches;
|
||||||
|
tmp["url"] = conncapa["handler"].asStringRef() + "://" + host + ":" + port + rel;
|
||||||
|
sources.append(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addSources(std::string & streamname, const std::string & rel, JSON::Value & sources, std::string & host, const std::string & port, JSON::Value & conncapa, JSON::Value & strmMeta){
|
||||||
|
unsigned int most_simul = 0;
|
||||||
|
unsigned int total_matches = 0;
|
||||||
|
if (conncapa.isMember("codecs") && conncapa["codecs"].size() > 0){
|
||||||
|
for (JSON::ArrIter it = conncapa["codecs"].ArrBegin(); it != conncapa["codecs"].ArrEnd(); it++){
|
||||||
|
unsigned int simul = 0;
|
||||||
|
if ((*it).size() > 0){
|
||||||
|
for (JSON::ArrIter itb = (*it).ArrBegin(); itb != (*it).ArrEnd(); itb++){
|
||||||
|
unsigned int matches = 0;
|
||||||
|
if ((*itb).size() > 0){
|
||||||
|
for (JSON::ArrIter itc = (*itb).ArrBegin(); itc != (*itb).ArrEnd(); itc++){
|
||||||
|
for (JSON::ObjIter trit = strmMeta["tracks"].ObjBegin(); trit != strmMeta["tracks"].ObjEnd(); trit++){
|
||||||
|
if (trit->second["codec"].asStringRef() == (*itc).asStringRef()){
|
||||||
|
matches++;
|
||||||
|
total_matches++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (matches){
|
||||||
|
simul++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (simul > most_simul){
|
||||||
|
most_simul = simul;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << streamname << ", " << most_simul << "sim, " << total_matches << " match" << std::endl;
|
||||||
|
if (conncapa.isMember("methods") && conncapa["methods"].size() > 0){
|
||||||
|
std::string relurl;
|
||||||
|
size_t found = rel.find('$');
|
||||||
|
if (found != std::string::npos){
|
||||||
|
relurl = rel.substr(0, found) + streamname + rel.substr(found+1);
|
||||||
|
}else{
|
||||||
|
relurl = "/";
|
||||||
|
}
|
||||||
|
for (JSON::ArrIter it = conncapa["methods"].ArrBegin(); it != conncapa["methods"].ArrEnd(); it++){
|
||||||
|
addSource(relurl, sources, host, port, *it, most_simul, total_matches);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///\brief Handles requests within the proxy.
|
///\brief Handles requests within the proxy.
|
||||||
///
|
///
|
||||||
|
@ -240,35 +297,17 @@ namespace Connector_HTTP {
|
||||||
//if the connector has a port,
|
//if the connector has a port,
|
||||||
if (capabilities.isMember(cName) && capabilities[cName].isMember("optional") && capabilities[cName]["optional"].isMember("port")){
|
if (capabilities.isMember(cName) && capabilities[cName].isMember("optional") && capabilities[cName]["optional"].isMember("port")){
|
||||||
//and a URL - then list the URL
|
//and a URL - then list the URL
|
||||||
if (capabilities[cName].isMember("url_type") && capabilities[cName].isMember("url_handler") && capabilities[cName].isMember("url_rel")){
|
if (capabilities[cName].isMember("url_rel")){
|
||||||
if (( *it)["port"].asInt() == 0){
|
if (( *it)["port"].asInt() == 0){
|
||||||
( *it)["port"] = capabilities[cName]["optional"]["port"]["default"];
|
( *it)["port"] = capabilities[cName]["optional"]["port"]["default"];
|
||||||
}
|
}
|
||||||
JSON::Value tmp;
|
addSources(streamname, capabilities[cName]["url_rel"].asStringRef(), json_resp["source"], host, ( *it)["port"].asString(), capabilities[cName], ServConf["streams"][streamname]["meta"]);
|
||||||
tmp["type"] = capabilities[cName]["url_type"];
|
|
||||||
size_t found = capabilities[cName]["url_rel"].asStringRef().find('$');
|
|
||||||
if (found != std::string::npos){
|
|
||||||
tmp["relurl"] = capabilities[cName]["url_rel"].asStringRef().substr(0, found) + streamname + capabilities[cName]["url_rel"].asStringRef().substr(found+1);
|
|
||||||
}else{
|
|
||||||
tmp["relurl"] = "/";
|
|
||||||
}
|
|
||||||
tmp["url"] = capabilities[cName]["url_handler"].asStringRef() + "://" + host + ":" + ( *it)["port"].asString() + tmp["relurl"].asStringRef();
|
|
||||||
json_resp["source"].append(tmp);
|
|
||||||
}
|
}
|
||||||
//check each enabled protocol separately to see if it depends on this connector
|
//check each enabled protocol separately to see if it depends on this connector
|
||||||
for (JSON::ObjIter oit = capabilities.ObjBegin(); oit != capabilities.ObjEnd(); oit++){
|
for (JSON::ObjIter oit = capabilities.ObjBegin(); oit != capabilities.ObjEnd(); oit++){
|
||||||
//if it depends on this connector and has a URL, list it
|
//if it depends on this connector and has a URL, list it
|
||||||
if (conns.count(oit->first) && oit->second["deps"].asStringRef() == cName && oit->second.isMember("url_type") && oit->second.isMember("url_handler") && oit->second.isMember("url_rel")){
|
if (conns.count(oit->first) && oit->second["deps"].asStringRef() == cName && oit->second.isMember("methods")){
|
||||||
JSON::Value tmp;
|
addSources(streamname, oit->second["url_rel"].asStringRef(), json_resp["source"], host, ( *it)["port"].asString(), oit->second, ServConf["streams"][streamname]["meta"]);
|
||||||
tmp["type"] = oit->second["url_type"];
|
|
||||||
size_t found = oit->second["url_rel"].asStringRef().find('$');
|
|
||||||
if (found != std::string::npos){
|
|
||||||
tmp["relurl"] = oit->second["url_rel"].asStringRef().substr(0, found) + streamname + oit->second["url_rel"].asStringRef().substr(found+1);
|
|
||||||
}else{
|
|
||||||
tmp["relurl"] = "/";
|
|
||||||
}
|
|
||||||
tmp["url"] = oit->second["url_handler"].asStringRef() + "://" + host + ":" + ( *it)["port"].asString() + tmp["relurl"].asStringRef();
|
|
||||||
json_resp["source"].append(tmp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,9 +315,15 @@ int main(int argc, char ** argv){
|
||||||
capa["deps"] = "HTTP";
|
capa["deps"] = "HTTP";
|
||||||
capa["url_rel"] = "/dynamic/$/manifest.f4m";
|
capa["url_rel"] = "/dynamic/$/manifest.f4m";
|
||||||
capa["url_prefix"] = "/dynamic/$/";
|
capa["url_prefix"] = "/dynamic/$/";
|
||||||
capa["url_handler"] = "http";
|
|
||||||
capa["url_type"] = "flash/11";
|
|
||||||
capa["socket"] = "http_dynamic";
|
capa["socket"] = "http_dynamic";
|
||||||
|
capa["codecs"][0u][0u].append("H264");
|
||||||
|
capa["codecs"][0u][0u].append("H263");
|
||||||
|
capa["codecs"][0u][0u].append("VP6");
|
||||||
|
capa["codecs"][0u][1u].append("AAC");
|
||||||
|
capa["codecs"][0u][1u].append("MP3");
|
||||||
|
capa["methods"][0u]["handler"] = "http";
|
||||||
|
capa["methods"][0u]["type"] = "flash/11";
|
||||||
|
capa["methods"][0u]["priority"] = 7ll;
|
||||||
conf.addBasicConnectorOptions(capa);
|
conf.addBasicConnectorOptions(capa);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -338,9 +338,12 @@ int main(int argc, char ** argv){
|
||||||
capa["deps"] = "HTTP";
|
capa["deps"] = "HTTP";
|
||||||
capa["url_rel"] = "/hls/$/index.m3u8";
|
capa["url_rel"] = "/hls/$/index.m3u8";
|
||||||
capa["url_prefix"] = "/hls/$/";
|
capa["url_prefix"] = "/hls/$/";
|
||||||
capa["url_handler"] = "http";
|
|
||||||
capa["url_type"] = "hls";
|
|
||||||
capa["socket"] = "http_live";
|
capa["socket"] = "http_live";
|
||||||
|
capa["codecs"][0u][0u].append("H264");
|
||||||
|
capa["codecs"][0u][1u].append("AAC");
|
||||||
|
capa["methods"][0u]["handler"] = "http";
|
||||||
|
capa["methods"][0u]["type"] = "html5/application/vnd.apple.mpegurl";
|
||||||
|
capa["methods"][0u]["priority"] = 9ll;
|
||||||
conf.addBasicConnectorOptions(capa);
|
conf.addBasicConnectorOptions(capa);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -185,9 +185,15 @@ int main(int argc, char ** argv){
|
||||||
capa["deps"] = "HTTP";
|
capa["deps"] = "HTTP";
|
||||||
capa["url_rel"] = "/$.flv";
|
capa["url_rel"] = "/$.flv";
|
||||||
capa["url_match"] = "/$.flv";
|
capa["url_match"] = "/$.flv";
|
||||||
capa["url_handler"] = "http";
|
|
||||||
capa["url_type"] = "flash/7";
|
|
||||||
capa["socket"] = "http_progressive_flv";
|
capa["socket"] = "http_progressive_flv";
|
||||||
|
capa["codecs"][0u][0u].append("H264");
|
||||||
|
capa["codecs"][0u][0u].append("H263");
|
||||||
|
capa["codecs"][0u][0u].append("VP6");
|
||||||
|
capa["codecs"][0u][1u].append("AAC");
|
||||||
|
capa["codecs"][0u][1u].append("MP3");
|
||||||
|
capa["methods"][0u]["handler"] = "http";
|
||||||
|
capa["methods"][0u]["type"] = "flash/7";
|
||||||
|
capa["methods"][0u]["priority"] = 5ll;
|
||||||
conf.addBasicConnectorOptions(capa);
|
conf.addBasicConnectorOptions(capa);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -165,11 +165,13 @@ int main(int argc, char ** argv){
|
||||||
JSON::Value capa;
|
JSON::Value capa;
|
||||||
capa["desc"] = "Enables HTTP protocol progressive streaming.";
|
capa["desc"] = "Enables HTTP protocol progressive streaming.";
|
||||||
capa["deps"] = "HTTP";
|
capa["deps"] = "HTTP";
|
||||||
|
capa["codecs"][0u][0u].append("MP3");
|
||||||
capa["url_rel"] = "/$.mp3";
|
capa["url_rel"] = "/$.mp3";
|
||||||
capa["url_match"] = "/$.mp3";
|
capa["url_match"] = "/$.mp3";
|
||||||
capa["url_handler"] = "http";
|
|
||||||
capa["url_type"] = "mp3";
|
|
||||||
capa["socket"] = "http_progressive_mp3";
|
capa["socket"] = "http_progressive_mp3";
|
||||||
|
capa["methods"][0u]["handler"] = "http";
|
||||||
|
capa["methods"][0u]["type"] = "mp3";
|
||||||
|
capa["methods"][0u]["priority"] = 8ll;
|
||||||
conf.addBasicConnectorOptions(capa);
|
conf.addBasicConnectorOptions(capa);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -188,9 +188,12 @@ int main(int argc, char ** argv){
|
||||||
capa["deps"] = "HTTP";
|
capa["deps"] = "HTTP";
|
||||||
capa["url_rel"] = "/$.ogg";
|
capa["url_rel"] = "/$.ogg";
|
||||||
capa["url_match"] = "/$.ogg";
|
capa["url_match"] = "/$.ogg";
|
||||||
capa["url_handler"] = "http";
|
|
||||||
capa["url_type"] = "ogg";
|
|
||||||
capa["socket"] = "http_progressive_ogg";
|
capa["socket"] = "http_progressive_ogg";
|
||||||
|
capa["codecs"][0u][0u].append("theora");
|
||||||
|
capa["codecs"][0u][1u].append("vorbis");
|
||||||
|
capa["methods"][0u]["handler"] = "http";
|
||||||
|
capa["methods"][0u]["type"] = "html5/video/ogg";
|
||||||
|
capa["methods"][0u]["priority"] = 8ll;
|
||||||
conf.addBasicConnectorOptions(capa);
|
conf.addBasicConnectorOptions(capa);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -459,9 +459,15 @@ int main(int argc, char ** argv){
|
||||||
capa["deps"] = "HTTP";
|
capa["deps"] = "HTTP";
|
||||||
capa["url_rel"] = "/smooth/$.ism/Manifest";
|
capa["url_rel"] = "/smooth/$.ism/Manifest";
|
||||||
capa["url_prefix"] = "/smooth/$.ism/";
|
capa["url_prefix"] = "/smooth/$.ism/";
|
||||||
capa["url_handler"] = "http";
|
|
||||||
capa["url_type"] = "ism";
|
|
||||||
capa["socket"] = "http_smooth";
|
capa["socket"] = "http_smooth";
|
||||||
|
capa["codecs"][0u][0u].append("H264");
|
||||||
|
capa["codecs"][0u][1u].append("AAC");
|
||||||
|
capa["methods"][0u]["handler"] = "http";
|
||||||
|
capa["methods"][0u]["type"] = "html5/application/vnd.ms-ss";
|
||||||
|
capa["methods"][0u]["priority"] = 9ll;
|
||||||
|
capa["methods"][1u]["handler"] = "http";
|
||||||
|
capa["methods"][1u]["type"] = "silverlight";
|
||||||
|
capa["methods"][1u]["priority"] = 1ll;
|
||||||
conf.addBasicConnectorOptions(capa);
|
conf.addBasicConnectorOptions(capa);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -657,8 +657,14 @@ int main(int argc, char ** argv){
|
||||||
capa["desc"] = "Enables the RTMP protocol which is used by Adobe Flash Player.";
|
capa["desc"] = "Enables the RTMP protocol which is used by Adobe Flash Player.";
|
||||||
capa["deps"] = "";
|
capa["deps"] = "";
|
||||||
capa["url_rel"] = "/play/$";
|
capa["url_rel"] = "/play/$";
|
||||||
capa["url_handler"] = "rtmp";
|
capa["codecs"][0u][0u].append("H264");
|
||||||
capa["url_type"] = "flash/10";
|
capa["codecs"][0u][0u].append("H263");
|
||||||
|
capa["codecs"][0u][0u].append("VP6");
|
||||||
|
capa["codecs"][0u][1u].append("AAC");
|
||||||
|
capa["codecs"][0u][1u].append("MP3");
|
||||||
|
capa["methods"][0u]["handler"] = "rtmp";
|
||||||
|
capa["methods"][0u]["type"] = "flash/10";
|
||||||
|
capa["methods"][0u]["priority"] = 6ll;
|
||||||
conf.addConnectorOptions(1935, capa);
|
conf.addConnectorOptions(1935, capa);
|
||||||
conf.parseArgs(argc, argv);
|
conf.parseArgs(argc, argv);
|
||||||
if (conf.getBool("json")){
|
if (conf.getBool("json")){
|
||||||
|
|
Loading…
Add table
Reference in a new issue