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>
pull/87/head
Michael Niedermayer 10 years ago
commit b64b719ad5
  1. 43
      libavcodec/vdpau.c
  2. 36
      libavcodec/vdpau_h264.c
  3. 2
      libavcodec/vdpau_internal.h

@ -79,17 +79,12 @@ int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx,
return 0; return 0;
} }
#if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG1_VDPAU_HWACCEL || \ int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \ struct vdpau_picture_context *pic_ctx)
CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
{ {
int res = 0;
AVVDPAUContext *hwctx = avctx->hwaccel_context; AVVDPAUContext *hwctx = avctx->hwaccel_context;
MpegEncContext *s = avctx->priv_data; VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);
Picture *pic = s->current_picture_ptr; VdpStatus status;
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
VdpVideoSurface surf = ff_vdpau_get_surface_id(pic->f);
#if FF_API_BUFS_VDPAU #if FF_API_BUFS_VDPAU
FF_DISABLE_DEPRECATION_WARNINGS FF_DISABLE_DEPRECATION_WARNINGS
@ -101,13 +96,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif #endif
if (!hwctx->render) { if (!hwctx->render) {
res = hwctx->render2(avctx, pic->f, (void *)&pic_ctx->info, status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info,
pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
} else } else
hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, status = hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info,
pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); 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); av_freep(&pic_ctx->bitstream_buffers);
#if FF_API_BUFS_VDPAU #if FF_API_BUFS_VDPAU
@ -118,7 +113,25 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
#endif #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 #endif

@ -189,41 +189,17 @@ static int vdpau_h264_decode_slice(AVCodecContext *avctx,
static int vdpau_h264_end_frame(AVCodecContext *avctx) static int vdpau_h264_end_frame(AVCodecContext *avctx)
{ {
int res = 0;
AVVDPAUContext *hwctx = avctx->hwaccel_context;
H264Context *h = avctx->priv_data; H264Context *h = avctx->priv_data;
H264Picture *pic = h->cur_pic_ptr; H264Picture *pic = h->cur_pic_ptr;
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
VdpVideoSurface surf = ff_vdpau_get_surface_id(&pic->f); int val;
#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);
#if FF_API_BUFS_VDPAU val = ff_vdpau_common_end_frame(avctx, &pic->f, pic_ctx);
FF_DISABLE_DEPRECATION_WARNINGS if (val < 0)
hwctx->bitstream_buffers = NULL; return val;
hwctx->bitstream_buffers_used = 0;
hwctx->bitstream_buffers_allocated = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
return res; ff_h264_draw_horiz_band(h, 0, h->avctx->height);
return 0;
} }
AVHWAccel ff_h264_vdpau_hwaccel = { AVHWAccel ff_h264_vdpau_hwaccel = {

@ -80,6 +80,8 @@ struct vdpau_picture_context {
int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic, int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic,
const uint8_t *buffer, uint32_t size); 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_mpeg_end_frame(AVCodecContext *avctx);
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic, const uint8_t *buf, int ff_vdpau_add_buffer(struct vdpau_picture_context *pic, const uint8_t *buf,
uint32_t buf_size); uint32_t buf_size);

Loading…
Cancel
Save