Skip to content

Commit 9fc1878

Browse files
committed
Move key_frame attribute to Frame class
1 parent 2341842 commit 9fc1878

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

av/frame.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ class SideData(TypedDict, total=False):
99
class Frame:
1010
dts: int | None
1111
pts: int | None
12-
time: float | None
1312
time_base: Fraction
14-
is_corrupt: bool
1513
side_data: SideData
1614
opaque: object
17-
15+
@property
16+
def time(self) -> float | None: ...
17+
@property
18+
def is_corrupt(self) -> bool: ...
19+
@property
20+
def key_frame(self) -> bool: ...
1821
def make_writable(self) -> None: ...

av/frame.pyx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ cdef class Frame:
132132
"""
133133
return self.ptr.decode_error_flags != 0 or bool(self.ptr.flags & lib.AV_FRAME_FLAG_CORRUPT)
134134

135+
@property
136+
def key_frame(self):
137+
"""Is this frame a key frame?
138+
139+
Wraps :ffmpeg:`AVFrame.key_frame`.
140+
141+
"""
142+
return bool(self.ptr.key_frame)
143+
144+
135145
@property
136146
def side_data(self):
137147
if self._side_data is None:

av/video/frame.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class VideoFrame(Frame):
3232
planes: tuple[VideoPlane, ...]
3333
width: int
3434
height: int
35-
key_frame: bool
3635
interlaced_frame: bool
3736
pict_type: int
3837
colorspace: int

av/video/frame.pyx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,11 @@ cdef class VideoFrame(Frame):
170170
"""Width of the image, in pixels."""
171171
return self.ptr.width
172172

173-
174173
@property
175174
def height(self):
176175
"""Height of the image, in pixels."""
177176
return self.ptr.height
178177

179-
180-
@property
181-
def key_frame(self):
182-
"""Is this frame a key frame?
183-
184-
Wraps :ffmpeg:`AVFrame.key_frame`.
185-
186-
"""
187-
return self.ptr.key_frame
188-
189-
190178
@property
191179
def interlaced_frame(self):
192180
"""Is this frame an interlaced or progressive?
@@ -196,7 +184,6 @@ cdef class VideoFrame(Frame):
196184
"""
197185
return self.ptr.interlaced_frame
198186

199-
200187
@property
201188
def pict_type(self):
202189
"""One of :class:`.PictureType`.

0 commit comments

Comments
 (0)