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
6 changes: 2 additions & 4 deletions av/audio/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Literal

from .frame import AudioFrame
from .stream import AudioStream
from .frame import AudioFrame as AudioFrame
from .stream import AudioStream as AudioStream

# FFmpeg 8.1 encoders and the codec descriptor aliases that resolve to them.
_AudioCodecName = Literal[
Expand Down Expand Up @@ -118,5 +118,3 @@ _AudioCodecName = Literal[
"wmav1",
"wmav2",
]

__all__ = ("AudioFrame", "AudioStream")
7 changes: 2 additions & 5 deletions av/codec/codec.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,9 @@ codecs_available: set[str]

def dump_codecs() -> None: ...
def dump_hwconfigs() -> None: ...

PixFmtLike = str | VideoFormat

def find_best_pix_fmt_of_list(
pix_fmts: Sequence[PixFmtLike],
src_pix_fmt: PixFmtLike,
pix_fmts: Sequence[str | VideoFormat],
src_pix_fmt: str | VideoFormat,
has_alpha: bool = False,
) -> tuple[VideoFormat | None, PixFmtLoss]:
"""
Expand Down
2 changes: 0 additions & 2 deletions av/device.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__all__ = ("DeviceInfo", "enumerate_input_devices", "enumerate_output_devices")

class DeviceInfo:
name: str
description: str
Expand Down
8 changes: 4 additions & 4 deletions av/dictionary.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from collections.abc import Iterable, Iterator, Mapping
from typing import final
from typing import Self, final

@final
class Dictionary:
def __init__(
self, *args: Mapping[str, str] | Iterable[tuple[str, str]], **kwargs: str
) -> None: ...
def __new__(
cls, *args: Mapping[str, str] | Iterable[tuple[str, str]], **kwargs: str
) -> Self: ...
def __getitem__(self, key: str, /) -> str: ...
def __setitem__(self, key: str, value: str, /) -> None: ...
def __delitem__(self, key: str, /) -> None: ...
Expand Down
2 changes: 0 additions & 2 deletions av/format.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__all__ = ("Flags", "ContainerFormat", "formats_available")

from enum import Flag
from typing import Literal, Self, final

Expand Down
8 changes: 4 additions & 4 deletions av/packet.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ def packet_sidedata_type_to_literal(dtype: int) -> PktSideDataT: ...
def packet_sidedata_type_from_literal(dtype: PktSideDataT) -> int: ...

# TypeVar for stream types - bound to Stream so it can be any stream type
StreamT = TypeVar("StreamT", bound=Stream)
_StreamT = TypeVar("_StreamT", bound=Stream)

@final
class Packet(Buffer, Generic[StreamT]):
class Packet(Buffer, Generic[_StreamT]):
@property
def stream(self) -> StreamT | None: ...
def stream(self) -> _StreamT | None: ...
@stream.setter
def stream(self, value: StreamT) -> None: ...
def stream(self, value: _StreamT) -> None: ...
stream_index: int
@property
def time_base(self) -> AVRational: ...
Expand Down
4 changes: 2 additions & 2 deletions av/sidedata/encparams.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import IntEnum
from typing import Any, final
from typing import Any, Self, final

import numpy as np

Expand Down Expand Up @@ -29,4 +29,4 @@ class VideoBlockParams:
w: int
h: int
delta_qp: int
def __init__(self, video_enc_params: VideoEncParams, idx: int, /) -> None: ...
def __new__(cls, video_enc_params: VideoEncParams, idx: int, /) -> Self: ...
10 changes: 5 additions & 5 deletions av/sidedata/motionvectors.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Iterator
from typing import Any, final
from typing import Any, Self, final

import numpy as np

Expand All @@ -9,7 +9,7 @@ from .sidedata import SideData

@final
class MotionVectors(SideData):
def __init__(self, sentinel: object, frame: Frame, index: int, /) -> None: ...
def __new__(cls, sentinel: object, frame: Frame, index: int, /) -> Self: ...
def __getitem__(self, index: int, /) -> MotionVector: ...
def __iter__(self) -> Iterator[MotionVector]: ...
def __len__(self) -> int: ...
Expand All @@ -27,6 +27,6 @@ class MotionVector:
motion_x: int
motion_y: int
motion_scale: int
def __init__(
self, sentinel: object, parent: MotionVectors, index: int, /
) -> None: ...
def __new__(
cls, sentinel: object, parent: MotionVectors, index: int, /
) -> Self: ...
4 changes: 2 additions & 2 deletions av/sidedata/sidedata.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Iterator, Mapping, Sequence
from enum import Enum
from typing import Literal, TypeVar, overload
from typing import Literal, Self, TypeVar, overload

from typing_extensions import disjoint_base

Expand Down Expand Up @@ -53,7 +53,7 @@ _VideoEncParamsKey = Literal["VIDEO_ENC_PARAMS", Type.VIDEO_ENC_PARAMS]
@disjoint_base
class SideData(Buffer):
type: Type
def __init__(self, sentinel: object, frame: Frame, index: int, /) -> None: ...
def __new__(cls, sentinel: object, frame: Frame, index: int, /) -> Self: ...

class SideDataContainer(Mapping[Type, SideData]):
def __len__(self) -> int: ...
Expand Down
6 changes: 2 additions & 4 deletions av/video/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Literal

from .frame import VideoFrame
from .stream import VideoStream
from .frame import VideoFrame as VideoFrame
from .stream import VideoStream as VideoStream

# FFmpeg 8.1 encoders and the codec descriptor aliases that resolve to them.
_VideoCodecName = Literal[
Expand Down Expand Up @@ -193,5 +193,3 @@ _VideoCodecName = Literal[
"zlib",
"zmbv",
]

__all__ = ("VideoFrame", "VideoStream")