From b71327966de89b2f3dc53155b8e76c1bcdc2684f Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Mon, 19 Jan 2026 01:43:46 -0500 Subject: [PATCH 1/2] Removed deprecated avformat_network_init func --- av/_core.pyx | 1 - include/libavformat/avformat.pxd | 1 - 2 files changed, 2 deletions(-) diff --git a/av/_core.pyx b/av/_core.pyx index edca772f5..b87ef8824 100644 --- a/av/_core.pyx +++ b/av/_core.pyx @@ -1,7 +1,6 @@ cimport libav as lib # Initialise libraries. -lib.avformat_network_init() lib.avdevice_register_all() # Exports. diff --git a/include/libavformat/avformat.pxd b/include/libavformat/avformat.pxd index 3816b46fa..3a2218f06 100644 --- a/include/libavformat/avformat.pxd +++ b/include/libavformat/avformat.pxd @@ -6,7 +6,6 @@ cdef extern from "libavformat/avformat.h" nogil: cdef int avformat_version() cdef char* avformat_configuration() cdef char* avformat_license() - cdef void avformat_network_init() cdef int64_t INT64_MIN From 80422e52a30e1450ca95ac58e18c2d16425a9c83 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Mon, 19 Jan 2026 01:47:43 -0500 Subject: [PATCH 2/2] Make av/core pure --- av/{_core.pyx => _core.py} | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) rename av/{_core.pyx => _core.py} (75%) diff --git a/av/_core.pyx b/av/_core.py similarity index 75% rename from av/_core.pyx rename to av/_core.py index b87ef8824..2384fa457 100644 --- a/av/_core.pyx +++ b/av/_core.py @@ -1,22 +1,23 @@ -cimport libav as lib +import cython +import cython.cimports.libav as lib -# Initialise libraries. lib.avdevice_register_all() # Exports. time_base = lib.AV_TIME_BASE -cdef decode_version(v): +@cython.cfunc +def decode_version(v): if v < 0: return (-1, -1, -1) - cdef int major = (v >> 16) & 0xff - cdef int minor = (v >> 8) & 0xff - cdef int micro = (v) & 0xff - + major: cython.int = (v >> 16) & 0xFF + minor: cython.int = (v >> 8) & 0xFF + micro: cython.int = (v) & 0xFF return (major, minor, micro) + # Return an informative version string. # This usually is the actual release version number or a git commit # description. This string has no fixed format and can change any time. It @@ -27,37 +28,37 @@ "libavutil": dict( version=decode_version(lib.avutil_version()), configuration=lib.avutil_configuration(), - license=lib.avutil_license() + license=lib.avutil_license(), ), "libavcodec": dict( version=decode_version(lib.avcodec_version()), configuration=lib.avcodec_configuration(), - license=lib.avcodec_license() + license=lib.avcodec_license(), ), "libavformat": dict( version=decode_version(lib.avformat_version()), configuration=lib.avformat_configuration(), - license=lib.avformat_license() + license=lib.avformat_license(), ), "libavdevice": dict( version=decode_version(lib.avdevice_version()), configuration=lib.avdevice_configuration(), - license=lib.avdevice_license() + license=lib.avdevice_license(), ), "libavfilter": dict( version=decode_version(lib.avfilter_version()), configuration=lib.avfilter_configuration(), - license=lib.avfilter_license() + license=lib.avfilter_license(), ), "libswscale": dict( version=decode_version(lib.swscale_version()), configuration=lib.swscale_configuration(), - license=lib.swscale_license() + license=lib.swscale_license(), ), "libswresample": dict( version=decode_version(lib.swresample_version()), configuration=lib.swresample_configuration(), - license=lib.swresample_license() + license=lib.swresample_license(), ), }