mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
vdpau: add a convenience function for getting a decoder profile.
Based on the code by Rémi Denis-Courmont <remi@remlab.net> from VLC.
This commit is contained in:
parent
19e30a58fc
commit
ca22d1dea2
@ -13,6 +13,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.25.0 - avcodec.h
|
||||
Add ITU-R BT.2020 and other not yet included values to color primaries,
|
||||
transfer characteristics and colorspaces.
|
||||
|
@ -90,4 +90,47 @@ int ff_vdpau_add_buffer(Picture *pic, const uint8_t *buf, uint32_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* @}*/
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "version.h"
|
||||
|
||||
#if FF_API_BUFS_VDPAU
|
||||
@ -125,6 +126,19 @@ typedef struct AVVDPAUContext {
|
||||
#endif
|
||||
} AVVDPAUContext;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 55
|
||||
#define LIBAVCODEC_VERSION_MINOR 25
|
||||
#define LIBAVCODEC_VERSION_MINOR 26
|
||||
#define LIBAVCODEC_VERSION_MICRO 0
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user