Skip to content

Commit

Permalink
Improve subs in av/codec/codec and av/codec/context
Browse files Browse the repository at this point in the history
  • Loading branch information
laggykiller authored Mar 4, 2024
1 parent 34359e2 commit 4962f0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 9 additions & 1 deletion av/codec/codec.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ from fractions import Fraction
from typing import Literal

from av.audio.format import AudioFormat
from av.descriptor import Descriptor
from av.enum import EnumFlag
from av.video.format import VideoFormat

from .context import CodecContext

class Properties(EnumFlag):
NONE: int
INTRA_ONLY: int
Expand Down Expand Up @@ -41,15 +44,20 @@ class UnknownCodecError(ValueError): ...

class Codec:
is_decoder: bool
descriptor: Descriptor
name: str
long_name: str
type: Literal["video", "audio", "data", "subtitle", "attachment"]
id: int
frame_rates: list[Fraction] | None
audio_rates: list[int] | None
video_formats: list[VideoFormat] | None
audio_formats: list[AudioFormat] | None
properties: Properties
capabilities: Capabilities

def __init__(self, name: str, mode: Literal["r", "w"]): ...
def __init__(self, name: str, mode: Literal["r", "w"]) -> None: ...
def create(self) -> CodecContext: ...

class codec_descriptor:
name: str
Expand Down
9 changes: 6 additions & 3 deletions av/codec/context.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Any, Iterator, Literal
from typing import Any, Literal

from av.enum import EnumFlag, EnumItem
from av.frame import Frame
from av.packet import Packet

from .codec import Codec

class ThreadType(EnumFlag):
NONE: int
FRAME: int
Expand Down Expand Up @@ -71,7 +72,9 @@ class CodecContext:
def open(self, strict: bool = True) -> None: ...
def close(self, strict: bool = True) -> None: ...
@staticmethod
def create(codec, mode=None) -> CodecContext: ...
def create(
codec: str | Codec, mode: Literal["r", "w"] | None = None
) -> CodecContext: ...
def parse(
self, raw_input: bytes | bytearray | memoryview | None = None
) -> list[Packet]: ...

0 comments on commit 4962f0d

Please sign in to comment.