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/container/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ cdef int pyav_io_open_gil(lib.AVFormatContext *s,
pb[0] = pyio_file.iocontext
return 0

except Exception as e:
except Exception:
return stash_exception()


Expand All @@ -117,7 +117,7 @@ cdef int pyav_io_close_gil(lib.AVFormatContext *s, lib.AVIOContext *pb) noexcept
else:
result = pyio_close_gil(pb)

except Exception as e:
except Exception:
stash_exception()
result = lib.AVERROR_UNKNOWN # Or another appropriate error code

Expand Down
12 changes: 6 additions & 6 deletions av/container/pyio.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cdef int pyio_read_gil(void *opaque, uint8_t *buf, int buf_size) noexcept:
if not res:
return lib.AVERROR_EOF
return len(res)
except Exception as e:
except Exception:
return stash_exception()


Expand All @@ -108,7 +108,7 @@ cdef int pyio_write_gil(void *opaque, const uint8_t *buf, int buf_size) noexcept
bytes_written = ret_value if isinstance(ret_value, int) else buf_size
self.pos += bytes_written
return bytes_written
except Exception as e:
except Exception:
return stash_exception()


Expand Down Expand Up @@ -140,15 +140,15 @@ cdef int64_t pyio_seek_gil(void *opaque, int64_t offset, int whence):
else:
res = self.ftell()
return res
except Exception as e:
except Exception:
return stash_exception()


cdef int pyio_close_gil(lib.AVIOContext *pb):
try:
return lib.avio_close(pb)

except Exception as e:
except Exception:
stash_exception()


Expand All @@ -158,12 +158,12 @@ cdef int pyio_close_custom_gil(lib.AVIOContext *pb):
self = <PyIOFile>pb.opaque

# Flush bytes in the AVIOContext buffers to the custom I/O
result = lib.avio_flush(pb)
lib.avio_flush(pb)

if self.fclose is not None:
self.fclose()

return 0

except Exception as e:
except Exception:
stash_exception()
2 changes: 1 addition & 1 deletion av/logging.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ cdef void log_callback(void *ptr, int level, const char *format, lib.va_list arg
with gil:
try:
log_callback_gil(level, name, message)
except Exception as e:
except Exception:
fprintf(stderr, "av.logging: exception while handling %s[%d]: %s\n",
name, level, message)
# For some reason lib.PyErr_PrintEx(0) won't work.
Expand Down
1 change: 0 additions & 1 deletion av/subtitles/subtitle.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ cdef class SubtitleSet:
"""
def __cinit__(self, SubtitleProxy proxy):
self.proxy = proxy
cdef int i
self.rects = tuple(build_subtitle(self, i) for i in range(self.proxy.struct.num_rects))

def __repr__(self):
Expand Down
1 change: 0 additions & 1 deletion av/video/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ cdef copy_bytes_to_plane(img_bytes, VideoPlane plane, unsigned int bytes_per_pix
cdef const uint8_t[:] i_buf = img_bytes
cdef size_t i_pos = 0
cdef size_t i_stride = plane.width * bytes_per_pixel
cdef size_t i_size = plane.height * i_stride

cdef uint8_t[:] o_buf = plane
cdef size_t o_pos = 0
Expand Down
22 changes: 10 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,18 @@ def parse_cflags(raw_flags):
library_dirs=extension_extra["library_dirs"],
)

compiler_directives = {
"c_string_type": "str",
"c_string_encoding": "ascii",
"embedsignature": True,
"binding": False,
"language_level": 3,
}

# Add the cythonized loudnorm extension to ext_modules
ext_modules = cythonize(
loudnorm_extension,
compiler_directives={
"c_string_type": "str",
"c_string_encoding": "ascii",
"embedsignature": True,
"language_level": 3,
},
compiler_directives=compiler_directives,
build_dir="src",
include_path=["include"],
)
Expand All @@ -223,12 +226,7 @@ def parse_cflags(raw_flags):
library_dirs=extension_extra["library_dirs"],
sources=[pyx_path],
),
compiler_directives={
"c_string_type": "str",
"c_string_encoding": "ascii",
"embedsignature": True,
"language_level": 3,
},
compiler_directives=compiler_directives,
build_dir="src",
include_path=["include"],
)
Expand Down
Loading