Vuo
2.3.1
type
inputEditor
VuoInputEditorVideoInputDevice
VuoInputEditorVideoInputDevice.cc
Go to the documentation of this file.
1
10
#include "
VuoInputEditorVideoInputDevice.hh
"
11
12
extern
"C"
13
{
14
#include "
VuoVideoInputDevice.h
"
15
#include "
VuoVideoCapture.h
"
16
}
17
22
void
__attribute__((constructor)) VuoInputEditorVideoInputDevice_init()
23
{
24
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
25
VuoVideoCapture_getInputDevices
();
26
});
27
}
28
32
VuoInputEditor
*
VuoInputEditorVideoInputDeviceFactory::newInputEditor
()
33
{
34
return
new
VuoInputEditorVideoInputDevice
();
35
}
36
40
VuoInputEditorMenuItem
*
VuoInputEditorVideoInputDevice::setUpMenuTree
()
41
{
42
VuoInputEditorMenuItem
*optionsTree =
new
VuoInputEditorMenuItem
(
"root"
);
43
44
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
"Default device"
, NULL));
45
optionsTree->
addSeparator
();
46
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
"Specific device"
, NULL, NULL,
false
));
47
48
VuoList_VuoVideoInputDevice
devices =
VuoVideoCapture_getInputDevices
();
49
unsigned
long
deviceCount =
VuoListGetCount_VuoVideoInputDevice
(devices);
50
51
if
(deviceCount)
52
for
(
unsigned
long
i = 1; i <= deviceCount; ++i)
53
{
54
VuoVideoInputDevice
device =
VuoListGetValue_VuoVideoInputDevice
(devices, i);
55
56
// https://b33p.net/kosada/node/9583
57
// When selecting a device via the input editor, only match by ID,
58
// since one device's name ("Logitech Camera") might be a substring of another device's name ("Logitech Camera #2").
59
device.
matchType
= VuoVideoInputDevice_MatchId;
60
61
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
VuoText_format
(
" %s"
, device.
name
),
VuoVideoInputDevice_getJson
(device)));
62
}
63
else
64
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
" (no devices found)"
, NULL, NULL,
false
));
65
66
return
optionsTree;
67
}
Generated on Mon Jun 14 2021 18:58:47 for Vuo by
1.9.1