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

@final
class AudioFormat:
Expand All @@ -11,4 +11,4 @@ class AudioFormat:
packed: AudioFormat
container_name: str

def __init__(self, name: str | AudioFormat) -> None: ...
def __new__(cls, name: str | AudioFormat) -> Self: ...
8 changes: 4 additions & 4 deletions av/audio/frame.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, final
from typing import Any, Self, final

import numpy as np

Expand Down Expand Up @@ -27,13 +27,13 @@ class AudioFrame(Frame):
def format(self) -> AudioFormat: ...
@property
def layout(self) -> AudioLayout: ...
def __init__(
self,
def __new__(
cls,
format: AudioFormat | str = "s16",
layout: AudioLayout | str = "stereo",
samples: int = 0,
align: int = 1,
) -> None: ...
) -> Self: ...
@staticmethod
def from_ndarray(
array: _SupportedNDarray,
Expand Down
4 changes: 2 additions & 2 deletions av/audio/layout.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from dataclasses import dataclass
from typing import final
from typing import Self, final

@final
class AudioLayout:
name: str
nb_channels: int
channels: tuple[AudioChannel, ...]
def __init__(self, layout: str | AudioLayout): ...
def __new__(cls, layout: str | AudioLayout) -> Self: ...

@dataclass
class AudioChannel:
Expand Down
8 changes: 4 additions & 4 deletions av/audio/resampler.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import final
from typing import Self, final

from .format import AudioFormat
from .frame import AudioFrame
Expand All @@ -14,13 +14,13 @@ class AudioResampler:
options: dict[str, str]
is_passthrough: bool

def __init__(
self,
def __new__(
cls,
format: str | int | AudioFormat | None = None,
layout: str | int | AudioLayout | None = None,
rate: int | None = None,
frame_size: int | None = None,
options: dict[str, str] | None = None,
threads: int | None = None,
) -> None: ...
) -> Self: ...
def resample(self, frame: AudioFrame | None) -> list[AudioFrame]: ...
8 changes: 4 additions & 4 deletions av/bitstream.pyi
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from typing import Any, final
from typing import Any, Self, final

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

@final
class BitStreamFilterContext:
def __init__(
self,
def __new__(
cls,
filter_description: str | bytes,
in_stream: Stream | Codec | str | None = None,
out_stream: Stream | None = None,
): ...
) -> Self: ...
def filter(self, packet: Packet[Any] | None) -> list[Packet[Stream]]: ...
def flush(self) -> None: ...

Expand Down
4 changes: 2 additions & 2 deletions 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 Literal, final, overload
from typing import Literal, Self, final, overload

from av.audio.codeccontext import AudioCodecContext
from av.audio.format import AudioFormat
Expand Down Expand Up @@ -103,7 +103,7 @@ class Codec:
def experimental(self) -> bool: ...
@property
def delay(self) -> bool: ...
def __init__(self, name: str, mode: Literal["r", "w"] = "r") -> None: ...
def __new__(cls, name: str, mode: Literal["r", "w"] = "r") -> Self: ...
@overload
def create(self, kind: Literal["video"]) -> VideoCodecContext: ...
@overload
Expand Down
4 changes: 2 additions & 2 deletions av/filter/filter.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import final
from typing import Self, final

from .link import FilterPad

Expand All @@ -12,6 +12,6 @@ class Filter:
def inputs(self) -> tuple[FilterPad, ...]: ...
@property
def outputs(self) -> tuple[FilterPad, ...]: ...
def __init__(self, name: str) -> None: ...
def __new__(cls, name: str) -> Self: ...

filters_available: set[str]
4 changes: 2 additions & 2 deletions 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, final
from typing import Any, Self, final

from av.audio.format import AudioFormat
from av.audio.frame import AudioFrame
Expand All @@ -19,7 +19,7 @@ class Graph:
configured: bool
threads: int

def __init__(self, hw_device: HWDevice | None = None) -> None: ...
def __new__(cls, hw_device: HWDevice | None = None) -> Self: ...
@property
def hw_device(self) -> HWDevice | None: ...
def configure(self, auto_buffer: bool = True, force: bool = False) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions 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 Literal, final
from typing import Literal, Self, final

class Flags(Flag):
_value_: int
Expand All @@ -25,7 +25,7 @@ class Flags(Flag):

@final
class ContainerFormat:
def __init__(self, name: str, mode: Literal["r", "w"] | None = None) -> None: ...
def __new__(cls, name: str, mode: Literal["r", "w"] | None = None) -> Self: ...
@property
def name(self) -> str: ...
@property
Expand Down
4 changes: 3 additions & 1 deletion av/plane.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Self

from typing_extensions import disjoint_base

from .buffer import Buffer
from .frame import Frame

@disjoint_base
class Plane(Buffer):
def __init__(self, frame: Frame, index: int) -> None: ...
def __new__(cls, frame: Frame, index: int) -> Self: ...
6 changes: 3 additions & 3 deletions av/video/format.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import final
from typing import Self, final

@final
class VideoFormat:
Expand All @@ -17,7 +17,7 @@ class VideoFormat:
def is_rgb(self) -> bool: ...
@property
def is_bayer(self) -> bool: ...
def __init__(self, name: str, width: int = 0, height: int = 0) -> None: ...
def __new__(cls, name: str, width: int = 0, height: int = 0) -> Self: ...
def chroma_width(self, luma_width: int = 0) -> int: ...
def chroma_height(self, luma_height: int = 0) -> int: ...
def __int__(self) -> int: ...
Expand All @@ -33,6 +33,6 @@ class VideoFormatComponent:
width: int
height: int

def __init__(self, format: VideoFormat, index: int) -> None: ...
def __new__(cls, format: VideoFormat, index: int) -> Self: ...

names: set[str]
14 changes: 7 additions & 7 deletions av/video/frame.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import IntEnum
from pathlib import Path
from typing import Any, Literal, final, overload
from typing import Any, Literal, Self, final, overload

import numpy as np
from PIL.Image import Image
Expand Down Expand Up @@ -40,13 +40,13 @@ class CudaContext:
def current_ctx(self) -> bool: ...
@property
def cuda_stream(self) -> int: ...
def __init__(
self,
def __new__(
cls,
device_id: int = 0,
primary_ctx: bool = True,
current_ctx: bool = False,
cuda_stream: int | None = None,
) -> None: ...
) -> Self: ...

@final
class VideoFrame(Frame):
Expand All @@ -71,9 +71,9 @@ class VideoFrame(Frame):
def interlaced_frame(self) -> bool: ...
@property
def rotation(self) -> int: ...
def __init__(
self, width: int = 0, height: int = 0, format: str = "yuv420p"
) -> None: ...
def __new__(
cls, width: int = 0, height: int = 0, format: str = "yuv420p"
) -> Self: ...
def reformat(
self,
width: int | None = None,
Expand Down
4 changes: 2 additions & 2 deletions av/video/plane.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from types import CapsuleType
from typing import final
from typing import Self, final

from av.plane import Plane

Expand All @@ -12,6 +12,6 @@ class VideoPlane(Plane):
height: int
buffer_size: int

def __init__(self, frame: VideoFrame, index: int) -> None: ...
def __new__(cls, frame: VideoFrame, index: int) -> Self: ...
def __dlpack_device__(self) -> tuple[int, int]: ...
def __dlpack__(self, *, stream: int | None = None) -> CapsuleType: ...