Example #1
0
        //return the current enum entries
        protected override IReadOnlyDictionary <string, object> GetEntries()
        {
            // Get the collection of video devices
            Activate[] capDevices = VideoInInfo.EnumerateVideoDevices();
            Dictionary <string, object> devices = new Dictionary <string, object>(capDevices.Length);

            for (int i = 0; i < capDevices.Length; i++)
            {
                devices[capDevices[i].Get(CaptureDeviceAttributeKeys.FriendlyName)] = i;
            }
            return(devices);
        }
        //return the current enum entries
        protected override IReadOnlyDictionary <string, object> GetEntries()
        {
            // Get the collection of video devices
            Activate[] capDevices = VideoInInfo.EnumerateVideoDevices();
            Dictionary <string, object> devices = new Dictionary <string, object>(capDevices.Length);

            for (int i = 0; i < capDevices.Length; i++)
            {
                var j            = 1;
                var friendlyName = capDevices[i].Get(CaptureDeviceAttributeKeys.FriendlyName);
                var finalName    = friendlyName;
                while (devices.ContainsKey(finalName))
                {
                    finalName = friendlyName + " #" + j++;
                }
                devices[finalName] = i;
            }
            return(devices);
        }