private void frmAVDevices_Closing(object sender, System.ComponentModel.CancelEventArgs e) { SaveSettings(); if (ac != null) { // If a camera hasn't been linked, link the first one if (clbCameras.CheckedItems.Count > 0) { bool goodLink = false; // Read from registry and select camera, if in list string[] linkedCamera = AVReg.ValueNames(AVReg.LinkedCamera); if (linkedCamera != null && linkedCamera.Length > 0) { Debug.Assert(linkedCamera.Length == 1); for (int i = 0; i < clbCameras.CheckedItems.Count; i++) { FilterInfo fi = (FilterInfo)clbCameras.CheckedItems[i]; if (fi.Moniker == linkedCamera[0]) { goodLink = true; break; } } } if (!goodLink) { SaveLinkedCamera((FilterInfo)clbCameras.CheckedItems[0]); } } ac.Dispose(); } foreach (VideoCapability vc in vcs.Values) { vc.Dispose(); } if (ckPlayVideo.Checked) { // To clean up any video windows GC.Collect(); } tmrPerf.Stop(); trouble.Close(); }
private void AutoSendAV() { // Determine if the form is shared string[] linkedCamera = AVReg.ValueNames(AVReg.LinkedCamera); if (linkedCamera != null) { Debug.Assert(linkedCamera.Length <= 1); } // Create the audio capability FilterInfo[] mics = AudioCapability.SelectedMicrophones(); Debug.Assert(mics.Length <= 1); // For now we only support 1 AudioCapability ac = null; foreach (FilterInfo fi in mics) { ac = new AudioCapability(fi); } // Create the video capabilities and start sending their data foreach (FilterInfo fi in VideoCapability.SelectedCameras()) { VideoCapability vc = new VideoCapability(fi); // Set the shared form ID if (ac != null && linkedCamera != null && linkedCamera.Length > 0) { if (fi.Moniker == linkedCamera[0]) { Guid sharedFormID = Guid.NewGuid(); ac.SharedFormID = sharedFormID; vc.SharedFormID = sharedFormID; } } try { vc.ActivateCamera(); vc.Send(); } catch (Exception) { vc.Dispose(); MessageBox.Show(string.Format("ConferenceXP was unable to send video from " + "the device - {0}. See the ConferenceAPI Event Log for details.", vc.Name), "Unable to send video", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Start sending the audio data try { if (ac != null) { ac.ActivateMicrophone(); ac.Send(); } } catch (Exception) { ac.Dispose(); MessageBox.Show(string.Format("ConferenceXP was unable to send audio from " + "the device - {0}. See the ConferenceAPI Event Log for details.", ac.Name), "Unable to send audio", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmAudioSettings_FormClosing(object sender, FormClosingEventArgs e) { ac.Dispose(); ac = null; }
private void AutoSendAV() { // Determine if the form is shared string[] linkedCamera = AVReg.ValueNames(AVReg.LinkedCamera); if (linkedCamera != null) { Debug.Assert(linkedCamera.Length <= 1); } // Create the audio capability FilterInfo[] mics = AudioCapability.SelectedMicrophones(); Debug.Assert(mics.Length <= 1); // For now we only support 1 AudioCapability ac = null; foreach (FilterInfo fi in mics) { ac = new AudioCapability(fi); ac.FecEnabled = enableAudioFec; } // Create the video capabilities and start sending their data foreach (FilterInfo fi in VideoCapability.SelectedCameras()) { VideoCapability vc = new VideoCapability(fi); vc.FecEnabled = enableVideoFec; // Set the shared form ID if (ac != null && linkedCamera != null && linkedCamera.Length > 0) { if (fi.Moniker == linkedCamera[0]) { Guid sharedFormID = Guid.NewGuid(); ac.SharedFormID = sharedFormID; vc.SharedFormID = sharedFormID; } } try { vc.ActivateCamera(); vc.Send(); } catch (Exception) { vc.Dispose(); RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Strings.SendVideoErrorText, vc.Name), Strings.SendVideoErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } } // Start sending the audio data try { if (ac != null) { ac.ActivateMicrophone(); ac.Send(); } } catch (Exception) { ac.Dispose(); RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Strings.SendAudioErrorText, ac.Name), Strings.SendAudioErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } }