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
9 changes: 7 additions & 2 deletions av/sidedata/encparams.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
from enum import IntEnum
from typing import Any, cast
from typing import Any, cast, final

import numpy as np

from .sidedata import SideData

class VideoEncParamsType(IntEnum):
NONE = cast(int, ...)
VP9 = cast(int, ...)
H264 = cast(int, ...)
MPEG2 = cast(int, ...)

class VideoEncParams:
@final
class VideoEncParams(SideData):
nb_blocks: int
blocks_offset: int
block_size: int
Expand All @@ -19,9 +22,11 @@ class VideoEncParams:
def block_params(self, idx: int) -> VideoBlockParams: ...
def qp_map(self) -> np.ndarray[Any, Any]: ...

@final
class VideoBlockParams:
src_x: int
src_y: int
w: int
h: int
delta_qp: int
def __init__(self, video_enc_params: VideoEncParams, idx: int, /) -> None: ...
12 changes: 10 additions & 2 deletions av/sidedata/motionvectors.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
from collections.abc import Iterator
from typing import Any
from typing import Any, final

import numpy as np

from av.frame import Frame

from .sidedata import SideData

@final
class MotionVectors(SideData):
def __getitem__(self, index: int) -> MotionVector: ...
def __init__(self, sentinel: object, frame: Frame, index: int, /) -> None: ...
def __getitem__(self, index: int, /) -> MotionVector: ...
def __iter__(self) -> Iterator[MotionVector]: ...
def __len__(self) -> int: ...
def to_ndarray(self) -> np.ndarray[Any, Any]: ...

@final
class MotionVector:
source: int
w: int
Expand All @@ -22,3 +27,6 @@ class MotionVector:
motion_x: int
motion_y: int
motion_scale: int
def __init__(
self, sentinel: object, parent: MotionVectors, index: int, /
) -> None: ...
13 changes: 7 additions & 6 deletions av/sidedata/sidedata.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ from collections.abc import Iterator, Mapping, Sequence
from enum import Enum
from typing import ClassVar, cast, overload

from typing_extensions import disjoint_base

from av.buffer import Buffer
from av.frame import Frame

class Type(Enum):
PANSCAN = cast(ClassVar[Type], ...)
Expand Down Expand Up @@ -38,17 +41,15 @@ class Type(Enum):
THREE_D_REFERENCE_DISPLAYS = cast(ClassVar[Type], ...)
EXIF = cast(ClassVar[Type], ...)

@disjoint_base
class SideData(Buffer):
type: Type
def __init__(self, sentinel: object, frame: Frame, index: int, /) -> None: ...

class SideDataContainer(Mapping):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[Type]: ...
@overload
def __getitem__(self, key: str | int | Type) -> SideData: ...
@overload
def __getitem__(self, key: slice) -> Sequence[SideData]: ...
def __getitem__(self, key: str | int | Type, /) -> SideData: ...
@overload
def __getitem__(
self, key: str | int | Type | slice
) -> SideData | Sequence[SideData]: ...
def __getitem__(self, key: slice, /) -> Sequence[SideData]: ...