胡斌

V2.0.8

1.修改在一对一布局下,有学生或老师视频需要缩放时,如果学生或老师有多个段,会出现程序异常
2.修改在一对一布局下,不需要缩放时,学生视频如果宽度小于输出视频宽度,输出视频有部分背景花屏
@@ -722,10 +722,9 @@ int CAVTranscoder::open_output_file(const char *filename) @@ -722,10 +722,9 @@ int CAVTranscoder::open_output_file(const char *filename)
722 } 722 }
723 723
724 724
725 -  
726 -  
727 int CAVTranscoder::scale_fill_one2one_teacherframe(AVFrame *pDstFrame) 725 int CAVTranscoder::scale_fill_one2one_teacherframe(AVFrame *pDstFrame)
728 { 726 {
  727 + if (_scaled_frame_teacher != _teacherFrame) {
729 if (_src_width_teacher != _teacherFrame->width || _src_height_teacher != _teacherFrame->height) {//init scale context 728 if (_src_width_teacher != _teacherFrame->width || _src_height_teacher != _teacherFrame->height) {//init scale context
730 729
731 free_scale_context(&_sws_ctx_teacher, &_scaled_frame_teacher); 730 free_scale_context(&_sws_ctx_teacher, &_scaled_frame_teacher);
@@ -745,6 +744,7 @@ int CAVTranscoder::open_output_file(const char *filename) @@ -745,6 +744,7 @@ int CAVTranscoder::open_output_file(const char *filename)
745 744
746 av_frame_free(&_teacherFrame); 745 av_frame_free(&_teacherFrame);
747 _teacherFrame = _scaled_frame_teacher; 746 _teacherFrame = _scaled_frame_teacher;
  747 + }
748 748
749 if (_teacherFrame->pkt_dts == 0 || _teacherFrame->pkt_dts == 180) { 749 if (_teacherFrame->pkt_dts == 0 || _teacherFrame->pkt_dts == 180) {
750 if (_teacher_width != _teacherFrame->width || _teacher_height != _teacherFrame->height){ 750 if (_teacher_width != _teacherFrame->width || _teacher_height != _teacherFrame->height){
@@ -774,6 +774,7 @@ int CAVTranscoder::open_output_file(const char *filename) @@ -774,6 +774,7 @@ int CAVTranscoder::open_output_file(const char *filename)
774 774
775 int CAVTranscoder::scale_fill_one2one_studentframe(AVFrame * pDstFrame, int y) 775 int CAVTranscoder::scale_fill_one2one_studentframe(AVFrame * pDstFrame, int y)
776 { 776 {
  777 + if (_scaled_frame_student != _studentFrame) {
777 if (_src_width_student != _studentFrame->width || _src_height_student != _studentFrame->height) {//init scale context 778 if (_src_width_student != _studentFrame->width || _src_height_student != _studentFrame->height) {//init scale context
778 free_scale_context(&_sws_ctx_student, &_scaled_frame_student); 779 free_scale_context(&_sws_ctx_student, &_scaled_frame_student);
779 780
@@ -793,6 +794,7 @@ int CAVTranscoder::open_output_file(const char *filename) @@ -793,6 +794,7 @@ int CAVTranscoder::open_output_file(const char *filename)
793 794
794 av_frame_free(&_studentFrame); 795 av_frame_free(&_studentFrame);
795 _studentFrame = _scaled_frame_student; 796 _studentFrame = _scaled_frame_student;
  797 + }
796 798
797 if (_studentFrame->pkt_dts == 0 || _studentFrame->pkt_dts == 180) { 799 if (_studentFrame->pkt_dts == 0 || _studentFrame->pkt_dts == 180) {
798 if (_teacher_width != _studentFrame->width || _teacher_height != _studentFrame->height){ 800 if (_teacher_width != _studentFrame->width || _teacher_height != _studentFrame->height){
@@ -823,6 +825,7 @@ int CAVTranscoder::open_output_file(const char *filename) @@ -823,6 +825,7 @@ int CAVTranscoder::open_output_file(const char *filename)
823 825
824 int CAVTranscoder::fill_one2one_student_frame(AVFrame * pDstFrame, int y) 826 int CAVTranscoder::fill_one2one_student_frame(AVFrame * pDstFrame, int y)
825 { 827 {
  828 + /*
826 if (_studentFrame->width == _student_width && _studentFrame->height == _student_height) { 829 if (_studentFrame->width == _student_width && _studentFrame->height == _student_height) {
827 if (_studentFrame->pkt_dts != 90){ 830 if (_studentFrame->pkt_dts != 90){
828 fillDestFrame(pDstFrame, _studentFrame, 0, y); 831 fillDestFrame(pDstFrame, _studentFrame, 0, y);
@@ -842,18 +845,29 @@ int CAVTranscoder::open_output_file(const char *filename) @@ -842,18 +845,29 @@ int CAVTranscoder::open_output_file(const char *filename)
842 else if (_studentFrame->width == _student_height && _studentFrame->height == _student_height) { 845 else if (_studentFrame->width == _student_height && _studentFrame->height == _student_height) {
843 fillDestFrame(pDstFrame, _studentFrame, (_nOutputWidth - _student_height) / 2, y); 846 fillDestFrame(pDstFrame, _studentFrame, (_nOutputWidth - _student_height) / 2, y);
844 } 847 }
845 - else { 848 + else {*/
846 if (_one2one_same_size){ 849 if (_one2one_same_size){
847 scale_fill_one2one_studentframe(pDstFrame, y); 850 scale_fill_one2one_studentframe(pDstFrame, y);
848 } 851 }
849 else { 852 else {
850 - //printf("\nresolution: %dx%d unexpected!", _studentFrame->width, _studentFrame->height);  
851 - memset(pDstFrame->data[0] + y * pDstFrame->linesize[0], _blank_y, pDstFrame->linesize[0] * _teacher_height);  
852 - memset(pDstFrame->data[1] + y * pDstFrame->linesize[1] / 2, _blank_u, pDstFrame->linesize[1] * _teacher_height / 2);  
853 - memset(pDstFrame->data[2] + y * pDstFrame->linesize[2] /2 , _blank_v, pDstFrame->linesize[2] * _teacher_height / 2); 853 + if (_studentFrame->pkt_dts == 0 || _studentFrame->pkt_dts == 180) {
  854 + if (_studentFrame->width < _nOutputWidth || _studentFrame->height < _nOutputHeight - y) {
  855 + memset(pDstFrame->data[0] + y * pDstFrame->linesize[0], _blank_y, pDstFrame->linesize[0] * _student_height);
  856 + memset(pDstFrame->data[1] + y * pDstFrame->linesize[1] / 2, _blank_u, pDstFrame->linesize[1] * _student_height / 2);
  857 + memset(pDstFrame->data[2] + y * pDstFrame->linesize[2] / 2, _blank_v, pDstFrame->linesize[2] * _student_height / 2);
  858 + }
  859 + fillDestFrame(pDstFrame, _studentFrame, 0, y);
  860 + }
  861 + else {
  862 + if (_studentFrame->height < _nOutputWidth || _studentFrame->width < _nOutputHeight - y) {
  863 + memset(pDstFrame->data[0] + y * pDstFrame->linesize[0], _blank_y, pDstFrame->linesize[0] * _student_height);
  864 + memset(pDstFrame->data[1] + y * pDstFrame->linesize[1] / 2, _blank_u, pDstFrame->linesize[1] * _student_height / 2);
  865 + memset(pDstFrame->data[2] + y * pDstFrame->linesize[2] / 2, _blank_v, pDstFrame->linesize[2] * _student_height / 2);
  866 + }
854 fillDestFrame(pDstFrame, _studentFrame, 0, y); 867 fillDestFrame(pDstFrame, _studentFrame, 0, y);
855 } 868 }
856 } 869 }
  870 + //}
857 return 0; 871 return 0;
858 } 872 }
859 873
@@ -84,3 +84,7 @@ V2.0.6 @@ -84,3 +84,7 @@ V2.0.6
84 V2.0.7 84 V2.0.7
85 1.修改bug: 在V2.0.4开放了设置视频编码参数,由于修改不完整,其中fps设置如果不是默认的参数20,会导致音视频不同步。 85 1.修改bug: 在V2.0.4开放了设置视频编码参数,由于修改不完整,其中fps设置如果不是默认的参数20,会导致音视频不同步。
86 2.修改在一对一布局下,有一个视频是竖屏时,对竖屏的缩放处理不正常 86 2.修改在一对一布局下,有一个视频是竖屏时,对竖屏的缩放处理不正常
  87 +
  88 +V2.0.8
  89 +1.修改在一对一布局下,有学生或老师视频需要缩放时,如果学生或老师有多个段,会出现程序异常
  90 +2.修改在一对一布局下,不需要缩放时,学生视频如果宽度小于输出视频宽度,输出视频有部分背景花屏
@@ -1211,7 +1211,7 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in @@ -1211,7 +1211,7 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in
1211 int main(int argc, char * argv[]) 1211 int main(int argc, char * argv[])
1212 { 1212 {
1213 if (argc < 2) { 1213 if (argc < 2) {
1214 - printf(" merge_pip 2.0.7\n"); 1214 + printf(" merge_pip 2.0.8\n");
1215 printf(" merge video files to one pip video according to record info file,\nusage:"); 1215 printf(" merge video files to one pip video according to record info file,\nusage:");
1216 printf("\n %s record_info_filename [-t {0,1,2}] [-c codec.cfg] [-s {1,0}]", argv[0]); 1216 printf("\n %s record_info_filename [-t {0,1,2}] [-c codec.cfg] [-s {1,0}]", argv[0]);
1217 printf("\n\n"); 1217 printf("\n\n");