add cmd play

This commit is contained in:
程广 2023-04-07 13:48:18 +08:00
parent ee2b0cd0c8
commit 175f775e4f
1 changed files with 13 additions and 1 deletions

View File

@ -25,6 +25,17 @@ int call_playback(CmdLineParser *parser){
return playback(&loginInfo, &stream); return playback(&loginInfo, &stream);
} }
int call_play(CmdLineParser *parser){
string user = parser->getOpt("user");
string password = parser->getOpt("password");
string device = parser->getOpt("device");
string channelStr = parser->getOpt("channel");
unsigned long channel = stol(channelStr);
LoginInfo loginInfo = {device, user, password};
StreamCon stream = {channel, 2048};
return play(&loginInfo, &stream);
}
int call_test(CmdLineParser *parser){ int call_test(CmdLineParser *parser){
cout<<"Cmd:"<<parser->getOpt("cmd")<<endl; cout<<"Cmd:"<<parser->getOpt("cmd")<<endl;
cout<<"User:"<<parser->getOpt("user")<<endl; cout<<"User:"<<parser->getOpt("user")<<endl;
@ -50,7 +61,8 @@ int main(int argc, char *argv[])
if(cmd == "playback"){ if(cmd == "playback"){
call_playback(cmdParser); call_playback(cmdParser);
} else if(cmd == "test"){ } else if(cmd =="play"){
}else if(cmd == "test"){
return call_test(cmdParser); return call_test(cmdParser);
} else { } else {
cmdParser->help(); cmdParser->help();