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
3 changes: 3 additions & 0 deletions av/audio/fifo.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from typing import final

from .format import AudioFormat
from .frame import AudioFrame
from .layout import AudioLayout

@final
class AudioFifo:
def write(self, frame: AudioFrame) -> None: ...
def read(self, samples: int = 0, partial: bool = False) -> AudioFrame | None: ...
Expand Down
3 changes: 3 additions & 0 deletions av/audio/format.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from typing import final

@final
class AudioFormat:
name: str
bytes: int
Expand Down
3 changes: 2 additions & 1 deletion av/audio/frame.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any
from typing import Any, final

import numpy as np

Expand All @@ -25,6 +25,7 @@ class _Layout:
def __get__(self, i: object | None, owner: type | None = None) -> AudioLayout: ...
def __set__(self, instance: object, value: AudioLayout | str) -> None: ...

@final
class AudioFrame(Frame):
planes: tuple[AudioPlane, ...]
samples: int
Expand Down
2 changes: 2 additions & 0 deletions av/audio/layout.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from dataclasses import dataclass
from typing import final

@final
class AudioLayout:
name: str
nb_channels: int
Expand Down
3 changes: 3 additions & 0 deletions av/audio/plane.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from typing import final

from av.plane import Plane

@final
class AudioPlane(Plane): ...
3 changes: 3 additions & 0 deletions av/audio/resampler.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from typing import final

from av.filter.graph import Graph

from .format import AudioFormat
from .frame import AudioFrame
from .layout import AudioLayout

@final
class AudioResampler:
rate: int
frame_size: int
Expand Down
3 changes: 2 additions & 1 deletion av/audio/stream.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Iterator
from typing import Literal
from typing import Literal, final

from av.codec.codec import Codec
from av.packet import Packet
Expand All @@ -18,6 +18,7 @@ class _Layout:
def __get__(self, i: object | None, owner: type | None = None) -> AudioLayout: ...
def __set__(self, instance: object, value: AudioLayout | str) -> None: ...

@final
class AudioStream(Stream):
codec_context: AudioCodecContext
def encode(self, frame: AudioFrame | None = None) -> list[Packet]: ...
Expand Down
3 changes: 3 additions & 0 deletions av/bitstream.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from typing import final

from .codec import Codec
from .packet import Packet
from .stream import Stream

@final
class BitStreamFilterContext:
def __init__(
self,
Expand Down
3 changes: 2 additions & 1 deletion av/codec/codec.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Sequence
from enum import Flag, IntEnum, IntFlag
from typing import ClassVar, Literal, cast, overload
from typing import ClassVar, Literal, cast, final, overload

from av.audio.codeccontext import AudioCodecContext
from av.audio.format import AudioFormat
Expand Down Expand Up @@ -56,6 +56,7 @@ class PixFmtLoss(IntFlag):

class UnknownCodecError(ValueError): ...

@final
class Codec:
@property
def is_encoder(self) -> bool: ...
Expand Down
5 changes: 4 additions & 1 deletion av/codec/hwaccel.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import IntEnum, IntFlag
from typing import cast
from typing import cast, final

from av.codec.codec import Codec
from av.video.format import VideoFormat
Expand Down Expand Up @@ -28,6 +28,7 @@ class HWConfigMethod(IntFlag):
internal = cast(int, ...)
ad_hoc = cast(int, ...)

@final
class HWConfig:
@property
def device_type(self) -> HWDeviceType: ...
Expand All @@ -38,6 +39,7 @@ class HWConfig:
@property
def is_supported(self) -> bool: ...

@final
class HWDevice:
options: dict[str, object]
flags: int
Expand All @@ -52,6 +54,7 @@ class HWDevice:
@property
def device_type(self) -> HWDeviceType: ...

@final
class HWAccel:
options: dict[str, object]
flags: int
Expand Down
8 changes: 5 additions & 3 deletions av/dictionary.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from collections.abc import Iterable, Iterator, Mapping
from typing import final

@final
class Dictionary:
def __getitem__(self, key: str) -> str: ...
def __setitem__(self, key: str, value: str) -> None: ...
def __delitem__(self, key: str) -> None: ...
def __getitem__(self, key: str, /) -> str: ...
def __setitem__(self, key: str, value: str, /) -> None: ...
def __delitem__(self, key: str, /) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
def __repr__(self) -> str: ...
Expand Down
3 changes: 3 additions & 0 deletions av/filter/context.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from typing import final

from av.filter import Graph
from av.filter.filter import Filter
from av.filter.link import FilterContextPad
from av.frame import Frame

@final
class FilterContext:
name: str | None
filter: Filter
Expand Down
3 changes: 3 additions & 0 deletions av/filter/filter.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from typing import final

from .link import FilterPad

@final
class Filter:
name: str
description: str
Expand Down
3 changes: 2 additions & 1 deletion av/filter/graph.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fractions import Fraction
from typing import Any
from typing import Any, final

from av.audio.format import AudioFormat
from av.audio.frame import AudioFrame
Expand All @@ -14,6 +14,7 @@ from av.video.stream import VideoStream
from .context import FilterContext
from .filter import Filter

@final
class Graph:
configured: bool
threads: int
Expand Down
6 changes: 5 additions & 1 deletion av/filter/link.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import final

from av.filter.context import FilterContext
from av.filter.filter import Filter
from av.filter.graph import Graph
Expand All @@ -7,7 +9,7 @@ class FilterPad:
context: FilterContext | None
is_input: bool
index: int
def __eq__(self, other: object) -> bool: ...
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...
@property
def is_output(self) -> bool: ...
Expand All @@ -16,13 +18,15 @@ class FilterPad:
@property
def type(self) -> str: ...

@final
class FilterContextPad(FilterPad):
context: FilterContext
@property
def link(self) -> FilterLink | None: ...
@property
def linked(self) -> FilterContextPad | None: ...

@final
class FilterLink:
@property
def graph(self) -> Graph: ...
Expand Down
3 changes: 2 additions & 1 deletion av/format.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__all__ = ("Flags", "ContainerFormat", "formats_available")

from enum import Flag
from typing import ClassVar, Literal, cast
from typing import ClassVar, Literal, cast, final

class Flags(Flag):
no_file = cast(ClassVar[Flags], ...)
Expand All @@ -22,6 +22,7 @@ class Flags(Flag):
ts_negative = cast(ClassVar[Flags], ...)
seek_to_pts = cast(ClassVar[Flags], ...)

@final
class ContainerFormat:
def __init__(self, name: str, mode: Literal["r", "w"] | None = None) -> None: ...
@property
Expand Down
8 changes: 5 additions & 3 deletions av/index.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Iterator
from typing import overload
from typing import final, overload

@final
class IndexEntry:
pos: int
timestamp: int
Expand All @@ -10,13 +11,14 @@ class IndexEntry:
size: int
min_distance: int

@final
class IndexEntries:
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[IndexEntry]: ...
@overload
def __getitem__(self, index: int) -> IndexEntry: ...
def __getitem__(self, index: int, /) -> IndexEntry: ...
@overload
def __getitem__(self, index: slice) -> list[IndexEntry]: ...
def __getitem__(self, index: slice, /) -> list[IndexEntry]: ...
def search_timestamp(
self, timestamp, *, backward: bool = True, any_frame: bool = False
) -> int: ...
3 changes: 2 additions & 1 deletion av/logging.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Callable
from typing import Any
from typing import Any, final

PANIC: int
FATAL: int
Expand All @@ -21,6 +21,7 @@ def set_skip_repeated(v: bool) -> None: ...
def get_last_error() -> tuple[int, tuple[int, str, str] | None]: ...
def log(level: int, name: str, message: str) -> None: ...

@final
class Capture:
logs: list[tuple[int, str, str]]

Expand Down
4 changes: 3 additions & 1 deletion av/packet.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Iterator
from fractions import Fraction
from typing import Generic, Literal, TypeVar, overload
from typing import Generic, Literal, TypeVar, final, overload

from av.audio.frame import AudioFrame
from av.audio.stream import AudioStream
Expand Down Expand Up @@ -61,6 +61,7 @@ PktSideDataT = Literal[
"hevc_conf",
]

@final
class PacketSideData(Buffer):
@staticmethod
def from_packet(packet: Packet[Stream], dtype: PktSideDataT) -> PacketSideData: ...
Expand All @@ -79,6 +80,7 @@ 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)

@final
class Packet(Buffer, Generic[StreamT]):
stream: StreamT
stream_index: int
Expand Down
37 changes: 19 additions & 18 deletions av/rational.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from fractions import Fraction
from numbers import Rational
from typing import Any, overload
from typing import Any, final, overload

@final
class AVRational:
num: int
den: int
Expand All @@ -13,29 +14,29 @@ class AVRational:
def __bool__(self) -> bool: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
def __eq__(self, other: Any) -> bool: ...
def __lt__(self, other: Any) -> bool: ...
def __le__(self, other: Any) -> bool: ...
def __gt__(self, other: Any) -> bool: ...
def __ge__(self, other: Any) -> bool: ...
def __eq__(self, other: Any, /) -> bool: ...
def __lt__(self, other: Any, /) -> bool: ...
def __le__(self, other: Any, /) -> bool: ...
def __gt__(self, other: Any, /) -> bool: ...
def __ge__(self, other: Any, /) -> bool: ...
def __neg__(self) -> AVRational: ...
def __mul__(self, other: Any) -> AVRational | Fraction | float: ...
def __mul__(self, other: Any, /) -> AVRational | Fraction | float: ...
@overload
def __rmul__(self, other: int | Fraction) -> Fraction: ...
def __rmul__(self, other: int | Fraction, /) -> Fraction: ...
@overload
def __rmul__(self, other: float) -> float: ...
def __truediv__(self, other: Any) -> AVRational | Fraction | float: ...
def __rmul__(self, other: float, /) -> float: ...
def __truediv__(self, other: Any, /) -> AVRational | Fraction | float: ...
@overload
def __rtruediv__(self, other: int | Fraction) -> Fraction: ...
def __rtruediv__(self, other: int | Fraction, /) -> Fraction: ...
@overload
def __rtruediv__(self, other: float) -> float: ...
def __add__(self, other: Any) -> AVRational | Fraction | float: ...
def __rtruediv__(self, other: float, /) -> float: ...
def __add__(self, other: Any, /) -> AVRational | Fraction | float: ...
@overload
def __radd__(self, other: int | Fraction) -> Fraction: ...
def __radd__(self, other: int | Fraction, /) -> Fraction: ...
@overload
def __radd__(self, other: float) -> float: ...
def __sub__(self, other: Any) -> AVRational | Fraction | float: ...
def __radd__(self, other: float, /) -> float: ...
def __sub__(self, other: Any, /) -> AVRational | Fraction | float: ...
@overload
def __rsub__(self, other: int | Fraction) -> Fraction: ...
def __rsub__(self, other: int | Fraction, /) -> Fraction: ...
@overload
def __rsub__(self, other: float) -> float: ...
def __rsub__(self, other: float, /) -> float: ...
4 changes: 3 additions & 1 deletion av/stream.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import IntEnum, IntFlag
from fractions import Fraction
from typing import Literal, cast
from typing import Literal, cast, final

from av.rational import AVRational

Expand Down Expand Up @@ -61,11 +61,13 @@ class Stream:
language: str | None
type: Literal["video", "audio", "data", "subtitle", "attachment", "unknown"]

@final
class DataStream(Stream):
codec_context: None
type: Literal["data"]
name: str | None

@final
class AttachmentStream(Stream):
codec_context: None
type: Literal["attachment"]
Expand Down
4 changes: 4 additions & 0 deletions av/video/format.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from typing import final

@final
class VideoFormat:
name: str
bits_per_pixel: int
Expand All @@ -18,6 +21,7 @@ class VideoFormat:
def chroma_width(self, luma_width: int = 0) -> int: ...
def chroma_height(self, luma_height: int = 0) -> int: ...

@final
class VideoFormatComponent:
index: int
plane: int
Expand Down
Loading