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
62
63
64
65
66
67
68
69
70
71
|
https://bugs.gentoo.org/951221
https://github.com/gpac/gpac/commit/18863aa2176e423dae2a6d7e39ff6ed6a37b2b78
--- a/src/filters/ff_dmx.c
+++ b/src/filters/ff_dmx.c
@@ -2202,5 +2202,4 @@
{
const AVInputFormat *fmt;
- AVFormatContext *ctx;
if (!dev_name) return;
@@ -2211,33 +2210,13 @@
return;
}
- ctx = avformat_alloc_context();
- if (!ctx) return;
- ctx->iformat = (AVInputFormat *)fmt;
- if (ctx->iformat->priv_data_size > 0) {
- ctx->priv_data = av_mallocz(ctx->iformat->priv_data_size);
- if (!ctx->priv_data) {
- avformat_free_context(ctx);
- return;
- }
- if (ctx->iformat->priv_class) {
- *(const AVClass**)ctx->priv_data = ctx->iformat->priv_class;
- av_opt_set_defaults(ctx->priv_data);
- }
- } else {
- ctx->priv_data = NULL;
- }
AVDeviceInfoList *dev_list = NULL;
-
- AVDictionary *tmp = NULL;
- av_dict_set(&tmp, "list_devices", "1", 0);
- av_opt_set_dict2(ctx, &tmp, AV_OPT_SEARCH_CHILDREN);
- if (tmp)
- av_dict_free(&tmp);
-
- int res = avdevice_list_devices(ctx, &dev_list);
+ int res = avdevice_list_input_sources(fmt, dev_name, NULL, &dev_list);
if (res<0) {
//device doesn't implement avdevice_list_devices, try loading the context using "list_devices=1" option
if (-res == ENOSYS) {
+ AVFormatContext *ctx = avformat_alloc_context();
+ if (!ctx) return;
+
AVDictionary *opts = NULL;
av_dict_set(&opts, "list_devices", "1", 0);
@@ -2245,6 +2224,15 @@
if (opts)
av_dict_free(&opts);
+
+#if !defined(__DARWIN__) && !defined(__APPLE__)
+ // FIXME: no-op, permission issues on macOS Sonoma+
+ if (res>=0) avdevice_list_devices(ctx, &dev_list);
+#endif
+
+ if (res>=0) avformat_close_input(&ctx);
+ avformat_free_context(ctx);
}
- } else if (!res && dev_list->nb_devices) {
+ }
+ if (!res && dev_list && dev_list->nb_devices) {
if (!dev_desc) {
gf_dynstrcat(&dev_desc, "# Detected devices\n", NULL);
@@ -2263,5 +2251,4 @@
if (dev_list) avdevice_free_list_devices(&dev_list);
- avformat_free_context(ctx);
}
|