summaryrefslogtreecommitdiff
path: root/libavcodec/vdpau_h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-06 13:21:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-06 13:21:52 +0200
commit0ba887bbf4d99b609247a5447dc63dc2e7550ff5 (patch)
treeceeab3191d427df6dfdca35962ec23d6e00d57de /libavcodec/vdpau_h264.c
parent8df41976b7cd2e3ae0fd83ec585c886e94734acf (diff)
parent89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4 (diff)
downloadffmpeg-0ba887bbf4d99b609247a5447dc63dc2e7550ff5.tar.gz
Merge commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4'
* commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4': vdpau: pass codec-specific parameters from hwaccel Conflicts: libavcodec/vdpau.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vdpau_h264.c')
-rw-r--r--libavcodec/vdpau_h264.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c
index c63f9a8d2a..5d35680e6f 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),
};