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: 4 additions & 2 deletions av/audio/codeccontext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ from .layout import AudioLayout

@final
class AudioCodecContext(CodecContext):
frame_size: int
@property
def frame_size(self) -> int: ...
sample_rate: int
rate: int
type: Literal["audio"]
@property
def type(self) -> Literal["audio"]: ...
@property
def format(self) -> AudioFormat | None: ...
@format.setter
Expand Down
25 changes: 16 additions & 9 deletions av/audio/format.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ from typing import Self, final

@final
class AudioFormat:
name: str
bytes: int
bits: int
is_planar: bool
is_packed: bool
planar: AudioFormat
packed: AudioFormat
container_name: str

@property
def name(self) -> str: ...
@property
def bytes(self) -> int: ...
@property
def bits(self) -> int: ...
@property
def is_planar(self) -> bool: ...
@property
def is_packed(self) -> bool: ...
@property
def planar(self) -> AudioFormat: ...
@property
def packed(self) -> AudioFormat: ...
@property
def container_name(self) -> str: ...
def __new__(cls, name: str | AudioFormat) -> Self: ...
6 changes: 4 additions & 2 deletions av/audio/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ type _SupportedNDarray = (

@final
class AudioFrame(Frame):
planes: tuple[AudioPlane, ...]
samples: int
@property
def planes(self) -> tuple[AudioPlane, ...]: ...
@property
def samples(self) -> int: ...
sample_rate: int
rate: int
@property
Expand Down
9 changes: 6 additions & 3 deletions av/audio/layout.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ from typing import Self, final

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

@dataclass
Expand Down
26 changes: 16 additions & 10 deletions av/audio/resampler.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@ from .layout import AudioLayout

@final
class AudioResampler:
rate: int
frame_size: int
threads: int
format: AudioFormat
layout: AudioLayout
options: dict[str, str]
is_passthrough: bool

@property
def rate(self) -> int: ...
@property
def frame_size(self) -> int: ...
@property
def threads(self) -> int: ...
@property
def format(self) -> AudioFormat: ...
@property
def layout(self) -> AudioLayout: ...
@property
def options(self) -> dict[str, str]: ...
@property
def is_passthrough(self) -> bool: ...
def __new__(
cls,
format: str | int | AudioFormat | None = None,
layout: str | int | AudioLayout | None = None,
format: str | AudioFormat | None = None,
layout: str | AudioLayout | None = None,
rate: int | None = None,
frame_size: int | None = None,
options: dict[str, str] | None = None,
Expand Down
21 changes: 14 additions & 7 deletions av/audio/stream.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,33 @@ from .layout import AudioLayout

@final
class AudioStream(Stream):
cctx: AudioCodecContext
codec_context: AudioCodecContext
@property
def cctx(self) -> AudioCodecContext: ...
@property
def codec_context(self) -> AudioCodecContext: ...
def encode(self, frame: AudioFrame | None = None) -> list[Packet[AudioStream]]: ...
def encode_lazy(
self, frame: AudioFrame | None = None
) -> Iterator[Packet[AudioStream]]: ...
def decode(self, packet: Packet[Any] | None = None) -> list[AudioFrame]: ...

# From codec context
name: str
codec: Codec
@property
def name(self) -> str: ...
@property
def codec(self) -> Codec: ...
codec_tag: str
options: dict[str, str]
frame_size: int
@property
def frame_size(self) -> int: ...
sample_rate: int
bit_rate: int | None
max_bit_rate: int | None
rate: int
channels: int
type: Literal["audio"]
@property
def channels(self) -> int: ...
@property
def type(self) -> Literal["audio"]: ...
@property
@deprecated("Use AudioStream.cctx.format instead")
def format(self) -> AudioFormat | None: ...
Expand Down
2 changes: 1 addition & 1 deletion av/bitstream.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BitStreamFilterContext:
in_stream: Stream | Codec | str | None = None,
out_stream: Stream | None = None,
) -> Self: ...
def filter(self, packet: Packet[Any] | None) -> list[Packet[Stream]]: ...
def filter(self, packet: Packet[Any] | None = None) -> list[Packet[Stream]]: ...
def flush(self) -> None: ...

bitstream_filters_available: set[str]
8 changes: 5 additions & 3 deletions av/buffer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class ByteSource: ...

@disjoint_base
class Buffer(_Buffer):
buffer_size: int
buffer_ptr: int
def update(self, input: bytes) -> None: ...
@property
def buffer_size(self) -> int: ...
@property
def buffer_ptr(self) -> int: ...
def update(self, input: _Buffer) -> None: ...
def __buffer__(self, flags: int, /) -> memoryview: ...
16 changes: 10 additions & 6 deletions av/codec/codec.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,16 @@ class Codec:
) -> Literal["video", "audio", "data", "subtitle", "attachment", "unknown"]: ...
@property
def id(self) -> int: ...
frame_rates: list[AVRational] | None
audio_rates: list[int] | None
video_formats: list[VideoFormat] | None
audio_formats: list[AudioFormat] | None
hardware_configs: tuple[HWConfig, ...]

@property
def frame_rates(self) -> list[AVRational] | None: ...
@property
def audio_rates(self) -> list[int] | None: ...
@property
def video_formats(self) -> list[VideoFormat] | None: ...
@property
def audio_formats(self) -> list[AudioFormat] | None: ...
@property
def hardware_configs(self) -> tuple[HWConfig, ...]: ...
@property
def properties(self) -> int: ...
@property
Expand Down
8 changes: 6 additions & 2 deletions av/codec/context.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ class CodecOptionSet:

@disjoint_base
class CodecContext:
name: str
type: Literal["video", "audio", "data", "subtitle", "attachment"]
@property
def name(self) -> str: ...
@property
def type(
self,
) -> Literal["video", "audio", "data", "subtitle", "attachment", "unknown"]: ...
options: dict[str, str]
@property
def supported_options(self) -> CodecOptionSet: ...
Expand Down
11 changes: 6 additions & 5 deletions av/codec/hwaccel.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ class HWConfig:

@final
class HWDevice:
options: dict[str, object]
flags: int

@property
def options(self) -> dict[str, object]: ...
@property
def flags(self) -> int: ...
def __init__(
self,
device_type: str | int | HWDeviceType,
Expand All @@ -59,8 +60,8 @@ class HWAccel:
options: dict[str, object]
flags: int
allow_software_fallback: bool
config: HWConfig | None

@property
def config(self) -> HWConfig | None: ...
@property
def is_hw_owned(self) -> bool: ...
@property
Expand Down
9 changes: 6 additions & 3 deletions av/container/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from .core import *
from .input import *
from .output import *
from .core import Chapter as Chapter
from .core import Container as Container
from .core import Flags as Flags
from .core import open as open
from .input import InputContainer as InputContainer
from .output import OutputContainer as OutputContainer
49 changes: 34 additions & 15 deletions av/container/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ from enum import Flag, IntEnum
from fractions import Fraction
from pathlib import Path
from types import TracebackType
from typing import Any, Literal, Protocol, Self, TypedDict, overload, type_check_only
from typing import (
Any,
Literal,
NotRequired,
Protocol,
Self,
TypedDict,
overload,
type_check_only,
)

from typing_extensions import disjoint_base

Expand Down Expand Up @@ -41,7 +50,6 @@ class Flags(Flag):
bitexact = ...
sort_dts = ...
fast_seek = ...
shortest = ...
auto_bsf = ...

class AudioCodec(IntEnum):
Expand Down Expand Up @@ -86,22 +94,33 @@ class Chapter(TypedDict):
id: int
start: int
end: int
time_base: AVRational
metadata: dict[str, str]
time_base: AVRational | Fraction
metadata: NotRequired[dict[str, str]]

@disjoint_base
class Container:
name: str
file: Any
io_open: _IOOpen | None
open_files: Any
format: ContainerFormat
options: dict[str, str]
container_options: dict[str, str]
streams: StreamContainer
metadata: dict[str, str]
open_timeout: _Real | None
read_timeout: _Real | None
@property
def name(self) -> str: ...
@property
def file(self) -> Any: ...
@property
def io_open(self) -> _IOOpen | None: ...
@property
def open_files(self) -> Any: ...
@property
def format(self) -> ContainerFormat: ...
@property
def options(self) -> dict[str, str]: ...
@property
def container_options(self) -> dict[str, str]: ...
@property
def streams(self) -> StreamContainer: ...
@property
def metadata(self) -> dict[str, str]: ...
@property
def open_timeout(self) -> _Real | None: ...
@property
def read_timeout(self) -> _Real | None: ...
flags: int
video_codec_id: int
def dumps_format(self) -> str: ...
Expand Down
24 changes: 16 additions & 8 deletions av/container/input.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,24 @@ class Program:

@final
class InputContainer(Container):
start_time: int | None
start_time_realtime: int | None
duration: int | None
bit_rate: int
size: int | None
probe_score: int
@property
def start_time(self) -> int | None: ...
@property
def start_time_realtime(self) -> int | None: ...
@property
def duration(self) -> int | None: ...
@property
def bit_rate(self) -> int: ...
@property
def size(self) -> int | None: ...
@property
def probe_score(self) -> int: ...
@property
def programs(self) -> tuple[Program, ...]: ...
duration_estimation_method: Literal["pts", "stream", "bitrate"] | None

@property
def duration_estimation_method(
self,
) -> Literal["pts", "stream", "bitrate"] | None: ...
@overload
def demux(self, video_stream: VideoStream) -> Iterator[Packet[VideoStream]]: ...
@overload
Expand Down
16 changes: 10 additions & 6 deletions av/container/streams.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ type _StreamSelector = (

@final
class StreamContainer:
video: tuple[VideoStream, ...]
audio: tuple[AudioStream, ...]
subtitles: tuple[SubtitleStream, ...]
attachments: tuple[AttachmentStream, ...]
data: tuple[DataStream, ...]

@property
def video(self) -> tuple[VideoStream, ...]: ...
@property
def audio(self) -> tuple[AudioStream, ...]: ...
@property
def subtitles(self) -> tuple[SubtitleStream, ...]: ...
@property
def attachments(self) -> tuple[AttachmentStream, ...]: ...
@property
def data(self) -> tuple[DataStream, ...]: ...
def __init__(self) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[Stream]: ...
Expand Down
8 changes: 4 additions & 4 deletions av/filter/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .context import *
from .filter import *
from .graph import *
from .loudnorm import *
from .filter import Filter as Filter
from .filter import filters_available as filters_available
from .graph import Graph as Graph
from .loudnorm import stats as stats
7 changes: 4 additions & 3 deletions av/filter/context.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ from av.frame import Frame

@final
class FilterContext:
name: str | None
filter: Filter

@property
def name(self) -> str | None: ...
@property
def filter(self) -> Filter: ...
@property
def inputs(self) -> tuple[FilterContextPad, ...]: ...
@property
Expand Down
Loading
Loading