Debian Codegraph @

av/codec/context.pyi

raw
1 from enum import Flag, IntEnum
2 from fractions import Fraction
3 from typing import ClassVar, Literal, cast, overload
4
5 from av.audio import _AudioCodecName
6 from av.audio.codeccontext import AudioCodecContext
7 from av.packet import Packet
8 from av.video import _VideoCodecName
9 from av.video.codeccontext import VideoCodecContext
10
11 from .codec import Codec
12 from .hwaccel import HWAccel
13
14 class ThreadType(Flag):
15 NONE = cast(ClassVar[ThreadType], ...)
16 FRAME = cast(ClassVar[ThreadType], ...)
17 SLICE = cast(ClassVar[ThreadType], ...)
18 AUTO = cast(ClassVar[ThreadType], ...)
19 def __get__(self, i: object | None, owner: type | None = None) -> ThreadType: ...
20 def __set__(self, instance: object, value: int | str | ThreadType) -> None: ...
21
22 class Flags(IntEnum):
23 unaligned = cast(int, ...)
24 qscale = cast(int, ...)
25 four_mv = cast(int, ...)
26 output_corrupt = cast(int, ...)
27 qpel = cast(int, ...)
28 recon_frame = cast(int, ...)
29 copy_opaque = cast(int, ...)
30 frame_duration = cast(int, ...)
31 pass1 = cast(int, ...)
32 pass2 = cast(int, ...)
33 loop_filter = cast(int, ...)
34 gray = cast(int, ...)
35 psnr = cast(int, ...)
36 interlaced_dct = cast(int, ...)
37 low_delay = cast(int, ...)
38 global_header = cast(int, ...)
39 bitexact = cast(int, ...)
40 ac_pred = cast(int, ...)
41 interlaced_me = cast(int, ...)
42 closed_gop = cast(int, ...)
43
44 class Flags2(IntEnum):
45 fast = cast(int, ...)
46 no_output = cast(int, ...)
47 local_header = cast(int, ...)
48 chunks = cast(int, ...)
49 ignore_crop = cast(int, ...)
50 show_all = cast(int, ...)
51 export_mvs = cast(int, ...)
52 skip_manual = cast(int, ...)
53 ro_flush_noop = cast(int, ...)
54
55 class CodecContext:
56 name: str
57 type: Literal["video", "audio", "data", "subtitle", "attachment"]
58 options: dict[str, str]
59 profile: str | None
60 @property
61 def profiles(self) -> list[str]: ...
62 extradata: bytes | None
63 time_base: Fraction
64 codec_tag: str
65 global_quality: int
66 bit_rate: int | None
67 bit_rate_tolerance: int
68 thread_count: int
69 thread_type: ThreadType
70 skip_frame: Literal[
71 "NONE", "DEFAULT", "NONREF", "BIDIR", "NONINTRA", "NONKEY", "ALL"
72 ]
73 flags: int
74 qscale: bool
75 copy_opaque: bool
76 flags2: int
77 @property
78 def is_open(self) -> bool: ...
79 @property
80 def is_encoder(self) -> bool: ...
81 @property
82 def is_decoder(self) -> bool: ...
83 @property
84 def codec(self) -> Codec: ...
85 @property
86 def max_bit_rate(self) -> int | None: ...
87 @property
88 def delay(self) -> bool: ...
89 @property
90 def extradata_size(self) -> int: ...
91 @property
92 def is_hwaccel(self) -> bool: ...
93 def open(self, strict: bool = True) -> None: ...
94 @overload
95 @staticmethod
96 def create(
97 codec: _AudioCodecName,
98 mode: Literal["r", "w"] | None = None,
99 hwaccel: HWAccel | None = None,
100 ) -> AudioCodecContext: ...
101 @overload
102 @staticmethod
103 def create(
104 codec: _VideoCodecName,
105 mode: Literal["r", "w"] | None = None,
106 hwaccel: HWAccel | None = None,
107 ) -> VideoCodecContext: ...
108 @overload
109 @staticmethod
110 def create(
111 codec: str | Codec,
112 mode: Literal["r", "w"] | None = None,
113 hwaccel: HWAccel | None = None,
114 ) -> CodecContext: ...
115 def parse(
116 self, raw_input: bytes | bytearray | memoryview | None = None
117 ) -> list[Packet]: ...
118 def flush_buffers(self) -> None: ...