Skip to content
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
4 changes: 2 additions & 2 deletions av/index.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cimport libav as lib


cdef class IndexEntry:
cdef lib.AVIndexEntry *ptr
cdef _init(self, lib.AVIndexEntry *ptr)
cdef const lib.AVIndexEntry *ptr
cdef _init(self, const lib.AVIndexEntry *ptr)

cdef class IndexEntries:
cdef lib.AVStream *stream_ptr
Expand Down
14 changes: 6 additions & 8 deletions av/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


@cython.cfunc
def wrap_index_entry(ptr: cython.pointer[lib.AVIndexEntry]) -> IndexEntry:
def wrap_index_entry(ptr: cython.pointer[cython.const[lib.AVIndexEntry]]) -> IndexEntry:
obj: IndexEntry = IndexEntry(_cinit_bypass_sentinel)
obj._init(ptr)
return obj
Expand All @@ -26,7 +26,7 @@ def __cinit__(self, sentinel):
raise RuntimeError("cannot manually instantiate IndexEntry")

@cython.cfunc
def _init(self, ptr: cython.pointer[lib.AVIndexEntry]):
def _init(self, ptr: cython.pointer[cython.const[lib.AVIndexEntry]]):
self.ptr = ptr

def __repr__(self):
Expand Down Expand Up @@ -110,19 +110,17 @@ def __getitem__(self, index):
if index < 0 or index >= n:
raise IndexError(f"Index entries {index} out of bounds for size {n}")

c_idx = cython.declare(cython.int, index)
c_idx: cython.int = index
entry: cython.pointer[cython.const[lib.AVIndexEntry]]
with cython.nogil:
entry = lib.avformat_index_get_entry(self.stream_ptr, c_idx)

if entry == cython.NULL:
raise IndexError("index entry not found")

return wrap_index_entry(entry)

elif isinstance(index, slice):
start, stop, step = index.indices(len(self))
return [self[i] for i in range(start, stop, step)]

else:
raise TypeError("Index must be an integer or a slice")

Expand All @@ -135,8 +133,8 @@ def search_timestamp(

Returns an index into this object, or ``-1`` if no match is found.
"""
c_timestamp = cython.declare(int64_t, timestamp)
flags = cython.declare(cython.int, 0)
c_timestamp: int64_t = timestamp
flags: cython.int = 0

if backward:
flags |= lib.AVSEEK_FLAG_BACKWARD
Expand Down
16 changes: 1 addition & 15 deletions docs/overview/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ See the `Conda quick install <https://docs.conda.io/projects/conda/en/latest/use
Bring your own FFmpeg
---------------------

PyAV can also be compiled against your own build of FFmpeg (version ``7.0`` or higher). You can force installing PyAV from source by running:
PyAV can also be compiled against your own build of FFmpeg (version ``8.0`` or higher). You can force installing PyAV from source by running:

.. code-block:: bash
pip install av --no-binary av
Expand Down Expand Up @@ -54,20 +54,6 @@ On **MacOS**, Homebrew_ saves the day::
.. _homebrew: http://brew.sh/


Ubuntu >= 18.04 LTS
^^^^^^^^^^^^^^^^^^^

On **Ubuntu 18.04 LTS** everything can come from the default sources::

# General dependencies
sudo apt-get install -y python-dev pkg-config

# Library components
sudo apt-get install -y \
libavformat-dev libavcodec-dev libavdevice-dev \
libavutil-dev libswscale-dev libswresample-dev libavfilter-dev


Windows
^^^^^^^

Expand Down
Loading