aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-02-10 00:05:14 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-10 13:24:37 -0500
commitdcd2b55e1a7d1f88dc893c04cc86181fc7f11cc4 (patch)
tree6349a8e3d2d70f1f9d6cb8d538c0f8e4b8bffd64 /libavcodec/utils.c
parent9e1db721c4329f4ac166a0bcc002c8d75f831aba (diff)
downloadffmpeg-dcd2b55e1a7d1f88dc893c04cc86181fc7f11cc4.tar.gz
Check AVCodec.pix_fmts in avcodec_open2()
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index de3816b27f..e1863199c1 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])