From 17a0cd1a122b0a17a362bb44da559a936731d70c Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 20 Oct 2015 16:49:40 +0300 Subject: libkms++/pixelformats.h: Add static inline std::string PixelFormatToFourCC(PixelFormat f) --- libkms++/pixelformats.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libkms++') diff --git a/libkms++/pixelformats.h b/libkms++/pixelformats.h index 4432cac..75e325c 100644 --- a/libkms++/pixelformats.h +++ b/libkms++/pixelformats.h @@ -27,4 +27,14 @@ static inline PixelFormat FourCCToPixelFormat(const std::string& fourcc) return (PixelFormat)MakeFourCC(fourcc.c_str()); } +static inline std::string PixelFormatToFourCC(PixelFormat f) +{ + char buf[5] = { (char)(((int)f >> 0) & 0xff), + (char)(((int)f >> 8) & 0xff), + (char)(((int)f >> 16) & 0xff), + (char)(((int)f >> 24) & 0xff), + 0 }; + return std::string(buf); +} + } -- cgit v1.2.3