From 2852740e23f91d6775714d7cc29b9a73e1111ce0 Mon Sep 17 00:00:00 2001 From: RĂ©mi Denis-Courmont Date: Thu, 25 Jul 2013 22:30:20 +0300 Subject: vdpau: store picture data in picture's rather than codec's context Signed-off-by: Anton Khirnov --- libavcodec/vdpau_mpeg12.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'libavcodec/vdpau_mpeg12.c') diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index 20031eaae1..426d58075b 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -31,8 +31,9 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { MpegEncContext * const s = avctx->priv_data; - AVVDPAUContext *hwctx = avctx->hwaccel_context; - VdpPictureInfoMPEG1Or2 *info = &hwctx->info.mpeg; + Picture *pic = s->current_picture_ptr; + struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; + VdpPictureInfoMPEG1Or2 *info = &pic_ctx->info.mpeg; VdpVideoSurface ref; int i; @@ -44,11 +45,11 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, case AV_PICTURE_TYPE_B: ref = ff_vdpau_get_surface_id(&s->next_picture); assert(ref != VDP_INVALID_HANDLE); - hwctx->info.mpeg.backward_reference = ref; + info->backward_reference = ref; /* fall through to forward prediction */ case AV_PICTURE_TYPE_P: ref = ff_vdpau_get_surface_id(&s->last_picture); - hwctx->info.mpeg.forward_reference = ref; + info->forward_reference = ref; } info->slice_count = 0; @@ -74,20 +75,22 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx, info->non_intra_quantizer_matrix[i] = s->inter_matrix[i]; } - return ff_vdpau_common_start_frame(avctx, buffer, size); + return ff_vdpau_common_start_frame(pic, buffer, size); } static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { - AVVDPAUContext *hwctx = avctx->hwaccel_context; + MpegEncContext * const s = avctx->priv_data; + Picture *pic = s->current_picture_ptr; + struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; - val = ff_vdpau_add_buffer(avctx, buffer, size); + val = ff_vdpau_add_buffer(pic, buffer, size); if (val < 0) return val; - hwctx->info.mpeg.slice_count++; + pic_ctx->info.mpeg.slice_count++; return 0; } @@ -100,6 +103,7 @@ AVHWAccel ff_mpeg1_vdpau_hwaccel = { .start_frame = vdpau_mpeg_start_frame, .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg_decode_slice, + .priv_data_size = sizeof(struct vdpau_picture_context), }; #endif @@ -112,5 +116,6 @@ AVHWAccel ff_mpeg2_vdpau_hwaccel = { .start_frame = vdpau_mpeg_start_frame, .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg_decode_slice, + .priv_data_size = sizeof(struct vdpau_picture_context), }; #endif -- cgit v1.2.3