From 4ca8b0a3add7051d0580a03f57272835b51b92ed Mon Sep 17 00:00:00 2001 From: BPanther Date: Sun, 4 Aug 2024 14:09:20 +0200 Subject: [PATCH] fix for ffmpeg 7.x --- src/driver/streamts.cpp | 8 ++++++-- src/driver/streamts.h | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index d91c726f5..e680dba4b 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -123,7 +123,7 @@ bool CStreamInstance::Stop() return (OpenThreads::Thread::join() == 0); } -bool CStreamInstance::Send(ssize_t r, unsigned char *_buf) +bool CStreamInstance::Send(ssize_t r, const unsigned char *_buf) { //OpenThreads::ScopedLock m_lock(mutex); stream_fds_t cfds; @@ -136,7 +136,7 @@ bool CStreamInstance::Send(ssize_t r, unsigned char *_buf) for (stream_fds_t::iterator it = cfds.begin(); it != cfds.end(); ++it) { int i = 10; - unsigned char *b = _buf ? _buf : buf; + const unsigned char *b = _buf ? _buf : buf; ssize_t count = r; do { @@ -837,7 +837,11 @@ CStreamStream::~CStreamStream() Close(); } +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 0, 0) +int CStreamStream::write_packet(void *opaque, const uint8_t *buffer, int buf_size) +#else int CStreamStream::write_packet(void *opaque, uint8_t *buffer, int buf_size) +#endif { CStreamStream *st = (CStreamStream *) opaque; st->Send(buf_size, buffer); diff --git a/src/driver/streamts.h b/src/driver/streamts.h index 98f686f8e..6185f9329 100644 --- a/src/driver/streamts.h +++ b/src/driver/streamts.h @@ -55,7 +55,7 @@ class CStreamInstance : public OpenThreads::Thread stream_pids_t pids; stream_fds_t fds; - virtual bool Send(ssize_t r, unsigned char *_buf = NULL); + virtual bool Send(ssize_t r, const unsigned char *_buf = NULL); virtual void Close(); virtual void run(); friend class CStreamManager; @@ -104,7 +104,11 @@ class CStreamStream : public CStreamInstance bool Stop(); static int Interrupt(void *data); - static int write_packet(void *opaque, uint8_t *buf, int buf_size); +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(61, 0, 0) + static int write_packet(void *opaque, const uint8_t *buffer, int buf_size); +#else + static int write_packet(void *opaque, uint8_t *buffer, int buf_size); +#endif }; typedef std::pair streammap_pair_t;