示例#1
0
        void RemoveDevice(object sender, DeckLinkDiscoveryEventArgs e)
        {
            // Stop capture thread if the selected capture device was removed
            if (m_selectedCaptureDevice != null && m_selectedCaptureDevice.DeckLink == e.deckLink && m_captureDeviceRemovedCancel != null)
            {
                m_captureDeviceRemovedCancel.Cancel();
            }

            // Stop playback thread if the selected playback device was removed
            if (m_selectedPlaybackDevice != null && m_selectedPlaybackDevice.DeckLink == e.deckLink && m_playbackDeviceRemovedCancel != null)
            {
                m_playbackDeviceRemovedCancel.Cancel();
            }

            // Remove the device from the capture dropdown
            comboBoxCaptureDevice.BeginUpdate();
            foreach (StringObjectPair <DeckLinkInputDevice> item in comboBoxCaptureDevice.Items)
            {
                if (item.value.DeckLink == e.deckLink)
                {
                    comboBoxCaptureDevice.Items.Remove(item);
                    break;
                }
            }
            comboBoxCaptureDevice.EndUpdate();

            if (comboBoxCaptureDevice.Items.Count == 0)
            {
                EnableComponent(groupBoxCapture, false);
                m_selectedCaptureDevice = null;
            }
            else if (m_selectedCaptureDevice.DeckLink == e.deckLink)
            {
                comboBoxCaptureDevice.SelectedIndex = 0;
            }

            // Remove the device from the playback dropdown
            comboBoxPlaybackDevice.BeginUpdate();
            foreach (StringObjectPair <DeckLinkOutputDevice> item in comboBoxPlaybackDevice.Items)
            {
                if (item.value.DeckLink == e.deckLink)
                {
                    comboBoxPlaybackDevice.Items.Remove(item);
                    break;
                }
            }
            comboBoxPlaybackDevice.EndUpdate();

            if (comboBoxPlaybackDevice.Items.Count == 0)
            {
                EnableComponent(groupBoxPlayback, false);
                m_selectedPlaybackDevice = null;
            }
            else if (m_selectedPlaybackDevice.DeckLink == e.deckLink)
            {
                comboBoxPlaybackDevice.SelectedIndex = 0;
            }
        }
示例#2
0
        private void comboBoxCaptureDevice_SelectedIndexChanged(object sender, EventArgs e)
        {
            m_selectedCaptureDevice = null;

            if (comboBoxCaptureDevice.SelectedIndex < 0)
            {
                return;
            }

            m_selectedCaptureDevice = ((StringObjectPair <DeckLinkInputDevice>)comboBoxCaptureDevice.SelectedItem).value;

            RefreshCaptureVideoModeList();
        }
示例#3
0
        void AddDevice(object sender, DeckLinkDiscoveryEventArgs e)
        {
            try
            {
                DeckLinkInputDevice deckLink = new DeckLinkInputDevice(e.deckLink);

                comboBoxCaptureDevice.BeginUpdate();
                comboBoxCaptureDevice.Items.Add(new StringObjectPair <DeckLinkInputDevice>(deckLink.DeviceName, deckLink));
                comboBoxCaptureDevice.EndUpdate();

                // If first device, then enable capture interface
                if (comboBoxCaptureDevice.Items.Count == 1)
                {
                    comboBoxCaptureDevice.SelectedIndex = 0;
                    EnableComponent(groupBoxCapture, true);
                }
            }
            catch (DeckLinkInputInvalidException)
            {
                // Device likely playback only, eg DeckLink Mini Monitor
            }

            try
            {
                DeckLinkOutputDevice deckLink = new DeckLinkOutputDevice(e.deckLink);

                comboBoxPlaybackDevice.BeginUpdate();
                comboBoxPlaybackDevice.Items.Add(new StringObjectPair <DeckLinkOutputDevice>(deckLink.DeviceName, deckLink));
                comboBoxPlaybackDevice.EndUpdate();

                if (comboBoxPlaybackDevice.Items.Count == 1)
                {
                    comboBoxPlaybackDevice.SelectedIndex = 0;
                    EnableComponent(groupBoxPlayback, true);
                }
            }
            catch (DeckLinkOutputInvalidException)
            {
                // Device likely capture only, eg DeckLink Mini Recorder
            }
        }