33 #include <stdatomic.h>
74 #if HAVE_SYS_RESOURCE_H
76 #include <sys/types.h>
77 #include <sys/resource.h>
78 #elif HAVE_GETPROCESSTIMES
81 #if HAVE_GETPROCESSMEMORYINFO
85 #if HAVE_SETCONSOLECTRLHANDLER
91 #include <sys/select.h>
96 #include <sys/ioctl.h>
155 static struct termios oldtty;
156 static int restore_tty;
182 uint32_t *pal, *dst2;
190 if (
r->x < 0 ||
r->x +
r->w >
w ||
r->y < 0 ||
r->y +
r->h >
h) {
192 r->x,
r->y,
r->w,
r->h,
w,
h
197 dst +=
r->y * dst_linesize +
r->x * 4;
199 pal = (uint32_t *)
r->data[1];
200 for (y = 0; y <
r->h; y++) {
201 dst2 = (uint32_t *)dst;
203 for (x = 0; x <
r->w; x++)
204 *(dst2++) = pal[*(
src2++)];
206 src +=
r->linesize[0];
234 int64_t
pts, end_pts;
243 num_rects =
sub->num_rects;
256 "Impossible to get a blank canvas.\n");
259 dst =
frame->data [0];
260 dst_linesize =
frame->linesize[0];
261 for (
i = 0;
i < num_rects;
i++)
286 if (pts2 <= ist2->sub2video.last_pts)
293 for (j = 0, nb_reqs = 0; j < ist2->
nb_filters; j++)
320 tcsetattr (0, TCSANOW, &oldtty);
345 ret = write(2,
"Received > 3 system signals, hard exiting\n",
346 strlen(
"Received > 3 system signals, hard exiting\n"));
352 #if HAVE_SETCONSOLECTRLHANDLER
353 static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
360 case CTRL_BREAK_EVENT:
364 case CTRL_CLOSE_EVENT:
365 case CTRL_LOGOFF_EVENT:
366 case CTRL_SHUTDOWN_EVENT:
385 #define SIGNAL(sig, func) \
387 action.sa_handler = func; \
388 sigaction(sig, &action, NULL); \
391 #define SIGNAL(sig, func) \
397 #if defined __linux__
398 struct sigaction action = {0};
402 sigfillset(&action.sa_mask);
405 action.sa_flags = SA_RESTART;
411 if (tcgetattr (0, &tty) == 0) {
415 tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
416 |INLCR|IGNCR|ICRNL|IXON);
417 tty.c_oflag |= OPOST;
418 tty.c_lflag &= ~(
ECHO|ECHONL|ICANON|IEXTEN);
419 tty.c_cflag &= ~(CSIZE|PARENB);
424 tcsetattr (0, TCSANOW, &tty);
436 signal(SIGPIPE, SIG_IGN);
438 #if HAVE_SETCONSOLECTRLHANDLER
439 SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE);
456 n = select(1, &rfds,
NULL,
NULL, &tv);
465 # if HAVE_PEEKNAMEDPIPE
467 static HANDLE input_handle;
470 input_handle = GetStdHandle(STD_INPUT_HANDLE);
471 is_pipe = !GetConsoleMode(input_handle, &dw);
476 if (!PeekNamedPipe(input_handle,
NULL, 0,
NULL, &nchars,
NULL)) {
561 "Error closing vstats file, loss of information possible: %s\n",
591 int ost_idx = prev ? prev->
index + 1 : 0;
607 int ist_idx = prev ? prev->
st->
index + 1 : 0;
612 return f->streams[ist_idx];
655 "bench: %8" PRIu64
" user %8" PRIu64
" sys %8" PRIu64
" real %s \n",
669 if (
ost->sq_idx_encode >= 0)
707 float_pts +=
FFSIGN(float_pts) * 1.0 / (1<<17);
711 frame->time_base = enc->time_base;
720 enc ? enc->time_base.num : -1,
721 enc ? enc->time_base.den : -1);
728 char *
error,
int error_len);
734 char error[1024] = {0};
736 if (
ost->initialized)
753 return -10.0 * log10(
d);
761 int64_t frame_number;
762 double ti1,
bitrate, avg_bitrate;
786 frame_number =
ost->packets_encoded;
788 fprintf(
vstats_file,
"frame= %5"PRId64
" q= %2.1f ", frame_number,
791 fprintf(
vstats_file,
"out= %2d st= %2d frame= %5"PRId64
" q= %2.1f ",
ost->file_index,
ost->
index, frame_number,
805 avg_bitrate = (
double)(
ost->data_size_enc * 8) / ti1 / 1000.0;
806 fprintf(
vstats_file,
"s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
807 (
double)
ost->data_size_enc / 1024, ti1,
bitrate, avg_bitrate);
820 int64_t ptsi = INT64_MAX;
882 const char *action =
frame ?
"encode" :
"flush";
886 if (
ost->enc_stats_pre.io)
888 ost->frames_encoded);
890 ost->frames_encoded++;
891 ost->samples_encoded +=
frame->nb_samples;
895 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
928 }
else if (
ret < 0) {
935 if (
ost->enc_stats_post.io)
937 ost->packets_encoded);
941 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s "
942 "duration:%s duration_time:%s\n",
954 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s "
955 "duration:%s duration_time:%s\n",
964 "Subtitle heartbeat logic failed in %s! (%s)\n",
971 ost->packets_encoded++;
984 if (
ost->sq_idx_encode < 0)
1010 }
else if (
ret < 0) {
1055 int subtitle_out_max_size = 1024 * 1024;
1056 int subtitle_out_size, nb,
i,
ret;
1082 for (
i = 0;
i < nb;
i++) {
1083 unsigned save_num_rects =
sub->num_rects;
1095 sub->end_display_time -=
sub->start_display_time;
1096 sub->start_display_time = 0;
1100 ost->frames_encoded++;
1104 sub->num_rects = save_num_rects;
1105 if (subtitle_out_size < 0) {
1134 int64_t *nb_frames, int64_t *nb_frames_prev)
1136 double delta0,
delta;
1141 delta0 = sync_ipts -
ost->next_pts;
1146 *nb_frames_prev = 0;
1154 if (delta0 < -0.6) {
1158 sync_ipts =
ost->next_pts;
1163 switch (
ost->vsync_method) {
1165 if (
ost->vsync_frame_number == 0 && delta0 >= 0.5) {
1175 }
else if (
delta < -1.1)
1177 else if (
delta > 1.1) {
1180 *nb_frames_prev =
llrintf(delta0 - 0.6);
1187 else if (
delta > 0.6)
1214 goto force_keyframe;
1215 }
else if (kf->
pexpr) {
1220 ff_dlog(
NULL,
"force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n",
1234 goto force_keyframe;
1237 in_picture->
key_frame == 1 && !dup_idx) {
1238 goto force_keyframe;
1242 goto force_keyframe;
1260 int64_t nb_frames, nb_frames_prev,
i;
1268 if (frame_rate.
num > 0 && frame_rate.
den > 0)
1274 if (!
ost->filters_script &&
1283 if (!next_picture) {
1285 nb_frames_prev = nb_frames =
mid_pred(
ost->last_nb0_frames[0],
1286 ost->last_nb0_frames[1],
1287 ost->last_nb0_frames[2]);
1290 &nb_frames, &nb_frames_prev);
1293 memmove(
ost->last_nb0_frames + 1,
1294 ost->last_nb0_frames,
1296 ost->last_nb0_frames[0] = nb_frames_prev;
1298 if (nb_frames_prev == 0 &&
ost->last_dropped) {
1301 "*** dropping frame %"PRId64
" at ts %"PRId64
"\n",
1302 ost->vsync_frame_number,
ost->last_frame->pts);
1304 if (nb_frames > (nb_frames_prev &&
ost->last_dropped) + (nb_frames > nb_frames_prev)) {
1310 nb_frames_dup += nb_frames - (nb_frames_prev &&
ost->last_dropped) - (nb_frames > nb_frames_prev);
1317 ost->last_dropped = nb_frames == nb_frames_prev && next_picture;
1318 ost->kf.dropped_keyframe =
ost->last_dropped && next_picture && next_picture->key_frame;
1321 for (
i = 0;
i < nb_frames;
i++) {
1324 if (i < nb_frames_prev && ost->last_frame->buf[0]) {
1325 in_picture =
ost->last_frame;
1327 in_picture = next_picture;
1332 in_picture->
pts =
ost->next_pts;
1347 ost->vsync_frame_number++;
1372 if (!
ost->filter || !
ost->filter->graph->graph)
1388 filtered_frame =
ost->filtered_frame;
1396 "Error in av_buffersink_get_frame_flags(): %s\n",
av_err2str(
ret));
1403 if (
ost->finished) {
1423 if (!
ost->frame_aspect_ratio.num)
1432 "Audio filter graph output is not normalized and encoder does not support parameter changes\n");
1451 uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
1452 uint64_t subtitle_size = 0;
1454 float percent = -1.0;
1460 const uint64_t
s =
ost->data_size_mux;
1466 default: other_size +=
s;
break;
1479 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: ",
1480 video_size / 1024.0,
1481 audio_size / 1024.0,
1482 subtitle_size / 1024.0,
1483 other_size / 1024.0,
1484 extra_size / 1024.0);
1494 uint64_t total_packets = 0, total_size = 0;
1499 for (j = 0; j <
f->nb_streams; j++) {
1523 total_packets, total_size);
1528 uint64_t total_packets = 0, total_size = 0;
1537 total_size +=
ost->data_size_mux;
1544 ost->frames_encoded);
1557 total_packets, total_size);
1559 if(video_size +
data_size + audio_size + subtitle_size + extra_size == 0){
1569 static void print_report(
int is_last_report, int64_t timer_start, int64_t cur_time)
1571 AVBPrint buf, buf_script;
1576 int64_t
pts = INT64_MIN + 1;
1577 static int64_t last_time = -1;
1578 static int first_report = 1;
1579 static int qp_histogram[52];
1580 int hours, mins, secs,
us;
1581 const char *hours_sign;
1588 if (!is_last_report) {
1589 if (last_time == -1) {
1590 last_time = cur_time;
1592 if (((cur_time - last_time) <
stats_period && !first_report) ||
1595 last_time = cur_time;
1598 t = (cur_time-timer_start) / 1000000.0;
1609 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1616 fps = t > 1 ? frame_number / t : 0;
1617 av_bprintf(&buf,
"frame=%5"PRId64
" fps=%3.*f q=%3.1f ",
1618 frame_number, fps < 9.95, fps, q);
1619 av_bprintf(&buf_script,
"frame=%"PRId64
"\n", frame_number);
1621 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1630 for (j = 0; j < 32; j++)
1637 double error, error_sum = 0;
1638 double scale, scale_sum = 0;
1640 char type[3] = {
'Y',
'U',
'V' };
1642 for (j = 0; j < 3; j++) {
1643 if (is_last_report) {
1656 av_bprintf(&buf_script,
"stream_%d_%d_psnr_%c=%2.2f\n",
1659 p =
psnr(error_sum / scale_sum);
1661 av_bprintf(&buf_script,
"stream_%d_%d_psnr_all=%2.2f\n",
1687 hours_sign = (
pts < 0) ?
"-" :
"";
1689 bitrate =
pts && total_size >= 0 ? total_size * 8 / (
pts / 1000.0) : -1;
1692 if (total_size < 0)
av_bprintf(&buf,
"size=N/A time=");
1693 else av_bprintf(&buf,
"size=%8.0fkB time=", total_size / 1024.0);
1709 if (total_size < 0)
av_bprintf(&buf_script,
"total_size=N/A\n");
1710 else av_bprintf(&buf_script,
"total_size=%"PRId64
"\n", total_size);
1712 av_bprintf(&buf_script,
"out_time_us=N/A\n");
1713 av_bprintf(&buf_script,
"out_time_ms=N/A\n");
1718 av_bprintf(&buf_script,
"out_time=%s%02d:%02d:%02d.%06d\n",
1719 hours_sign, hours, mins, secs,
us);
1732 av_bprintf(&buf_script,
"speed=%4.3gx\n", speed);
1736 const char end = is_last_report ?
'\n' :
'\r';
1738 fprintf(stderr,
"%s %c", buf.str, end);
1748 is_last_report ?
"end" :
"continue");
1750 FFMIN(buf_script.len, buf_script.size - 1));
1753 if (is_last_report) {
1756 "Error closing progress log, loss of information possible: %s\n",
av_err2str(
ret));
1790 if (
ost->sq_idx_encode >= 0)
1803 if (!
ost->initialized) {
1807 "Finishing stream without any data written to it.\n");
1813 if (ifilter->
format < 0 &&
1851 if (
ost->ist != ist)
1879 !
ost->copy_initial_nonkeyframes)
1882 if (!
ost->streamcopy_started && !
ost->copy_prior_start) {
1884 ist->
pts <
ost->ts_copy_start :
1895 if (
f->recording_time != INT64_MAX) {
1925 opkt->
pts = opkt->
dts - ost_tb_start_time;
1928 opkt->
dts -= ost_tb_start_time;
1936 "Subtitle heartbeat logic failed in %s! (%s)\n",
1944 ost->streamcopy_started = 1;
1981 int need_reinit,
ret;
1996 need_reinit |= ifilter->
width !=
frame->width ||
2021 if (need_reinit || !fg->
graph) {
2069 if (ifilter->
format < 0) {
2111 if (!
frame->opaque_ref) {
2138 "Failed to inject frame into filter network: %s\n",
av_err2str(
ret));
2194 (
AVRational){1, decoded_frame->sample_rate});
2199 return err < 0 ? err :
ret;
2206 int i,
ret = 0, err = 0;
2207 int64_t best_effort_timestamp;
2245 "video_delay is larger in decoder than demuxer %d > %d.\n"
2246 "If you want to help, upload a sample "
2247 "of this file to https://streams.videolan.org/upload/ "
2248 "and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)\n",
2307 "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",
2310 best_effort_timestamp,
2323 return err < 0 ? err :
ret;
2336 if (end < ist->
prev_sub.subtitle.end_display_time) {
2338 "Subtitle duration reduced from %"PRId32
" to %d%s\n",
2340 end <= 0 ?
", dropping it" :
"");
2389 .format =
src->format,
2390 .start_display_time =
src->start_display_time,
2391 .end_display_time =
src->end_display_time,
2397 if (!
src->num_rects)
2403 for (
int i = 0;
i <
src->num_rects;
i++) {
2417 dst_rect->
x = src_rect->
x;
2418 dst_rect->
y = src_rect->
y;
2419 dst_rect->
w = src_rect->
w;
2420 dst_rect->
h = src_rect->
h;
2435 for (
int j = 0; j < 4; j++) {
2443 if (!src_rect->
data[j])
2473 signal_pts <= prev_subtitle->
pts)
2557 int eof_reached = 0;
2593 int64_t duration_dts = 0;
2594 int64_t duration_pts = 0;
2596 int decode_failed = 0;
2629 if (duration_pts > 0) {
2655 if (decode_failed) {
2741 return !eof_reached;
2767 if (
config->pix_fmt == *p)
2776 "%s hwaccel requested for input stream #%d:%d, "
2777 "but cannot be initialized.\n",
2800 snprintf(
error, error_len,
"Decoder (codec %s) not found for input stream #%d:%d",
2812 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");
2828 "decoder on input stream #%d:%d : %s",
2838 "Error while opening decoder for input stream "
2874 "Error setting up codec context options.\n");
2883 "Error getting reference codec parameters.\n");
2888 unsigned int codec_tag_tmp;
2897 if (!
ost->frame_rate.num)
2900 if (
ost->frame_rate.num)
2911 if (
ost->frame_rate.num)
2921 if (!
ost->copy_prior_start) {
2938 memcpy(dst_data, sd_src->
data, sd_src->
size);
2942 #if FFMPEG_ROTATION_METADATA
2943 if (
ost->rotate_overridden) {
2960 if (
ost->frame_aspect_ratio.num) {
2965 "with stream copy may produce invalid files\n");
2984 const char *cname =
ost->enc_ctx->codec->name;
2985 uint8_t *encoder_string;
2986 int encoder_string_len;
2992 encoder_string =
av_mallocz(encoder_string_len);
2993 if (!encoder_string)
2999 av_strlcpy(encoder_string,
"Lavc ", encoder_string_len);
3000 av_strlcat(encoder_string, cname, encoder_string_len);
3010 if (
ost->enc_timebase.num > 0) {
3015 if (
ost->enc_timebase.num < 0) {
3022 "Input stream data not available, using default time base\n");
3043 if (!
ost->frame_rate.num)
3045 if (!
ost->frame_rate.num && !
ost->max_frame_rate.num) {
3049 "about the input framerate is available. Falling "
3050 "back to a default value of 25fps. Use the -r option "
3051 "if you want a different framerate.\n");
3054 if (
ost->max_frame_rate.num &&
3056 !
ost->frame_rate.den))
3057 ost->frame_rate =
ost->max_frame_rate;
3066 ost->frame_rate.num,
ost->frame_rate.den, 65535);
3078 if (
ost->bits_per_raw_sample)
3080 else if (
dec_ctx &&
ost->filter->graph->is_meta)
3096 "Please consider specifying a lower framerate, a different muxer or "
3097 "setting vsync/fps_mode to vfr\n");
3103 ost->frame_aspect_ratio.num ?
3109 if (
ost->bits_per_raw_sample)
3111 else if (
dec_ctx &&
ost->filter->graph->is_meta)
3130 ost->top_field_first >= 0)
3131 frame->top_field_first = !!
ost->top_field_first;
3133 if (
frame->interlaced_frame) {
3143 if (
ost->top_field_first == 0) {
3145 }
else if (
ost->top_field_first == 1) {
3152 if (!enc_ctx->
width) {
3153 enc_ctx->
width =
ost->ist->par->width;
3154 enc_ctx->
height =
ost->ist->par->height;
3159 if (!
ost->enc_ctx->subtitle_header)
3167 int input_props = 0, output_props = 0;
3172 if (input_descriptor)
3174 if (output_descriptor)
3176 if (input_props && output_props && input_props != output_props) {
3178 "Subtitle encoding currently only possible from text to text "
3179 "or bitmap to bitmap");
3195 if (
ost->sq_idx_encode >= 0)
3204 char *
error,
int error_len)
3228 "encoder on output stream #%d:%d : %s",
3237 "Error while opening encoder for output stream #%d:%d - "
3238 "maybe incorrect parameters such as bit_rate, rate, width or height",
3245 ost->enc_ctx->frame_size);
3247 if (
ost->enc_ctx->bit_rate &&
ost->enc_ctx->bit_rate < 1000 &&
3250 " It takes bits/s as argument, not kbits/s\n");
3255 "Error initializing the output stream codec context.\n");
3259 if (
ost->enc_ctx->nb_coded_side_data) {
3262 for (
i = 0;
i <
ost->enc_ctx->nb_coded_side_data;
i++) {
3269 memcpy(dst_data, sd_src->
data, sd_src->
size);
3302 }
else if (
ost->ist) {
3318 char error[1024] = {0};
3324 for (
int j = 0; j <
ifile->nb_streams; j++)
3356 for (
int j = 0; j <
ifile->ctx->nb_programs; j++) {
3373 for (
int j = 0; j < ist->nb_filters; j++) {
3376 ist->file_index, ist->st->index, ist->dec ? ist->dec->name :
"?",
3377 ist->filters[j]->name);
3386 if (
ost->attachment_filename) {
3405 ost->ist->file_index,
3411 const AVCodec *out_codec =
ost->enc_ctx->codec;
3412 const char *decoder_name =
"?";
3413 const char *in_codec_name =
"?";
3414 const char *encoder_name =
"?";
3415 const char *out_codec_name =
"?";
3419 decoder_name = in_codec->
name;
3422 in_codec_name =
desc->name;
3423 if (!strcmp(decoder_name, in_codec_name))
3424 decoder_name =
"native";
3428 encoder_name = out_codec->
name;
3431 out_codec_name =
desc->name;
3432 if (!strcmp(encoder_name, out_codec_name))
3433 encoder_name =
"native";
3437 in_codec_name, decoder_name,
3438 out_codec_name, encoder_name);
3474 int64_t opts_min = INT64_MAX;
3484 INT64_MIN :
ost->last_mux_dts;
3487 "cur_dts is invalid [init:%d i_done:%d finish:%d] (this is harmless if it occurs once at the start per stream)\n",
3488 ost->initialized,
ost->inputs_done,
ost->finished);
3491 if (!
ost->initialized && !
ost->inputs_done)
3494 if (!
ost->finished &&
opts < opts_min) {
3506 if (tcgetattr(0, &tty) == 0) {
3507 if (
on) tty.c_lflag |=
ECHO;
3508 else tty.c_lflag &= ~
ECHO;
3509 tcsetattr(0, TCSANOW, &tty);
3517 static int64_t last_time;
3521 if (cur_time - last_time >= 100000) {
3523 last_time = cur_time;
3533 if (
key ==
'c' ||
key ==
'C'){
3534 char buf[4096], target[64],
command[256],
arg[256] = {0};
3537 fprintf(stderr,
"\nEnter command: <target>|all <time>|-1 <command>[ <argument>]\n");
3540 while ((k =
read_key()) !=
'\n' && k !=
'\r' &&
i <
sizeof(buf)-1)
3545 fprintf(stderr,
"\n");
3547 (n = sscanf(buf,
"%63[^ ] %lf %255[^ ] %255[^\n]", target, &time,
command,
arg)) >= 3) {
3556 fprintf(stderr,
"Command reply for stream %d: ret:%d res:\n%s",
i,
ret, buf);
3557 }
else if (
key ==
'c') {
3558 fprintf(stderr,
"Queuing commands only on filters supporting the specific command is unsupported\n");
3563 fprintf(stderr,
"Queuing command failed with error %s\n",
av_err2str(
ret));
3569 "Parse error, at least 3 arguments were expected, "
3570 "only %d given in string '%s'\n", n, buf);
3573 if (
key ==
'd' ||
key ==
'D'){
3581 if(!debug) debug = 1;
3589 while ((k =
read_key()) !=
'\n' && k !=
'\r' &&
i <
sizeof(buf)-1)
3594 fprintf(stderr,
"\n");
3595 if (k <= 0 || sscanf(buf,
"%d", &debug)!=1)
3596 fprintf(stderr,
"error parsing debug value\n");
3599 ist->dec_ctx->debug = debug;
3602 ost->enc_ctx->debug = debug;
3605 fprintf(stderr,
"debug=%d\n", debug);
3608 fprintf(stderr,
"key function\n"
3609 "? show this help\n"
3610 "+ increase verbosity\n"
3611 "- decrease verbosity\n"
3612 "c Send command to first matching filter supporting it\n"
3613 "C Send/Queue command to all matching filters\n"
3614 "D cycle through available debug modes\n"
3615 "h dump packets/hex press to cycle through the 3 states\n"
3617 "s Show QP histogram\n"
3626 if (
ost->unavailable)
3637 ost->unavailable = 0;
3642 for (
int i = 0;
i <
ifile->nb_streams;
i++) {
3675 int disable_discontinuity_correction =
copy_ts;
3685 disable_discontinuity_correction = 0;
3690 if (fmt_is_discont) {
3695 "timestamp discontinuity for stream #%d:%d "
3696 "(id=%d, type=%s): %"PRId64
", new offset= %"PRId64
"\n",
3724 "Inter stream timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
3789 for (
i = 0;
i <
ifile->nb_streams;
i++) {
3799 if (
ost->ist == ist &&
3807 ifile->eof_reached = 1;
3819 goto discard_packet;
3837 memcpy(dst_data, src_sd->
data, src_sd->
size);
3845 av_log(
NULL,
AV_LOG_INFO,
"demuxer+ffmpeg -> ist_index:%d:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s off:%s off_time:%s\n",
3875 int nb_requests, nb_requests_max = 0;
3900 if (nb_requests > nb_requests_max) {
3901 nb_requests_max = nb_requests;
3935 if (
ost->filter && !
ost->filter->graph->graph) {
3945 if (
ost->filter &&
ost->filter->graph->graph) {
3974 }
else if (
ost->filter) {
3976 for (
i = 0;
i <
ost->filter->graph->nb_inputs;
i++) {
3984 ost->inputs_done = 1;
3995 ost->unavailable = 1;
4012 int64_t timer_start;
4013 int64_t total_packets_written = 0;
4071 uint64_t packets_written;
4073 total_packets_written += packets_written;
4098 struct rusage rusage;
4100 getrusage(RUSAGE_SELF, &rusage);
4102 (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
4104 (rusage.ru_stime.tv_sec * 1000000LL) + rusage.ru_stime.tv_usec;
4105 #elif HAVE_GETPROCESSTIMES
4107 FILETIME
c, e, k,
u;
4108 proc = GetCurrentProcess();
4109 GetProcessTimes(proc, &
c, &e, &k, &
u);
4111 ((int64_t)
u.dwHighDateTime << 32 |
u.dwLowDateTime) / 10;
4113 ((int64_t)k.dwHighDateTime << 32 | k.dwLowDateTime) / 10;
4122 #if HAVE_GETRUSAGE && HAVE_STRUCT_RUSAGE_RU_MAXRSS
4123 struct rusage rusage;
4124 getrusage(RUSAGE_SELF, &rusage);
4125 return (int64_t)rusage.ru_maxrss * 1024;
4126 #elif HAVE_GETPROCESSMEMORYINFO
4128 PROCESS_MEMORY_COUNTERS memcounters;
4129 proc = GetCurrentProcess();
4130 memcounters.cb =
sizeof(memcounters);
4131 GetProcessMemoryInfo(proc, &memcounters,
sizeof(memcounters));
4132 return memcounters.PeakPagefileUsage;
4147 setvbuf(stderr,
NULL,_IONBF,0);
4180 int64_t utime, stime, rtime;
4186 "bench: utime=%0.3fs stime=%0.3fs rtime=%0.3fs\n",
4187 utime / 1000000.0, stime / 1000000.0, rtime / 1000000.0);