1.if no teacher detected,and the detected max audio stream is 2,use one to many layout
2.get the max width and height of teacher and student,to deal with case that the width or height is not qual of student and teacher,not finished
正在显示
1 个修改的文件
包含
54 行增加
和
4 行删除
| @@ -629,6 +629,11 @@ int count_audio_files(float mid) | @@ -629,6 +629,11 @@ int count_audio_files(float mid) | ||
| 629 | int max_audio = 1; | 629 | int max_audio = 1; |
| 630 | int width = 0; | 630 | int width = 0; |
| 631 | int height = 0; | 631 | int height = 0; |
| 632 | +int width_teacher = 0; | ||
| 633 | +int height_teacher = 0; | ||
| 634 | +int width_student = 0; | ||
| 635 | +int height_student = 0; | ||
| 636 | +bool has_teacher = false; | ||
| 632 | 637 | ||
| 633 | void add_media_infos() | 638 | void add_media_infos() |
| 634 | { | 639 | { |
| @@ -703,6 +708,43 @@ void add_media_infos() | @@ -703,6 +708,43 @@ void add_media_infos() | ||
| 703 | height = it->width; | 708 | height = it->width; |
| 704 | } | 709 | } |
| 705 | } | 710 | } |
| 711 | + if (it->m_role == mr_teacher) { | ||
| 712 | + has_teacher = true; | ||
| 713 | + if (it->width > it->height) { | ||
| 714 | + if (width_teacher < it->width) { | ||
| 715 | + width_teacher = it->width; | ||
| 716 | + } | ||
| 717 | + if (height_teacher < it->height) { | ||
| 718 | + height_teacher = it->height; | ||
| 719 | + } | ||
| 720 | + } | ||
| 721 | + else {//set the image to landscape | ||
| 722 | + if (width_teacher < it->height) { | ||
| 723 | + width_teacher = it->height; | ||
| 724 | + } | ||
| 725 | + if (height_teacher < it->width) { | ||
| 726 | + height_teacher = it->width; | ||
| 727 | + } | ||
| 728 | + } | ||
| 729 | + } | ||
| 730 | + else { | ||
| 731 | + if (it->width > it->height) { | ||
| 732 | + if (width_student < it->width) { | ||
| 733 | + width_student = it->width; | ||
| 734 | + } | ||
| 735 | + if (height_student < it->height) { | ||
| 736 | + height_student = it->height; | ||
| 737 | + } | ||
| 738 | + } | ||
| 739 | + else {//set the image to landscape | ||
| 740 | + if (width_student < it->height) { | ||
| 741 | + width_student = it->height; | ||
| 742 | + } | ||
| 743 | + if (height_student < it->width) { | ||
| 744 | + height_student = it->width; | ||
| 745 | + } | ||
| 746 | + } | ||
| 747 | + } | ||
| 706 | } | 748 | } |
| 707 | else { | 749 | else { |
| 708 | printf("\n%2d %8.3f %s %s", it->sorted_index, it->type_time, it->name.c_str(), it->t_type == tt_start ? "start" : "end"); | 750 | printf("\n%2d %8.3f %s %s", it->sorted_index, it->type_time, it->name.c_str(), it->t_type == tt_start ? "start" : "end"); |
| @@ -1040,8 +1082,6 @@ int load_record_info(char * record_info) | @@ -1040,8 +1082,6 @@ int load_record_info(char * record_info) | ||
| 1040 | return 0; | 1082 | return 0; |
| 1041 | } | 1083 | } |
| 1042 | 1084 | ||
| 1043 | - | ||
| 1044 | - | ||
| 1045 | #define MIN_TIME_INTERVAL 25 | 1085 | #define MIN_TIME_INTERVAL 25 |
| 1046 | 1086 | ||
| 1047 | int process_av_files(char * record_info, int piptype) | 1087 | int process_av_files(char * record_info, int piptype) |
| @@ -1056,6 +1096,11 @@ int process_av_files(char * record_info, int piptype) | @@ -1056,6 +1096,11 @@ int process_av_files(char * record_info, int piptype) | ||
| 1056 | avfilter_register_all(); | 1096 | avfilter_register_all(); |
| 1057 | 1097 | ||
| 1058 | bool one2one = max_audio <= 2; | 1098 | bool one2one = max_audio <= 2; |
| 1099 | + | ||
| 1100 | + if (has_teacher == false && max_audio == 2) { | ||
| 1101 | + one2one = false; | ||
| 1102 | + } | ||
| 1103 | + | ||
| 1059 | if (1 == piptype) { | 1104 | if (1 == piptype) { |
| 1060 | one2one = true; | 1105 | one2one = true; |
| 1061 | printf("using one2one layout\n"); | 1106 | printf("using one2one layout\n"); |
| @@ -1069,7 +1114,12 @@ int process_av_files(char * record_info, int piptype) | @@ -1069,7 +1114,12 @@ int process_av_files(char * record_info, int piptype) | ||
| 1069 | printf("using one2one layout,because detected max %d audio\n",max_audio); | 1114 | printf("using one2one layout,because detected max %d audio\n",max_audio); |
| 1070 | } | 1115 | } |
| 1071 | else { | 1116 | else { |
| 1072 | - printf("using one2many layout,because detected max %d audio\n", max_audio); | 1117 | + if (max_audio == 2 && has_teacher == false) { |
| 1118 | + printf("using one2many layout,because detected max %d audio,but no teacher\n", max_audio); | ||
| 1119 | + } | ||
| 1120 | + else { | ||
| 1121 | + printf("using one2many layout,because detected max %d audio\n", max_audio); | ||
| 1122 | + } | ||
| 1073 | } | 1123 | } |
| 1074 | } | 1124 | } |
| 1075 | 1125 | ||
| @@ -1148,7 +1198,7 @@ int process_av_files(char * record_info, int piptype) | @@ -1148,7 +1198,7 @@ int process_av_files(char * record_info, int piptype) | ||
| 1148 | int main(int argc, char * argv[]) | 1198 | int main(int argc, char * argv[]) |
| 1149 | { | 1199 | { |
| 1150 | if (argc < 2) { | 1200 | if (argc < 2) { |
| 1151 | - printf(" merge_pip 2.0.2\n"); | 1201 | + printf(" merge_pip 2.0.3\n"); |
| 1152 | printf(" merge video files to one pip video according to record info file,\nusage:"); | 1202 | printf(" merge video files to one pip video according to record info file,\nusage:"); |
| 1153 | printf("\n %s record_info_filename [-t {0,1,2}]", argv[0]); | 1203 | printf("\n %s record_info_filename [-t {0,1,2}]", argv[0]); |
| 1154 | printf("\n\n"); | 1204 | printf("\n\n"); |
-
请 注册 或 登录 后发表评论