[FFmpeg-devel] [PATCH] fftools/ffmpeg: Fix declaration-after-statement warning

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Jul 18 22:23:04 EEST 2021


Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> What is actually the reason that we stick to this C90 rule?
> Is it because of compability with ancient compilers? (Given that we
> already require several C99 features, I doubt that there are compilers
> which would fail if we stopped adhering to the
> declaration-before-statement rule.) Or is it because it is presumed that
> it improves clarity and readability?
> 

I pushed this to fix the warning, although I'd like to hear other
peoples' opinion on whether the warning should no longer be enabled.

>  fftools/ffmpeg.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index e0f2fe138f..6f6e002604 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -4234,10 +4234,11 @@ static int get_input_packet(InputFile *f, AVPacket **pkt)
>          float scale = f->rate_emu ? 1.0 : f->readrate;
>          for (i = 0; i < f->nb_streams; i++) {
>              InputStream *ist = input_streams[f->ist_index + i];
> +            int64_t stream_ts_offset, pts, now;
>              if (!ist->nb_packets) continue;
> -            int64_t stream_ts_offset = FFMAX(ist->first_dts != AV_NOPTS_VALUE ? ist->first_dts : 0, file_start);
> -            int64_t pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
> -            int64_t now = (av_gettime_relative() - ist->start)*scale + stream_ts_offset;
> +            stream_ts_offset = FFMAX(ist->first_dts != AV_NOPTS_VALUE ? ist->first_dts : 0, file_start);
> +            pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
> +            now = (av_gettime_relative() - ist->start) * scale + stream_ts_offset;
>              if (pts > now)
>                  return AVERROR(EAGAIN);
>          }
> 



More information about the ffmpeg-devel mailing list