[FFmpeg-devel] [PATCH 2/2] lavfi/src_movie: minor simplifications

Michael Niedermayer michaelni at gmx.at
Tue May 13 07:09:32 CEST 2014


On Sun, May 11, 2014 at 06:08:09AM +0200, Lukasz Marek wrote:
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>  libavfilter/src_movie.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index dd3b516..0b97b82 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -192,7 +192,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
>      MovieContext *movie = ctx->priv;
>      AVInputFormat *iformat = NULL;
>      int64_t timestamp;
> -    int nb_streams, ret, i;
> +    int nb_streams = 1, ret, i;
>      char default_streams[16], *stream_specs, *spec, *cursor;
>      char name[16];
>      AVStream *st;
> @@ -211,7 +211,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
>                   movie->stream_index);
>          stream_specs = default_streams;
>      }
> -    for (cursor = stream_specs, nb_streams = 1; *cursor; cursor++)
> +    for (cursor = stream_specs; *cursor; cursor++)
>          if (*cursor == '+')
>              nb_streams++;
>  

> @@ -283,11 +283,9 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
>          return AVERROR(ENOMEM);
>      for (i = 0; i <= movie->max_stream_index; i++)
>          movie->out_index[i] = -1;
> -    for (i = 0; i < nb_streams; i++)
> -        movie->out_index[movie->st[i].st->index] = i;
> -
>      for (i = 0; i < nb_streams; i++) {
>          AVFilterPad pad = { 0 };
> +        movie->out_index[movie->st[i].st->index] = i;
>          snprintf(name, sizeof(name), "out%d", i);

should be ok if nothing touches out_index before its initialized

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140513/855bc4c2/attachment.asc>


More information about the ffmpeg-devel mailing list