diff --git a/av/frame.pyi b/av/frame.pyi index 7c34e91bf..9af81dcfe 100644 --- a/av/frame.pyi +++ b/av/frame.pyi @@ -9,10 +9,13 @@ class SideData(TypedDict, total=False): class Frame: dts: int | None pts: int | None - time: float | None time_base: Fraction - is_corrupt: bool side_data: SideData opaque: object - + @property + def time(self) -> float | None: ... + @property + def is_corrupt(self) -> bool: ... + @property + def key_frame(self) -> bool: ... def make_writable(self) -> None: ... diff --git a/av/frame.pyx b/av/frame.pyx index a8871fd8f..1084ca45e 100644 --- a/av/frame.pyx +++ b/av/frame.pyx @@ -132,6 +132,16 @@ cdef class Frame: """ return self.ptr.decode_error_flags != 0 or bool(self.ptr.flags & lib.AV_FRAME_FLAG_CORRUPT) + @property + def key_frame(self): + """Is this frame a key frame? + + Wraps :ffmpeg:`AVFrame.key_frame`. + + """ + return bool(self.ptr.key_frame) + + @property def side_data(self): if self._side_data is None: diff --git a/av/video/frame.pyi b/av/video/frame.pyi index 29f961ba4..3300e8607 100644 --- a/av/video/frame.pyi +++ b/av/video/frame.pyi @@ -32,7 +32,6 @@ class VideoFrame(Frame): planes: tuple[VideoPlane, ...] width: int height: int - key_frame: bool interlaced_frame: bool pict_type: int colorspace: int diff --git a/av/video/frame.pyx b/av/video/frame.pyx index 4fb463c8c..bfc74c40a 100644 --- a/av/video/frame.pyx +++ b/av/video/frame.pyx @@ -170,23 +170,11 @@ cdef class VideoFrame(Frame): """Width of the image, in pixels.""" return self.ptr.width - @property def height(self): """Height of the image, in pixels.""" return self.ptr.height - - @property - def key_frame(self): - """Is this frame a key frame? - - Wraps :ffmpeg:`AVFrame.key_frame`. - - """ - return self.ptr.key_frame - - @property def interlaced_frame(self): """Is this frame an interlaced or progressive? @@ -196,7 +184,6 @@ cdef class VideoFrame(Frame): """ return self.ptr.interlaced_frame - @property def pict_type(self): """One of :class:`.PictureType`.