Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion av/video/format.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ cdef class VideoFormat:
cdef lib.AVPixelFormat pix_fmt
cdef const lib.AVPixFmtDescriptor *ptr
cdef readonly unsigned int width, height
cdef readonly tuple components
cdef _init(self, lib.AVPixelFormat pix_fmt, unsigned int width, unsigned int height)
cpdef chroma_width(self, int luma_width=?)
cpdef chroma_height(self, int luma_height=?)
Expand Down
9 changes: 6 additions & 3 deletions av/video/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def _init(self, pix_fmt: lib.AVPixelFormat, width: cuint, height: cuint):
self.ptr = lib.av_pix_fmt_desc_get(pix_fmt)
self.width = width
self.height = height
self.components = tuple(
VideoFormatComponent(self, i) for i in range(self.ptr.nb_components)
)

def __repr__(self):
if self.width or self.height:
Expand All @@ -73,6 +70,12 @@ def name(self):
"""Canonical name of the pixel format."""
return cython.cast(str, self.ptr.name)

@property
def components(self):
return tuple(
VideoFormatComponent(self, i) for i in range(self.ptr.nb_components)
)

@property
def bits_per_pixel(self):
return lib.av_get_bits_per_pixel(self.ptr)
Expand Down
8 changes: 4 additions & 4 deletions av/video/format.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class VideoFormat:
has_palette: bool
is_bit_stream: bool
is_planar: bool
width: int
height: int
@property
def components(self) -> tuple[VideoFormatComponent, ...]: ...
@property
def is_rgb(self) -> bool: ...
@property
def is_bayer(self) -> bool: ...
width: int
height: int
components: tuple[VideoFormatComponent, ...]

def __init__(self, name: str, width: int = 0, height: int = 0) -> None: ...
def chroma_width(self, luma_width: int = 0) -> int: ...
def chroma_height(self, luma_height: int = 0) -> int: ...
Expand Down
Loading