AkVideoCaps::PixelFormat AkVideoCaps::pixelFormatFromString(const QString &pixelFormat) { AkVideoCaps caps; QString format = "Format_" + pixelFormat; int enumIndex = caps.metaObject()->indexOfEnumerator("PixelFormat"); QMetaEnum enumType = caps.metaObject()->enumerator(enumIndex); int enumValue = enumType.keyToValue(format.toStdString().c_str()); return static_cast<PixelFormat>(enumValue); }
QString AkVideoCaps::pixelFormatToString(AkVideoCaps::PixelFormat pixelFormat) { AkVideoCaps caps; int formatIndex = caps.metaObject()->indexOfEnumerator("PixelFormat"); QMetaEnum formatEnum = caps.metaObject()->enumerator(formatIndex); QString format(formatEnum.valueToKey(pixelFormat)); format.remove("Format_"); return format; }