70 #if HAVE_SYS_RESOURCE_H
72 #include <sys/types.h>
73 #include <sys/resource.h>
74 #elif HAVE_GETPROCESSTIMES
77 #if HAVE_GETPROCESSMEMORYINFO
83 #include <sys/select.h>
88 #include <sys/ioctl.h>
134 #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
152 static struct termios oldtty;
153 static int restore_tty;
157 static void free_input_threads(
void);
183 uint32_t *pal, *dst2;
191 if (r->
x < 0 || r->
x + r->
w > w || r->
y < 0 || r->
y + r->
h > h) {
196 dst += r->
y * dst_linesize + r->
x * 4;
199 for (y = 0; y < r->
h; y++) {
200 dst2 = (uint32_t *)dst;
202 for (x = 0; x < r->
w; x++)
203 *(dst2++) = pal[*(src2++)];
229 int64_t
pts, end_pts;
246 "Impossible to get a blank canvas.\n");
249 dst = frame->
data [0];
251 for (i = 0; i < num_rects; i++)
275 if (pts2 <= ist2->sub2video.last_pts)
279 for (j = 0, nb_reqs = 0; j < ist2->
nb_filters; j++)
302 tcsetattr (0, TCSANOW, &oldtty);
334 istty = isatty(0) && isatty(2);
336 if (istty && tcgetattr (0, &tty) == 0) {
340 tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
341 |INLCR|IGNCR|ICRNL|IXON);
342 tty.c_oflag |= OPOST;
343 tty.c_lflag &= ~(
ECHO|ECHONL|ICANON|IEXTEN);
344 tty.c_cflag &= ~(CSIZE|PARENB);
349 tcsetattr (0, TCSANOW, &tty);
376 n = select(1, &rfds,
NULL,
NULL, &tv);
385 # if HAVE_PEEKNAMEDPIPE
387 static HANDLE input_handle;
390 input_handle = GetStdHandle(STD_INPUT_HANDLE);
391 is_pipe = !GetConsoleMode(input_handle, &dw);
394 if (stdin->_cnt > 0) {
400 if (!PeekNamedPipe(input_handle,
NULL, 0,
NULL, &nchars,
NULL)) {
432 printf(
"bench: maxrss=%ikB\n", maxrss);
494 free_input_threads();
572 printf(
"bench: %8"PRIu64
" %s \n", t -
current_time, buf);
583 ost2->
finished |= ost == ost2 ? this_stream : others;
636 memcpy(t, new_pkt.
data, new_pkt.
size);
653 av_log(NULL,
AV_LOG_ERROR,
"Failed to open bitstream filter %s for stream %d with codec %s",
669 av_log(s,
AV_LOG_WARNING,
"Invalid DTS: %"PRId64
" PTS: %"PRId64
" in output stream %d:%d, replacing by guess\n",
682 if (pkt->
dts < max) {
684 av_log(s, loglevel,
"Non-monotonous DTS in output stream "
685 "%d:%d; previous: %"PRId64
", current: %"PRId64
"; ",
691 av_log(s, loglevel,
"changing to %"PRId64
". This may result "
692 "in incorrect timestamps in the output file.\n",
709 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n",
774 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
790 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
804 int subtitle_out_max_size = 1024 * 1024;
805 int subtitle_out_size, nb, i;
839 for (i = 0; i < nb; i++) {
840 unsigned save_num_rects = sub->
num_rects;
857 subtitle_out_max_size, sub);
860 if (subtitle_out_size < 0) {
867 pkt.
size = subtitle_out_size;
874 pkt.
pts += 90 * sub->start_display_time;
876 pkt.
pts += 90 * sub->end_display_time;
888 int ret, format_video_sync;
892 int nb_frames, nb0_frames, i;
893 double delta, delta0;
945 double cor =
FFMIN(-delta0, duration);
955 switch (format_video_sync) {
957 if (ost->
frame_number == 0 && delta - duration >= 0.5) {
967 }
else if (delta < -1.1)
969 else if (delta > 1.1) {
970 nb_frames =
lrintf(delta);
972 nb0_frames =
lrintf(delta0 - 0.6);
978 else if (delta > 0.6)
990 nb0_frames =
FFMIN(nb0_frames, nb_frames);
994 "*** dropping frame %d from stream %d at ts %"PRId64
"\n",
997 if (nb_frames > (nb0_frames && ost->
last_droped) + (nb_frames > nb0_frames)) {
1009 for (i = 0; i < nb_frames; i++) {
1015 if (i < nb0_frames && ost->last_frame) {
1018 in_picture = next_picture;
1045 int got_packet, forced_keyframe = 0;
1068 forced_keyframe = 1;
1074 av_dlog(
NULL,
"force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n",
1082 forced_keyframe = 1;
1093 if (forced_keyframe) {
1101 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
1118 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1130 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1135 frame_size = pkt.
size;
1164 return -10.0 * log(d) / log(10.0);
1171 double ti1, bitrate, avg_bitrate;
1196 avg_bitrate = (double)(ost->
data_size * 8) / ti1 / 1000.0;
1197 fprintf(
vstats_file,
"s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
1198 (
double)ost->
data_size / 1024, ti1, bitrate, avg_bitrate);
1251 "Error in av_buffersink_get_frame_flags(): %s\n",
av_err2str(ret));
1270 float_pts +=
FFSIGN(float_pts) * 1.0 / (1<<17);
1272 filtered_frame->
pts =
1297 "Audio filter graph output is not normalized and encoder does not support parameter changes\n");
1316 uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
1317 uint64_t subtitle_size = 0;
1318 uint64_t data_size = 0;
1319 float percent = -1.0;
1328 default: other_size += ost->
data_size;
break;
1334 if (data_size && total_size>0 && total_size >= data_size)
1335 percent = 100.0 * (total_size - data_size) / data_size;
1337 av_log(
NULL,
AV_LOG_INFO,
"video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
1338 video_size / 1024.0,
1339 audio_size / 1024.0,
1340 subtitle_size / 1024.0,
1341 other_size / 1024.0,
1342 extra_size / 1024.0);
1352 uint64_t total_packets = 0, total_size = 0;
1381 total_packets, total_size);
1386 uint64_t total_packets = 0, total_size = 0;
1415 total_packets, total_size);
1417 if(video_size + data_size + audio_size + subtitle_size + extra_size == 0){
1418 av_log(
NULL,
AV_LOG_WARNING,
"Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)\n");
1425 AVBPrint buf_script;
1430 int frame_number, vid, i;
1432 int64_t
pts = INT64_MIN;
1433 static int64_t last_time = -1;
1434 static int qp_histogram[52];
1435 int hours, mins, secs, us;
1437 if (!
print_stats && !is_last_report && !progress_avio)
1440 if (!is_last_report) {
1441 if (last_time == -1) {
1445 if ((cur_time - last_time) < 500000)
1451 oc = output_files[0]->
ctx;
1454 if (total_size <= 0)
1462 ost = output_streams[i];
1467 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"q=%2.1f ", q);
1468 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1472 float fps, t = (cur_time-timer_start) / 1000000.0;
1475 fps = t > 1 ? frame_number / t : 0;
1476 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"frame=%5d fps=%3.*f q=%3.1f ",
1477 frame_number, fps < 9.95, fps, q);
1478 av_bprintf(&buf_script,
"frame=%d\n", frame_number);
1480 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1483 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"L");
1489 for (j = 0; j < 32; j++)
1490 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%X", (
int)
lrintf(
log2(qp_histogram[j] + 1)));
1494 double error, error_sum = 0;
1495 double scale, scale_sum = 0;
1497 char type[3] = {
'Y',
'U',
'V' };
1498 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"PSNR=");
1499 for (j = 0; j < 3; j++) {
1500 if (is_last_report) {
1501 error = enc->
error[j];
1502 scale = enc->
width * enc->
height * 255.0 * 255.0 * frame_number;
1511 p =
psnr(error / scale);
1512 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%c:%2.2f ", type[j], p);
1513 av_bprintf(&buf_script,
"stream_%d_%d_psnr_%c=%2.2f\n",
1516 p =
psnr(error_sum / scale_sum);
1517 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"*:%2.2f ",
psnr(error_sum / scale_sum));
1518 av_bprintf(&buf_script,
"stream_%d_%d_psnr_all=%2.2f\n",
1538 bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1;
1540 if (total_size < 0)
snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1542 else snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1543 "size=%8.0fkB time=", total_size / 1024.0);
1545 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"-");
1546 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1547 "%02d:%02d:%02d.%02d ", hours, mins, secs,
1551 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"bitrate=N/A");
1554 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"bitrate=%6.1fkbits/s", bitrate);
1555 av_bprintf(&buf_script,
"bitrate=%6.1fkbits/s\n", bitrate);
1558 if (total_size < 0)
av_bprintf(&buf_script,
"total_size=N/A\n");
1559 else av_bprintf(&buf_script,
"total_size=%"PRId64
"\n", total_size);
1560 av_bprintf(&buf_script,
"out_time_ms=%"PRId64
"\n", pts);
1561 av_bprintf(&buf_script,
"out_time=%02d:%02d:%02d.%06d\n",
1562 hours, mins, secs, us);
1565 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
" dup=%d drop=%d",
1571 const char end = is_last_report ?
'\n' :
'\r';
1573 fprintf(stderr,
"%s %c", buf, end);
1580 if (progress_avio) {
1582 is_last_report ?
"end" :
"continue");
1584 FFMIN(buf_script.len, buf_script.size - 1));
1587 if (is_last_report) {
1604 int stop_encoding = 0;
1640 ret = encode(enc, &pkt,
NULL, &got_packet);
1658 pkt_size = pkt.
size;
1746 opkt.
dts -= ost_tb_start_time;
1767 &opkt.data, &opkt.size,
1782 avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
1796 char layout_name[256];
1815 int i,
ret, err = 0, resample_changed;
1833 if (*got_output || ret<0 || pkt->
size)
1836 if (!*got_output || ret < 0) {
1864 if (resample_changed) {
1865 char layout1[64], layout2[64];
1869 "layout for Input Stream #%d.%d\n", ist->
file_index,
1881 "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:%s to rate:%d fmt:%s ch:%d chl:%s\n",
1912 decoded_frame->
pts = pkt->
pts;
1915 decoded_frame->
pts = ist->
dts;
1923 for (i = 0; i < ist->nb_filters; i++) {
1924 if (i < ist->nb_filters - 1) {
1925 f = ist->filter_frame;
1942 return err < 0 ? err :
ret;
1948 int i,
ret = 0, err = 0, resample_changed;
1949 int64_t best_effort_timestamp;
1961 decoded_frame, got_output, pkt);
1972 "has_b_frames is larger in decoder than demuxer %d > %d ",
1978 if (*got_output || ret<0 || pkt->
size)
1981 if (*got_output && ret >= 0) {
1986 decoded_frame->
width,
1995 if (!*got_output || ret < 0) {
2025 "frame_pts:%s frame_pts_time:%s best_effort_ts:%"PRId64
" best_effort_ts_time:%s keyframe:%d frame_type:%d time_base:%d/%d\n",
2028 best_effort_timestamp,
2042 if (resample_changed) {
2044 "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
2064 if (!frame_sample_aspect->
num)
2067 if (i < ist->nb_filters - 1) {
2077 }
else if (ret < 0) {
2079 "Failed to inject frame into filter network: %s\n",
av_err2str(ret));
2087 return err < 0 ? err :
ret;
2094 &subtitle, got_output, pkt);
2096 if (*got_output || ret<0 || pkt->
size)
2099 if (ret < 0 || !*got_output) {
2110 if (end < ist->prev_sub.subtitle.end_display_time) {
2112 "Subtitle duration reduced from %d to %d%s\n",
2114 end <= 0 ?
", dropping it" :
"");
2199 "Multiple frames in a packet from stream %d\n", pkt->
stream_index);
2250 if (got_output && !pkt)
2304 if (!strcmp(output_files[i]->ctx->oformat->name,
"rtp")) {
2305 avc[j] = output_files[i]->
ctx;
2313 printf(
"SDP:\n%s\n", sdp);
2332 if (
hwaccels[i].pix_fmt == pix_fmt)
2343 for (p = pix_fmts; *p != -1; p++) {
2356 ret = hwaccel->
init(s);
2360 "%s hwaccel requested for input stream #%d:%d, "
2361 "but cannot be initialized.\n", hwaccel->
name,
2393 snprintf(error, error_len,
"Decoder (codec %s) not found for input stream #%d:%d",
2408 av_log(
NULL,
AV_LOG_WARNING,
"Warning using DVB subtitles for filtering and output at the same time is not fully supported, also see -compute_edt [0|1]\n");
2418 "Error while opening decoder for input stream "
2441 int64_t va = *(int64_t *)a, vb = *(int64_t *)
b;
2442 return va < vb ? -1 : va > vb ? +1 : 0;
2452 for (p = kf; *p; p++)
2463 for (i = 0; i <
n; i++) {
2464 char *next = strchr(p,
',');
2469 if (!memcmp(p,
"chapters", 8)) {
2478 "Could not allocate forced key frames array.\n");
2510 InputFile *file = input_files[input_index];
2516 "New %s stream %d:%d at pos:%"PRId64
" and DTS:%ss\n",
2528 int encoder_string_len;
2529 int format_flags = 0;
2551 encoder_string =
av_mallocz(encoder_string_len);
2552 if (!encoder_string)
2558 av_strlcpy(encoder_string,
"Lavc ", encoder_string_len);
2566 int ret = 0, i, j, k;
2570 char error[1024] = {0};
2582 if (fg->
inputs[0]->
ist == input_streams[k])
2598 oc = output_files[i]->
ctx;
2615 ost = output_streams[i];
2643 uint64_t extra_size;
2649 if (extra_size > INT_MAX) {
2658 unsigned int codec_tag;
2705 if( copy_tb<0 && dec_ctx->time_base.den
2763 #if FF_API_AUDIOENC_DELAY
2781 "with stream copy may produce invalid files\n");
2806 snprintf(error,
sizeof(error),
"Encoder (codec %s) not found for output stream #%d:%d",
2840 "about the input framerate is available. Falling "
2841 "back to a default value of 25fps for output stream #%d:%d. Use the -r option "
2842 "if you want a different framerate.\n",
2857 switch (enc_ctx->codec_type) {
2863 enc_ctx->time_base = (
AVRational){ 1, enc_ctx->sample_rate };
2867 if (ost->
filter && !(enc_ctx->time_base.num && enc_ctx->time_base.den))
2872 "Please consider specifying a lower framerate, a different muxer or -vsync 2\n");
2877 enc_ctx->time_base);
2885 if (!strncmp(ost->
enc->
name,
"libx264", 7) &&
2889 "No pixel format specified, %s for H.264 encoding chosen.\n"
2890 "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
2892 if (!strncmp(ost->
enc->
name,
"mpeg2video", 10) &&
2896 "No pixel format specified, %s for MPEG-2 encoding chosen.\n"
2897 "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
2930 if (!enc_ctx->width) {
2943 char logfilename[1024];
2946 snprintf(logfilename,
sizeof(logfilename),
"%s-%d.log",
2950 if (!strcmp(ost->
enc->
name,
"libx264")) {
2955 size_t logbuffer_size;
2961 enc_ctx->stats_in = logbuffer;
2967 logfilename, strerror(errno));
2976 if (ost->disposition) {
2978 {
"disposition" ,
NULL, 0,
AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit =
"flags" },
2994 static const AVClass class = {
3000 const AVClass *pclass = &
class;
3010 ost = output_streams[i];
3011 if (ost->encoding_needed) {
3020 if (!ost->enc_ctx->subtitle_header) {
3028 av_dict_set(&ost->encoder_opts,
"threads",
"auto", 0);
3029 av_dict_set(&ost->encoder_opts,
"side_data_only_packets",
"1", 0);
3034 snprintf(error,
sizeof(error),
"Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",
3035 ost->file_index, ost->index);
3041 ost->enc_ctx->frame_size);
3043 if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000)
3045 " It takes bits/s as argument, not kbits/s\n");
3050 "Error setting up codec context options.\n");
3058 "Error initializing the output stream codec context.\n");
3061 ost->st->codec->codec= ost->enc_ctx->codec;
3071 ost = output_streams[i];
3095 oc = output_files[i]->
ctx;
3099 "Could not write header for output file #%d "
3100 "(incorrect codec parameters ?): %s",
3106 if (strcmp(oc->oformat->name,
"rtp")) {
3115 av_dump_format(output_files[i]->ctx, i, output_files[i]->ctx->filename, 1);
3121 ist = input_streams[i];
3123 for (j = 0; j < ist->nb_filters; j++) {
3124 if (ist->filters[j]->graph->graph_desc) {
3126 ist->file_index, ist->st->index, ist->dec ? ist->dec->name :
"?",
3127 ist->filters[j]->name);
3136 ost = output_streams[i];
3138 if (ost->attachment_filename) {
3141 ost->attachment_filename, ost->file_index, ost->index);
3145 if (ost->filter && ost->filter->graph->graph_desc) {
3152 ost->index, ost->enc ? ost->enc->name :
"?");
3157 input_streams[ost->source_index]->
file_index,
3158 input_streams[ost->source_index]->
st->
index,
3161 if (ost->sync_ist != input_streams[ost->source_index])
3163 ost->sync_ist->file_index,
3164 ost->sync_ist->st->index);
3165 if (ost->stream_copy)
3168 const AVCodec *in_codec = input_streams[ost->source_index]->
dec;
3169 const AVCodec *out_codec = ost->enc;
3170 const char *decoder_name =
"?";
3171 const char *in_codec_name =
"?";
3172 const char *encoder_name =
"?";
3173 const char *out_codec_name =
"?";
3176 decoder_name = in_codec->
name;
3178 if (!strcmp(decoder_name, in_codec_name))
3179 decoder_name =
"native";
3183 encoder_name = out_codec->
name;
3185 if (!strcmp(encoder_name, out_codec_name))
3186 encoder_name =
"native";
3190 in_codec_name, decoder_name,
3191 out_codec_name, encoder_name);
3244 int64_t opts_min = INT64_MAX;
3251 if (!ost->
finished && opts < opts_min) {
3262 static int64_t last_time;
3285 if (key ==
'c' || key ==
'C'){
3289 fprintf(stderr,
"\nEnter command: <target>|all <time>|-1 <command>[ <argument>]\n");
3291 while ((k =
read_key()) !=
'\n' && k !=
'\r' && i <
sizeof(buf)-1)
3296 (n = sscanf(buf,
"%63[^ ] %lf %255[^ ] %255[^\n]", target, &time, command, arg)) >= 3) {
3298 target, time, command, arg);
3305 fprintf(stderr,
"Command reply for stream %d: ret:%d res:\n%s", i, ret, buf);
3306 }
else if (key ==
'c') {
3307 fprintf(stderr,
"Queing commands only on filters supporting the specific command is unsupported\n");
3316 "Parse error, at least 3 arguments were expected, "
3317 "only %d given in string '%s'\n", n, buf);
3320 if (key ==
'd' || key ==
'D'){
3324 if(!debug) debug = 1;
3328 if(scanf(
"%d", &debug)!=1)
3329 fprintf(stderr,
"error parsing debug value\n");
3338 fprintf(stderr,
"debug=%d\n", debug);
3341 fprintf(stderr,
"key function\n"
3342 "? show this help\n"
3343 "+ increase verbosity\n"
3344 "- decrease verbosity\n"
3345 "c Send command to first matching filter supporting it\n"
3346 "C Send/Que command to all matching filters\n"
3347 "D cycle through available debug modes\n"
3348 "h dump packets/hex press to cycle through the 3 states\n"
3350 "s Show QP histogram\n"
3357 static void *input_thread(
void *
arg)
3377 if (flags && ret ==
AVERROR(EAGAIN)) {
3381 "Thread message queue blocking; consider raising the "
3382 "thread_queue_size option (current value: %d)\n",
3383 f->thread_queue_size);
3388 "Unable to send packet to main thread: %s\n",
3399 static void free_input_threads(
void)
3407 if (!f->in_thread_queue)
3419 static int init_input_threads(
void)
3423 if (nb_input_files == 1)
3431 f->non_blocking = 1;
3433 f->thread_queue_size,
sizeof(
AVPacket));
3438 av_log(
NULL,
AV_LOG_ERROR,
"pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret));
3468 if (nb_input_files > 1)
3469 return get_input_packet_mt(f, pkt);
3478 if (output_streams[i]->unavailable)
3487 input_files[i]->eagain = 0;
3489 output_streams[i]->unavailable = 0;
3501 InputFile *ifile = input_files[file_index];
3522 ist = input_streams[ifile->
ist_index + i];
3553 goto discard_packet;
3562 goto discard_packet;
3566 "next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
3577 int64_t stime, stime2;
3584 int64_t new_start_time = INT64_MAX;
3626 memcpy(dst_data, src_sd->
data, src_sd->
size);
3650 "Inter stream timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
3670 "timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
3698 av_log(
NULL,
AV_LOG_INFO,
"demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
3732 int nb_requests, nb_requests_max = 0;
3750 for (i = 0; i < graph->
nb_inputs; i++) {
3751 ifilter = graph->
inputs[i];
3757 if (nb_requests > nb_requests_max) {
3758 nb_requests_max = nb_requests;
3823 int64_t timer_start;
3836 if ((ret = init_input_threads()) < 0)
3867 free_input_threads();
3872 ist = input_streams[i];
3883 os = output_files[i]->
ctx;
3892 ost = output_streams[i];
3900 ist = input_streams[i];
3913 free_input_threads();
3916 if (output_streams) {
3918 ost = output_streams[i];
3941 struct rusage rusage;
3943 getrusage(RUSAGE_SELF, &rusage);
3944 return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
3945 #elif HAVE_GETPROCESSTIMES
3947 FILETIME
c, e, k,
u;
3948 proc = GetCurrentProcess();
3949 GetProcessTimes(proc, &c, &e, &k, &u);
3950 return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
3958 #if HAVE_GETRUSAGE && HAVE_STRUCT_RUSAGE_RU_MAXRSS
3959 struct rusage rusage;
3960 getrusage(RUSAGE_SELF, &rusage);
3961 return (int64_t)rusage.ru_maxrss * 1024;
3962 #elif HAVE_GETPROCESSMEMORYINFO
3964 PROCESS_MEMORY_COUNTERS memcounters;
3965 proc = GetCurrentProcess();
3966 memcounters.cb =
sizeof(memcounters);
3967 GetProcessMemoryInfo(proc, &memcounters,
sizeof(memcounters));
3968 return memcounters.PeakPagefileUsage;
3985 setvbuf(stderr,
NULL,_IONBF,0);
3990 if(argc>1 && !strcmp(argv[1],
"-d")){
4014 if (nb_output_files <= 0 && nb_input_files == 0) {
4021 if (nb_output_files <= 0) {
4036 printf(
"bench: utime=%0.3fs\n", ti / 1000000.0);