diff options
author | RĂ©mi Denis-Courmont <remi@remlab.net> | 2014-10-04 16:55:05 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-10-05 10:41:31 +0000 |
commit | 89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4 (patch) | |
tree | e7f7bd220d603c1755f045f350a5319ee355a334 /libavcodec/vdpau_h264.c | |
parent | ce083282f0a8b7d63c4047c30b7bac498f9806dd (diff) | |
download | ffmpeg-89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4.tar.gz |
vdpau: pass codec-specific parameters from hwaccel
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/vdpau_h264.c')
-rw-r--r-- | libavcodec/vdpau_h264.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 838a6700ff..b759335289 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -24,6 +24,7 @@ #include <vdpau/vdpau.h> #include "avcodec.h" +#include "internal.h" #include "h264.h" #include "mpegutils.h" #include "vdpau.h" @@ -202,6 +203,32 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx) 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_CONSTRAINED_BASELINE: + case FF_PROFILE_H264_BASELINE: + profile = VDP_DECODER_PROFILE_H264_BASELINE; + break; + 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 ((avctx->profile & FF_PROFILE_H264_INTRA) && avctx->level == 11) + level = VDP_DECODER_LEVEL_H264_1b; + + return ff_vdpau_common_init(avctx, profile, level); +} + AVHWAccel ff_h264_vdpau_hwaccel = { .name = "h264_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -211,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), }; |