Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve stubs in av.filter #1312

Merged
merged 2 commits into from
Mar 5, 2024
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
15 changes: 12 additions & 3 deletions av/filter/context.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
from av.frame import Frame

from .pad import FilterContextPad

class FilterContext:
name: str | None
inputs: tuple[FilterContextPad, ...]
outputs: tuple[FilterContextPad, ...]

def init(self, args=None, **kwargs) -> None: ...
def link_to(self, input_, output_idx: int = 0, input_idx: int = 0) -> None: ...
def push(self, frame) -> None: ...
def init(self, args: str | None = None, **kwargs: str | None) -> None: ...
def link_to(
self, input_: FilterContext, output_idx: int = 0, input_idx: int = 0
) -> None: ...
def push(self, frame: Frame) -> None: ...
def pull(self) -> Frame: ...
14 changes: 11 additions & 3 deletions av/filter/filter.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
from av.descriptor import Descriptor
from av.option import Option

from .pad import FilterPad

class Filter:
name: str
description: str
options: tuple | None

descriptor: Descriptor
options: tuple[Option, ...] | None
flags: int
dynamic_inputs: bool
dynamic_outputs: bool
timeline_support: bool
slice_threads: bool
command_support: bool
inputs: tuple
outputs: tuple
inputs: tuple[FilterPad, ...]
outputs: tuple[FilterPad, ...]

filters_available: set[str]
16 changes: 12 additions & 4 deletions av/filter/graph.pyi
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
from fractions import Fraction
from typing import Any

from av.audio.format import AudioFormat
from av.audio.frame import AudioFrame
from av.audio.layout import AudioLayout
from av.audio.stream import AudioStream
from av.video.format import VideoFormat
from av.video.frame import VideoFrame
from av.video.stream import VideoStream

from .context import FilterContext
from .filter import Filter

class Graph:
configured: bool

def __init__(self) -> None: ...
def configure(self, auto_buffer: bool = True, force: bool = False) -> None: ...
def add(self, filter: str | Filter, args=None, **kwargs: str) -> FilterContext: ...
def add(
self, filter: str | Filter, args: Any = None, **kwargs: str
) -> FilterContext: ...
def add_buffer(
self,
template: VideoStream | None = None,
width: int | None = None,
height: int | None = None,
format=None,
format: VideoFormat | None = None,
name: str | None = None,
time_base: Fraction | None = None,
) -> FilterContext: ...
def add_abuffer(
self,
template: AudioStream | None = None,
sample_rate: int | None = None,
format=None,
layout=None,
format: AudioFormat | None = None,
layout: AudioLayout | None = None,
channels: int | None = None,
name: str | None = None,
time_base: Fraction | None = None,
Expand Down
Loading