From a2ed9607b62d3dd7b71a11795689c8e47c68c740 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Sun, 10 Nov 2024 02:02:08 -0500 Subject: [PATCH] Use flags instead of deprecated properties --- av/frame.pyx | 2 +- av/video/frame.pyx | 7 ++----- include/libavcodec/avcodec.pxd | 10 +++++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/av/frame.pyx b/av/frame.pyx index 1084ca45e..57681bbcd 100644 --- a/av/frame.pyx +++ b/av/frame.pyx @@ -139,7 +139,7 @@ cdef class Frame: Wraps :ffmpeg:`AVFrame.key_frame`. """ - return bool(self.ptr.key_frame) + return bool(self.ptr.flags & lib.AV_FRAME_FLAG_KEY) @property diff --git a/av/video/frame.pyx b/av/video/frame.pyx index bfc74c40a..e5cd523b5 100644 --- a/av/video/frame.pyx +++ b/av/video/frame.pyx @@ -177,12 +177,9 @@ cdef class VideoFrame(Frame): @property def interlaced_frame(self): - """Is this frame an interlaced or progressive? + """Is this frame an interlaced or progressive?""" - Wraps :ffmpeg:`AVFrame.interlaced_frame`. - - """ - return self.ptr.interlaced_frame + return bool(self.ptr.flags & lib.AV_FRAME_FLAG_INTERLACED) @property def pict_type(self): diff --git a/include/libavcodec/avcodec.pxd b/include/libavcodec/avcodec.pxd index 71121e976..d680e8b13 100644 --- a/include/libavcodec/avcodec.pxd +++ b/include/libavcodec/avcodec.pxd @@ -135,6 +135,9 @@ cdef extern from "libavcodec/avcodec.h" nogil: cdef enum: AV_FRAME_FLAG_CORRUPT + AV_FRAME_FLAG_KEY + AV_FRAME_FLAG_DISCARD + AV_FRAME_FLAG_INTERLACED cdef enum: FF_COMPLIANCE_VERY_STRICT @@ -368,19 +371,16 @@ cdef extern from "libavcodec/avcodec.h" nogil: uint8_t **extended_data int format # Should be AVPixelFormat or AVSampleFormat - int key_frame # 0 or 1. AVPictureType pict_type - int interlaced_frame # 0 or 1. - int width int height int nb_side_data AVFrameSideData **side_data - int nb_samples # Audio samples - int sample_rate # Audio Sample rate + int nb_samples + int sample_rate AVChannelLayout ch_layout