diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-06 14:25:08 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-06 14:25:26 +0200 |
commit | c3b29023207850fa3b5b6b4dcb8e4940b86abb83 (patch) | |
tree | 36d9ce6c2f8647b333e7cc025d39074ae00c8480 /libavcodec/vdpau.c | |
parent | 50fb8c1114b9c2b7d299cbc17a18a457d12069a8 (diff) | |
parent | 2852740e23f91d6775714d7cc29b9a73e1111ce0 (diff) | |
download | ffmpeg-c3b29023207850fa3b5b6b4dcb8e4940b86abb83.tar.gz |
Merge commit '2852740e23f91d6775714d7cc29b9a73e1111ce0'
* commit '2852740e23f91d6775714d7cc29b9a73e1111ce0':
vdpau: store picture data in picture's rather than codec's context
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vdpau.c')
-rw-r--r-- | libavcodec/vdpau.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 1873a701d6..cf564a5982 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; |