Based on the code by Rémi Denis-Courmont <remi@remlab.net> from VLC.
Unified · Split
| @@ -13,6 +13,9 @@ libavutil: 2012-10-22 · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | API changes, most recent first: | 14 | API changes, most recent first: |
| 15 | 15 | ||
| 16 | 2013-11-xx - xxxxxxx - lavc 55.26.0 - vdpau.h | ||
| 17 | Add av_vdpau_get_profile(). | ||
| 18 | |||
| 16 | 2013-11-xx - xxxxxxx - lavc 55.25.0 - avcodec.h | 19 | 2013-11-xx - xxxxxxx - lavc 55.25.0 - avcodec.h |
| 17 | Add ITU-R BT.2020 and other not yet included values to color primaries, | 20 | Add ITU-R BT.2020 and other not yet included values to color primaries, |
| 18 | transfer characteristics and colorspaces. | 21 | transfer characteristics and colorspaces. |
| @@ -90,4 +90,47 @@ int ff_vdpau_add_buffer(Picture *pic, const uint8_t *buf, uint32_t size) · 89 unmodified lines | |||
| 90 | return 0; | 90 | return 0; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile) | ||
| 94 | { | ||
| 95 | #define PROFILE(prof) \ | ||
| 96 | do { \ | ||
| 97 | *profile = prof; \ | ||
| 98 | return 0; \ | ||
| 99 | } while (0) | ||
| 100 | |||
| 101 | switch (avctx->codec_id) { | ||
| 102 | case AV_CODEC_ID_MPEG1VIDEO: PROFILE(VDP_DECODER_PROFILE_MPEG1); | ||
| 103 | case AV_CODEC_ID_MPEG2VIDEO: | ||
| 104 | switch (avctx->profile) { | ||
| 105 | case FF_PROFILE_MPEG2_MAIN: PROFILE(VDP_DECODER_PROFILE_MPEG2_MAIN); | ||
| 106 | case FF_PROFILE_MPEG2_SIMPLE: PROFILE(VDP_DECODER_PROFILE_MPEG2_SIMPLE); | ||
| 107 | default: return AVERROR(EINVAL); | ||
| 108 | } | ||
| 109 | case AV_CODEC_ID_H263: PROFILE(VDP_DECODER_PROFILE_MPEG4_PART2_ASP); | ||
| 110 | case AV_CODEC_ID_MPEG4: | ||
| 111 | switch (avctx->profile) { | ||
| 112 | case FF_PROFILE_MPEG4_SIMPLE: PROFILE(VDP_DECODER_PROFILE_MPEG4_PART2_SP); | ||
| 113 | case FF_PROFILE_MPEG4_ADVANCED_SIMPLE: PROFILE(VDP_DECODER_PROFILE_MPEG4_PART2_ASP); | ||
| 114 | default: return AVERROR(EINVAL); | ||
| 115 | } | ||
| 116 | case AV_CODEC_ID_H264: | ||
| 117 | switch (avctx->profile) { | ||
| 118 | case FF_PROFILE_H264_CONSTRAINED_BASELINE: | ||
| 119 | case FF_PROFILE_H264_BASELINE: PROFILE(VDP_DECODER_PROFILE_H264_BASELINE); | ||
| 120 | case FF_PROFILE_H264_MAIN: PROFILE(VDP_DECODER_PROFILE_H264_MAIN); | ||
| 121 | case FF_PROFILE_H264_HIGH: PROFILE(VDP_DECODER_PROFILE_H264_HIGH); | ||
| 122 | default: return AVERROR(EINVAL); | ||
| 123 | } | ||
| 124 | case AV_CODEC_ID_WMV3: | ||
| 125 | case AV_CODEC_ID_VC1: | ||
| 126 | switch (avctx->profile) { | ||
| 127 | case FF_PROFILE_VC1_SIMPLE: PROFILE(VDP_DECODER_PROFILE_VC1_SIMPLE); | ||
| 128 | case FF_PROFILE_VC1_MAIN: PROFILE(VDP_DECODER_PROFILE_VC1_MAIN); | ||
| 129 | case FF_PROFILE_VC1_ADVANCED: PROFILE(VDP_DECODER_PROFILE_VC1_ADVANCED); | ||
| 130 | default: return AVERROR(EINVAL); | ||
| 131 | } | ||
| 132 | } | ||
| 133 | return AVERROR(EINVAL); | ||
| 134 | } | ||
| 135 | |||
| 93 | /* @}*/ | 136 | /* @}*/ |
| @@ -54,6 +54,7 @@ · 53 unmodified lines | |||
| 54 | 54 | ||
| 55 | #include "libavutil/attributes.h" | 55 | #include "libavutil/attributes.h" |
| 56 | 56 | ||
| 57 | #include "avcodec.h" | ||
| 57 | #include "version.h" | 58 | #include "version.h" |
| 58 | 59 | ||
| 59 | #if FF_API_BUFS_VDPAU | 60 | #if FF_API_BUFS_VDPAU |
| @@ -125,6 +126,19 @@ typedef struct AVVDPAUContext { · 65 unmodified lines | |||
| 125 | #endif | 126 | #endif |
| 126 | } AVVDPAUContext; | 127 | } AVVDPAUContext; |
| 127 | 128 | ||
| 129 | /** | ||
| 130 | * Get a decoder profile that should be used for initializing a VDPAU decoder. | ||
| 131 | * Should be called from the AVCodecContext.get_format() callback. | ||
| 132 | * | ||
| 133 | * @param avctx the codec context being used for decoding the stream | ||
| 134 | * @param profile a pointer into which the result will be written on success. | ||
| 135 | * The contents of profile are undefined if this function returns | ||
| 136 | * an error. | ||
| 137 | * | ||
| 138 | * @return 0 on success (non-negative), a negative AVERROR on failure. | ||
| 139 | */ | ||
| 140 | int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); | ||
| 141 | |||
| 128 | #if FF_API_CAP_VDPAU | 142 | #if FF_API_CAP_VDPAU |
| 129 | /** @brief The videoSurface is used for rendering. */ | 143 | /** @brief The videoSurface is used for rendering. */ |
| 130 | #define FF_VDPAU_STATE_USED_FOR_RENDER 1 | 144 | #define FF_VDPAU_STATE_USED_FOR_RENDER 1 |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | |||
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | #define LIBAVCODEC_VERSION_MAJOR 55 | 29 | #define LIBAVCODEC_VERSION_MAJOR 55 |
| 30 | #define LIBAVCODEC_VERSION_MINOR 25 | 30 | #define LIBAVCODEC_VERSION_MINOR 26 |
| 31 | #define LIBAVCODEC_VERSION_MICRO 0 | 31 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 32 | 32 | ||
| 33 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 33 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |