diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-06 13:21:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-06 13:21:52 +0200 |
commit | 0ba887bbf4d99b609247a5447dc63dc2e7550ff5 (patch) | |
tree | ceeab3191d427df6dfdca35962ec23d6e00d57de | |
parent | 8df41976b7cd2e3ae0fd83ec585c886e94734acf (diff) | |
parent | 89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4 (diff) | |
download | ffmpeg-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>
-rw-r--r-- | libavcodec/vdpau.c | 3 | ||||
-rw-r--r-- | libavcodec/vdpau_h264.c | 30 | ||||
-rw-r--r-- | libavcodec/vdpau_mpeg12.c | 30 | ||||
-rw-r--r-- | libavcodec/vdpau_mpeg4.c | 30 | ||||
-rw-r--r-- | libavcodec/vdpau_vc1.c | 27 |
5 files changed, 119 insertions, 1 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 4fe486bce6..316281457e 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -146,6 +146,7 @@ int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, struct vdpau_picture_context *pic_ctx) { + VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; AVVDPAUContext *hwctx = avctx->hwaccel_context; VdpVideoSurface surf = ff_vdpau_get_surface_id(frame); VdpStatus status; @@ -163,7 +164,7 @@ FF_ENABLE_DEPRECATION_WARNINGS status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); } else - status = hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, + status = vdctx->render(vdctx->decoder, surf, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); 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), }; diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index 84a971c5b1..c47e50e0ec 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -95,6 +95,12 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, } #if CONFIG_MPEG1_VDPAU_HWACCEL +static int vdpau_mpeg1_init(AVCodecContext *avctx) +{ + return ff_vdpau_common_init(avctx, VDP_DECODER_PROFILE_MPEG1, + VDP_DECODER_LEVEL_MPEG1_NA); +} + AVHWAccel ff_mpeg1_vdpau_hwaccel = { .name = "mpeg1_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -104,10 +110,31 @@ AVHWAccel ff_mpeg1_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), + .init = vdpau_mpeg1_init, + .uninit = ff_vdpau_common_uninit, + .priv_data_size = sizeof(VDPAUContext), }; #endif #if CONFIG_MPEG2_VDPAU_HWACCEL +static int vdpau_mpeg2_init(AVCodecContext *avctx) +{ + VdpDecoderProfile profile; + + switch (avctx->profile) { + case FF_PROFILE_MPEG2_MAIN: + profile = VDP_DECODER_PROFILE_MPEG2_MAIN; + break; + case FF_PROFILE_MPEG2_SIMPLE: + profile = VDP_DECODER_PROFILE_MPEG2_SIMPLE; + break; + default: + return AVERROR(EINVAL); + } + + return ff_vdpau_common_init(avctx, profile, VDP_DECODER_LEVEL_MPEG2_HL); +} + AVHWAccel ff_mpeg2_vdpau_hwaccel = { .name = "mpeg2_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -117,5 +144,8 @@ AVHWAccel ff_mpeg2_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), + .init = vdpau_mpeg2_init, + .uninit = ff_vdpau_common_uninit, + .priv_data_size = sizeof(VDPAUContext), }; #endif diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c index 64669a6e0f..fbbacbc3af 100644 --- a/libavcodec/vdpau_mpeg4.c +++ b/libavcodec/vdpau_mpeg4.c @@ -89,6 +89,12 @@ static int vdpau_mpeg4_decode_slice(av_unused AVCodecContext *avctx, } #if CONFIG_H263_VDPAU_HWACCEL +static int vdpau_h263_init(AVCodecContext *avctx) +{ + return ff_vdpau_common_init(avctx, VDP_DECODER_PROFILE_MPEG4_PART2_ASP, + VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5); +} + AVHWAccel ff_h263_vdpau_hwaccel = { .name = "h263_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -98,10 +104,31 @@ AVHWAccel ff_h263_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg4_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), + .init = vdpau_h263_init, + .uninit = ff_vdpau_common_uninit, + .priv_data_size = sizeof(VDPAUContext), }; #endif #if CONFIG_MPEG4_VDPAU_HWACCEL +static int vdpau_mpeg4_init(AVCodecContext *avctx) +{ + VdpDecoderProfile profile; + + switch (avctx->profile) { + case FF_PROFILE_MPEG4_SIMPLE: + profile = VDP_DECODER_PROFILE_MPEG4_PART2_SP; + break; + case FF_PROFILE_MPEG4_ADVANCED_SIMPLE: + profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP; + break; + default: + return AVERROR(ENOTSUP); + } + + return ff_vdpau_common_init(avctx, profile, avctx->level); +} + AVHWAccel ff_mpeg4_vdpau_hwaccel = { .name = "mpeg4_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -111,5 +138,8 @@ AVHWAccel ff_mpeg4_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg4_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), + .init = vdpau_mpeg4_init, + .uninit = ff_vdpau_common_uninit, + .priv_data_size = sizeof(VDPAUContext), }; #endif diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c index 13c41df66a..ffd6505d13 100644 --- a/libavcodec/vdpau_vc1.c +++ b/libavcodec/vdpau_vc1.c @@ -113,6 +113,27 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx, return 0; } +static int vdpau_vc1_init(AVCodecContext *avctx) +{ + VdpDecoderProfile profile; + + switch (avctx->profile) { + case FF_PROFILE_VC1_SIMPLE: + profile = VDP_DECODER_PROFILE_VC1_SIMPLE; + break; + case FF_PROFILE_VC1_MAIN: + profile = VDP_DECODER_PROFILE_VC1_MAIN; + break; + case FF_PROFILE_VC1_ADVANCED: + profile = VDP_DECODER_PROFILE_VC1_ADVANCED; + break; + default: + return AVERROR(ENOTSUP); + } + + return ff_vdpau_common_init(avctx, profile, avctx->level); +} + #if CONFIG_WMV3_VDPAU_HWACCEL AVHWAccel ff_wmv3_vdpau_hwaccel = { .name = "wm3_vdpau", @@ -123,6 +144,9 @@ AVHWAccel ff_wmv3_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_vc1_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), + .init = vdpau_vc1_init, + .uninit = ff_vdpau_common_uninit, + .priv_data_size = sizeof(VDPAUContext), }; #endif @@ -135,4 +159,7 @@ AVHWAccel ff_vc1_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_vc1_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), + .init = vdpau_vc1_init, + .uninit = ff_vdpau_common_uninit, + .priv_data_size = sizeof(VDPAUContext), }; |