Skip to content

Commit 637b21a

Browse files
committed
Type stub what is read only
1 parent 89d131c commit 637b21a

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

av/codec/context.pxd

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,27 @@ cdef class CodecContext:
1313
# Whether AVCodecContext.extradata should be de-allocated upon destruction.
1414
cdef bint extradata_set
1515

16-
# Used as a signal that this is within a stream, and also for us to access
17-
# that stream. This is set "manually" by the stream after constructing
18-
# this object.
16+
# Used as a signal that this is within a stream, and also for us to access that
17+
# stream. This is set "manually" by the stream after constructing this object.
1918
cdef int stream_index
2019

2120
cdef lib.AVCodecParserContext *parser
22-
2321
cdef _init(self, lib.AVCodecContext *ptr, const lib.AVCodec *codec)
2422

23+
# Public API.
24+
cdef readonly bint is_open
2525
cdef readonly Codec codec
26-
2726
cdef public dict options
28-
29-
# Public API.
3027
cpdef open(self, bint strict=?)
31-
cdef readonly bint is_open
3228

3329
# Wraps both versions of the transcode API, returning lists.
3430
cpdef encode(self, Frame frame=?)
3531
cpdef decode(self, Packet packet=?)
36-
3732
cpdef flush_buffers(self)
3833

3934
# Used by both transcode APIs to setup user-land objects.
40-
# TODO: Remove the `Packet` from `_setup_decoded_frame` (because flushing
41-
# packets are bogus). It should take all info it needs from the context and/or stream.
35+
# TODO: Remove the `Packet` from `_setup_decoded_frame` (because flushing packets
36+
# are bogus). It should take all info it needs from the context and/or stream.
4237
cdef _prepare_and_time_rebase_frames_for_encode(self, Frame frame)
4338
cdef _prepare_frames_for_encode(self, Frame frame)
4439
cdef _setup_encoded_packet(self, Packet)

av/codec/context.pyi

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,20 @@ class Flags2(EnumFlag):
5555
RO_FLUSH_NOOP: int
5656

5757
class CodecContext:
58-
extradata: bytes | None
59-
extradata_size: int
6058
name: str
61-
codec: Codec
62-
options: dict[str, str]
6359
type: Literal["video", "audio", "data", "subtitle", "attachment"]
60+
options: dict[str, str]
6461
profile: str | None
62+
extradata: bytes | None
6563
time_base: Fraction
6664
codec_tag: str
6765
bit_rate: int | None
68-
max_bit_rate: int | None
6966
bit_rate_tolerance: int
7067
thread_count: int
7168
thread_type: Any
7269
skip_frame: Any
7370

74-
# flgas
71+
# flags
7572
unaligned: bool
7673
qscale: bool
7774
four_mv: bool
@@ -93,14 +90,21 @@ class CodecContext:
9390
ac_pred: bool
9491
interlaced_me: bool
9592
closed_gop: bool
96-
delay: bool
9793

9894
@property
9995
def is_open(self) -> bool: ...
10096
@property
10197
def is_encoder(self) -> bool: ...
10298
@property
10399
def is_decoder(self) -> bool: ...
100+
@property
101+
def codec(self) -> Codec: ...
102+
@property
103+
def max_bit_rate(self) -> int | None: ...
104+
@property
105+
def delay(self) -> bool: ...
106+
@property
107+
def extradata_size(self) -> int: ...
104108
def open(self, strict: bool = True) -> None: ...
105109
@staticmethod
106110
def create(

0 commit comments

Comments
 (0)