This was the last bit of codec-specific handling in VLC.
---
 doc/APIchanges       |  3 +++
 libavcodec/vdpau.c   | 28 ++++++++++++++++++++++++++++
 libavcodec/vdpau.h   | 14 ++++++++++++++
 libavcodec/version.h |  4 ++--
 4 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 38d18bc..cb19cf8 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2013-12-xx
 
 API changes, most recent first:
 
+2014-xx-xx - xxxxxxx - lavc 55.35.0 - vdpau.h
+  Add av_vdpau_get_level().
+
 2014-xx-xx - xxxxxxx - lavu 53.06.0 - pixfmt.h
   Add RGBA64 pixel format and variants.
 
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 5ad5d06..e650009 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -131,6 +131,34 @@ do {                        \
     return AVERROR(EINVAL);
 }
 
+int av_vdpau_get_level(AVCodecContext *avctx, unsigned *levelp)
+{
+    unsigned level = avctx->level;
+
+    if (level == FF_LEVEL_UNKNOWN)
+        return AVERROR(EINVAL);
+
+    switch (avctx->codec_id)
+    {
+        case AV_CODEC_ID_MPEG1VIDEO:
+            level = VDP_DECODER_LEVEL_MPEG1_NA;
+            break;
+        case AV_CODEC_ID_MPEG2VIDEO:
+            level = VDP_DECODER_LEVEL_MPEG2_HL;
+            break;
+        case AV_CODEC_ID_H263:
+            level = VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5;
+            break;
+        case AV_CODEC_ID_H264:
+            if ((avctx->profile & FF_PROFILE_H264_INTRA) && level == 11)
+                level = VDP_DECODER_LEVEL_H264_1b;
+            break;
+    }
+
+    *levelp = level;
+    return 0;
+}
+
 AVVDPAUContext *av_vdpau_alloc_context(void)
 {
     return av_mallocz(sizeof(AVVDPAUContext));
diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h
index 75cb1bf..ec8686f 100644
--- a/libavcodec/vdpau.h
+++ b/libavcodec/vdpau.h
@@ -150,6 +150,20 @@ AVVDPAUContext *av_vdpau_alloc_context(void);
  */
 int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
 
+/**
+ * Get a decoder level to match with the capabilities of a VDPAU decoder
+ * (from VdpDecoderQueryCapabilities()).
+ * Should be called from the AVCodecContext.get_format() callback.
+ *
+ * @param avctx the codec context being used for decoding the stream
+ * @param level a pointer into which the result will be written on success.
+ *                The value is undefined if this function returns an error.
+ *
+ * @return 0 on success (non-negative), a negative AVERROR on failure.
+ */
+int av_vdpau_get_level(AVCodecContext *avctx, unsigned *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 5ab49d5..d2f80ad 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 55
-#define LIBAVCODEC_VERSION_MINOR 34
-#define LIBAVCODEC_VERSION_MICRO  1
+#define LIBAVCODEC_VERSION_MINOR 35
+#define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
-- 
1.9.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to