[FFmpeg-devel] [PATCH 027/281] apc: convert to new channel layout API

Anton Khirnov anton at khirnov.net
Wed Jan 26 15:41:09 EET 2022


Quoting James Almer (2022-01-13 02:49:49)
> From: Vittorio Giovara <vittorio.giovara at gmail.com>
> 
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavformat/apc.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/apc.c b/libavformat/apc.c
> index 56151bb59a..192e115278 100644
> --- a/libavformat/apc.c
> +++ b/libavformat/apc.c
> @@ -38,6 +38,7 @@ static int apc_read_header(AVFormatContext *s)
>      AVIOContext *pb = s->pb;
>      AVStream *st;
>      int ret;
> +    int channels;
>  
>      avio_rl32(pb); /* CRYO */
>      avio_rl32(pb); /* _APC */
> @@ -57,16 +58,11 @@ static int apc_read_header(AVFormatContext *s)
>      if ((ret = ff_get_extradata(s, st->codecpar, pb, 2 * 4)) < 0)
>          return ret;
>  
> -    if (avio_rl32(pb)) {
> -        st->codecpar->channels       = 2;
> -        st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
> -    } else {
> -        st->codecpar->channels       = 1;
> -        st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
> -    }
> +    channels = avio_rl32(pb) + 1;

This changes behavior in case the value read is > 1. No idea if that
ever happens, but still better make it !!avio_rl32.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list