File size: 3,543 Bytes
06555b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
from fractions import Fraction
from pathlib import Path
from types import TracebackType
from typing import Any, Callable, Literal, Type, overload

from av.enum import EnumFlag
from av.format import ContainerFormat

from .input import InputContainer
from .output import OutputContainer
from .streams import StreamContainer

Real = int | float | Fraction

class Flags(EnumFlag):
    GENPTS: int
    IGNIDX: int
    NONBLOCK: int
    IGNDTS: int
    NOFILLIN: int
    NOPARSE: int
    NOBUFFER: int
    CUSTOM_IO: int
    DISCARD_CORRUPT: int
    FLUSH_PACKETS: int
    BITEXACT: int
    SORT_DTS: int
    FAST_SEEK: int
    SHORTEST: int
    AUTO_BSF: int

class Container:
    writeable: bool
    name: str
    metadata_encoding: str
    metadata_errors: str
    file: Any
    buffer_size: int
    input_was_opened: bool
    io_open: Any
    open_files: Any
    format: ContainerFormat
    options: dict[str, str]
    container_options: dict[str, str]
    stream_options: list[str]
    streams: StreamContainer
    metadata: dict[str, str]
    open_timeout: Real | None
    read_timeout: Real | None

    def __enter__(self) -> Container: ...
    def __exit__(

        self,

        exc_type: Type[BaseException] | None,

        exc_val: BaseException | None,

        exc_tb: TracebackType | None,

    ) -> bool: ...
    def err_check(self, value: int) -> int: ...
    def set_timeout(self, timeout: Real | None) -> None: ...
    def start_timeout(self) -> None: ...

@overload
def open(

    file: Any,

    mode: Literal["r"],

    format: str | None = None,

    options: dict[str, str] | None = None,

    container_options: dict[str, str] | None = None,

    stream_options: list[str] | None = None,

    metadata_encoding: str = "utf-8",

    metadata_errors: str = "strict",

    buffer_size: int = 32768,

    timeout: Real | None | tuple[Real | None, Real | None] = None,

    io_open: Callable[..., Any] | None = None,

) -> InputContainer: ...
@overload
def open(

    file: str | Path,

    mode: Literal["r"] | None = None,

    format: str | None = None,

    options: dict[str, str] | None = None,

    container_options: dict[str, str] | None = None,

    stream_options: list[str] | None = None,

    metadata_encoding: str = "utf-8",

    metadata_errors: str = "strict",

    buffer_size: int = 32768,

    timeout: Real | None | tuple[Real | None, Real | None] = None,

    io_open: Callable[..., Any] | None = None,

) -> InputContainer: ...
@overload
def open(

    file: Any,

    mode: Literal["w"],

    format: str | None = None,

    options: dict[str, str] | None = None,

    container_options: dict[str, str] | None = None,

    stream_options: list[str] | None = None,

    metadata_encoding: str = "utf-8",

    metadata_errors: str = "strict",

    buffer_size: int = 32768,

    timeout: Real | None | tuple[Real | None, Real | None] = None,

    io_open: Callable[..., Any] | None = None,

) -> OutputContainer: ...
@overload
def open(

    file: Any,

    mode: Literal["r", "w"] | None = None,

    format: str | None = None,

    options: dict[str, str] | None = None,

    container_options: dict[str, str] | None = None,

    stream_options: list[str] | None = None,

    metadata_encoding: str = "utf-8",

    metadata_errors: str = "strict",

    buffer_size: int = 32768,

    timeout: Real | None | tuple[Real | None, Real | None] = None,

    io_open: Callable[..., Any] | None = None,

) -> InputContainer | OutputContainer: ...