[FFmpeg-devel] [PATCH] lavc: set frame defaults in internals codec frames
Stefano Sabatini
stefano.sabatini-lala at poste.it
Mon May 2 02:18:11 CEST 2011
This is required, specifically for setting frame->format to -1,
otherwise it will be set to 0 = PIX_FMT_YUV420P and code reading
format from the output decoded frame will get misled.
In particular fix regressions occurring with the pending vsrc_buffer
patch.
---
libavcodec/dnxhddec.c | 1 +
libavcodec/dv.c | 1 +
libavcodec/flashsv.c | 1 +
libavcodec/huffyuv.c | 1 +
libavcodec/mjpegdec.c | 1 +
libavcodec/qtrle.c | 2 ++
libavcodec/roqvideodec.c | 2 ++
7 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 9b37d1d..545edfa 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 = FF_I_TYPE;
ctx->picture.key_frame = 1;
return 0;
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 5fca22f..3621aec 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -1096,6 +1096,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
s->picture.reference = 0;
s->picture.key_frame = 1;
s->picture.pict_type = FF_I_TYPE;
+ s->picture.format = PIX_FMT_NONE;
avctx->pix_fmt = s->sys->pix_fmt;
avctx->time_base = s->sys->time_base;
avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index 12aabe6..b2a3178 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/huffyuv.c b/libavcodec/huffyuv.c
index 6895968..19dbabb 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/mjpegdec.c b/libavcodec/mjpegdec.c
index 2fe2070..4ca529f 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/qtrle.c b/libavcodec/qtrle.c
index 8b0c726..946a7ba 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -384,6 +384,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
QtrleContext *s = avctx->priv_data;
s->avctx = avctx;
+
switch (avctx->bits_per_coded_sample) {
case 1:
case 33:
@@ -417,6 +418,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/roqvideodec.c b/libavcodec/roqvideodec.c
index 4959239..f0977f6 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;
--
1.7.2.3
More information about the ffmpeg-devel
mailing list