Skip to content

Commit

Permalink
Use flags instead of deprecated properties
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Nov 10, 2024
1 parent 9fc1878 commit 20a5262
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion av/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions av/video/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions include/libavcodec/avcodec.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 20a5262

Please sign in to comment.