胡斌

output encoded duration every 60s,

improved adding new file when start time reached
... ... @@ -1020,9 +1020,15 @@ int process_av_files(char * record_info, int piptype)
int64_t cur_time = 0;
bool has_file = sorted_media.size()!=0;
std::string out_media_file,first_media_file;
int64_t nextfile_start_time_ms;
int encode_loop_count = 0;
if (has_file) {
media_info info = sorted_media.front();
first_media_file = info.name;
nextfile_start_time_ms = info.start_time_ms;
out_media_file = get_outmedia_file_name(record_info);
printf("open output file:%s\n", out_media_file.c_str());
int ret = videoTranscoder.open_output_file(out_media_file.c_str());
... ... @@ -1035,26 +1041,38 @@ int process_av_files(char * record_info, int piptype)
}
}
while (has_file){
while (has_file){
media_info info = sorted_media.front();
if (info.start_time_ms - cur_time < MIN_TIME_INTERVAL) {
if (nextfile_start_time_ms - cur_time < MIN_TIME_INTERVAL) {
media_info info = sorted_media.front();
sorted_media.pop_front();
videoTranscoder.add(info);
has_file = sorted_media.size() != 0;
if (has_file) {
nextfile_start_time_ms = sorted_media.front().start_time_ms;
}
}
else {
break;
}
has_file = sorted_media.size()!=0;
}
cur_time = videoTranscoder.transcode();
encode_loop_count++;
if (encode_loop_count == 1200) {
encode_loop_count = 0;
printf("\n encoded : %d seconds\n", cur_time / 1000);
}
}
while (!videoTranscoder.all_processed()){
cur_time = videoTranscoder.transcode();
encode_loop_count++;
if (encode_loop_count == 1200) {
encode_loop_count = 0;
printf("\n encoded : %d seconds\n", cur_time / 1000);
}
}
videoTranscoder.close();
... ...