Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
|
|
@ -1,9 +1,9 @@
|
|||
from enum import Flag
|
||||
from enum import IntEnum, IntFlag
|
||||
|
||||
import cython
|
||||
from cython.cimports import libav as lib
|
||||
from cython.cimports.av.error import err_check
|
||||
from cython.cimports.av.packet import Packet
|
||||
from cython.cimports.av.index import wrap_index_entries
|
||||
from cython.cimports.av.utils import (
|
||||
avdict_to_dict,
|
||||
avrational_to_fraction,
|
||||
|
|
@ -12,7 +12,7 @@ from cython.cimports.av.utils import (
|
|||
)
|
||||
|
||||
|
||||
class Disposition(Flag):
|
||||
class Disposition(IntFlag):
|
||||
default = 1 << 0
|
||||
dub = 1 << 1
|
||||
original = 1 << 2
|
||||
|
|
@ -34,6 +34,16 @@ class Disposition(Flag):
|
|||
multilayer = 1 << 21
|
||||
|
||||
|
||||
class Discard(IntEnum):
|
||||
none = lib.AVDISCARD_NONE
|
||||
default = lib.AVDISCARD_DEFAULT
|
||||
nonref = lib.AVDISCARD_NONREF
|
||||
bidir = lib.AVDISCARD_BIDIR
|
||||
nonintra = lib.AVDISCARD_NONINTRA
|
||||
nonkey = lib.AVDISCARD_NONKEY
|
||||
all = lib.AVDISCARD_ALL
|
||||
|
||||
|
||||
_cinit_bypass_sentinel = cython.declare(object, object())
|
||||
|
||||
|
||||
|
|
@ -106,6 +116,7 @@ class Stream:
|
|||
):
|
||||
self.container = container
|
||||
self.ptr = stream
|
||||
self.index_entries = wrap_index_entries(self.ptr)
|
||||
|
||||
self.codec_context = codec_context
|
||||
if self.codec_context:
|
||||
|
|
@ -131,6 +142,9 @@ class Stream:
|
|||
if name == "disposition":
|
||||
self.ptr.disposition = value
|
||||
return
|
||||
if name == "discard":
|
||||
self.ptr.discard = Discard(value).value
|
||||
return
|
||||
if name == "time_base":
|
||||
to_avrational(value, cython.address(self.ptr.time_base))
|
||||
return
|
||||
|
|
@ -267,6 +281,19 @@ class Stream:
|
|||
def disposition(self):
|
||||
return Disposition(self.ptr.disposition)
|
||||
|
||||
@property
|
||||
def discard(self):
|
||||
"""
|
||||
Controls which packets of this stream are discarded by the demuxer.
|
||||
|
||||
Set this to e.g. :attr:`Discard.all` on streams you don't need so that
|
||||
:meth:`.Container.demux` and :meth:`.Container.seek` skip them, avoiding
|
||||
the cost of synchronizing streams you never read.
|
||||
|
||||
:type: Discard
|
||||
"""
|
||||
return Discard(self.ptr.discard)
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
|
|
@ -274,9 +301,11 @@ class Stream:
|
|||
|
||||
:type: Literal["audio", "video", "subtitle", "data", "attachment"]
|
||||
"""
|
||||
return lib.av_get_media_type_string(self.ptr.codecpar.codec_type)
|
||||
media_type = lib.av_get_media_type_string(self.ptr.codecpar.codec_type)
|
||||
return "unknown" if media_type == cython.NULL else media_type
|
||||
|
||||
|
||||
@cython.final
|
||||
@cython.cclass
|
||||
class DataStream(Stream):
|
||||
def __repr__(self):
|
||||
|
|
@ -295,6 +324,7 @@ class DataStream(Stream):
|
|||
return desc.name
|
||||
|
||||
|
||||
@cython.final
|
||||
@cython.cclass
|
||||
class AttachmentStream(Stream):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue