diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-02 02:15:15 +0200 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-07 12:03:59 +0200 |
commit | 01042d4123b6e0a4c15d6828f835bd648eb03d38 (patch) | |
tree | 1effe8a600ae996aaa2f0a036b6ce7e87bbd09a8 | |
parent | 2beac7c325583160bdf2978de6e87176b9146da0 (diff) | |
download | ffmpeg-01042d4123b6e0a4c15d6828f835bd648eb03d38.tar.gz |
lavc: set defaults in internal codec frames
This is required specifically for setting frame->format to -1,
otherwise it will be set to 0 = PIX_FMT_YUV420P and code reading
the format from the output decoded frame will get misled.
In particular fix regressions occurring with the pending vsrc_buffer
patch.
67 files changed, 109 insertions, 6 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index bd348211f0..d89b494b09 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -832,6 +832,8 @@ static av_cold int decode_init(AVCodecContext *avctx){ return 1; } + avcodec_get_frame_defaults(&f->current_picture); + avcodec_get_frame_defaults(&f->last_picture); f->version= AV_RL32(avctx->extradata)>>16; common_init(avctx); init_vlcs(f); diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index d5f550ffd7..832298b98e 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -162,6 +162,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; + avcodec_get_frame_defaults(&c->pic); c->pic.data[0] = NULL; switch (avctx->bits_per_coded_sample) { diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c index 44bdcb0b63..e6f363de4c 100644 --- a/libavcodec/aasc.c +++ b/libavcodec/aasc.c @@ -50,8 +50,8 @@ static av_cold int aasc_decode_init(AVCodecContext *avctx) AascContext *s = avctx->priv_data; s->avctx = avctx; - avctx->pix_fmt = PIX_FMT_BGR24; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/anm.c b/libavcodec/anm.c index e216c08441..02244f70e1 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -44,6 +44,7 @@ static av_cold int decode_init(AVCodecContext *avctx) if (avctx->extradata_size != 16*8 + 4*256) return -1; + avcodec_get_frame_defaults(&s->frame); s->frame.reference = 1; buf = avctx->extradata + 16*8; diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index fdd1d321f7..7043b7c9d9 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -81,6 +81,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->fg = DEFAULT_FG_COLOR; s->bg = DEFAULT_BG_COLOR; + avcodec_get_frame_defaults(&s->frame); if (!avctx->width || !avctx->height) avcodec_set_dimensions(avctx, 80<<3, 25<<4); diff --git a/libavcodec/aura.c b/libavcodec/aura.c index 9041c7cb68..18024f1c08 100644 --- a/libavcodec/aura.c +++ b/libavcodec/aura.c @@ -39,6 +39,7 @@ static av_cold int aura_decode_init(AVCodecContext *avctx) if (avctx->width & 0x3) return -1; avctx->pix_fmt = PIX_FMT_YUV422P; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/avs.c b/libavcodec/avs.c index 5aebe35533..06fcd5cd0e 100644 --- a/libavcodec/avs.c +++ b/libavcodec/avs.c @@ -146,7 +146,9 @@ avs_decode_frame(AVCodecContext * avctx, static av_cold int avs_decode_init(AVCodecContext * avctx) { + AvsContext *const avs = avctx->priv_data; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&avs->picture); return 0; } diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c index 5b06e5f12e..3869b87aa2 100644 --- a/libavcodec/bethsoftvideo.c +++ b/libavcodec/bethsoftvideo.c @@ -39,6 +39,7 @@ typedef struct BethsoftvidContext { static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx) { BethsoftvidContext *vid = avctx->priv_data; + avcodec_get_frame_defaults(&vid->frame); vid->frame.reference = 1; vid->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index e0b0c68e8b..9e40b86e50 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -41,6 +41,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx) { BFIContext *bfi = avctx->priv_data; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&bfi->frame); bfi->dst = av_mallocz(avctx->width * avctx->height); return 0; } diff --git a/libavcodec/c93.c b/libavcodec/c93.c index 8eecf4788c..31296395f7 100644 --- a/libavcodec/c93.c +++ b/libavcodec/c93.c @@ -47,6 +47,10 @@ typedef enum { static av_cold int decode_init(AVCodecContext *avctx) { + C93DecoderContext * const c93 = avctx->priv_data; + + avcodec_get_frame_defaults(&c93->pictures[0]); + avcodec_get_frame_defaults(&c93->pictures[1]); avctx->pix_fmt = PIX_FMT_PAL8; return 0; } diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index bbff22b62b..57657afaa4 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -404,6 +404,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_PAL8; } + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c index ebe5c99d3b..c9b0911674 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -118,6 +118,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, static av_cold void common_init(AVCodecContext *avctx){ CLJRContext * const a = avctx->priv_data; + avcodec_get_frame_defaults(&a->picture); avctx->coded_frame= (AVFrame*)&a->picture; a->avctx= avctx; } diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index a3f6fbf022..9255503e05 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -231,6 +231,7 @@ static av_cold int decode_init(AVCodecContext *avctx) { return 1; } c->bpp = avctx->bits_per_coded_sample; + avcodec_get_frame_defaults(&c->pic); c->pic.data[0] = NULL; c->linelen = avctx->width * avctx->bits_per_coded_sample / 8; c->height = avctx->height; diff --git a/libavcodec/cyuv.c b/libavcodec/cyuv.c index 79a84412e7..1c665aefc8 100644 --- a/libavcodec/cyuv.c +++ b/libavcodec/cyuv.c @@ -53,6 +53,7 @@ static av_cold int cyuv_decode_init(AVCodecContext *avctx) return -1; s->height = avctx->height; avctx->pix_fmt = PIX_FMT_YUV411P; + avcodec_get_frame_defaults(&s->frame); return 0; } diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index fb7bb8f8fd..8cbe1a8111 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -55,6 +55,7 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx) ctx->avctx = avctx; dsputil_init(&ctx->dsp, avctx); avctx->coded_frame = &ctx->picture; + avcodec_get_frame_defaults(&ctx->picture); ctx->picture.type = AV_PICTURE_TYPE_I; ctx->picture.key_frame = 1; return 0; diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index b4e0579a7b..f12560714a 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -94,6 +94,7 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx) cin->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&cin->frame); cin->frame.data[0] = NULL; cin->bitmap_size = avctx->width * avctx->height; diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 27d0daa4f5..9b24d13967 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -1093,6 +1093,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); + avcodec_get_frame_defaults(&s->picture); s->picture.reference = 0; s->picture.key_frame = 1; s->picture.pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c index 759cc907b5..807ecd85ee 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -295,6 +295,9 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&c->pic); + avcodec_get_frame_defaults(&c->prev); + c->dsize = avctx->width * avctx->height * 2; if((c->decomp_buf = av_malloc(c->dsize)) == NULL) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index 7904a686db..408d948812 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -43,6 +43,10 @@ typedef struct CmvContext { static av_cold int cmv_decode_init(AVCodecContext *avctx){ CmvContext *s = avctx->priv_data; + avcodec_get_frame_defaults(&s->frame); + avcodec_get_frame_defaults(&s->last_frame); + avcodec_get_frame_defaults(&s->last2_frame); + s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; return 0; diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 0f6557f77e..0855f10417 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -55,6 +55,8 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx){ s->avctx = avctx; avctx->time_base = (AVRational){1, 15}; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&s->frame); + avcodec_get_frame_defaults(&s->last_frame); return 0; } diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index 5a6769d342..12e478fe19 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -61,6 +61,7 @@ static av_cold int escape124_decode_init(AVCodecContext *avctx) { Escape124Context *s = avctx->priv_data; + avcodec_get_frame_defaults(&s->frame); avctx->pix_fmt = PIX_FMT_RGB555; s->num_superblocks = ((unsigned)avctx->width / 8) * @@ -214,7 +215,8 @@ static int escape124_decode_frame(AVCodecContext *avctx, uint16_t* old_frame_data, *new_frame_data; unsigned old_stride, new_stride; - AVFrame new_frame = { { 0 } }; + AVFrame new_frame; + avcodec_get_frame_defaults(&new_frame); init_get_bits(&gb, buf, buf_size * 8); diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 18327ad462..a57e851078 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -92,6 +92,7 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx) return 1; } avctx->pix_fmt = PIX_FMT_BGR24; + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index 7d2fd87647..8cc72e241e 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -118,6 +118,7 @@ static av_cold int flic_decode_init(AVCodecContext *avctx) return -1; } + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; s->new_palette = 0; diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index fc7392ae54..7e96b0d312 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -60,6 +60,7 @@ static av_cold int decode_init(AVCodecContext *avctx) { FrapsContext * const s = avctx->priv_data; + avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = (AVFrame*)&s->frame; s->avctx = avctx; diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 87c5b3e36a..0f59421bb7 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -433,6 +433,7 @@ static av_cold int decode_init(AVCodecContext *avctx) memset(s->vlc, 0, 3*sizeof(VLC)); avctx->coded_frame= &s->picture; + avcodec_get_frame_defaults(&s->picture); s->interlaced= s->height > 288; s->bgr32=1; diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index ab0697252b..362ba3bde9 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -166,6 +166,7 @@ static av_cold int idcin_decode_init(AVCodecContext *avctx) huff_build_tree(s, i); } + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 2467781537..85a190f49c 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -339,6 +339,7 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); s->bpp = avctx->bits_per_coded_sample; + avcodec_get_frame_defaults(&s->frame); if ((err = extract_header(avctx, NULL)) < 0) return err; diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c index c4d410faf5..f58804bab3 100644 --- a/libavcodec/indeo2.c +++ b/libavcodec/indeo2.c @@ -192,6 +192,7 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx){ Ir2Context * const ic = avctx->priv_data; static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2]; + avcodec_get_frame_defaults(&ic->picture); ic->avctx = avctx; avctx->pix_fmt= PIX_FMT_YUV410P; diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 14526a239c..588a5b4cac 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -967,6 +967,7 @@ static av_cold int indeo3_decode_init(AVCodecContext *avctx) s->width = avctx->width; s->height = avctx->height; avctx->pix_fmt = PIX_FMT_YUV410P; + avcodec_get_frame_defaults(&s->frame); if (!(ret = build_modpred(s))) ret = iv_alloc_frames(s); diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c index d96b31032f..5135c46bc7 100644 --- a/libavcodec/indeo5.c +++ b/libavcodec/indeo5.c @@ -713,6 +713,8 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->pic_conf.tile_height = avctx->height; ctx->pic_conf.luma_bands = ctx->pic_conf.chroma_bands = 1; + avcodec_get_frame_defaults(&ctx->frame); + result = ff_ivi_init_planes(ctx->planes, &ctx->pic_conf); if (result) { av_log(avctx, AV_LOG_ERROR, "Couldn't allocate color planes!\n"); diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index d2b8345607..d539cfc207 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -1030,6 +1030,9 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx) /* decoding map contains 4 bits of information per 8x8 block */ s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2); + avcodec_get_frame_defaults(&s->second_last_frame); + avcodec_get_frame_defaults(&s->last_frame); + avcodec_get_frame_defaults(&s->current_frame); s->current_frame.data[0] = s->last_frame.data[0] = s->second_last_frame.data[0] = NULL; diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c index 2f6a80c2c6..c364cfc593 100644 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@ -150,6 +150,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; avctx->pix_fmt = PIX_FMT_RGB555; + avcodec_get_frame_defaults(&c->pic); return 0; } diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index 0bc7e944c6..aa2aaace6c 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -375,6 +375,7 @@ static av_cold int decode_init(AVCodecContext * avctx) c->setpal = 1; } + avcodec_get_frame_defaults(&c->pic); avctx->pix_fmt = PIX_FMT_PAL8; return 0; diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index f2e5bb0c80..57735ac6ff 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -453,6 +453,7 @@ static av_cold int decode_init(AVCodecContext *avctx) unsigned int max_basesize = FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4) + AV_LZO_OUTPUT_PADDING; unsigned int max_decomp_size; + avcodec_get_frame_defaults(&c->pic); if (avctx->extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n"); return 1; diff --git a/libavcodec/loco.c b/libavcodec/loco.c index 8f2b8ff325..f5807b8f0a 100644 --- a/libavcodec/loco.c +++ b/libavcodec/loco.c @@ -272,6 +272,8 @@ static av_cold int decode_init(AVCodecContext *avctx){ if(avctx->debug & FF_DEBUG_PICT_INFO) av_log(avctx, AV_LOG_INFO, "lossy:%i, version:%i, mode: %i\n", l->lossy, version, l->mode); + avcodec_get_frame_defaults(&l->pic); + return 0; } diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 246ec2108c..30cd3ab176 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -218,6 +218,7 @@ static av_cold void mdec_common_init(AVCodecContext *avctx){ a->mb_width = (avctx->coded_width + 15) / 16; a->mb_height = (avctx->coded_height + 15) / 16; + avcodec_get_frame_defaults(&a->picture); avctx->coded_frame= &a->picture; a->avctx= avctx; } diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 3adc16ece7..3b1a8abbee 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -84,6 +84,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) if (!s->picture_ptr) s->picture_ptr = &s->picture; + avcodec_get_frame_defaults(&s->picture); s->avctx = avctx; dsputil_init(&s->dsp, avctx); diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index 92420b1d25..707ddc5f7e 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -58,6 +58,7 @@ static av_cold int mm_decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&s->frame); s->frame.reference = 1; return 0; diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index ed0af4d90e..01558ab95b 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -61,6 +61,7 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel)); mp->hpt = av_mallocz(avctx->height * avctx->width / 16 * sizeof(YuvPixel)); avctx->pix_fmt = PIX_FMT_RGB555; + avcodec_get_frame_defaults(&mp->frame); return 0; } diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index a263318512..6d6a2a3502 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -65,6 +65,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx) return -1; } + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index f7434a3a88..c1c7d48080 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -70,6 +70,7 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_RGB555; } + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 8981dbc759..b87c8643d0 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -94,6 +94,14 @@ static const uint8_t cga_mode45_index[6][4] = { [5] = { 0, 11, 12, 15 }, // mode5, high intensity }; +static av_cold int decode_init(AVCodecContext *avctx) +{ + PicContext *s = avctx->priv_data; + + avcodec_get_frame_defaults(&s->frame); + return 0; +} + static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) @@ -242,7 +250,7 @@ AVCodec ff_pictor_decoder = { AVMEDIA_TYPE_VIDEO, CODEC_ID_PICTOR, sizeof(PicContext), - NULL, + decode_init, NULL, decode_end, decode_frame, diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 8123d8db34..cd3146388e 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -133,8 +133,9 @@ static int decode_frame(AVCodecContext *avctx, } static av_cold int decode_init(AVCodecContext *avctx){ -// QdrawContext * const a = avctx->priv_data; + QdrawContext * const a = avctx->priv_data; + avcodec_get_frame_defaults(&a->pic); avctx->pix_fmt= PIX_FMT_PAL8; return 0; diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index 55a65405f3..68232e28e3 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -295,6 +295,8 @@ static int decode_frame(AVCodecContext *avctx, static av_cold int decode_init(AVCodecContext *avctx){ QpegContext * const a = avctx->priv_data; + avcodec_get_frame_defaults(&a->pic); + avcodec_get_frame_defaults(&a->ref); a->avctx = avctx; avctx->pix_fmt= PIX_FMT_PAL8; diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 8b0c72641c..2cc2de2e23 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -417,6 +417,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx) break; } + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c index 19104144a2..8a553539ab 100644 --- a/libavcodec/rl2.c +++ b/libavcodec/rl2.c @@ -134,6 +134,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx) int i; s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&s->frame); /** parse extra data */ if(!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE){ diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index 4959239ba7..f0977f6491 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -159,6 +159,8 @@ static av_cold int roq_decode_init(AVCodecContext *avctx) s->avctx = avctx; s->width = avctx->width; s->height = avctx->height; + avcodec_get_frame_defaults(&s->frames[0]); + avcodec_get_frame_defaults(&s->frames[1]); s->last_frame = &s->frames[0]; s->current_frame = &s->frames[1]; avctx->pix_fmt = PIX_FMT_YUV444P; diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index 6a79d97e86..12558563c6 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -233,6 +233,7 @@ static av_cold int rpza_decode_init(AVCodecContext *avctx) s->avctx = avctx; avctx->pix_fmt = PIX_FMT_RGB555; + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index bef44b89b5..b8eab837ff 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -515,6 +515,7 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->pix_fmt = 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 3f1b9742b8..ce5b72a2a3 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -425,6 +425,7 @@ static av_cold int smc_decode_init(AVCodecContext *avctx) s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c index c8aa38cca9..f3a044882e 100644 --- a/libavcodec/tiertexseqv.c +++ b/libavcodec/tiertexseqv.c @@ -180,6 +180,7 @@ static av_cold int seqvideo_decode_init(AVCodecContext *avctx) seq->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&seq->frame); seq->frame.data[0] = NULL; return 0; diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c index ee5d060525..b1083fe682 100644 --- a/libavcodec/tmv.c +++ b/libavcodec/tmv.c @@ -34,6 +34,14 @@ typedef struct TMVContext { AVFrame pic; } TMVContext; +static av_cold int tmv_decode_init(AVCodecContext *avctx) +{ + TMVContext *tmv = avctx->priv_data; + + avcodec_get_frame_defaults(&tmv->pic); + return 0; +} + static int tmv_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { @@ -97,6 +105,7 @@ AVCodec ff_tmv_decoder = { .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_TMV, .priv_data_size = sizeof(TMVContext), + .init = tmv_decode_init, .close = tmv_decode_close, .decode = tmv_decode_frame, .capabilities = CODEC_CAP_DR1, diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index b1b14319c5..284dbd8e12 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -474,6 +474,7 @@ static av_cold int truemotion1_decode_init(AVCodecContext *avctx) // else // avctx->pix_fmt = PIX_FMT_RGB555; + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; /* there is a vertical predictor for each pixel in a line; each vertical diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index b254bcce41..122049c957 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -831,6 +831,7 @@ static av_cold int decode_init(AVCodecContext *avctx){ l->avctx = avctx; l->pic.data[0]=NULL; avctx->pix_fmt = PIX_FMT_BGR24; + avcodec_get_frame_defaults(&l->pic); dsputil_init(&l->dsp, avctx); diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index dc344a100a..e12b9a31fc 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -145,6 +145,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->height = avctx->height; + avcodec_get_frame_defaults(&c->pic); // Needed if zlib unused or init aborted before inflateInit memset(&(c->zstream), 0, sizeof(z_stream)); switch(avctx->bits_per_coded_sample){ diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c index 83a66ab85e..9033cee98f 100644 --- a/libavcodec/ulti.c +++ b/libavcodec/ulti.c @@ -49,6 +49,7 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx) s->height = avctx->height; s->blocks = (s->width / 8) * (s->height / 8); avctx->pix_fmt = PIX_FMT_YUV410P; + avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = (AVFrame*) &s->frame; s->ulti_codebook = ulti_codebook; diff --git a/libavcodec/vb.c b/libavcodec/vb.c index fc79f5d586..3fb59cf377 100644 --- a/libavcodec/vb.c +++ b/libavcodec/vb.c @@ -268,6 +268,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&c->pic); c->frame = av_mallocz(avctx->width * avctx->height); c->prev_frame = av_mallocz(avctx->width * avctx->height); diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c index 0bedba0f1f..0d59b7e7ec 100644 --- a/libavcodec/vcr1.c +++ b/libavcodec/vcr1.c @@ -146,6 +146,7 @@ static av_cold void common_init(AVCodecContext *avctx){ VCR1Context * const a = avctx->priv_data; avctx->coded_frame= (AVFrame*)&a->picture; + avcodec_get_frame_defaults(&a->picture); a->avctx= avctx; } diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 86e3683725..8d8bc61e42 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -358,6 +358,9 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx) palette32[i] = (r << 16) | (g << 8) | (b); } + avcodec_get_frame_defaults(&s->frame); + avcodec_get_frame_defaults(&s->prev_frame); + return 0; } diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index 68ec3fc18c..6455d86f77 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -470,6 +470,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->bpp = avctx->bits_per_coded_sample; c->bpp2 = c->bpp/8; + avcodec_get_frame_defaults(&c->pic); switch(c->bpp){ case 8: diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c index 27f56a78aa..ad451c251f 100644 --- a/libavcodec/vp56.c +++ b/libavcodec/vp56.c @@ -653,8 +653,10 @@ av_cold void ff_vp56_init(AVCodecContext *avctx, int flip, int has_alpha) ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id); ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct); - for (i=0; i<4; i++) + for (i=0; i<4; i++) { s->framep[i] = &s->frames[i]; + avcodec_get_frame_defaults(&s->frames[i]); + } s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN]; s->framep[VP56_FRAME_UNUSED2] = s->framep[VP56_FRAME_GOLDEN2]; s->edge_emu_buffer_alloc = NULL; diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 109faab4fb..272d80906e 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -187,6 +187,7 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx) (s->height / s->vector_height) * 2; s->decode_buffer = av_malloc(s->decode_buffer_size); + avcodec_get_frame_defaults(&s->frame); s->frame.data[0] = NULL; return 0; diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index 15d90c1a89..197cf7985d 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -136,6 +136,7 @@ static av_cold int decode_init(AVCodecContext *avctx){ l->avctx = avctx; avctx->pix_fmt = PIX_FMT_YUV422P; + avcodec_get_frame_defaults(&l->pic); code_vlc.table = code_table; code_vlc.table_allocated = 1 << CODE_VLC_BITS; diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 520331634c..f5d1812aec 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -91,6 +91,8 @@ static av_cold int xan_decode_init(AVCodecContext *avctx) av_freep(&s->buffer1); return AVERROR(ENOMEM); } + avcodec_get_frame_defaults(&s->last_frame); + avcodec_get_frame_defaults(&s->current_frame); return 0; } diff --git a/libavcodec/xl.c b/libavcodec/xl.c index 5f19cae3bb..7f3b0775c0 100644 --- a/libavcodec/xl.c +++ b/libavcodec/xl.c @@ -121,8 +121,9 @@ static int decode_frame(AVCodecContext *avctx, } static av_cold int decode_init(AVCodecContext *avctx){ -// VideoXLContext * const a = avctx->priv_data; + VideoXLContext * const a = avctx->priv_data; + avcodec_get_frame_defaults(&a->pic); avctx->pix_fmt= PIX_FMT_YUV411P; return 0; diff --git a/libavcodec/yop.c b/libavcodec/yop.c index a117e2d791..45a3344b9e 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -92,6 +92,7 @@ static av_cold int yop_decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_PAL8; + avcodec_get_frame_defaults(&s->frame); s->num_pal_colors = avctx->extradata[0]; s->first_color[0] = avctx->extradata[1]; s->first_color[1] = avctx->extradata[2]; diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 3edbe921a1..4bd159cc44 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -599,6 +599,7 @@ static av_cold int decode_init(AVCodecContext *avctx) c->width = avctx->width; c->height = avctx->height; + avcodec_get_frame_defaults(&c->pic); c->bpp = avctx->bits_per_coded_sample; |