Skip to content

Commit

Permalink
Add stubs for enum and video
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Nov 24, 2023
1 parent 19970c9 commit 2266f33
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
30 changes: 30 additions & 0 deletions av/enum.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class EnumType(type):
def __init__(self, name, bases, attrs, items): ...
def _create(self, name: str, value: int, doc=None, by_value_only=False): ...
def __len__(self): ...
def __iter__(self): ...
def __getitem__(self, key): ...
def _get(self, value: int, create: bool = False): ...
def _get_multi_flags(self, value: int): ...
def get(
self, key, default: int | None = None, create: bool = False
) -> int | None: ...

class EnumItem:
name: str
value: int

def __int__(self): ...
def __hash__(self): ...
def __reduce__(self): ...
def __eq__(self, other) -> bool: ...
def __ne__(self, other) -> bool: ...

class EnumFlag(EnumItem):
flags: tuple[EnumFlag]

def __and__(self, other): ...
def __or__(self, other): ...
def __xor__(self, other): ...
def __invert__(self): ...
def __nonzero__(self) -> bool: ...
2 changes: 2 additions & 0 deletions av/video/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .frame import VideoFrame
from .stream import VideoStream
24 changes: 24 additions & 0 deletions av/video/format.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class VideoFormat:
name: str
bits_per_pixel: int
padded_bits_per_pixel: int
is_big_endian: bool
has_palette: bool
is_bit_stream: bool
is_planar: bool
is_rgb: bool

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

class VideoFormatComponent:
plane: int
bits: int
is_alpha: bool
is_luma: bool
is_chroma: bool
width: int
height: int

def __init__(self, format: VideoFormat, index: int): ...
16 changes: 16 additions & 0 deletions av/video/frame.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from typing import Any

from .plane import VideoPlane

class VideoFrame:
planes: tuple[VideoPlane]
width: int
height: int
key_frame: bool
interlaced_frame: bool
pict_type: Any

def from_image(img: Any) -> VideoFrame: ...
def __init__(
self, name: str, width: int = 0, height: int = 0, format: str = "yuv420p"
): ...
9 changes: 9 additions & 0 deletions av/video/plane.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from .frame import VideoFrame

class VideoPlane:
line_size: int
width: int
height: int
buffer_size: int

def __init__(frame: VideoFrame, index: int): ...

0 comments on commit 2266f33

Please sign in to comment.