summaryrefslogtreecommitdiff
path: root/libkms++/pixelformats.h
blob: 25fdecb03ca74a9dc26eb7c4f0ced05a3ab3d359 (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
#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());
}

}