mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-29 18:53:02 +00:00
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>
This commit is contained in:
commit
b64b719ad5
@ -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
|
||||
|
||||
|
@ -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);
|
||||
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);
|
||||
val = ff_vdpau_common_end_frame(avctx, &pic->f, pic_ctx);
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
ff_h264_draw_horiz_band(h, 0, h->avctx->height);
|
||||
av_freep(&pic_ctx->bitstream_buffers);
|
||||
|
||||
#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
|
||||
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVHWAccel ff_h264_vdpau_hwaccel = {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user