Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packet set is_keyframe #1208

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions av/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ cdef class Frame:
return None
return self.ptr.pkt_dts

def __set__(self, value):
if value is None:
self.ptr.pkt_dts = lib.AV_NOPTS_VALUE
else:
self.ptr.pkt_dts = value

property pts:
"""
The presentation timestamp in :attr:`time_base` units for this frame.
Expand Down
12 changes: 12 additions & 0 deletions av/packet.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,17 @@ cdef class Packet(Buffer):
property is_keyframe:
def __get__(self): return bool(self.ptr.flags & lib.AV_PKT_FLAG_KEY)

def __set__(self, v):
if v:
self.ptr.flags |= lib.AV_PKT_FLAG_KEY
else:
self.ptr.flags &= ~(lib.AV_PKT_FLAG_KEY)

property is_corrupt:
def __get__(self): return bool(self.ptr.flags & lib.AV_PKT_FLAG_CORRUPT)

def __set__(self, v):
if v:
self.ptr.flags |= lib.AV_PKT_FLAG_CORRUPT
else:
self.ptr.flags &= ~(lib.AV_PKT_FLAG_CORRUPT)
Loading