From 22af9a81ef7ea28b4766595fcedc9fc2a7d14d25 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Fri, 4 Jul 2025 21:23:08 -0400 Subject: [PATCH] Avoid setting channel variable --- av/audio/layout.pyx | 6 ++---- setup.py | 19 ------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/av/audio/layout.pyx b/av/audio/layout.pyx index ea259d0fd..0936075ef 100644 --- a/av/audio/layout.pyx +++ b/av/audio/layout.pyx @@ -52,16 +52,14 @@ cdef class AudioLayout: @property def channels(self): - cdef lib.AVChannel channel cdef char buf[16] cdef char buf2[128] results = [] for index in range(self.layout.nb_channels): - channel = lib.av_channel_layout_channel_from_index(&self.layout, index); - size = lib.av_channel_name(buf, sizeof(buf), channel) - 1 - size2 = lib.av_channel_description(buf2, sizeof(buf2), channel) - 1 + size = lib.av_channel_name(buf, sizeof(buf), lib.av_channel_layout_channel_from_index(&self.layout, index)) - 1 + size2 = lib.av_channel_description(buf2, sizeof(buf2), lib.av_channel_layout_channel_from_index(&self.layout, index)) - 1 results.append( AudioChannel( PyBytes_FromStringAndSize(buf, size).decode("utf-8"), diff --git a/setup.py b/setup.py index a96e0a019..ebc2146fe 100644 --- a/setup.py +++ b/setup.py @@ -26,21 +26,6 @@ old_embed_signature = EmbedSignature._embed_signature -def insert_enum_in_generated_files(source): - # Work around Cython failing to add `enum` to `AVChannel` type. - # TODO: Make Cython bug report - if source.endswith(".c"): - with open(source, "r") as file: - content = file.read() - - # Replace "AVChannel __pyx_v_channel;" with "enum AVChannel __pyx_v_channel;" - modified_content = re.sub( - r"\b(?