1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.
This commit is contained in:
Stefano Sabatini 2011-05-02 02:15:15 +02:00
parent 2beac7c325
commit 01042d4123
67 changed files with 109 additions and 6 deletions

View File

@ -832,6 +832,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
return 1; return 1;
} }
avcodec_get_frame_defaults(&f->current_picture);
avcodec_get_frame_defaults(&f->last_picture);
f->version= AV_RL32(avctx->extradata)>>16; f->version= AV_RL32(avctx->extradata)>>16;
common_init(avctx); common_init(avctx);
init_vlcs(f); init_vlcs(f);

View File

@ -162,6 +162,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx; c->avctx = avctx;
avcodec_get_frame_defaults(&c->pic);
c->pic.data[0] = NULL; c->pic.data[0] = NULL;
switch (avctx->bits_per_coded_sample) { switch (avctx->bits_per_coded_sample) {

View File

@ -50,8 +50,8 @@ static av_cold int aasc_decode_init(AVCodecContext *avctx)
AascContext *s = avctx->priv_data; AascContext *s = avctx->priv_data;
s->avctx = avctx; s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_BGR24; avctx->pix_fmt = PIX_FMT_BGR24;
avcodec_get_frame_defaults(&s->frame);
return 0; return 0;
} }

View File

@ -44,6 +44,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (avctx->extradata_size != 16*8 + 4*256) if (avctx->extradata_size != 16*8 + 4*256)
return -1; return -1;
avcodec_get_frame_defaults(&s->frame);
s->frame.reference = 1; s->frame.reference = 1;
buf = avctx->extradata + 16*8; buf = avctx->extradata + 16*8;

View File

@ -81,6 +81,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->fg = DEFAULT_FG_COLOR; s->fg = DEFAULT_FG_COLOR;
s->bg = DEFAULT_BG_COLOR; s->bg = DEFAULT_BG_COLOR;
avcodec_get_frame_defaults(&s->frame);
if (!avctx->width || !avctx->height) if (!avctx->width || !avctx->height)
avcodec_set_dimensions(avctx, 80<<3, 25<<4); avcodec_set_dimensions(avctx, 80<<3, 25<<4);

View File

@ -39,6 +39,7 @@ static av_cold int aura_decode_init(AVCodecContext *avctx)
if (avctx->width & 0x3) if (avctx->width & 0x3)
return -1; return -1;
avctx->pix_fmt = PIX_FMT_YUV422P; avctx->pix_fmt = PIX_FMT_YUV422P;
avcodec_get_frame_defaults(&s->frame);
return 0; return 0;
} }

View File

@ -146,7 +146,9 @@ avs_decode_frame(AVCodecContext * avctx,
static av_cold int avs_decode_init(AVCodecContext * avctx) static av_cold int avs_decode_init(AVCodecContext * avctx)
{ {
AvsContext *const avs = avctx->priv_data;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&avs->picture);
return 0; return 0;
} }

View File

@ -39,6 +39,7 @@ typedef struct BethsoftvidContext {
static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx) static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
{ {
BethsoftvidContext *vid = avctx->priv_data; BethsoftvidContext *vid = avctx->priv_data;
avcodec_get_frame_defaults(&vid->frame);
vid->frame.reference = 1; vid->frame.reference = 1;
vid->frame.buffer_hints = FF_BUFFER_HINTS_VALID | vid->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;

View File

@ -41,6 +41,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx)
{ {
BFIContext *bfi = avctx->priv_data; BFIContext *bfi = avctx->priv_data;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&bfi->frame);
bfi->dst = av_mallocz(avctx->width * avctx->height); bfi->dst = av_mallocz(avctx->width * avctx->height);
return 0; return 0;
} }

View File

@ -47,6 +47,10 @@ typedef enum {
static av_cold int decode_init(AVCodecContext *avctx) 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; avctx->pix_fmt = PIX_FMT_PAL8;
return 0; return 0;
} }

View File

@ -404,6 +404,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
} }
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -118,6 +118,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
static av_cold void common_init(AVCodecContext *avctx){ static av_cold void common_init(AVCodecContext *avctx){
CLJRContext * const a = avctx->priv_data; CLJRContext * const a = avctx->priv_data;
avcodec_get_frame_defaults(&a->picture);
avctx->coded_frame= (AVFrame*)&a->picture; avctx->coded_frame= (AVFrame*)&a->picture;
a->avctx= avctx; a->avctx= avctx;
} }

View File

@ -231,6 +231,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
return 1; return 1;
} }
c->bpp = avctx->bits_per_coded_sample; c->bpp = avctx->bits_per_coded_sample;
avcodec_get_frame_defaults(&c->pic);
c->pic.data[0] = NULL; c->pic.data[0] = NULL;
c->linelen = avctx->width * avctx->bits_per_coded_sample / 8; c->linelen = avctx->width * avctx->bits_per_coded_sample / 8;
c->height = avctx->height; c->height = avctx->height;

View File

@ -53,6 +53,7 @@ static av_cold int cyuv_decode_init(AVCodecContext *avctx)
return -1; return -1;
s->height = avctx->height; s->height = avctx->height;
avctx->pix_fmt = PIX_FMT_YUV411P; avctx->pix_fmt = PIX_FMT_YUV411P;
avcodec_get_frame_defaults(&s->frame);
return 0; return 0;
} }

View File

@ -55,6 +55,7 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
ctx->avctx = avctx; ctx->avctx = avctx;
dsputil_init(&ctx->dsp, avctx); dsputil_init(&ctx->dsp, avctx);
avctx->coded_frame = &ctx->picture; avctx->coded_frame = &ctx->picture;
avcodec_get_frame_defaults(&ctx->picture);
ctx->picture.type = AV_PICTURE_TYPE_I; ctx->picture.type = AV_PICTURE_TYPE_I;
ctx->picture.key_frame = 1; ctx->picture.key_frame = 1;
return 0; return 0;

View File

@ -94,6 +94,7 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
cin->avctx = avctx; cin->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&cin->frame);
cin->frame.data[0] = NULL; cin->frame.data[0] = NULL;
cin->bitmap_size = avctx->width * avctx->height; cin->bitmap_size = avctx->width * avctx->height;

View File

@ -1093,6 +1093,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
if (s->picture.data[0]) if (s->picture.data[0])
avctx->release_buffer(avctx, &s->picture); avctx->release_buffer(avctx, &s->picture);
avcodec_get_frame_defaults(&s->picture);
s->picture.reference = 0; s->picture.reference = 0;
s->picture.key_frame = 1; s->picture.key_frame = 1;
s->picture.pict_type = AV_PICTURE_TYPE_I; s->picture.pict_type = AV_PICTURE_TYPE_I;

View File

@ -295,6 +295,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx; c->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8; 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; c->dsize = avctx->width * avctx->height * 2;
if((c->decomp_buf = av_malloc(c->dsize)) == NULL) { if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");

View File

@ -43,6 +43,10 @@ typedef struct CmvContext {
static av_cold int cmv_decode_init(AVCodecContext *avctx){ static av_cold int cmv_decode_init(AVCodecContext *avctx){
CmvContext *s = avctx->priv_data; 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; s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
return 0; return 0;

View File

@ -55,6 +55,8 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx){
s->avctx = avctx; s->avctx = avctx;
avctx->time_base = (AVRational){1, 15}; avctx->time_base = (AVRational){1, 15};
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&s->frame);
avcodec_get_frame_defaults(&s->last_frame);
return 0; return 0;
} }

View File

@ -61,6 +61,7 @@ static av_cold int escape124_decode_init(AVCodecContext *avctx)
{ {
Escape124Context *s = avctx->priv_data; Escape124Context *s = avctx->priv_data;
avcodec_get_frame_defaults(&s->frame);
avctx->pix_fmt = PIX_FMT_RGB555; avctx->pix_fmt = PIX_FMT_RGB555;
s->num_superblocks = ((unsigned)avctx->width / 8) * 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; uint16_t* old_frame_data, *new_frame_data;
unsigned old_stride, new_stride; 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); init_get_bits(&gb, buf, buf_size * 8);

View File

@ -92,6 +92,7 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx)
return 1; return 1;
} }
avctx->pix_fmt = PIX_FMT_BGR24; avctx->pix_fmt = PIX_FMT_BGR24;
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -118,6 +118,7 @@ static av_cold int flic_decode_init(AVCodecContext *avctx)
return -1; return -1;
} }
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
s->new_palette = 0; s->new_palette = 0;

View File

@ -60,6 +60,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
{ {
FrapsContext * const s = avctx->priv_data; FrapsContext * const s = avctx->priv_data;
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = (AVFrame*)&s->frame; avctx->coded_frame = (AVFrame*)&s->frame;
s->avctx = avctx; s->avctx = avctx;

View File

@ -433,6 +433,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
memset(s->vlc, 0, 3*sizeof(VLC)); memset(s->vlc, 0, 3*sizeof(VLC));
avctx->coded_frame= &s->picture; avctx->coded_frame= &s->picture;
avcodec_get_frame_defaults(&s->picture);
s->interlaced= s->height > 288; s->interlaced= s->height > 288;
s->bgr32=1; s->bgr32=1;

View File

@ -166,6 +166,7 @@ static av_cold int idcin_decode_init(AVCodecContext *avctx)
huff_build_tree(s, i); huff_build_tree(s, i);
} }
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -339,6 +339,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
s->bpp = avctx->bits_per_coded_sample; s->bpp = avctx->bits_per_coded_sample;
avcodec_get_frame_defaults(&s->frame);
if ((err = extract_header(avctx, NULL)) < 0) if ((err = extract_header(avctx, NULL)) < 0)
return err; return err;

View File

@ -192,6 +192,7 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx){
Ir2Context * const ic = avctx->priv_data; Ir2Context * const ic = avctx->priv_data;
static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2]; static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2];
avcodec_get_frame_defaults(&ic->picture);
ic->avctx = avctx; ic->avctx = avctx;
avctx->pix_fmt= PIX_FMT_YUV410P; avctx->pix_fmt= PIX_FMT_YUV410P;

View File

@ -967,6 +967,7 @@ static av_cold int indeo3_decode_init(AVCodecContext *avctx)
s->width = avctx->width; s->width = avctx->width;
s->height = avctx->height; s->height = avctx->height;
avctx->pix_fmt = PIX_FMT_YUV410P; avctx->pix_fmt = PIX_FMT_YUV410P;
avcodec_get_frame_defaults(&s->frame);
if (!(ret = build_modpred(s))) if (!(ret = build_modpred(s)))
ret = iv_alloc_frames(s); ret = iv_alloc_frames(s);

View File

@ -713,6 +713,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->pic_conf.tile_height = avctx->height; ctx->pic_conf.tile_height = avctx->height;
ctx->pic_conf.luma_bands = ctx->pic_conf.chroma_bands = 1; 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); result = ff_ivi_init_planes(ctx->planes, &ctx->pic_conf);
if (result) { if (result) {
av_log(avctx, AV_LOG_ERROR, "Couldn't allocate color planes!\n"); av_log(avctx, AV_LOG_ERROR, "Couldn't allocate color planes!\n");

View File

@ -1030,6 +1030,9 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
/* decoding map contains 4 bits of information per 8x8 block */ /* decoding map contains 4 bits of information per 8x8 block */
s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2); 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->current_frame.data[0] = s->last_frame.data[0] =
s->second_last_frame.data[0] = NULL; s->second_last_frame.data[0] = NULL;

View File

@ -150,6 +150,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx; c->avctx = avctx;
avctx->pix_fmt = PIX_FMT_RGB555; avctx->pix_fmt = PIX_FMT_RGB555;
avcodec_get_frame_defaults(&c->pic);
return 0; return 0;
} }

View File

@ -375,6 +375,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
c->setpal = 1; c->setpal = 1;
} }
avcodec_get_frame_defaults(&c->pic);
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
return 0; return 0;

View File

@ -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_basesize = FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4) + AV_LZO_OUTPUT_PADDING;
unsigned int max_decomp_size; unsigned int max_decomp_size;
avcodec_get_frame_defaults(&c->pic);
if (avctx->extradata_size < 8) { if (avctx->extradata_size < 8) {
av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n"); av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n");
return 1; return 1;

View File

@ -272,6 +272,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
if(avctx->debug & FF_DEBUG_PICT_INFO) 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); 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; return 0;
} }

View File

@ -218,6 +218,7 @@ static av_cold void mdec_common_init(AVCodecContext *avctx){
a->mb_width = (avctx->coded_width + 15) / 16; a->mb_width = (avctx->coded_width + 15) / 16;
a->mb_height = (avctx->coded_height + 15) / 16; a->mb_height = (avctx->coded_height + 15) / 16;
avcodec_get_frame_defaults(&a->picture);
avctx->coded_frame= &a->picture; avctx->coded_frame= &a->picture;
a->avctx= avctx; a->avctx= avctx;
} }

View File

@ -84,6 +84,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
if (!s->picture_ptr) if (!s->picture_ptr)
s->picture_ptr = &s->picture; s->picture_ptr = &s->picture;
avcodec_get_frame_defaults(&s->picture);
s->avctx = avctx; s->avctx = avctx;
dsputil_init(&s->dsp, avctx); dsputil_init(&s->dsp, avctx);

View File

@ -58,6 +58,7 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&s->frame);
s->frame.reference = 1; s->frame.reference = 1;
return 0; return 0;

View File

@ -61,6 +61,7 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel)); mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
mp->hpt = av_mallocz(avctx->height * avctx->width / 16 * sizeof(YuvPixel)); mp->hpt = av_mallocz(avctx->height * avctx->width / 16 * sizeof(YuvPixel));
avctx->pix_fmt = PIX_FMT_RGB555; avctx->pix_fmt = PIX_FMT_RGB555;
avcodec_get_frame_defaults(&mp->frame);
return 0; return 0;
} }

View File

@ -65,6 +65,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
return -1; return -1;
} }
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -70,6 +70,7 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_RGB555; avctx->pix_fmt = PIX_FMT_RGB555;
} }
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -94,6 +94,14 @@ static const uint8_t cga_mode45_index[6][4] = {
[5] = { 0, 11, 12, 15 }, // mode5, high intensity [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, static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size, void *data, int *data_size,
AVPacket *avpkt) AVPacket *avpkt)
@ -242,7 +250,7 @@ AVCodec ff_pictor_decoder = {
AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_VIDEO,
CODEC_ID_PICTOR, CODEC_ID_PICTOR,
sizeof(PicContext), sizeof(PicContext),
NULL, decode_init,
NULL, NULL,
decode_end, decode_end,
decode_frame, decode_frame,

View File

@ -133,8 +133,9 @@ static int decode_frame(AVCodecContext *avctx,
} }
static av_cold int decode_init(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; avctx->pix_fmt= PIX_FMT_PAL8;
return 0; return 0;

View File

@ -295,6 +295,8 @@ static int decode_frame(AVCodecContext *avctx,
static av_cold int decode_init(AVCodecContext *avctx){ static av_cold int decode_init(AVCodecContext *avctx){
QpegContext * const a = avctx->priv_data; QpegContext * const a = avctx->priv_data;
avcodec_get_frame_defaults(&a->pic);
avcodec_get_frame_defaults(&a->ref);
a->avctx = avctx; a->avctx = avctx;
avctx->pix_fmt= PIX_FMT_PAL8; avctx->pix_fmt= PIX_FMT_PAL8;

View File

@ -417,6 +417,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
break; break;
} }
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -134,6 +134,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
int i; int i;
s->avctx = avctx; s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&s->frame);
/** parse extra data */ /** parse extra data */
if(!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE){ if(!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE){

View File

@ -159,6 +159,8 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
s->width = avctx->width; s->width = avctx->width;
s->height = avctx->height; 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->last_frame = &s->frames[0];
s->current_frame = &s->frames[1]; s->current_frame = &s->frames[1];
avctx->pix_fmt = PIX_FMT_YUV444P; avctx->pix_fmt = PIX_FMT_YUV444P;

View File

@ -233,6 +233,7 @@ static av_cold int rpza_decode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_RGB555; avctx->pix_fmt = PIX_FMT_RGB555;
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -515,6 +515,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&c->pic);
/* decode huffman trees from extradata */ /* decode huffman trees from extradata */
if(avctx->extradata_size < 16){ if(avctx->extradata_size < 16){

View File

@ -425,6 +425,7 @@ static av_cold int smc_decode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -180,6 +180,7 @@ static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
seq->avctx = avctx; seq->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&seq->frame);
seq->frame.data[0] = NULL; seq->frame.data[0] = NULL;
return 0; return 0;

View File

@ -34,6 +34,14 @@ typedef struct TMVContext {
AVFrame pic; AVFrame pic;
} TMVContext; } 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, static int tmv_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *data_size, AVPacket *avpkt)
{ {
@ -97,6 +105,7 @@ AVCodec ff_tmv_decoder = {
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_TMV, .id = CODEC_ID_TMV,
.priv_data_size = sizeof(TMVContext), .priv_data_size = sizeof(TMVContext),
.init = tmv_decode_init,
.close = tmv_decode_close, .close = tmv_decode_close,
.decode = tmv_decode_frame, .decode = tmv_decode_frame,
.capabilities = CODEC_CAP_DR1, .capabilities = CODEC_CAP_DR1,

View File

@ -474,6 +474,7 @@ static av_cold int truemotion1_decode_init(AVCodecContext *avctx)
// else // else
// avctx->pix_fmt = PIX_FMT_RGB555; // avctx->pix_fmt = PIX_FMT_RGB555;
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
/* there is a vertical predictor for each pixel in a line; each vertical /* there is a vertical predictor for each pixel in a line; each vertical

View File

@ -831,6 +831,7 @@ static av_cold int decode_init(AVCodecContext *avctx){
l->avctx = avctx; l->avctx = avctx;
l->pic.data[0]=NULL; l->pic.data[0]=NULL;
avctx->pix_fmt = PIX_FMT_BGR24; avctx->pix_fmt = PIX_FMT_BGR24;
avcodec_get_frame_defaults(&l->pic);
dsputil_init(&l->dsp, avctx); dsputil_init(&l->dsp, avctx);

View File

@ -145,6 +145,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->height = avctx->height; c->height = avctx->height;
avcodec_get_frame_defaults(&c->pic);
// Needed if zlib unused or init aborted before inflateInit // Needed if zlib unused or init aborted before inflateInit
memset(&(c->zstream), 0, sizeof(z_stream)); memset(&(c->zstream), 0, sizeof(z_stream));
switch(avctx->bits_per_coded_sample){ switch(avctx->bits_per_coded_sample){

View File

@ -49,6 +49,7 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx)
s->height = avctx->height; s->height = avctx->height;
s->blocks = (s->width / 8) * (s->height / 8); s->blocks = (s->width / 8) * (s->height / 8);
avctx->pix_fmt = PIX_FMT_YUV410P; avctx->pix_fmt = PIX_FMT_YUV410P;
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = (AVFrame*) &s->frame; avctx->coded_frame = (AVFrame*) &s->frame;
s->ulti_codebook = ulti_codebook; s->ulti_codebook = ulti_codebook;

View File

@ -268,6 +268,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx; c->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&c->pic);
c->frame = av_mallocz(avctx->width * avctx->height); c->frame = av_mallocz(avctx->width * avctx->height);
c->prev_frame = av_mallocz(avctx->width * avctx->height); c->prev_frame = av_mallocz(avctx->width * avctx->height);

View File

@ -146,6 +146,7 @@ static av_cold void common_init(AVCodecContext *avctx){
VCR1Context * const a = avctx->priv_data; VCR1Context * const a = avctx->priv_data;
avctx->coded_frame= (AVFrame*)&a->picture; avctx->coded_frame= (AVFrame*)&a->picture;
avcodec_get_frame_defaults(&a->picture);
a->avctx= avctx; a->avctx= avctx;
} }

View File

@ -358,6 +358,9 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
palette32[i] = (r << 16) | (g << 8) | (b); palette32[i] = (r << 16) | (g << 8) | (b);
} }
avcodec_get_frame_defaults(&s->frame);
avcodec_get_frame_defaults(&s->prev_frame);
return 0; return 0;
} }

View File

@ -470,6 +470,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->bpp = avctx->bits_per_coded_sample; c->bpp = avctx->bits_per_coded_sample;
c->bpp2 = c->bpp/8; c->bpp2 = c->bpp/8;
avcodec_get_frame_defaults(&c->pic);
switch(c->bpp){ switch(c->bpp){
case 8: case 8:

View File

@ -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_vp56dsp_init(&s->vp56dsp, avctx->codec->id);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct); 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]; 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_UNUSED] = s->framep[VP56_FRAME_GOLDEN];
s->framep[VP56_FRAME_UNUSED2] = s->framep[VP56_FRAME_GOLDEN2]; s->framep[VP56_FRAME_UNUSED2] = s->framep[VP56_FRAME_GOLDEN2];
s->edge_emu_buffer_alloc = NULL; s->edge_emu_buffer_alloc = NULL;

View File

@ -187,6 +187,7 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
(s->height / s->vector_height) * 2; (s->height / s->vector_height) * 2;
s->decode_buffer = av_malloc(s->decode_buffer_size); s->decode_buffer = av_malloc(s->decode_buffer_size);
avcodec_get_frame_defaults(&s->frame);
s->frame.data[0] = NULL; s->frame.data[0] = NULL;
return 0; return 0;

View File

@ -136,6 +136,7 @@ static av_cold int decode_init(AVCodecContext *avctx){
l->avctx = avctx; l->avctx = avctx;
avctx->pix_fmt = PIX_FMT_YUV422P; avctx->pix_fmt = PIX_FMT_YUV422P;
avcodec_get_frame_defaults(&l->pic);
code_vlc.table = code_table; code_vlc.table = code_table;
code_vlc.table_allocated = 1 << CODE_VLC_BITS; code_vlc.table_allocated = 1 << CODE_VLC_BITS;

View File

@ -91,6 +91,8 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
av_freep(&s->buffer1); av_freep(&s->buffer1);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
avcodec_get_frame_defaults(&s->last_frame);
avcodec_get_frame_defaults(&s->current_frame);
return 0; return 0;
} }

View File

@ -121,8 +121,9 @@ static int decode_frame(AVCodecContext *avctx,
} }
static av_cold int decode_init(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; avctx->pix_fmt= PIX_FMT_YUV411P;
return 0; return 0;

View File

@ -92,6 +92,7 @@ static av_cold int yop_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&s->frame);
s->num_pal_colors = avctx->extradata[0]; s->num_pal_colors = avctx->extradata[0];
s->first_color[0] = avctx->extradata[1]; s->first_color[0] = avctx->extradata[1];
s->first_color[1] = avctx->extradata[2]; s->first_color[1] = avctx->extradata[2];

View File

@ -599,6 +599,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->width = avctx->width; c->width = avctx->width;
c->height = avctx->height; c->height = avctx->height;
avcodec_get_frame_defaults(&c->pic);
c->bpp = avctx->bits_per_coded_sample; c->bpp = avctx->bits_per_coded_sample;