libkms++/pixelformats.h: Add static inline std::string PixelFormatToFourCC(PixelFormat f)
authorJyri Sarha <jsarha@ti.com>
Tue, 20 Oct 2015 13:49:40 +0000 (16:49 +0300)
committerJyri Sarha <jsarha@ti.com>
Tue, 20 Oct 2015 16:18:32 +0000 (19:18 +0300)
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());
 }
 
        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);
+}
+
 }
 }