fourcc code converter helper

This commit is contained in:
Abyss Watcher
2024-11-15 17:05:23 +01:00
parent 9f145ddcf0
commit 36a18f405b
@@ -483,6 +483,22 @@ class LinuxUtilities(interfaces.configuration.VersionableInterface):
return kernel
@classmethod
def convert_fourcc_code(cls, code: int) -> str:
"""Convert a fourcc integer back to its fourcc string representation.
Args:
code: the numerical representation of the fourcc
Returns:
The fourcc code string.
"""
code_bytes_length = (code.bit_length() + 7) // 8
return "".join(
[chr((code >> (i * 8)) & 0xFF) for i in range(code_bytes_length)]
)
class IDStorage(ABC):
"""Abstraction to support both XArray and RadixTree"""