Skip to content

Commit 9c05d4e

Browse files
skeskinenWyattBlue
andcommitted
Add reorder_depth setter
Co-Authored-By: WyattBlue <wyattblue@auto-editor.com>
1 parent 3d45d47 commit 9c05d4e

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

av/video/codeccontext.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,20 @@ def has_b_frames(self):
278278
"""
279279
return bool(self.ptr.has_b_frames)
280280

281+
@property
282+
def reorder_depth(self):
283+
"""Raw ``has_b_frames`` value from FFmpeg (int, not bool).
284+
285+
After :meth:`flush_buffers`, FFmpeg may reset the internal reorder
286+
heuristic. Set this to the known reorder depth *after* seeking to
287+
avoid dropped hierarchical B-frames.
288+
"""
289+
return self.ptr.has_b_frames
290+
291+
@reorder_depth.setter
292+
def reorder_depth(self, value: cython.int):
293+
self.ptr.has_b_frames = value
294+
281295
@property
282296
def coded_width(self):
283297
"""

av/video/codeccontext.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class VideoCodecContext(CodecContext):
1919
sample_aspect_ratio: Fraction | None
2020
display_aspect_ratio: Fraction | None
2121
has_b_frames: bool
22+
reorder_depth: int
2223
max_b_frames: int
2324
coded_width: int
2425
coded_height: int

0 commit comments

Comments
 (0)