History

vdpau: add a convenience function for getting a decoder profile.

Based on the code by Rémi Denis-Courmont <remi@remlab.net> from VLC.

Anton Khirnov committed 13 years ago

Commit ca22d1d1 parent 19e30a54 files · +61 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/vdpau.c +43 −0
  3. libavcodec/vdpau.h +14 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2012-10-22 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162013-11-xx - xxxxxxx - lavc 55.26.0 - vdpau.h
17 Add av_vdpau_get_profile().
18
162013-11-xx - xxxxxxx - lavc 55.25.0 - avcodec.h192013-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.
libavcodec/vdpau.c+43−0
@@ -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
93int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
94{
95#define PROFILE(prof) \
96do { \
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/* @}*/
libavcodec/vdpau.h+14−0
@@ -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_VDPAU60#if FF_API_BUFS_VDPAU
@@ -125,6 +126,19 @@ typedef struct AVVDPAUContext { · 65 unmodified lines
125#endif126#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 */
140int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
141
128#if FF_API_CAP_VDPAU142#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 1144#define FF_VDPAU_STATE_USED_FOR_RENDER 1
libavcodec/version.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
27 */27 */
28 28
29#define LIBAVCODEC_VERSION_MAJOR 5529#define LIBAVCODEC_VERSION_MAJOR 55
30#define LIBAVCODEC_VERSION_MINOR 2530#define LIBAVCODEC_VERSION_MINOR 26
31#define LIBAVCODEC_VERSION_MICRO 031#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, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t