diff --git a/av/enum.pyi b/av/enum.pyi new file mode 100644 index 000000000..508cda07a --- /dev/null +++ b/av/enum.pyi @@ -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: ... diff --git a/av/video/__init__.pyi b/av/video/__init__.pyi new file mode 100644 index 000000000..4a25d8837 --- /dev/null +++ b/av/video/__init__.pyi @@ -0,0 +1,2 @@ +from .frame import VideoFrame +from .stream import VideoStream diff --git a/av/video/format.pyi b/av/video/format.pyi new file mode 100644 index 000000000..33aa8d3c2 --- /dev/null +++ b/av/video/format.pyi @@ -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): ... diff --git a/av/video/frame.pyi b/av/video/frame.pyi new file mode 100644 index 000000000..f5b364033 --- /dev/null +++ b/av/video/frame.pyi @@ -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" + ): ... diff --git a/av/video/plane.pyi b/av/video/plane.pyi new file mode 100644 index 000000000..aeb1a7d7f --- /dev/null +++ b/av/video/plane.pyi @@ -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): ...