]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_av] Add support for FFmpeg 6.0 2840/head
authorJakub Karolczyk <jakub.karolczyk@signalwire.com>
Wed, 8 May 2024 09:53:58 +0000 (10:53 +0100)
committerJakub Karolczyk <jakub.karolczyk@signalwire.com>
Fri, 11 Jul 2025 08:38:05 +0000 (09:38 +0100)
src/mod/applications/mod_av/avformat.c
src/mod/applications/mod_av/mod_av.h

index c1e00525300162297ad05677089756bd746345da..b5b844ef8aa24a2ec6747cf2cc0f5b59c5790e9b 100644 (file)
@@ -416,6 +416,7 @@ static int interrupt_cb(void *cp)
 }
  
 
+#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_6_V)
 static int mod_avformat_alloc_output_context2(AVFormatContext **avctx, const char *format, const char *filename, av_file_context_t *context)
 {
        AVFormatContext *s = avformat_alloc_context();
@@ -489,6 +490,7 @@ error:
 
        return ret;
 }
+#endif
 
 static int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt)
 {
@@ -2235,7 +2237,16 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
                return SWITCH_STATUS_SUCCESS;
        }
 
+#if (LIBAVFORMAT_VERSION_MAJOR < LIBAVFORMAT_6_V)
        mod_avformat_alloc_output_context2(&context->fc, format, (char *)file, context);
+#else
+       avformat_alloc_output_context2(&context->fc, NULL, format, (char *)file);
+
+       if (context->fc) {
+               context->fc->interrupt_callback.callback = interrupt_cb;
+               context->fc->interrupt_callback.opaque = context;
+       }
+#endif
 
        if (!context->fc) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not deduce output format from file extension\n");
index a89e6cb8f72e4980fc47c5bea68392489e3dd27f..074a2224825af8f6f5efb432e60f68b9c60f7b89 100644 (file)
@@ -42,6 +42,7 @@
 
 #define LIBAVCODEC_V 59
 #define LIBAVFORMAT_V 59
+#define LIBAVFORMAT_6_V 60
 #define LIBAVUTIL_V 57
 
 struct mod_av_globals {