Skip to content
Closed
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
76 changes: 38 additions & 38 deletions av/codec/codec.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Sequence
from enum import Flag, IntEnum, IntFlag
from typing import ClassVar, Literal, cast, overload
from typing import Literal, overload

from av.audio.codeccontext import AudioCodecContext
from av.audio.format import AudioFormat
Expand All @@ -13,46 +13,47 @@ from .context import CodecContext
from .hwaccel import HWConfig

class Properties(Flag):
NONE = cast(ClassVar[Properties], ...)
INTRA_ONLY = cast(ClassVar[Properties], ...)
LOSSY = cast(ClassVar[Properties], ...)
LOSSLESS = cast(ClassVar[Properties], ...)
REORDER = cast(ClassVar[Properties], ...)
FIELDS = cast(ClassVar[Properties], ...)
ENHANCEMENT = cast(ClassVar[Properties], ...)
BITMAP_SUB = cast(ClassVar[Properties], ...)
TEXT_SUB = cast(ClassVar[Properties], ...)
_value_: int
NONE = 0
INTRA_ONLY = ...
LOSSY = ...
LOSSLESS = ...
REORDER = ...
FIELDS = ...
ENHANCEMENT = ...
BITMAP_SUB = ...
TEXT_SUB = ...

class Capabilities(IntEnum):
none = cast(int, ...)
draw_horiz_band = cast(int, ...)
dr1 = cast(int, ...)
delay = cast(int, ...)
small_last_frame = cast(int, ...)
experimental = cast(int, ...)
channel_conf = cast(int, ...)
frame_threads = cast(int, ...)
slice_threads = cast(int, ...)
param_change = cast(int, ...)
auto_threads = cast(int, ...)
variable_frame_size = cast(int, ...)
avoid_probing = cast(int, ...)
hardware = cast(int, ...)
hybrid = cast(int, ...)
encoder_reordered_opaque = cast(int, ...)
encoder_flush = cast(int, ...)
encoder_recon_frame = cast(int, ...)
none = 0
draw_horiz_band = ...
dr1 = ...
delay = ...
small_last_frame = ...
experimental = ...
channel_conf = ...
frame_threads = ...
slice_threads = ...
param_change = ...
auto_threads = ...
variable_frame_size = ...
avoid_probing = ...
hardware = ...
hybrid = ...
encoder_reordered_opaque = ...
encoder_flush = ...
encoder_recon_frame = ...

class PixFmtLoss(IntFlag):
NONE = cast(ClassVar[PixFmtLoss], ...)
RESOLUTION = cast(ClassVar[PixFmtLoss], ...)
DEPTH = cast(ClassVar[PixFmtLoss], ...)
COLORSPACE = cast(ClassVar[PixFmtLoss], ...)
ALPHA = cast(ClassVar[PixFmtLoss], ...)
COLORQUANT = cast(ClassVar[PixFmtLoss], ...)
CHROMA = cast(ClassVar[PixFmtLoss], ...)
EXCESS_RESOLUTION = cast(ClassVar[PixFmtLoss], ...)
EXCESS_DEPTH = cast(ClassVar[PixFmtLoss], ...)
NONE = 0
RESOLUTION = 0x0001
DEPTH = 0x0002
COLORSPACE = 0x0004
ALPHA = 0x0008
COLORQUANT = 0x0010
CHROMA = 0x0020
EXCESS_RESOLUTION = 0x0040
EXCESS_DEPTH = 0x0080

class UnknownCodecError(ValueError): ...

Expand Down Expand Up @@ -149,4 +150,3 @@ def find_best_pix_fmt_of_list(
members.
For exact behavior see: libavutil/pixdesc.c/get_pix_fmt_score() in ffmpeg source code.
"""
...
137 changes: 68 additions & 69 deletions av/codec/context.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from enum import Flag, IntEnum, IntFlag
from fractions import Fraction
from typing import ClassVar, Literal, cast, overload
from typing import Literal, overload

from av.audio import _AudioCodecName
from av.audio.codeccontext import AudioCodecContext
Expand All @@ -17,82 +17,81 @@ from .codec import Codec
from .hwaccel import HWAccel

class ThreadType(Flag):
NONE = cast(ClassVar[ThreadType], ...)
FRAME = cast(ClassVar[ThreadType], ...)
SLICE = cast(ClassVar[ThreadType], ...)
AUTO = cast(ClassVar[ThreadType], ...)
def __get__(self, i: object | None, owner: type | None = None) -> ThreadType: ...
def __set__(self, instance: object, value: int | str | ThreadType) -> None: ...
_value_: int
NONE = ...
FRAME = ...
SLICE = ...
AUTO = ...

class Flags(IntEnum):
unaligned = cast(int, ...)
qscale = cast(int, ...)
four_mv = cast(int, ...)
output_corrupt = cast(int, ...)
qpel = cast(int, ...)
recon_frame = cast(int, ...)
copy_opaque = cast(int, ...)
frame_duration = cast(int, ...)
pass1 = cast(int, ...)
pass2 = cast(int, ...)
loop_filter = cast(int, ...)
gray = cast(int, ...)
psnr = cast(int, ...)
interlaced_dct = cast(int, ...)
low_delay = cast(int, ...)
global_header = cast(int, ...)
bitexact = cast(int, ...)
ac_pred = cast(int, ...)
interlaced_me = cast(int, ...)
closed_gop = cast(int, ...)
unaligned = ...
qscale = ...
four_mv = ...
output_corrupt = ...
qpel = ...
recon_frame = ...
copy_opaque = ...
frame_duration = ...
pass1 = ...
pass2 = ...
loop_filter = ...
gray = ...
psnr = ...
interlaced_dct = ...
low_delay = ...
global_header = ...
bitexact = ...
ac_pred = ...
interlaced_me = ...
closed_gop = ...

class Flags2(IntEnum):
fast = cast(int, ...)
no_output = cast(int, ...)
local_header = cast(int, ...)
chunks = cast(int, ...)
ignore_crop = cast(int, ...)
show_all = cast(int, ...)
export_mvs = cast(int, ...)
skip_manual = cast(int, ...)
ro_flush_noop = cast(int, ...)
icc_profiles = cast(int, ...)
fast = ...
no_output = ...
local_header = ...
chunks = ...
ignore_crop = ...
show_all = ...
export_mvs = ...
skip_manual = ...
ro_flush_noop = ...
icc_profiles = ...

class OptionType(IntEnum):
FLAGS = cast(int, ...)
INT = cast(int, ...)
INT64 = cast(int, ...)
DOUBLE = cast(int, ...)
FLOAT = cast(int, ...)
STRING = cast(int, ...)
RATIONAL = cast(int, ...)
BINARY = cast(int, ...)
DICT = cast(int, ...)
UINT64 = cast(int, ...)
CONST = cast(int, ...)
IMAGE_SIZE = cast(int, ...)
PIXEL_FMT = cast(int, ...)
SAMPLE_FMT = cast(int, ...)
VIDEO_RATE = cast(int, ...)
DURATION = cast(int, ...)
COLOR = cast(int, ...)
CHANNEL_LAYOUT = cast(int, ...)
BOOL = cast(int, ...)
UINT = cast(int, ...)
FLAGS = ...
INT = ...
INT64 = ...
DOUBLE = ...
FLOAT = ...
STRING = ...
RATIONAL = ...
BINARY = ...
DICT = ...
UINT64 = ...
CONST = ...
IMAGE_SIZE = ...
PIXEL_FMT = ...
SAMPLE_FMT = ...
VIDEO_RATE = ...
DURATION = ...
COLOR = ...
CHANNEL_LAYOUT = ...
BOOL = ...
UINT = ...

class OptionFlags(IntFlag):
ENCODING_PARAM = cast(int, ...)
DECODING_PARAM = cast(int, ...)
AUDIO_PARAM = cast(int, ...)
VIDEO_PARAM = cast(int, ...)
SUBTITLE_PARAM = cast(int, ...)
EXPORT = cast(int, ...)
READONLY = cast(int, ...)
BITSTREAM_FILTER_PARAM = cast(int, ...)
RUNTIME_PARAM = cast(int, ...)
FILTERING_PARAM = cast(int, ...)
DEPRECATED = cast(int, ...)
CHILD_CONSTS = cast(int, ...)
ENCODING_PARAM = ...
DECODING_PARAM = ...
AUDIO_PARAM = ...
VIDEO_PARAM = ...
SUBTITLE_PARAM = ...
EXPORT = ...
READONLY = ...
BITSTREAM_FILTER_PARAM = ...
RUNTIME_PARAM = ...
FILTERING_PARAM = ...
DEPRECATED = ...
CHILD_CONSTS = ...

@dataclass(frozen=True, slots=True)
class CodecOptionChoice:
Expand Down
41 changes: 20 additions & 21 deletions av/codec/hwaccel.pyi
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
from enum import IntEnum
from typing import cast

from av.codec.codec import Codec
from av.video.format import VideoFormat

class HWDeviceType(IntEnum):
none = cast(int, ...)
vdpau = cast(int, ...)
cuda = cast(int, ...)
vaapi = cast(int, ...)
dxva2 = cast(int, ...)
qsv = cast(int, ...)
videotoolbox = cast(int, ...)
d3d11va = cast(int, ...)
drm = cast(int, ...)
opencl = cast(int, ...)
mediacodec = cast(int, ...)
vulkan = cast(int, ...)
d3d12va = cast(int, ...)
amf = cast(int, ...)
ohcodec = cast(int, ...)
none = ...
vdpau = ...
cuda = ...
vaapi = ...
dxva2 = ...
qsv = ...
videotoolbox = ...
d3d11va = ...
drm = ...
opencl = ...
mediacodec = ...
vulkan = ...
d3d12va = ...
amf = ...
ohcodec = ...

class HWConfigMethod(IntEnum):
none = cast(int, ...)
hw_device_ctx = cast(int, ...)
hw_frame_ctx = cast(int, ...)
internal = cast(int, ...)
ad_hoc = cast(int, ...)
none = ...
hw_device_ctx = ...
hw_frame_ctx = ...
internal = ...
ad_hoc = ...

class HWConfig:
@property
Expand Down
Loading