summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libkms++/pixelformats.h10
1 files changed, 10 insertions, 0 deletions
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);
+}
+
}