Working encoder detection
This commit is contained in:
parent
2ab4204e71
commit
e3bb5253d0
2 changed files with 17 additions and 3 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <mist/procs.h>
|
||||
#include <mist/auth.h>
|
||||
#include <mist/timing.h>
|
||||
#include <mist/converter.h>
|
||||
#include "controller_storage.h"
|
||||
#include "controller_connectors.h"
|
||||
#include "controller_streams.h"
|
||||
|
@ -243,6 +244,10 @@ int main(int argc, char ** argv){
|
|||
Controller::ConnectedUser * uplink = 0;
|
||||
Controller::Log("CONF", "Controller started");
|
||||
conf.activate();
|
||||
|
||||
//Create a converter class and automatically load in all encoders.
|
||||
Converter::Converter myConverter;
|
||||
|
||||
while (API_Socket.connected() && conf.is_active){
|
||||
usleep(10000); //sleep for 10 ms - prevents 100% CPU time
|
||||
|
||||
|
@ -450,6 +455,11 @@ int main(int argc, char ** argv){
|
|||
if (Request.isMember("capabilities")){
|
||||
Controller::checkCapable(Response["capabilities"]);
|
||||
}
|
||||
if (Request.isMember("conversion")){
|
||||
if (Request["conversion"].isMember("encoders")) {
|
||||
Response["conversion"]["encoders"] = myConverter.getEncoders();
|
||||
}
|
||||
}
|
||||
if (Request.isMember("save")){
|
||||
Controller::WriteFile(conf.getString("configFile"), Controller::Storage.toString());
|
||||
Controller::Log("CONF", "Config written to file on request through API");
|
||||
|
@ -472,6 +482,7 @@ int main(int argc, char ** argv){
|
|||
Controller::Storage["log"].null();
|
||||
Controller::Storage["statistics"].null();
|
||||
}
|
||||
|
||||
}
|
||||
jsonp = "";
|
||||
if (it->H.GetVar("callback") != ""){
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <mist/json.h>
|
||||
#include <mist/dtsc.h>
|
||||
#include <mist/procs.h>
|
||||
#include <mist/timing.h>
|
||||
|
||||
namespace Info {
|
||||
int getInfo(int argc, char* argv[]) {
|
||||
|
@ -16,11 +17,13 @@ namespace Info {
|
|||
DTSC::File F(argv[1]);
|
||||
JSON::Value fileSpecs = F.getMeta();
|
||||
if( !fileSpecs ) {
|
||||
std::vector<std::string> cmd;
|
||||
cmd.push_back("ffprobe");
|
||||
cmd.push_back(argv[1]);
|
||||
char ** cmd = (char**)malloc(3*sizeof(char*));
|
||||
cmd[0] = "ffprobe";
|
||||
cmd[1] = argv[1];
|
||||
cmd[2] = NULL;
|
||||
int outFD = -1;
|
||||
Util::Procs::StartPiped("FFProbe", cmd, 0, 0, &outFD);
|
||||
while( Util::Procs::isActive("FFProbe")){ Util::sleep(100); }
|
||||
FILE * outFile = fdopen( outFD, "r" );
|
||||
char * fileBuf = 0;
|
||||
size_t fileBufLen = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue