Commit ce3a4224 authored by Loren Merritt's avatar Loren Merritt

cli: fix a crash on piped input.


git-svn-id: svn://svn.videolan.org/x264/trunk@311 df754926-b1dd-0310-bc7b-ec298dee348c
parent cb88eb7b
......@@ -1136,13 +1136,19 @@ static int Encode( x264_param_t *param, cli_opt_t *opt )
/* update status line (up to 1000 times per input file) */
if( opt->b_progress && param->i_log_level < X264_LOG_DEBUG &&
i_frame * 1000 / i_frame_total > i_progress )
( i_frame_total ? i_frame * 1000 / i_frame_total > i_progress
: i_frame % 10 == 0 ) )
{
int64_t i_elapsed = x264_mdate() - i_start;
double fps = i_elapsed > 0 ? i_frame * 1000000. / i_elapsed : 0;
i_progress = i_frame * 1000 / i_frame_total;
fprintf( stderr, "encoded frames: %d/%d (%.1f%%), %.2f fps \r", i_frame,
i_frame_total, (float)i_progress / 10, fps );
if( i_frame_total )
{
i_progress = i_frame * 1000 / i_frame_total;
fprintf( stderr, "encoded frames: %d/%d (%.1f%%), %.2f fps \r", i_frame,
i_frame_total, (float)i_progress / 10, fps );
}
else
fprintf( stderr, "encoded frames: %d, %.2f fps \r", i_frame, fps );
fflush( stderr ); // needed in windows
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment