From c334ffeeecddc2e454cc761a2d8a4a76647da352 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 3 Jan 2026 13:36:43 +0100 Subject: [PATCH] DATV modulator: use the libavcodec version to figure out write_packet_cb prototype --- plugins/channeltx/moddatv/tsgenerator.cpp | 6 +++--- plugins/channeltx/moddatv/tsgenerator.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/channeltx/moddatv/tsgenerator.cpp b/plugins/channeltx/moddatv/tsgenerator.cpp index 23478ca35..ce5f979cc 100644 --- a/plugins/channeltx/moddatv/tsgenerator.cpp +++ b/plugins/channeltx/moddatv/tsgenerator.cpp @@ -17,8 +17,8 @@ extern "C" { -#include "libavcodec/avcodec.h" -#include "libavformat/avformat.h" +#include +#include #include #include @@ -376,7 +376,7 @@ void TSGenerator::encode_frame_to_ts(AVFormatContext* oc, AVCodecContext* codec_ } // Write callback - stores TS packets in memory -#if FF_API_AVIO_WRITE_NONCONST +#if LIBAVFORMAT_VERSION_INT < ((61 << 16) | (0 << 8) | 0) int TSGenerator::write_packet_cb(void* opaque, uint8_t* buf, int buf_size) #else int TSGenerator::write_packet_cb(void* opaque, const uint8_t* buf, int buf_size) diff --git a/plugins/channeltx/moddatv/tsgenerator.h b/plugins/channeltx/moddatv/tsgenerator.h index 6166531f3..a2acc6af7 100644 --- a/plugins/channeltx/moddatv/tsgenerator.h +++ b/plugins/channeltx/moddatv/tsgenerator.h @@ -21,6 +21,7 @@ #include #include #include +#include #include "datvmodsettings.h" @@ -67,7 +68,7 @@ private: int setup_ts_context(AVFormatContext** oc, AVCodecContext* codec_ctx); void encode_frame_to_ts(AVFormatContext* oc, AVCodecContext* codec_ctx, AVFrame* frame, int stream_idx = 0); std::pair create_codec_context(int fps, int bitrate, int width, int height, int duration_sec); -#if FF_API_AVIO_WRITE_NONCONST +#if LIBAVFORMAT_VERSION_INT < ((61 << 16) | (0 << 8) | 0) static int write_packet_cb(void* opaque, uint8_t* buf, int buf_size); #else static int write_packet_cb(void* opaque, const uint8_t* buf, int buf_size);