胡斌

use width and height of image from record file instead of fixed 320x240

but at present,only support landscape layout
@@ -13,17 +13,13 @@ uint8_t blank_r = 0x16; @@ -13,17 +13,13 @@ uint8_t blank_r = 0x16;
13 uint8_t blank_g = 0x5a; 13 uint8_t blank_g = 0x5a;
14 uint8_t blank_b = 0x82; 14 uint8_t blank_b = 0x82;
15 15
16 -CAVTranscoder::CAVTranscoder(bool bOne2One): 16 +CAVTranscoder::CAVTranscoder(bool bOne2One,int width,int height):
17 _start_time(INT64_MAX), 17 _start_time(INT64_MAX),
18 _all_processed(true), 18 _all_processed(true),
19 _nOutputWidth(320), 19 _nOutputWidth(320),
20 _cur_out_v_ts(0), 20 _cur_out_v_ts(0),
21 _cur_out_a_ts(0), 21 _cur_out_a_ts(0),
22 _max_audio(1), 22 _max_audio(1),
23 -_scaled_width(100),  
24 -_scaled_height(75),  
25 -_src_width(320),  
26 -_src_height(240),  
27 _sws_ctx_w_h(NULL), 23 _sws_ctx_w_h(NULL),
28 _sws_ctx_h_w(NULL), 24 _sws_ctx_h_w(NULL),
29 _sws_ctx_h_h(NULL), 25 _sws_ctx_h_h(NULL),
@@ -34,6 +30,10 @@ _last_videos_got(-1), @@ -34,6 +30,10 @@ _last_videos_got(-1),
34 _teacherFrame(NULL), 30 _teacherFrame(NULL),
35 _studentFrame(NULL) 31 _studentFrame(NULL)
36 { 32 {
  33 + _src_width = width;
  34 + _src_height = height;
  35 + _scaled_width = _src_width * 10 / 32;
  36 + _scaled_height = _src_height * 10 / 32;
37 _one2one = bOne2One; 37 _one2one = bOne2One;
38 if (_one2one) { 38 if (_one2one) {
39 _nOutputHeight = _src_height * 2; 39 _nOutputHeight = _src_height * 2;
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 class CAVTranscoder 5 class CAVTranscoder
6 { 6 {
7 public: 7 public:
8 - CAVTranscoder(bool bOne2One); 8 + CAVTranscoder(bool bOne2One, int width, int height);
9 virtual ~CAVTranscoder(); 9 virtual ~CAVTranscoder();
10 10
11 int add(media_info & info); 11 int add(media_info & info);
@@ -627,6 +627,8 @@ int count_audio_files(float mid) @@ -627,6 +627,8 @@ int count_audio_files(float mid)
627 } 627 }
628 628
629 int max_audio = 1; 629 int max_audio = 1;
  630 +int width = 0;
  631 +int height = 0;
630 632
631 void add_media_infos() 633 void add_media_infos()
632 { 634 {
@@ -684,6 +686,22 @@ void add_media_infos() @@ -684,6 +686,22 @@ void add_media_infos()
684 it = sorted_media_with_end.begin(); 686 it = sorted_media_with_end.begin();
685 for (; it != sorted_media_with_end.end();it++){ 687 for (; it != sorted_media_with_end.end();it++){
686 printf("\n%2d %8.3f %s %4d %4d %3d %s", it->sorted_index, it->type_time, it->name.c_str(), it->width, it->height, it->rotate, it->t_type == tt_start ? "start" : "end"); 688 printf("\n%2d %8.3f %s %4d %4d %3d %s", it->sorted_index, it->type_time, it->name.c_str(), it->width, it->height, it->rotate, it->t_type == tt_start ? "start" : "end");
  689 + if (it->width > it->height) {
  690 + if (width < it->width) {
  691 + width = it->width;
  692 + }
  693 + if (height < it->height) {
  694 + height = it->height;
  695 + }
  696 + }
  697 + else {//set the image to landscape
  698 + if (width < it->height) {
  699 + width = it->height;
  700 + }
  701 + if (height < it->width) {
  702 + height = it->width;
  703 + }
  704 + }
687 } 705 }
688 printf("\n-------------------------\n"); 706 printf("\n-------------------------\n");
689 707
@@ -1050,7 +1068,7 @@ int process_av_files(char * record_info, int piptype) @@ -1050,7 +1068,7 @@ int process_av_files(char * record_info, int piptype)
1050 } 1068 }
1051 } 1069 }
1052 1070
1053 - CAVTranscoder videoTranscoder(one2one); 1071 + CAVTranscoder videoTranscoder(one2one, width, height);
1054 videoTranscoder.set_max_audio(max_audio); 1072 videoTranscoder.set_max_audio(max_audio);
1055 1073
1056 int64_t cur_time = 0; 1074 int64_t cur_time = 0;