[PATCH 4/7] Add check in raw_init_encoder(), make the rawvideo encoder fail if no codec tag is specified and there is no codec tag corresponding to the output pixel format.

Stefano Sabatini stefano.sabatini-lala
Wed May 26 23:51:34 CEST 2010


---
 libavcodec/rawenc.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index 4199704..6a8be8a 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -37,6 +37,13 @@ static av_cold int raw_init_encoder(AVCodecContext *avctx)
     avctx->bits_per_coded_sample = av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]);
     if(!avctx->codec_tag)
         avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);
+    if (!avctx->codec_tag) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Cannot find codec tag for rawvideo pixel format '%s'\n",
+               avcodec_get_pix_fmt_name(avctx->pix_fmt));
+        return AVERROR(EINVAL);
+    }
+
     return 0;
 }
 
-- 
1.7.1


--+pHx0qQiF2pBVqBT--



More information about the ffmpeg-devel mailing list