summaryrefslogtreecommitdiff
path: root/libkms++/pixelformats.h
blob: 6741ea4583f5c173b04b43817332d1f8abc330ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#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"),
	XBGR8888 = MakeFourCC("XB24"),
	RGB565 = MakeFourCC("RG16"),
};

static inline PixelFormat FourCCToPixelFormat(const std::string& fourcc)
{
	return (PixelFormat)MakeFourCC(fourcc.c_str());
}

}