Skip to content

Commit 03d394c

Browse files
committed
Add some documentation
Signed-off-by: Max Ehrlich <queuecumber@protonmail.com>
1 parent 6c59e69 commit 03d394c

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

av/indexentries.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ def wrap_index_entries(ptr: cython.pointer[lib.AVStream]) -> IndexEntries:
1717

1818
@cython.cclass
1919
class IndexEntries:
20+
"""A sequence-like view of FFmpeg's per-stream index entries.
21+
22+
Exposed as :attr:`~av.stream.Stream.index_entries`.
23+
24+
The index is provided by the demuxer and may be empty or incomplete depending
25+
on the container format. This is useful for fast multi-seek loops (e.g., decoding
26+
at a lower-than-native framerate).
27+
"""
2028
def __cinit__(self, sentinel):
2129
if sentinel is _cinit_bypass_sentinel:
2230
return
@@ -62,6 +70,12 @@ def __getitem__(self, index):
6270
raise TypeError("Index must be an integer or a slice")
6371

6472
def search_timestamp(self, timestamp, *, backward: bool = True, any_frame: bool = False):
73+
"""Search the underlying index for ``timestamp``.
74+
75+
This wraps FFmpeg's ``av_index_search_timestamp``.
76+
77+
Returns an index into this object, or ``-1`` if no match is found.
78+
"""
6579
c_timestamp = cython.declare(int64_t, timestamp)
6680
flags = cython.declare(cython.int, 0)
6781

av/indexentry.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ def wrap_index_entry(ptr: cython.pointer[lib.AVIndexEntry]) -> IndexEntry:
1414

1515
@cython.cclass
1616
class IndexEntry:
17+
"""A single entry from a stream's index.
18+
19+
This is a thin wrapper around FFmpeg's ``AVIndexEntry``.
20+
21+
The exact meaning of the fields depends on the container/demuxer.
22+
"""
1723
def __cinit__(self, sentinel):
1824
if sentinel is not _cinit_bypass_sentinel:
1925
raise RuntimeError("cannot manually instantiate IndexEntry")

0 commit comments

Comments
 (0)