1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
From 0aceedbb4006fcc418a23730756400d2249cab9a Mon Sep 17 00:00:00 2001
From: yangfl <yangfl@users.noreply.github.com>
Date: Wed, 28 Aug 2024 14:45:37 +0800
Subject: [PATCH 4/5] fix(video): fix FTBFS with ffmpeg 7.0
---
src/video/cameradevice.cpp | 36 +-----------------------------------
1 file changed, 1 insertion(+), 35 deletions(-)
diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp
index 15edb1470a4f..0857eb11db1a 100644
--- a/src/video/cameradevice.cpp
+++ b/src/video/cameradevice.cpp
@@ -279,43 +279,9 @@ QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric()
if (!getDefaultInputFormat())
return devices;
- // Alloc an input device context
- AVFormatContext* s;
- if (!(s = avformat_alloc_context()))
- return devices;
-
- if (!iformat->priv_class || !AV_IS_INPUT_DEVICE(iformat->priv_class->category)) {
- avformat_free_context(s);
- return devices;
- }
-
- s->iformat = iformat;
- if (s->iformat->priv_data_size > 0) {
- s->priv_data = av_mallocz(s->iformat->priv_data_size);
- if (!s->priv_data) {
- avformat_free_context(s);
- return devices;
- }
- if (s->iformat->priv_class) {
- *(const AVClass**)s->priv_data = s->iformat->priv_class;
- av_opt_set_defaults(s->priv_data);
- }
- } else {
- s->priv_data = nullptr;
- }
-
// List the devices for this context
AVDeviceInfoList* devlist = nullptr;
- AVDictionary* tmp = nullptr;
- av_dict_copy(&tmp, nullptr, 0);
- if (av_opt_set_dict2(s, &tmp, AV_OPT_SEARCH_CHILDREN) < 0) {
- av_dict_free(&tmp);
- avformat_free_context(s);
- return devices;
- }
- avdevice_list_devices(s, &devlist);
- av_dict_free(&tmp);
- avformat_free_context(s);
+ avdevice_list_input_sources(iformat, nullptr, nullptr, &devlist);
if (!devlist) {
qWarning() << "avdevice_list_devices failed";
return devices;
--
2.45.2
|