[FFmpeg-cvslog] Fix crash in ffmpeg.c with PIX_FMT_NONE

Stefano Sabatini stefano.sabatini-lala at poste.it
Wed Apr 6 01:25:59 CEST 2011


On date Wednesday 2011-04-06 01:16:45 +0200, Michael Niedermayer wrote:
> ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Apr  5 23:22:08 2011 +0200| [b5ef6f8eb452c37b19d973d61548725d7b91113e] | committer: Michael Niedermayer
> 
> Fix crash in ffmpeg.c with PIX_FMT_NONE
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b5ef6f8eb452c37b19d973d61548725d7b91113e
> ---
> 
>  ffmpeg.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index cb23581..e2692de 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -657,6 +657,7 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
>                  break;
>          }
>          if (*p == -1) {
> +            if(st->codec->pix_fmt != PIX_FMT_NONE)
>              av_log(NULL, AV_LOG_WARNING,
>                     "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
>                     av_pix_fmt_descriptors[st->codec->pix_fmt].name,

What about a function:
av_inline const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
{
    return (unsigned)pix_fmt < PIX_FMT_NB ?
        av_pix_fmt_descriptors[st->codec->pix_fmt].name : NULL;
}

i'd find it quite useful and safer.
-- 
Do not read this fortune under penalty of law.
Violators will be prosecuted.
(Penal Code sec. 2.3.2 (II.a.))


More information about the ffmpeg-cvslog mailing list