From e45d393abb1a984584508f435f1ccae86fe7824f Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 1 Nov 2024 12:37:03 +0200 Subject: [PATCH] MetaFormat: Add conversion to str --- pixutils/formats/metaformats.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pixutils/formats/metaformats.py b/pixutils/formats/metaformats.py index c3af549..a402afb 100644 --- a/pixutils/formats/metaformats.py +++ b/pixutils/formats/metaformats.py @@ -12,6 +12,12 @@ def __init__(self, name: str, v4l2_fourcc: str, pixelspergroup: int, bytespergro self.pixelspergroup = pixelspergroup self.bytespergroup = bytespergroup + def __str__(self): + return self.name + + def __repr__(self): + return f'MetaFormat({self.name})' + def stride(self, width: int, align: int = 1): # ceil(width / pixelsPerGroup) * bytesPerGroup stride = (width + self.pixelspergroup - 1) // self.pixelspergroup * self.bytespergroup