summaryrefslogtreecommitdiff
path: root/libavcodec/vdpau.c
diff options
context:
space:
mode:
authorRĂ©mi Denis-Courmont <remi@remlab.net>2013-07-25 22:30:20 +0300
committerAnton Khirnov <anton@khirnov.net>2013-08-05 11:20:41 +0200
commit2852740e23f91d6775714d7cc29b9a73e1111ce0 (patch)
tree967ba877c15aac37512765a534895fff99aa97d2 /libavcodec/vdpau.c
parent549294fbbe1c00fee37dc4d3f291b98945e11094 (diff)
vdpau: store picture data in picture's rather than codec's context
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/vdpau.c')
-rw-r--r--libavcodec/vdpau.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index b6bb7baabf..9bcbc2e11b 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -38,13 +38,15 @@
* @{
*/
-int ff_vdpau_common_start_frame(AVCodecContext *avctx,
+int ff_vdpau_common_start_frame(Picture *pic,
av_unused const uint8_t *buffer,
av_unused uint32_t size)
{
- AVVDPAUContext *hwctx = avctx->hwaccel_context;
+ struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
- hwctx->bitstream_buffers_used = 0;
+ pic_ctx->bitstream_buffers_allocated = 0;
+ pic_ctx->bitstream_buffers_used = 0;
+ pic_ctx->bitstream_buffers = NULL;
return 0;
}
@@ -55,31 +57,32 @@ int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
{
AVVDPAUContext *hwctx = avctx->hwaccel_context;
MpegEncContext *s = avctx->priv_data;
- VdpVideoSurface surf = ff_vdpau_get_surface_id(s->current_picture_ptr);
+ Picture *pic = s->current_picture_ptr;
+ struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
+ VdpVideoSurface surf = ff_vdpau_get_surface_id(pic);
- hwctx->render(hwctx->decoder, surf, (void *)&hwctx->info,
- hwctx->bitstream_buffers_used, hwctx->bitstream_buffers);
+ hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info,
+ pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
- hwctx->bitstream_buffers_used = 0;
+ av_freep(&pic_ctx->bitstream_buffers);
return 0;
}
#endif
-int ff_vdpau_add_buffer(AVCodecContext *avctx,
- const uint8_t *buf, uint32_t size)
+int ff_vdpau_add_buffer(Picture *pic, const uint8_t *buf, uint32_t size)
{
- AVVDPAUContext *hwctx = avctx->hwaccel_context;
- VdpBitstreamBuffer *buffers = hwctx->bitstream_buffers;
+ struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
+ VdpBitstreamBuffer *buffers = pic_ctx->bitstream_buffers;
- buffers = av_fast_realloc(buffers, &hwctx->bitstream_buffers_allocated,
- (hwctx->bitstream_buffers_used + 1) * sizeof(*buffers));
+ buffers = av_fast_realloc(buffers, &pic_ctx->bitstream_buffers_allocated,
+ (pic_ctx->bitstream_buffers_used + 1) * sizeof(*buffers));
if (!buffers)
return AVERROR(ENOMEM);
- hwctx->bitstream_buffers = buffers;
- buffers += hwctx->bitstream_buffers_used++;
+ pic_ctx->bitstream_buffers = buffers;
+ buffers += pic_ctx->bitstream_buffers_used++;
buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
buffers->bitstream = buf;