Skip to content

Commit

Permalink
MetaFormat: Add conversion to str
Browse files Browse the repository at this point in the history
  • Loading branch information
tomba committed Nov 1, 2024
1 parent cad4229 commit e45d393
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pixutils/formats/metaformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e45d393

Please sign in to comment.