X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Fvdpau_h264.c;h=c8307bcc47924e781d886d1b95459028b433e8fd;hp=05a41d040261e8e953a49773bd3eead7e1461ed9;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/vdpau_h264.c b/ffmpeg/libavcodec/vdpau_h264.c index 05a41d0..c8307bc 100644 --- a/ffmpeg/libavcodec/vdpau_h264.c +++ b/ffmpeg/libavcodec/vdpau_h264.c @@ -24,6 +24,7 @@ #include #include "avcodec.h" +#include "internal.h" #include "h264.h" #include "mpegutils.h" #include "vdpau.h" @@ -189,41 +190,43 @@ 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); + int val; + + 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); + return 0; +} + +static int vdpau_h264_init(AVCodecContext *avctx) +{ + VdpDecoderProfile profile; + uint32_t level = avctx->level; + + switch (avctx->profile & ~FF_PROFILE_H264_INTRA) { + case FF_PROFILE_H264_BASELINE: + profile = VDP_DECODER_PROFILE_H264_BASELINE; + break; + case FF_PROFILE_H264_CONSTRAINED_BASELINE: + case FF_PROFILE_H264_MAIN: + profile = VDP_DECODER_PROFILE_H264_MAIN; + break; + case FF_PROFILE_H264_HIGH: + profile = VDP_DECODER_PROFILE_H264_HIGH; + break; + default: + return AVERROR(ENOTSUP); + } -#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 + if ((avctx->profile & FF_PROFILE_H264_INTRA) && avctx->level == 11) + level = VDP_DECODER_LEVEL_H264_1b; - return res; + return ff_vdpau_common_init(avctx, profile, level); } AVHWAccel ff_h264_vdpau_hwaccel = { @@ -235,4 +238,7 @@ AVHWAccel ff_h264_vdpau_hwaccel = { .end_frame = vdpau_h264_end_frame, .decode_slice = vdpau_h264_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), + .init = vdpau_h264_init, + .uninit = ff_vdpau_common_uninit, + .priv_data_size = sizeof(VDPAUContext), };