summaryrefslogtreecommitdiff
path: root/libkms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@iki.fi>2015-10-03 23:26:06 +0300
committerTomi Valkeinen <tomi.valkeinen@iki.fi>2015-10-04 10:21:56 +0300
commit8bcc94ddddf93646ed8e9988a5b25f30938b7e20 (patch)
tree49765a13d212023e551c3799e85d36b61d9a12ce /libkms++
parentc0dffb7c577b03ff63871b5d13be15f230a010a3 (diff)
add PixelFormat
Diffstat (limited to 'libkms++')
-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());
+}
+
+}