On 02/09/2012 07:05 PM, Paul B Mahol wrote:

> Signed-off-by: Paul B Mahol <one...@gmail.com>
> ---
>  libavcodec/utils.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index c890cf9..cf7e0ce 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -758,6 +758,16 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, AVCodec *codec, AVD
>                  goto free_and_end;
>              }
>          }
> +        if (avctx->codec->pix_fmts) {
> +            for (i = 0; avctx->codec->pix_fmts[i] != PIX_FMT_NONE; i++)
> +                if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
> +                    break;
> +            if (avctx->codec->pix_fmts[i] == PIX_FMT_NONE) {
> +                av_log(avctx, AV_LOG_ERROR, "Specified pix_fmt is not 
> supported\n");
> +                ret = AVERROR(EINVAL);
> +                goto free_and_end;
> +            }
> +        }
>          if (avctx->codec->supported_samplerates) {
>              for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)
>                  if (avctx->sample_rate == 
> avctx->codec->supported_samplerates[i])


LGTM.

-Justin

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to