[vlc-commits] vdpau: add function to convert VLC format to VDPAU type/format pair

Rémi Denis-Courmont git at videolan.org
Sun Jul 7 20:13:36 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 15 19:47:33 2013 +0300| [d6817151944c7697f30106124474f92deb19f246] | committer: Rémi Denis-Courmont

vdpau: add function to convert VLC format to VDPAU type/format pair

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d6817151944c7697f30106124474f92deb19f246
---

 modules/hw/vdpau/vlc_vdpau.h |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
index 281f409..23d77c3 100644
--- a/modules/hw/vdpau/vlc_vdpau.h
+++ b/modules/hw/vdpau/vlc_vdpau.h
@@ -203,4 +203,38 @@ vdp_t *vdp_hold_x11(vdp_t *vdp, VdpDevice *device);
  */
 void vdp_release_x11(vdp_t *);
 
+/* VLC specifics */
+# include <stdbool.h>
+# include <vlc_common.h>
+# include <vlc_fourcc.h>
+
+/** Converts VLC YUV format to VDPAU chroma type and YCbCr format */
+static inline
+bool vlc_fourcc_to_vdp_ycc(vlc_fourcc_t fourcc,
+                 VdpChromaType *restrict type, VdpYCbCrFormat *restrict format)
+{
+    switch (fourcc)
+    {
+        case VLC_CODEC_I420:
+        case VLC_CODEC_YV12:
+            *type = VDP_CHROMA_TYPE_420;
+            *format = VDP_YCBCR_FORMAT_YV12;
+            break;
+        case VLC_CODEC_NV12:
+            *type = VDP_CHROMA_TYPE_420;
+            *format = VDP_YCBCR_FORMAT_NV12;
+            break;
+        case VLC_CODEC_YUYV:
+            *type = VDP_CHROMA_TYPE_422;
+            *format = VDP_YCBCR_FORMAT_YUYV;
+            break;
+        case VLC_CODEC_UYVY:
+            *type = VDP_CHROMA_TYPE_422;
+            *format = VDP_YCBCR_FORMAT_UYVY;
+            break;
+        default:
+            return false;
+    }
+    return true;
+}
 #endif



More information about the vlc-commits mailing list