胡斌

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
... ... @@ -629,6 +629,11 @@ int count_audio_files(float mid)
int max_audio = 1;
int width = 0;
int height = 0;
int width_teacher = 0;
int height_teacher = 0;
int width_student = 0;
int height_student = 0;
bool has_teacher = false;
void add_media_infos()
{
... ... @@ -703,6 +708,43 @@ void add_media_infos()
height = it->width;
}
}
if (it->m_role == mr_teacher) {
has_teacher = true;
if (it->width > it->height) {
if (width_teacher < it->width) {
width_teacher = it->width;
}
if (height_teacher < it->height) {
height_teacher = it->height;
}
}
else {//set the image to landscape
if (width_teacher < it->height) {
width_teacher = it->height;
}
if (height_teacher < it->width) {
height_teacher = it->width;
}
}
}
else {
if (it->width > it->height) {
if (width_student < it->width) {
width_student = it->width;
}
if (height_student < it->height) {
height_student = it->height;
}
}
else {//set the image to landscape
if (width_student < it->height) {
width_student = it->height;
}
if (height_student < it->width) {
height_student = it->width;
}
}
}
}
else {
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)
return 0;
}
#define MIN_TIME_INTERVAL 25
int process_av_files(char * record_info, int piptype)
... ... @@ -1056,6 +1096,11 @@ int process_av_files(char * record_info, int piptype)
avfilter_register_all();
bool one2one = max_audio <= 2;
if (has_teacher == false && max_audio == 2) {
one2one = false;
}
if (1 == piptype) {
one2one = true;
printf("using one2one layout\n");
... ... @@ -1069,7 +1114,12 @@ int process_av_files(char * record_info, int piptype)
printf("using one2one layout,because detected max %d audio\n",max_audio);
}
else {
printf("using one2many layout,because detected max %d audio\n", max_audio);
if (max_audio == 2 && has_teacher == false) {
printf("using one2many layout,because detected max %d audio,but no teacher\n", max_audio);
}
else {
printf("using one2many layout,because detected max %d audio\n", max_audio);
}
}
}
... ... @@ -1148,7 +1198,7 @@ int process_av_files(char * record_info, int piptype)
int main(int argc, char * argv[])
{
if (argc < 2) {
printf(" merge_pip 2.0.2\n");
printf(" merge_pip 2.0.3\n");
printf(" merge video files to one pip video according to record info file,\nusage:");
printf("\n %s record_info_filename [-t {0,1,2}]", argv[0]);
printf("\n\n");
... ...