summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: c0dffb7)
raw | patch | inline | side by side (from parent 1: c0dffb7)
author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | |
Sat, 3 Oct 2015 20:26:06 +0000 (23:26 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | |
Sun, 4 Oct 2015 07:21:56 +0000 (10:21 +0300) |
libkms++/pixelformats.h | [new file with mode: 0644] | patch | blob |
diff --git a/libkms++/pixelformats.h b/libkms++/pixelformats.h
--- /dev/null
+++ b/libkms++/pixelformats.h
@@ -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());
+}
+
+}