胡斌

add -n to support only merge pip,that is the input file is the output of merge_av

正在显示 1 个修改的文件 包含 29 行增加16 行删除
@@ -1452,6 +1452,8 @@ int main(int argc, char * argv[]) @@ -1452,6 +1452,8 @@ int main(int argc, char * argv[])
1452 1452
1453 load_codec_param(); 1453 load_codec_param();
1454 1454
  1455 + bool bmerge_files = true;
  1456 +
1455 for (int i = 3; i < argc; i++){ 1457 for (int i = 3; i < argc; i++){
1456 if (!strcmp(argv[i], "-p")){ 1458 if (!strcmp(argv[i], "-p")){
1457 only_print = true; 1459 only_print = true;
@@ -1459,28 +1461,39 @@ int main(int argc, char * argv[]) @@ -1459,28 +1461,39 @@ int main(int argc, char * argv[])
1459 else if (!strcmp(argv[i], "-k")){ 1461 else if (!strcmp(argv[i], "-k")){
1460 keep_tmp_files = true; 1462 keep_tmp_files = true;
1461 } 1463 }
  1464 + else if (!strcmp(argv[i], "-n")){
  1465 + bmerge_files = false;
  1466 + }
1462 } 1467 }
1463 1468
1464 char merged_info1[1024]; 1469 char merged_info1[1024];
1465 - if (readfile(argv[1]) < 0) {  
1466 - printf("open file: %s error", argv[1]);  
1467 - return -2;  
1468 - } 1470 + char merged_info2[1024];
1469 1471
1470 - get_outinfo_file_name(argv[1]);  
1471 - strcpy(merged_info1, out_info_file);  
1472 - process_record_file_to_ts(); 1472 + if (bmerge_files) {
  1473 + if (readfile(argv[1]) < 0) {
  1474 + printf("open file: %s error", argv[1]);
  1475 + return -2;
  1476 + }
1473 1477
  1478 + get_outinfo_file_name(argv[1]);
  1479 + strcpy(merged_info1, out_info_file);
  1480 + process_record_file_to_ts();
1474 1481
1475 - char merged_info2[1024];  
1476 - if (readfile(argv[2]) < 0) {  
1477 - printf("open file: %s error", argv[1]);  
1478 - return -2;  
1479 - }  
1480 1482
1481 - get_outinfo_file_name(argv[2]);  
1482 - strcpy(merged_info2, out_info_file);  
1483 - process_record_file_to_ts(); 1483 +
  1484 + if (readfile(argv[2]) < 0) {
  1485 + printf("open file: %s error", argv[1]);
  1486 + return -2;
  1487 + }
  1488 +
  1489 + get_outinfo_file_name(argv[2]);
  1490 + strcpy(merged_info2, out_info_file);
  1491 + process_record_file_to_ts();
  1492 + }
  1493 + else {
  1494 + strcpy(merged_info1, argv[1]);
  1495 + strcpy(merged_info2, argv[2]);
  1496 + }
1484 1497
1485 1498
1486 media_files.clear(); 1499 media_files.clear();
@@ -1498,7 +1511,7 @@ int main(int argc, char * argv[]) @@ -1498,7 +1511,7 @@ int main(int argc, char * argv[])
1498 1511
1499 process_merged_files_to_pip_files(); 1512 process_merged_files_to_pip_files();
1500 1513
1501 - if (!keep_tmp_files) { 1514 + if (!keep_tmp_files && bmerge_files) {
1502 removefiles(all_input_files_for_pip); 1515 removefiles(all_input_files_for_pip);
1503 remove_file(merged_info1); 1516 remove_file(merged_info1);
1504 remove_file(merged_info2); 1517 remove_file(merged_info2);