@@ -1278,17 +1278,29 @@ void respond_request(http_request_t *req) {
12781278 else if (EQUALS_CASE (value , "false" ) || EQUALS (value , "0" ))
12791279 app_config .record_enable = 0 ;
12801280 }
1281+ else if (EQUALS (key , "continuous" )) {
1282+ if (EQUALS_CASE (value , "true" ) || EQUALS (value , "1" ))
1283+ app_config .record_continuous = 1 ;
1284+ else if (EQUALS_CASE (value , "false" ) || EQUALS (value , "0" ))
1285+ app_config .record_continuous = 0 ;
1286+ }
12811287 else if (EQUALS (key , "path" ))
12821288 strncpy (app_config .record_path , value , sizeof (app_config .record_path ) - 1 );
12831289 else if (EQUALS (key , "filename" ))
12841290 strncpy (app_config .record_filename , value , sizeof (app_config .record_filename ) - 1 );
1291+ else if (EQUALS (key , "segment_duration" )) {
1292+ short result = strtol (value , & remain , 10 );
1293+ if (remain != value )
1294+ app_config .record_segment_duration = result ;
1295+ }
12851296 else if (EQUALS (key , "segment_size" )) {
12861297 short result = strtol (value , & remain , 10 );
12871298 if (remain != value )
12881299 app_config .record_segment_size = result ;
12891300 }
12901301
12911302 if (!app_config .record_enable ) continue ;
1303+ if (app_config .record_continuous ) continue ;
12921304 if (EQUALS (key , "start" ))
12931305 record_start ();
12941306 else if (EQUALS (key , "stop" ))
@@ -1304,10 +1316,11 @@ void respond_request(http_request_t *req) {
13041316 "Content-Type: application/json;charset=UTF-8\r\n"
13051317 "Connection: close\r\n"
13061318 "\r\n"
1307- "{\"recording\":%s,\"start_time\":\"%s\",\"path\":\"%s\","
1308- "\"filename\":\"%s\",\"segment_size\":%d}" ,
1309- recordOn ? "true" : "false" , recordStartTime ,
1310- app_config .record_path , app_config .record_filename , app_config .record_segment_size );
1319+ "{\"recording\":%s,\"start_time\":\"%s\",\"continuous\":\"%s\",\"path\":\"%s\","
1320+ "\"filename\":\"%s\",\"segment_duration\":%d,\"segment_size\":%d}" ,
1321+ recordOn ? "true" : "false" , recordStartTime , app_config .record_continuous ? "true" : "false" ,
1322+ app_config .record_path , app_config .record_filename ,
1323+ app_config .record_segment_duration , app_config .record_segment_size );
13111324 send_and_close (req -> clntFd , response , respLen );
13121325 return ;
13131326 }
0 commit comments