胡斌

V2.0.11

1.修改1对多布局时,缺省不扩大合成视频大小,-t 3参数时才根据学生数量扩大合成视频大小
@@ -34,7 +34,7 @@ int g_fps; @@ -34,7 +34,7 @@ int g_fps;
34 34
35 #define ensure_no_zero(x, v) if(!x) x = v 35 #define ensure_no_zero(x, v) if(!x) x = v
36 36
37 -CAVTranscoder::CAVTranscoder(bool bOne2One, bool one2one_same_size, int width_teacher, int height_teacher, int width_student, int height_student, bool has_teacher, int max_audio) : 37 +CAVTranscoder::CAVTranscoder(bool bOne2One, bool one2one_same_size, bool one2many_inflat, int width_teacher, int height_teacher, int width_student, int height_student, bool has_teacher, int max_audio) :
38 _start_time(INT64_MAX), 38 _start_time(INT64_MAX),
39 _all_processed(true), 39 _all_processed(true),
40 _nOutputWidth(320), 40 _nOutputWidth(320),
@@ -101,6 +101,11 @@ _one2one_same_size(one2one_same_size) @@ -101,6 +101,11 @@ _one2one_same_size(one2one_same_size)
101 int extent_student_lines = n_students / 4; 101 int extent_student_lines = n_students / 4;
102 int part_student = n_students % 4; 102 int part_student = n_students % 4;
103 103
  104 + if (one2many_inflat == false) {
  105 + extent_student_lines = 0;
  106 + part_student = 0;
  107 + }
  108 +
104 _pip_width = _scaled_height - pip_x_reduce; //use the scaled height,not the scaled width as pip_width 109 _pip_width = _scaled_height - pip_x_reduce; //use the scaled height,not the scaled width as pip_width
105 _pip_height = _scaled_height - pip_y_reduce; 110 _pip_height = _scaled_height - pip_y_reduce;
106 111
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 class CAVTranscoder 5 class CAVTranscoder
6 { 6 {
7 public: 7 public:
8 - CAVTranscoder(bool bOne2One, bool one2one_same_size, int width_teacher, int height_teacher, int student_width,int student_height, bool has_teacher, int max_audio); 8 + CAVTranscoder(bool bOne2One, bool one2one_same_size, bool one2many_inflat, int width_teacher, int height_teacher, int student_width,int student_height, bool has_teacher, int max_audio);
9 virtual ~CAVTranscoder(); 9 virtual ~CAVTranscoder();
10 10
11 int add(media_info & info); 11 int add(media_info & info);
@@ -28,7 +28,8 @@ student:下面是学生的录像信息文件,一个文件名一行 @@ -28,7 +28,8 @@ student:下面是学生的录像信息文件,一个文件名一行
28 -t 为可选参数,后面必须跟0,1,或2。 28 -t 为可选参数,后面必须跟0,1,或2。
29 0 为由程序自动选择合屏布局(目前根据录像信息文件里音频的起止时间,确定最多同时出现的人员数量,如果为2,则选用1对1布局). 29 0 为由程序自动选择合屏布局(目前根据录像信息文件里音频的起止时间,确定最多同时出现的人员数量,如果为2,则选用1对1布局).
30 1 为使用一对一布局 30 1 为使用一对一布局
31 -2 为使用一对多布局 31 +2 为使用一对多布局,每排4个学生,由下向上排布
  32 +3 为使用一对多布局,最多只在老师视频下部排4个学生,多于4个学生的情况,扩大合成视频的高度,把学生视频排列在老师视频下方,保证老师视频部分最多只有一排学生视频,避免老师视频被过度遮挡
32 如果不加-t,则为程序自动选择合屏布局 33 如果不加-t,则为程序自动选择合屏布局
33 34
34 -c 为可选参数,后面为编码配置文件名。缺省的编码配置文件名为merge_pip_codec.cfg。配置文件与merge_pip可执行文件在同一目录。 35 -c 为可选参数,后面为编码配置文件名。缺省的编码配置文件名为merge_pip_codec.cfg。配置文件与merge_pip可执行文件在同一目录。
@@ -95,3 +96,6 @@ V2.0.9 @@ -95,3 +96,6 @@ V2.0.9
95 V2.0.10 96 V2.0.10
96 1.修改一对多布局时,老师视频由多段不同分辨率视频组成时,会出现程序异常的问题 97 1.修改一对多布局时,老师视频由多段不同分辨率视频组成时,会出现程序异常的问题
97 2.一对多布局时,支持对不同分辨率的老师视频进行缩放,统一到相同分辨率 98 2.一对多布局时,支持对不同分辨率的老师视频进行缩放,统一到相同分辨率
  99 +
  100 +V2.0.11
  101 +1.修改1对多布局时,缺省不扩大合成视频大小,-t 3参数时才根据学生数量扩大合成视频大小
@@ -1110,13 +1110,20 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in @@ -1110,13 +1110,20 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in
1110 one2one = false; 1110 one2one = false;
1111 } 1111 }
1112 1112
  1113 + bool one_to_many_inflat = false;
  1114 +
1113 if (1 == piptype) { 1115 if (1 == piptype) {
1114 one2one = true; 1116 one2one = true;
1115 printf("using one2one layout\n"); 1117 printf("using one2one layout\n");
1116 } 1118 }
1117 else if(2 == piptype){ 1119 else if(2 == piptype){
1118 one2one = false; 1120 one2one = false;
1119 - printf("using one2many layout\n"); 1121 + printf("using one2many layout type 1\n");
  1122 + }
  1123 + else if (3 == piptype){
  1124 + one2one = false;
  1125 + one_to_many_inflat = true;
  1126 + printf("using one2many layout type 2\n");
1120 } 1127 }
1121 else { 1128 else {
1122 if (one2one) { 1129 if (one2one) {
@@ -1132,7 +1139,7 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in @@ -1132,7 +1139,7 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in
1132 } 1139 }
1133 } 1140 }
1134 1141
1135 - CAVTranscoder videoTranscoder(one2one, one2one_same_size, width_teacher, height_teacher, width_student, height_student, has_teacher, max_audio); 1142 + CAVTranscoder videoTranscoder(one2one, one2one_same_size, one_to_many_inflat, width_teacher, height_teacher, width_student, height_student, has_teacher, max_audio);
1136 videoTranscoder.set_max_audio(max_audio); 1143 videoTranscoder.set_max_audio(max_audio);
1137 1144
1138 int64_t cur_time = 0; 1145 int64_t cur_time = 0;
@@ -1216,9 +1223,9 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in @@ -1216,9 +1223,9 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in
1216 int main(int argc, char * argv[]) 1223 int main(int argc, char * argv[])
1217 { 1224 {
1218 if (argc < 2) { 1225 if (argc < 2) {
1219 - printf(" merge_pip 2.0.10\n"); 1226 + printf(" merge_pip 2.0.11\n");
1220 printf(" merge video files to one pip video according to record info file,\nusage:"); 1227 printf(" merge video files to one pip video according to record info file,\nusage:");
1221 - printf("\n %s record_info_filename [-t {0,1,2}] [-c codec.cfg] [-s {1,0}]", argv[0]); 1228 + printf("\n %s record_info_filename [-t {0,1,2,3}] [-c codec.cfg] [-s {1,0}]", argv[0]);
1222 printf("\n\n"); 1229 printf("\n\n");
1223 return -1; 1230 return -1;
1224 } 1231 }
@@ -1230,7 +1237,7 @@ int main(int argc, char * argv[]) @@ -1230,7 +1237,7 @@ int main(int argc, char * argv[])
1230 if (!strcmp(argv[i], "-t")){ 1237 if (!strcmp(argv[i], "-t")){
1231 i++; 1238 i++;
1232 if (i > argc) { 1239 if (i > argc) {
1233 - printf("error,should be 0, 1 or 2 after -t"); 1240 + printf("error,should be 0, 1 ,2 or 3 after -t");
1234 return -2; 1241 return -2;
1235 } 1242 }
1236 piptype = atoi(argv[i]); 1243 piptype = atoi(argv[i]);