__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
cimport libav as lib
from av.utils cimport flag_in_bitfield
from enum import Enum, Flag
cdef object _cinit_sentinel = object()
cdef Option wrap_option(tuple choices, const lib.AVOption *ptr):
if ptr == NULL:
return None
cdef Option obj = Option(_cinit_sentinel)
obj.ptr = ptr
obj.choices = choices
return obj
class OptionType(Enum):
FLAGS = lib.AV_OPT_TYPE_FLAGS
INT = lib.AV_OPT_TYPE_INT
INT64 = lib.AV_OPT_TYPE_INT64
DOUBLE = lib.AV_OPT_TYPE_DOUBLE
FLOAT = lib.AV_OPT_TYPE_FLOAT
STRING = lib.AV_OPT_TYPE_STRING
RATIONAL = lib.AV_OPT_TYPE_RATIONAL
BINARY = lib.AV_OPT_TYPE_BINARY
DICT = lib.AV_OPT_TYPE_DICT
UINT64 = lib.AV_OPT_TYPE_UINT64
CONST = lib.AV_OPT_TYPE_CONST
IMAGE_SIZE = lib.AV_OPT_TYPE_IMAGE_SIZE
PIXEL_FMT = lib.AV_OPT_TYPE_PIXEL_FMT
SAMPLE_FMT = lib.AV_OPT_TYPE_SAMPLE_FMT
VIDEO_RATE = lib.AV_OPT_TYPE_VIDEO_RATE
DURATION = lib.AV_OPT_TYPE_DURATION
COLOR = lib.AV_OPT_TYPE_COLOR
CHANNEL_LAYOUT = lib.AV_OPT_TYPE_CHLAYOUT
BOOL = lib.AV_OPT_TYPE_BOOL
cdef tuple _INT_TYPES = (
lib.AV_OPT_TYPE_FLAGS,
lib.AV_OPT_TYPE_INT,
lib.AV_OPT_TYPE_INT64,
lib.AV_OPT_TYPE_PIXEL_FMT,
lib.AV_OPT_TYPE_SAMPLE_FMT,
lib.AV_OPT_TYPE_DURATION,
lib.AV_OPT_TYPE_CHLAYOUT,
lib.AV_OPT_TYPE_BOOL,
)
class OptionFlags(Flag):
ENCODING_PARAM = lib.AV_OPT_FLAG_ENCODING_PARAM
DECODING_PARAM = lib.AV_OPT_FLAG_DECODING_PARAM
AUDIO_PARAM = lib.AV_OPT_FLAG_AUDIO_PARAM
VIDEO_PARAM = lib.AV_OPT_FLAG_VIDEO_PARAM
SUBTITLE_PARAM = lib.AV_OPT_FLAG_SUBTITLE_PARAM
EXPORT = lib.AV_OPT_FLAG_EXPORT
READONLY = lib.AV_OPT_FLAG_READONLY
FILTERING_PARAM = lib.AV_OPT_FLAG_FILTERING_PARAM
cdef class BaseOption:
def __cinit__(self, sentinel):
if sentinel is not _cinit_sentinel:
raise RuntimeError(f"Cannot construct av.{self.__class__.__name__}")
@property
def name(self):
return self.ptr.name
@property
def help(self):
return self.ptr.help if self.ptr.help != NULL else ""
@property
def flags(self):
return self.ptr.flags
# Option flags
@property
def is_encoding_param(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_ENCODING_PARAM)
@property
def is_decoding_param(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_DECODING_PARAM)
@property
def is_audio_param(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_AUDIO_PARAM)
@property
def is_video_param(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_VIDEO_PARAM)
@property
def is_subtitle_param(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_SUBTITLE_PARAM)
@property
def is_export(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_EXPORT)
@property
def is_readonly(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_READONLY)
@property
def is_filtering_param(self):
return flag_in_bitfield(self.ptr.flags, lib.AV_OPT_FLAG_FILTERING_PARAM)
cdef class Option(BaseOption):
@property
def type(self):
return OptionType(self.ptr.type)
@property
def offset(self):
"""
This can be used to find aliases of an option.
Options in a particular descriptor with the same offset are aliases.
"""
return self.ptr.offset
@property
def default(self):
if self.ptr.type in _INT_TYPES:
return self.ptr.default_val.i64
if self.ptr.type in (lib.AV_OPT_TYPE_DOUBLE, lib.AV_OPT_TYPE_FLOAT,
lib.AV_OPT_TYPE_RATIONAL):
return self.ptr.default_val.dbl
if self.ptr.type in (lib.AV_OPT_TYPE_STRING, lib.AV_OPT_TYPE_BINARY,
lib.AV_OPT_TYPE_IMAGE_SIZE, lib.AV_OPT_TYPE_VIDEO_RATE,
lib.AV_OPT_TYPE_COLOR):
return self.ptr.default_val.str if self.ptr.default_val.str != NULL else ""
def _norm_range(self, value):
if self.ptr.type in _INT_TYPES:
return int(value)
return value
@property
def min(self):
return self._norm_range(self.ptr.min)
@property
def max(self):
return self._norm_range(self.ptr.max)
def __repr__(self):
return (
f"<av.{self.__class__.__name__} {self.name}"
f" ({self.type} at *0x{self.offset:x}) at 0x{id(self):x}>"
)
cdef OptionChoice wrap_option_choice(const lib.AVOption *ptr, bint is_default):
if ptr == NULL:
return None
cdef OptionChoice obj = OptionChoice(_cinit_sentinel)
obj.ptr = ptr
obj.is_default = is_default
return obj
cdef class OptionChoice(BaseOption):
"""
Represents AV_OPT_TYPE_CONST options which are essentially
choices of non-const option with same unit.
"""
@property
def value(self):
return self.ptr.default_val.i64
def __repr__(self):
return f"<av.{self.__class__.__name__} {self.name} at 0x{id(self):x}>"
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| attachments | Folder | 0755 |
|
|
| audio | Folder | 0755 |
|
|
| codec | Folder | 0755 |
|
|
| container | Folder | 0755 |
|
|
| data | Folder | 0755 |
|
|
| filter | Folder | 0755 |
|
|
| sidedata | Folder | 0755 |
|
|
| subtitles | Folder | 0755 |
|
|
| video | Folder | 0755 |
|
|
| __init__.pxd | File | 0 B | 0644 |
|
| __init__.py | File | 2.07 KB | 0644 |
|
| __main__.py | File | 1.53 KB | 0644 |
|
| _core.cpython-313-aarch64-linux-gnu.so | File | 66.98 KB | 0644 |
|
| _core.pyi | File | 251 B | 0644 |
|
| _core.pyx | File | 1.92 KB | 0644 |
|
| about.py | File | 23 B | 0644 |
|
| bitstream.cpython-313-aarch64-linux-gnu.so | File | 69.05 KB | 0644 |
|
| bitstream.pxd | File | 184 B | 0644 |
|
| bitstream.pyi | File | 389 B | 0644 |
|
| bitstream.pyx | File | 2.73 KB | 0644 |
|
| buffer.cpython-313-aarch64-linux-gnu.so | File | 69.18 KB | 0644 |
|
| buffer.pxd | File | 126 B | 0644 |
|
| buffer.pyi | File | 316 B | 0644 |
|
| buffer.pyx | File | 1.6 KB | 0644 |
|
| bytesource.cpython-313-aarch64-linux-gnu.so | File | 68.87 KB | 0644 |
|
| bytesource.pxd | File | 241 B | 0644 |
|
| bytesource.pyx | File | 1.07 KB | 0644 |
|
| datasets.py | File | 3.02 KB | 0644 |
|
| descriptor.cpython-313-aarch64-linux-gnu.so | File | 69.02 KB | 0644 |
|
| descriptor.pxd | File | 519 B | 0644 |
|
| descriptor.pyi | File | 121 B | 0644 |
|
| descriptor.pyx | File | 2.21 KB | 0644 |
|
| dictionary.cpython-313-aarch64-linux-gnu.so | File | 134.56 KB | 0644 |
|
| dictionary.pxd | File | 174 B | 0644 |
|
| dictionary.pyi | File | 388 B | 0644 |
|
| dictionary.pyx | File | 1.52 KB | 0644 |
|
| error.cpython-313-aarch64-linux-gnu.so | File | 262.11 KB | 0644 |
|
| error.pxd | File | 89 B | 0644 |
|
| error.pyi | File | 3.13 KB | 0644 |
|
| error.pyx | File | 12.12 KB | 0644 |
|
| format.cpython-313-aarch64-linux-gnu.so | File | 133.55 KB | 0644 |
|
| format.pxd | File | 234 B | 0644 |
|
| format.pyi | File | 1.37 KB | 0644 |
|
| format.pyx | File | 5.57 KB | 0644 |
|
| frame.cpython-313-aarch64-linux-gnu.so | File | 69.44 KB | 0644 |
|
| frame.pxd | File | 411 B | 0644 |
|
| frame.pyi | File | 507 B | 0644 |
|
| frame.pyx | File | 4.82 KB | 0644 |
|
| logging.cpython-313-aarch64-linux-gnu.so | File | 133.65 KB | 0644 |
|
| logging.pxd | File | 24 B | 0644 |
|
| logging.pyi | File | 885 B | 0644 |
|
| logging.pyx | File | 8.87 KB | 0644 |
|
| opaque.cpython-313-aarch64-linux-gnu.so | File | 68.95 KB | 0644 |
|
| opaque.pxd | File | 237 B | 0644 |
|
| opaque.pyx | File | 833 B | 0644 |
|
| option.cpython-313-aarch64-linux-gnu.so | File | 135.05 KB | 0644 |
|
| option.pxd | File | 366 B | 0644 |
|
| option.pyi | File | 1.28 KB | 0644 |
|
| option.pyx | File | 5.02 KB | 0644 |
|
| packet.cpython-313-aarch64-linux-gnu.so | File | 133.67 KB | 0644 |
|
| packet.pxd | File | 447 B | 0644 |
|
| packet.pyi | File | 559 B | 0644 |
|
| packet.pyx | File | 5.77 KB | 0644 |
|
| plane.cpython-313-aarch64-linux-gnu.so | File | 68.91 KB | 0644 |
|
| plane.pxd | File | 196 B | 0644 |
|
| plane.pyi | File | 169 B | 0644 |
|
| plane.pyx | File | 564 B | 0644 |
|
| py.typed | File | 0 B | 0644 |
|
| stream.cpython-313-aarch64-linux-gnu.so | File | 133.61 KB | 0644 |
|
| stream.pxd | File | 635 B | 0644 |
|
| stream.pyi | File | 1.29 KB | 0644 |
|
| stream.pyx | File | 7.19 KB | 0644 |
|
| utils.cpython-313-aarch64-linux-gnu.so | File | 66.89 KB | 0644 |
|
| utils.pxd | File | 452 B | 0644 |
|
| utils.pyx | File | 2.06 KB | 0644 |
|