summaryrefslogtreecommitdiff
path: root/libkms++/pixelformats.h
diff options
context:
space:
mode:
Diffstat (limited to 'libkms++/pixelformats.h')
-rw-r--r--libkms++/pixelformats.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/libkms++/pixelformats.h b/libkms++/pixelformats.h
new file mode 100644
index 0000000..25fdecb
--- /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());
+}
+
+}