Vuo  2.3.1
VuoInputEditorVideoInputDevice.cc
Go to the documentation of this file.
1 
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), ^{
26  });
27 }
28 
33 {
34  return new VuoInputEditorVideoInputDevice();
35 }
36 
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 
49  unsigned long deviceCount = VuoListGetCount_VuoVideoInputDevice(devices);
50 
51  if (deviceCount)
52  for (unsigned long i = 1; i <= deviceCount; ++i)
53  {
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 }