diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-14 13:00:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-14 13:00:10 +0100 |
commit | 5f231d909f158e40d20281b88e7aecc2333057fe (patch) | |
tree | 4a7a02aad0bc1d864181b156306dfb3c2aed0f32 | |
parent | f3458a56c117674bf6003b59250c79a13308c05f (diff) | |
parent | ca22d1dea2842fca0422dd1d2bd09e7eb2c8f118 (diff) | |
download | ffmpeg-5f231d909f158e40d20281b88e7aecc2333057fe.tar.gz |
Merge commit 'ca22d1dea2842fca0422dd1d2bd09e7eb2c8f118'
* commit 'ca22d1dea2842fca0422dd1d2bd09e7eb2c8f118':
vdpau: add a convenience function for getting a decoder profile.
Conflicts:
doc/APIchanges
libavcodec/vdpau.c
libavcodec/vdpau.h
libavcodec/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libavcodec/vdpau.c | 43 | ||||
-rw-r--r-- | libavcodec/vdpau.h | 15 | ||||
-rw-r--r-- | libavcodec/version.h | 4 |
4 files changed, 63 insertions, 2 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index dfdc159308..3a5e5b646d 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2012-10-22 API changes, most recent first: +2013-11-xx - xxxxxxx - lavc 55.26.0 - vdpau.h + Add av_vdpau_get_profile(). + 2013-11-xx - xxxxxxx - lavc 55.41.100 / 55.25.0 - avcodec.h lavu 52.51.100 - frame.h Add ITU-R BT.2020 and other not yet included values to color primaries, diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 7a4d1458a9..b848174f90 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -438,4 +438,47 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, } #endif /* CONFIG_MPEG4_VDPAU_DECODER */ +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile) +{ +#define PROFILE(prof) \ +do { \ + *profile = prof; \ + return 0; \ +} while (0) + + switch (avctx->codec_id) { + case AV_CODEC_ID_MPEG1VIDEO: PROFILE(VDP_DECODER_PROFILE_MPEG1); + case AV_CODEC_ID_MPEG2VIDEO: + switch (avctx->profile) { + case FF_PROFILE_MPEG2_MAIN: PROFILE(VDP_DECODER_PROFILE_MPEG2_MAIN); + case FF_PROFILE_MPEG2_SIMPLE: PROFILE(VDP_DECODER_PROFILE_MPEG2_SIMPLE); + default: return AVERROR(EINVAL); + } + case AV_CODEC_ID_H263: PROFILE(VDP_DECODER_PROFILE_MPEG4_PART2_ASP); + case AV_CODEC_ID_MPEG4: + switch (avctx->profile) { + case FF_PROFILE_MPEG4_SIMPLE: PROFILE(VDP_DECODER_PROFILE_MPEG4_PART2_SP); + case FF_PROFILE_MPEG4_ADVANCED_SIMPLE: PROFILE(VDP_DECODER_PROFILE_MPEG4_PART2_ASP); + default: return AVERROR(EINVAL); + } + case AV_CODEC_ID_H264: + switch (avctx->profile) { + case FF_PROFILE_H264_CONSTRAINED_BASELINE: + case FF_PROFILE_H264_BASELINE: PROFILE(VDP_DECODER_PROFILE_H264_BASELINE); + case FF_PROFILE_H264_MAIN: PROFILE(VDP_DECODER_PROFILE_H264_MAIN); + case FF_PROFILE_H264_HIGH: PROFILE(VDP_DECODER_PROFILE_H264_HIGH); + default: return AVERROR(EINVAL); + } + case AV_CODEC_ID_WMV3: + case AV_CODEC_ID_VC1: + switch (avctx->profile) { + case FF_PROFILE_VC1_SIMPLE: PROFILE(VDP_DECODER_PROFILE_VC1_SIMPLE); + case FF_PROFILE_VC1_MAIN: PROFILE(VDP_DECODER_PROFILE_VC1_MAIN); + case FF_PROFILE_VC1_ADVANCED: PROFILE(VDP_DECODER_PROFILE_VC1_ADVANCED); + default: return AVERROR(EINVAL); + } + } + return AVERROR(EINVAL); +} + /* @}*/ diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h index 97889aeea0..b84bdeaeba 100644 --- a/libavcodec/vdpau.h +++ b/libavcodec/vdpau.h @@ -53,6 +53,8 @@ #include <vdpau/vdpau_x11.h> #include "libavutil/avconfig.h" #include "libavutil/attributes.h" + +#include "avcodec.h" #include "version.h" #if FF_API_BUFS_VDPAU @@ -143,6 +145,19 @@ AVVDPAUContext *av_alloc_vdpaucontext(void); AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *); void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2); +/** + * Get a decoder profile that should be used for initializing a VDPAU decoder. + * Should be called from the AVCodecContext.get_format() callback. + * + * @param avctx the codec context being used for decoding the stream + * @param profile a pointer into which the result will be written on success. + * The contents of profile are undefined if this function returns + * an error. + * + * @return 0 on success (non-negative), a negative AVERROR on failure. + */ +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); + #if FF_API_CAP_VDPAU /** @brief The videoSurface is used for rendering. */ #define FF_VDPAU_STATE_USED_FOR_RENDER 1 diff --git a/libavcodec/version.h b/libavcodec/version.h index 0d18626935..d2fa0de842 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,8 +29,8 @@ #include "libavutil/avutil.h" #define LIBAVCODEC_VERSION_MAJOR 55 -#define LIBAVCODEC_VERSION_MINOR 41 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MINOR 42 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ |