diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index 3b07968b3..a012a0f78 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -31,6 +31,9 @@ extern "C" { #include "cameradevice.h" #include "src/persistence/settings.h" +// no longer needed when avformat version < 59 is no longer supported +using AvFindInputFormatRet = decltype(av_find_input_format("")); + #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) #define USING_V4L 1 #else @@ -71,8 +74,8 @@ extern "C" { QHash CameraDevice::openDevices; QMutex CameraDevice::openDeviceLock, CameraDevice::iformatLock; -AVInputFormat* CameraDevice::iformat{nullptr}; -AVInputFormat* CameraDevice::idesktopFormat{nullptr}; +static AvFindInputFormatRet idesktopFormat{nullptr}; +static AvFindInputFormatRet iformat{nullptr}; CameraDevice::CameraDevice(const QString& devName, AVFormatContext* context) : devName{devName} @@ -92,7 +95,7 @@ CameraDevice* CameraDevice::open(QString devName, AVDictionary** options) goto out; } - AVInputFormat* format; + AvFindInputFormatRet format; if (devName.startsWith("x11grab#")) { devName = devName.mid(8); format = idesktopFormat; diff --git a/src/video/cameradevice.h b/src/video/cameradevice.h index 910873325..c05f1dbed 100644 --- a/src/video/cameradevice.h +++ b/src/video/cameradevice.h @@ -64,5 +64,4 @@ private: std::atomic_int refcount; static QHash openDevices; static QMutex openDeviceLock, iformatLock; - static AVInputFormat *iformat, *idesktopFormat; }; diff --git a/src/video/camerasource.cpp b/src/video/camerasource.cpp index 134bc49af..3a899f11d 100644 --- a/src/video/camerasource.cpp +++ b/src/video/camerasource.cpp @@ -278,7 +278,6 @@ void CameraSource::openDevice() } // We need to create a new CameraDevice - AVCodec* codec; device = CameraDevice::open(deviceName, mode); if (!device) { @@ -322,7 +321,7 @@ void CameraSource::openDevice() AVCodecParameters* cparams = device->context->streams[videoStreamIndex]->codecpar; codecId = cparams->codec_id; #endif - codec = avcodec_find_decoder(codecId); + const AVCodec* codec = avcodec_find_decoder(codecId); if (!codec) { qWarning() << "Codec not found"; emit openFailed();