Skip to content

Commit 20a5262

Browse files
committed
Use flags instead of deprecated properties
1 parent 9fc1878 commit 20a5262

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

av/frame.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ cdef class Frame:
139139
Wraps :ffmpeg:`AVFrame.key_frame`.
140140
141141
"""
142-
return bool(self.ptr.key_frame)
142+
return bool(self.ptr.flags & lib.AV_FRAME_FLAG_KEY)
143143

144144

145145
@property

av/video/frame.pyx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,9 @@ cdef class VideoFrame(Frame):
177177

178178
@property
179179
def interlaced_frame(self):
180-
"""Is this frame an interlaced or progressive?
180+
"""Is this frame an interlaced or progressive?"""
181181

182-
Wraps :ffmpeg:`AVFrame.interlaced_frame`.
183-
184-
"""
185-
return self.ptr.interlaced_frame
182+
return bool(self.ptr.flags & lib.AV_FRAME_FLAG_INTERLACED)
186183

187184
@property
188185
def pict_type(self):

include/libavcodec/avcodec.pxd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ cdef extern from "libavcodec/avcodec.h" nogil:
135135

136136
cdef enum:
137137
AV_FRAME_FLAG_CORRUPT
138+
AV_FRAME_FLAG_KEY
139+
AV_FRAME_FLAG_DISCARD
140+
AV_FRAME_FLAG_INTERLACED
138141

139142
cdef enum:
140143
FF_COMPLIANCE_VERY_STRICT
@@ -368,19 +371,16 @@ cdef extern from "libavcodec/avcodec.h" nogil:
368371
uint8_t **extended_data
369372

370373
int format # Should be AVPixelFormat or AVSampleFormat
371-
int key_frame # 0 or 1.
372374
AVPictureType pict_type
373375

374-
int interlaced_frame # 0 or 1.
375-
376376
int width
377377
int height
378378

379379
int nb_side_data
380380
AVFrameSideData **side_data
381381

382-
int nb_samples # Audio samples
383-
int sample_rate # Audio Sample rate
382+
int nb_samples
383+
int sample_rate
384384

385385
AVChannelLayout ch_layout
386386

0 commit comments

Comments
 (0)