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
1313
1414 API changes, most recent first:
1515
16+2013-11-xx - xxxxxxx - lavc 55.26.0 - vdpau.h
17+ Add av_vdpau_get_profile().
18+
1619 2013-11-xx - xxxxxxx - lavc 55.25.0 - avcodec.h
1720 Add ITU-R BT.2020 and other not yet included values to color primaries,
1821 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
9090 return 0;
9191 }
9292
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+
93136 /* @}*/
libavcodec/vdpau.h+14−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454
5555 #include "libavutil/attributes.h"
5656
57+#include "avcodec.h"
5758 #include "version.h"
5859
5960 #if FF_API_BUFS_VDPAU
@@ -125,6 +126,19 @@ typedef struct AVVDPAUContext { · 65 unmodified lines
125126 #endif
126127 } AVVDPAUContext;
127128
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+
128142 #if FF_API_CAP_VDPAU
129143 /** @brief The videoSurface is used for rendering. */
130144 #define FF_VDPAU_STATE_USED_FOR_RENDER 1
libavcodec/version.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 */
2828
2929 #define LIBAVCODEC_VERSION_MAJOR 55
30−#define LIBAVCODEC_VERSION_MINOR 25
30+#define LIBAVCODEC_VERSION_MINOR 26
3131 #define LIBAVCODEC_VERSION_MICRO 0
3232
3333 #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