angelcam / rust-ac-ffmpeg

Simple and safe Rust interface for FFmpeg libraries.
MIT License
197 stars 33 forks source link

Compatibility with libavutil >=59 #82

Open cpg314 opened 1 month ago

cpg314 commented 1 month ago

The avio_alloc_context function has changed signature, and the following patch is required for the build script to run on both the old and new version of libavutil:

diff --git a/ac-ffmpeg/src/format/io.c b/ac-ffmpeg/src/format/io.c
index 907fccd..e3800d3 100644
--- a/ac-ffmpeg/src/format/io.c
+++ b/ac-ffmpeg/src/format/io.c
@@ -2,7 +2,11 @@
 #include <libavutil/mem.h>

 typedef int read_packet_t(void*, uint8_t*, int);
+#if LIBAVUTIL_VERSION_MAJOR >= 59
+typedef int write_packet_t(void*, const uint8_t*, int);
+#else
 typedef int write_packet_t(void*, uint8_t*, int);
+#endif
 typedef int64_t seek_t(void*, int64_t, int);

 int ffw_io_is_avseek_size(int whence) {
operutka commented 1 month ago

Thanks for the patch. I'll look into it.