libkms++/pixelformats.h: Add static inline std::string PixelFormatToFourCC(PixelFormat f)
[android/external-libkmsxx.git] / libkms++ / pixelformats.h
index 4432cace7c542e179de52790ac0493c4c0fe9b39..75e325c88a2c56d0457b0eee712354fa53a143d8 100644 (file)
@@ -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);
+}
+
 }