From 3b199d29cd597a3518136d78860e172060b9e83d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 13 Feb 2013 08:50:04 +0100 Subject: [PATCH] lavc decoders: properly initialize AVFrame. --- libavcodec/avs.c | 2 ++ libavcodec/bethsoftvideo.c | 1 + libavcodec/c93.c | 3 +++ libavcodec/cinepak.c | 2 +- libavcodec/dsicinav.c | 2 +- libavcodec/dv.c | 1 + libavcodec/flashsv.c | 2 +- libavcodec/flicvideo.c | 2 +- libavcodec/fraps.c | 2 ++ libavcodec/iff.c | 2 ++ libavcodec/indeo2.c | 2 ++ libavcodec/mmvideo.c | 2 ++ libavcodec/motionpixels.c | 1 + libavcodec/msrle.c | 2 +- libavcodec/msvideo1.c | 2 +- libavcodec/qpeg.c | 2 ++ libavcodec/qtrle.c | 2 +- libavcodec/rpza.c | 2 +- libavcodec/smacker.c | 2 +- libavcodec/smc.c | 2 +- libavcodec/tiertexseqv.c | 2 +- libavcodec/truemotion1.c | 2 +- libavcodec/truemotion2.c | 2 +- libavcodec/ulti.c | 1 + libavcodec/vmnc.c | 2 ++ 25 files changed, 34 insertions(+), 13 deletions(-) diff --git a/libavcodec/avs.c b/libavcodec/avs.c index 45cb4484d6..da27e0013f 100644 --- a/libavcodec/avs.c +++ b/libavcodec/avs.c @@ -158,8 +158,10 @@ avs_decode_frame(AVCodecContext * avctx, static av_cold int avs_decode_init(AVCodecContext * avctx) { + AvsContext *s = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; avcodec_set_dimensions(avctx, 318, 198); + avcodec_get_frame_defaults(&s->picture); return 0; } diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c index 73145701ff..b113bc44e7 100644 --- a/libavcodec/bethsoftvideo.c +++ b/libavcodec/bethsoftvideo.c @@ -42,6 +42,7 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx) { BethsoftvidContext *vid = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; + avcodec_get_frame_defaults(&vid->frame); return 0; } diff --git a/libavcodec/c93.c b/libavcodec/c93.c index 750941e021..b534669ca2 100644 --- a/libavcodec/c93.c +++ b/libavcodec/c93.c @@ -48,7 +48,10 @@ typedef enum { static av_cold int decode_init(AVCodecContext *avctx) { + C93DecoderContext *s = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; + avcodec_get_frame_defaults(&s->pictures[0]); + avcodec_get_frame_defaults(&s->pictures[1]); return 0; } diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index 0c5d5b0f0d..e0c527cd05 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -414,7 +414,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_PAL8; } - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index 39479546cc..959a82fc7b 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -96,7 +96,7 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx) cin->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; - cin->frame.data[0] = NULL; + avcodec_get_frame_defaults(&cin->frame); cin->bitmap_size = avctx->width * avctx->height; for (i = 0; i < 3; ++i) { diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 91588192ae..5253b7f88e 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -313,6 +313,7 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx) s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); + avcodec_get_frame_defaults(&s->picture); avctx->coded_frame = &s->picture; s->avctx = avctx; avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 3f211926e3..26b42e5442 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -115,7 +115,7 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx) return 1; } avctx->pix_fmt = AV_PIX_FMT_BGR24; - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index 2588619e15..3d43e5e827 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -123,7 +123,7 @@ static av_cold int flic_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); s->new_palette = 0; return 0; diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 2a5a5a8b38..66ecdef419 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -66,6 +66,8 @@ static av_cold int decode_init(AVCodecContext *avctx) s->avctx = avctx; s->tmpbuf = NULL; + avcodec_get_frame_defaults(&s->frame); + ff_dsputil_init(&s->dsp, avctx); return 0; diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 08d548b0ea..184dcab73e 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -168,6 +168,8 @@ static av_cold int decode_init(AVCodecContext *avctx) if (!s->planebuf) return AVERROR(ENOMEM); + avcodec_get_frame_defaults(&s->frame); + return 0; } diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c index 37b3ea19cd..a33bbb1fc9 100644 --- a/libavcodec/indeo2.c +++ b/libavcodec/indeo2.c @@ -219,6 +219,8 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx) avctx->pix_fmt= AV_PIX_FMT_YUV410P; + avcodec_get_frame_defaults(&ic->picture); + ir2_vlc.table = vlc_tables; ir2_vlc.table_allocated = 1 << CODE_VLC_BITS; #ifdef BITSTREAM_READER_LE diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index 7101f8033f..48d5772114 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -61,6 +61,8 @@ static av_cold int mm_decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_PAL8; + avcodec_get_frame_defaults(&s->frame); + return 0; } diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index c205735c90..6ef9b0b351 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -64,6 +64,7 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel)); mp->hpt = av_mallocz(h4 * w4 / 16 * sizeof(YuvPixel)); avctx->pix_fmt = AV_PIX_FMT_RGB555; + avcodec_get_frame_defaults(&mp->frame); return 0; } diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 24fa523363..fe6819cc18 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -66,7 +66,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index d0aee12d49..fd968bce2c 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -72,7 +72,7 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_RGB555; } - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index afcb2dfc97..bb963ed1a3 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -295,6 +295,8 @@ static av_cold int decode_init(AVCodecContext *avctx){ avctx->pix_fmt= AV_PIX_FMT_PAL8; a->refdata = av_malloc(avctx->width * avctx->height); + avcodec_get_frame_defaults(&a->pic); + return 0; } diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 7a1213f601..b4667f43bb 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -385,7 +385,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index dd2b547afc..45350a85d8 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -239,7 +239,7 @@ static av_cold int rpza_decode_init(AVCodecContext *avctx) s->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_RGB555; - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index c37fb14a4d..a27997f361 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -518,7 +518,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; - + avcodec_get_frame_defaults(&c->pic); /* decode huffman trees from extradata */ if(avctx->extradata_size < 16){ diff --git a/libavcodec/smc.c b/libavcodec/smc.c index de81a43e91..d16242bf50 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -417,7 +417,7 @@ static av_cold int smc_decode_init(AVCodecContext *avctx) s->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c index 5d5d69434b..50f8921dde 100644 --- a/libavcodec/tiertexseqv.c +++ b/libavcodec/tiertexseqv.c @@ -217,7 +217,7 @@ static av_cold int seqvideo_decode_init(AVCodecContext *avctx) seq->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; - seq->frame.data[0] = NULL; + avcodec_get_frame_defaults(&seq->frame); return 0; } diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 01d4694e14..f8a8dad3e9 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -468,7 +468,7 @@ static av_cold int truemotion1_decode_init(AVCodecContext *avctx) // else // avctx->pix_fmt = AV_PIX_FMT_RGB555; - s->frame.data[0] = NULL; + avcodec_get_frame_defaults(&s->frame); /* there is a vertical predictor for each pixel in a line; each vertical * predictor is 0 to start with */ diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index 2ecfb93161..342cb05e15 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -900,7 +900,7 @@ static av_cold int decode_init(AVCodecContext *avctx) } l->avctx = avctx; - l->pic.data[0] = NULL; + avcodec_get_frame_defaults(&l->pic); avctx->pix_fmt = AV_PIX_FMT_BGR24; ff_dsputil_init(&l->dsp, avctx); diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c index e99c26725b..3825980cfb 100644 --- a/libavcodec/ulti.c +++ b/libavcodec/ulti.c @@ -53,6 +53,7 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_YUV410P; avctx->coded_frame = &s->frame; s->ulti_codebook = ulti_codebook; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index 41e4730b44..d060d5b81f 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -488,6 +488,8 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } + avcodec_get_frame_defaults(&c->pic); + return 0; }