胡斌

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;
uint8_t blank_g = 0x5a;
uint8_t blank_b = 0x82;
CAVTranscoder::CAVTranscoder(bool bOne2One):
CAVTranscoder::CAVTranscoder(bool bOne2One,int width,int height):
_start_time(INT64_MAX),
_all_processed(true),
_nOutputWidth(320),
_cur_out_v_ts(0),
_cur_out_a_ts(0),
_max_audio(1),
_scaled_width(100),
_scaled_height(75),
_src_width(320),
_src_height(240),
_sws_ctx_w_h(NULL),
_sws_ctx_h_w(NULL),
_sws_ctx_h_h(NULL),
... ... @@ -34,6 +30,10 @@ _last_videos_got(-1),
_teacherFrame(NULL),
_studentFrame(NULL)
{
_src_width = width;
_src_height = height;
_scaled_width = _src_width * 10 / 32;
_scaled_height = _src_height * 10 / 32;
_one2one = bOne2One;
if (_one2one) {
_nOutputHeight = _src_height * 2;
... ...
... ... @@ -5,7 +5,7 @@
class CAVTranscoder
{
public:
CAVTranscoder(bool bOne2One);
CAVTranscoder(bool bOne2One, int width, int height);
virtual ~CAVTranscoder();
int add(media_info & info);
... ...
... ... @@ -627,6 +627,8 @@ int count_audio_files(float mid)
}
int max_audio = 1;
int width = 0;
int height = 0;
void add_media_infos()
{
... ... @@ -684,6 +686,22 @@ void add_media_infos()
it = sorted_media_with_end.begin();
for (; it != sorted_media_with_end.end();it++){
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");
if (it->width > it->height) {
if (width < it->width) {
width = it->width;
}
if (height < it->height) {
height = it->height;
}
}
else {//set the image to landscape
if (width < it->height) {
width = it->height;
}
if (height < it->width) {
height = it->width;
}
}
}
printf("\n-------------------------\n");
... ... @@ -1050,7 +1068,7 @@ int process_av_files(char * record_info, int piptype)
}
}
CAVTranscoder videoTranscoder(one2one);
CAVTranscoder videoTranscoder(one2one, width, height);
videoTranscoder.set_max_audio(max_audio);
int64_t cur_time = 0;
... ...