]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/commitdiff
add PixelFormat
authorTomi Valkeinen <tomi.valkeinen@iki.fi>
Sat, 3 Oct 2015 20:26:06 +0000 (23:26 +0300)
committerTomi Valkeinen <tomi.valkeinen@iki.fi>
Sun, 4 Oct 2015 07:21:56 +0000 (10:21 +0300)
libkms++/pixelformats.h [new file with mode: 0644]

diff --git a/libkms++/pixelformats.h b/libkms++/pixelformats.h
new file mode 100644 (file)
index 0000000..25fdecb
--- /dev/null
@@ -0,0 +1,25 @@
+#pragma once
+
+namespace kms
+{
+constexpr uint32_t MakeFourCC(const char *fourcc)
+{
+       return fourcc[0] | (fourcc[1] << 8) | (fourcc[2] << 16) | (fourcc[3] << 24);
+}
+
+enum class PixelFormat : uint32_t
+{
+       NV12 = MakeFourCC("NV12"),
+       NV21 = MakeFourCC("NV21"),
+       UYVY = MakeFourCC("UYVY"),
+       YUYV = MakeFourCC("YUYV"),
+       XRGB8888 = MakeFourCC("XR24"),
+       RGB565 = MakeFourCC("RG16"),
+};
+
+static inline PixelFormat FourCCToPixelFormat(const std::string& fourcc)
+{
+       return (PixelFormat)MakeFourCC(fourcc.c_str());
+}
+
+}