Skip to content

Commit ce2c520

Browse files
committed
DATV modulator: fixed write_packet_cb prototype depending on FF_API_AVIO_WRITE_NONCONST value. Fixes PR #2586
1 parent 0ddbba7 commit ce2c520

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

plugins/channeltx/moddatv/tsgenerator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,11 @@ void TSGenerator::encode_frame_to_ts(AVFormatContext* oc, AVCodecContext* codec_
376376
}
377377

378378
// Write callback - stores TS packets in memory
379+
#if FF_API_AVIO_WRITE_NONCONST
379380
int TSGenerator::write_packet_cb(void* opaque, uint8_t* buf, int buf_size)
381+
#else
382+
int TSGenerator::write_packet_cb(void* opaque, const uint8_t* buf, int buf_size)
383+
#endif
380384
{
381385
std::vector<uint8_t>* buffer = static_cast<std::vector<uint8_t>*>(opaque);
382386
buffer->insert(buffer->end(), buf, buf + buf_size);

plugins/channeltx/moddatv/tsgenerator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ class TSGenerator
6767
int setup_ts_context(AVFormatContext** oc, AVCodecContext* codec_ctx);
6868
void encode_frame_to_ts(AVFormatContext* oc, AVCodecContext* codec_ctx, AVFrame* frame, int stream_idx = 0);
6969
std::pair<const AVCodec*, AVCodecContext*> create_codec_context(int fps, int bitrate, int width, int height, int duration_sec);
70+
#if FF_API_AVIO_WRITE_NONCONST
7071
static int write_packet_cb(void* opaque, uint8_t* buf, int buf_size);
72+
#else
73+
static int write_packet_cb(void* opaque, const uint8_t* buf, int buf_size);
74+
#endif
7175
static int read_packet_cb(void* opaque, uint8_t* buf, int buf_size);
7276
static int64_t seek_cb(void* opaque, int64_t offset, int whence);
7377
static double get_dvbs2_rate(double symbol_rate, DATVModSettings::DATVModulation modulation, DATVModSettings::DATVCodeRate code_rate);

0 commit comments

Comments
 (0)