diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-06 12:04:25 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-06 12:09:17 +0200 |
commit | b64b719ad5c212e197009fa3f1e7aa96255cbd28 (patch) | |
tree | 38b2b3d650a29e10136bf251277db559b3d2cb58 /libavcodec | |
parent | 567c0dcee6745dc53d67e6de796270449b5753f7 (diff) | |
parent | fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7 (diff) | |
download | ffmpeg-b64b719ad5c212e197009fa3f1e7aa96255cbd28.tar.gz |
Merge commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7'
* commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7':
vdpau: factor out common end-of-frame handling
Conflicts:
libavcodec/vdpau.c
libavcodec/vdpau_h264.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vdpau.c | 43 | ||||
-rw-r--r-- | libavcodec/vdpau_h264.c | 36 | ||||
-rw-r--r-- | libavcodec/vdpau_internal.h | 2 |
3 files changed, 36 insertions, 45 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 18d09ae980..9ac423a0eb 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -79,17 +79,12 @@ int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, return 0; } -#if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG1_VDPAU_HWACCEL || \ - CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \ - CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL -int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) +int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, + struct vdpau_picture_context *pic_ctx) { - int res = 0; AVVDPAUContext *hwctx = avctx->hwaccel_context; - MpegEncContext *s = avctx->priv_data; - Picture *pic = s->current_picture_ptr; - struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; - VdpVideoSurface surf = ff_vdpau_get_surface_id(pic->f); + VdpVideoSurface surf = ff_vdpau_get_surface_id(frame); + VdpStatus status; #if FF_API_BUFS_VDPAU FF_DISABLE_DEPRECATION_WARNINGS @@ -101,13 +96,13 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif if (!hwctx->render) { - res = hwctx->render2(avctx, pic->f, (void *)&pic_ctx->info, - pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); + status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info, + pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); } else - hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, - pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); + status = 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); av_freep(&pic_ctx->bitstream_buffers); #if FF_API_BUFS_VDPAU @@ -118,7 +113,25 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - return res; + return vdpau_error(status); +} + +#if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG1_VDPAU_HWACCEL || \ + CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \ + CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL +int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) +{ + MpegEncContext *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_common_end_frame(avctx, pic->f, pic_ctx); + if (val < 0) + return val; + + ff_mpeg_draw_horiz_band(s, 0, s->avctx->height); + return 0; } #endif diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 05a41d0402..c63f9a8d2a 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -189,41 +189,17 @@ static int vdpau_h264_decode_slice(AVCodecContext *avctx, static int vdpau_h264_end_frame(AVCodecContext *avctx) { - int res = 0; - AVVDPAUContext *hwctx = avctx->hwaccel_context; H264Context *h = avctx->priv_data; H264Picture *pic = h->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; - VdpVideoSurface surf = ff_vdpau_get_surface_id(&pic->f); - -#if FF_API_BUFS_VDPAU -FF_DISABLE_DEPRECATION_WARNINGS - hwctx->info = pic_ctx->info; - hwctx->bitstream_buffers = pic_ctx->bitstream_buffers; - hwctx->bitstream_buffers_used = pic_ctx->bitstream_buffers_used; - hwctx->bitstream_buffers_allocated = pic_ctx->bitstream_buffers_allocated; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - if (!hwctx->render) { - res = hwctx->render2(avctx, &pic->f, (void *)&pic_ctx->info, - pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); - } else - hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, - pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); - - ff_h264_draw_horiz_band(h, 0, h->avctx->height); - av_freep(&pic_ctx->bitstream_buffers); + int val; -#if FF_API_BUFS_VDPAU -FF_DISABLE_DEPRECATION_WARNINGS - hwctx->bitstream_buffers = NULL; - hwctx->bitstream_buffers_used = 0; - hwctx->bitstream_buffers_allocated = 0; -FF_ENABLE_DEPRECATION_WARNINGS -#endif + val = ff_vdpau_common_end_frame(avctx, &pic->f, pic_ctx); + if (val < 0) + return val; - return res; + ff_h264_draw_horiz_band(h, 0, h->avctx->height); + return 0; } AVHWAccel ff_h264_vdpau_hwaccel = { diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 0f3652b729..1debbe6e2b 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -80,6 +80,8 @@ struct vdpau_picture_context { int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic, const uint8_t *buffer, uint32_t size); +int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, + struct vdpau_picture_context *pic); int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx); int ff_vdpau_add_buffer(struct vdpau_picture_context *pic, const uint8_t *buf, uint32_t buf_size); |