---
libavcodec/mpeg12.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 4d1889f..4cd89db 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1562,6 +1562,8 @@ static int mpeg_field_start(MpegEncContext *s, const
uint8_t *buf, int buf_size)
/* start frame decoding */
if (s->first_field || s->picture_structure == PICT_FRAME) {
+ AVFrameSideData *pan_scan;
+
if (ff_MPV_frame_start(s, avctx) < 0)
return -1;
@@ -1580,7 +1582,12 @@ static int mpeg_field_start(MpegEncContext *s, const
uint8_t *buf, int buf_size)
}
}
- *s->current_picture_ptr->f.pan_scan = s1->pan_scan;
+ pan_scan = av_frame_new_side_data(&s->current_picture_ptr->f,
+ AV_FRAME_DATA_PANSCAN,
+ sizeof(s1->pan_scan));
+ if (!pan_scan)
+ return AVERROR(ENOMEM);
+ memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan));
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME))
ff_thread_finish_setup(avctx);
@@ -1913,14 +1920,14 @@ static int slice_end(AVCodecContext *avctx, AVFrame
*pict)
if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field) {
/* end of image */
- s->current_picture_ptr->f.qscale_type = FF_QSCALE_TYPE_MPEG2;
-
ff_er_frame_end(&s->er);
ff_MPV_frame_end(s);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
- *pict = s->current_picture_ptr->f;
+ int ret = av_frame_ref(pict, &s->current_picture_ptr->f);
+ if (ret < 0)
+ return ret;
ff_print_debug_info(s, s->current_picture_ptr);
} else {
if (avctx->active_thread_type & FF_THREAD_FRAME)
@@ -1928,8 +1935,10 @@ static int slice_end(AVCodecContext *avctx, AVFrame
*pict)
/* latency of 1 frame for I- and P-frames */
/* XXX: use another variable than picture_number */
if (s->last_picture_ptr != NULL) {
- *pict = s->last_picture_ptr->f;
- ff_print_debug_info(s, s->last_picture_ptr);
+ int ret = av_frame_ref(pict, &s->last_picture_ptr->f);
+ if (ret < 0)
+ return ret;
+ ff_print_debug_info(s, s->last_picture_ptr);
}
}
@@ -2216,7 +2225,10 @@ static int decode_chunks(AVCodecContext *avctx,
if (CONFIG_MPEG_VDPAU_DECODER && avctx->codec->capabilities &
CODEC_CAP_HWACCEL_VDPAU)
ff_vdpau_mpeg_picture_complete(s2, buf, buf_size,
s->slice_count);
- if (slice_end(avctx, picture)) {
+ ret = slice_end(avctx, picture);
+ if (ret < 0)
+ return ret;
+ else if (ret) {
if (s2->last_picture_ptr || s2->low_delay) //FIXME merge
with the stuff in mpeg_decode_slice
*got_output = 1;
}
@@ -2436,7 +2448,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
/* special case for last picture */
if (s2->low_delay == 0 && s2->next_picture_ptr) {
- *picture = s2->next_picture_ptr->f;
+ int ret = av_frame_ref(picture, &s2->next_picture_ptr->f);
+ if (ret < 0)
+ return ret;
+
s2->next_picture_ptr = NULL;
*got_output = 1;
--
1.7.10.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel