]> git.sesse.net Git - nageru/commitdiff
If a DeckLink card has multiple subdevices, label them.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 21 Jan 2017 20:38:51 +0000 (21:38 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 21 Jan 2017 20:38:51 +0000 (21:38 +0100)
Makes it slightly easier to tell the devices apart on e.g. a Duo 2.

decklink_capture.cpp

index 892660da09eb64793c8f1490baf5368ace61c31d..348ee28ef002e055f4b306b771fc23491ed520f9 100644 (file)
@@ -205,6 +205,16 @@ DeckLinkCapture::DeckLinkCapture(IDeckLink *card, int card_index)
                }
        }
 
+       // If there's more than one subdevice on this card, label them.
+       int64_t num_subdevices, subdevice_idx;
+       if (attr->GetInt(BMDDeckLinkNumberOfSubDevices, &num_subdevices) == S_OK && num_subdevices > 1) {
+               if (attr->GetInt(BMDDeckLinkSubDeviceIndex, &subdevice_idx) == S_OK) {
+                       char buf[256];
+                       snprintf(buf, sizeof(buf), " (subdevice %d)", int(subdevice_idx));
+                       description += buf;
+               }
+       }
+
        attr->Release();
 
        /* Set up the video and audio sources. */