Split input handling into separate convert and serve functions.

This commit is contained in:
Thulinma 2015-09-08 18:32:12 +02:00
parent c096450a8f
commit c62b4bf381
2 changed files with 65 additions and 54 deletions

View file

@ -116,6 +116,14 @@ namespace Mist {
parseHeader();
if (!config->getString("streamname").size()){
convert();
}else{
serve();
}
return 0;
}
void Input::convert(){
//check filename for no -
if (config->getString("output") != "-"){
std::string filename = config->getString("output");
@ -144,7 +152,9 @@ namespace Mist {
}else{
DEBUG_MSG(DLVL_FAIL,"No filename specified, exiting");
}
}else{
}
void Input::serve(){
char userPageName[NAME_BUFFER_SIZE];
snprintf(userPageName, NAME_BUFFER_SIZE, SHM_USERS, streamName.c_str());
userPage.init(userPageName, PLAY_EX_SIZE, true);
@ -172,8 +182,6 @@ namespace Mist {
DEBUG_MSG(DLVL_DEVEL,"Input for stream %s closing clean", streamName.c_str());
//end player functionality
}
return 0;
}
void Input::finish(){
for( std::map<unsigned int, std::map<unsigned int, unsigned int> >::iterator it = pageCounter.begin(); it != pageCounter.end(); it++){

View file

@ -37,6 +37,9 @@ namespace Mist {
virtual void trackSelect(std::string trackSpec){};
virtual void userCallback(char * data, size_t len, unsigned int id);
void serve();
void convert();
void parseHeader();
bool bufferFrame(unsigned int track, unsigned int keyNum);