private void UserControl_Loaded(object sender, RoutedEventArgs e) { MainWindow.mISourceItems.Add(this); mEncoderControl = MainWindow.mCaptureManager.createEncoderControl(); if (mEncoderControl == null) { return; } mSourceControl = MainWindow.mCaptureManager.createSourceControl(); if (mSourceControl == null) { return; } mStreamControl = MainWindow.mCaptureManager.createStreamControl(); if (mStreamControl == null) { return; } mStreamControl.createStreamControlNodeFactory(ref mSpreaderNodeFactory); if (mSpreaderNodeFactory == null) { return; } mSinkControl = MainWindow.mCaptureManager.createSinkControl(); if (mSinkControl == null) { return; } mSinkControl.createSinkFactory(Guid.Empty, out mEVRMultiSinkFactory); if (mEVRMultiSinkFactory == null) { return; } }
public MainWindow() { InitializeComponent(); try { mCaptureManager = new CaptureManager("CaptureManager.dll"); } catch (System.Exception exc) { try { mCaptureManager = new CaptureManager(); } catch (System.Exception exc1) { } } if (mCaptureManager == null) { mCtrlBtn.Content = "Error"; mCtrlBtn.IsEnabled = false; mState.Text = "Library CaptureManager.dll is not acessable"; return; } LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent; mSourceControl = mCaptureManager.createSourceControl(); mEncoderControl = mCaptureManager.createEncoderControl(); mSinkControl = mCaptureManager.createSinkControl(); init(); }
public IEncoderControl createEncoderControl() { IEncoderControl lresult = null; do { try { if (checkICaptureManagerControl()) { break; } object lUnknown; mICaptureManagerControl.createControl( typeof(CaptureManagerLibrary.IEncoderControl).GUID, out lUnknown); if (lUnknown == null) { break; } var lEncoderControl = lUnknown as CaptureManagerLibrary.IEncoderControl; if (lEncoderControl == null) { break; } lresult = new EncoderControl(lEncoderControl); } catch (Exception exc) { LogManager.getInstance().write(exc.Message); } } while (false); return(lresult); }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { mCaptureManager = new CaptureManager("CaptureManager.dll"); } catch (System.Exception) { try { mCaptureManager = new CaptureManager(); } catch (System.Exception) { } } LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent; if (mCaptureManager == null) { return; } mSourceControl = mCaptureManager.createSourceControl(); if (mSourceControl == null) { return; } mEncoderControl = mCaptureManager.createEncoderControl(); if (mEncoderControl == null) { return; } mSinkControl = mCaptureManager.createSinkControl(); if (mSinkControl == null) { return; } mISessionControl = mCaptureManager.createSessionControl(); if (mISessionControl == null) { return; } mStreamControl = mCaptureManager.createStreamControl(); if (mStreamControl == null) { return; } mStreamControl.createStreamControlNodeFactory(ref mSpreaderNodeFactory); if (mSpreaderNodeFactory == null) { return; } mSinkControl.createSinkFactory(Guid.Empty, out mEVRMultiSinkFactory); if (mEVRMultiSinkFactory == null) { return; } XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSources"]; if (lXmlDataProvider == null) { return; } XmlDocument doc = new XmlDocument(); string lxmldoc = ""; mCaptureManager.getCollectionOfSources(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncoders"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); mCaptureManager.getCollectionOfEncoders(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; mCaptureManager.getCollectionOfSinks(ref lxmldoc); lXmlDataProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; ProcessPriorityClass lpriority = Process.GetCurrentProcess().PriorityClass; Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (ControlWindow.mCaptureManager == null) { return; } mSourceControl = ControlWindow.mCaptureManager.createSourceControl(); if (mSourceControl == null) { return; } mEncoderControl = ControlWindow.mCaptureManager.createEncoderControl(); if (mEncoderControl == null) { return; } XmlDocument doc = new XmlDocument(); string lxmldoc = ""; var lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncoders"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); ControlWindow.mCaptureManager.getCollectionOfEncoders(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; ControlWindow.mCaptureManager.getCollectionOfSinks(ref lxmldoc); lXmlDataProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; ControlWindow.mCaptureManager.getCollectionOfSources(ref lxmldoc); doc = new XmlDocument(); doc.LoadXml(lxmldoc); string lxpath = "//*[Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK']/SingleValue[@Value='Temp']]"; lxpath = lxpath.Replace("Temp", mCurrentSymbolicLink); var lNode = doc.SelectSingleNode(lxpath); if (lNode != null) { m_VideoStreamComboBox.DataContext = lNode; } mSourceName.Text = mCurrentSymbolicLink; }
public MainWindow() { InitializeComponent(); try { mCaptureManager = new CaptureManager("CaptureManager.dll"); } catch (System.Exception) { try { mCaptureManager = new CaptureManager(); } catch (System.Exception) { } } LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent; mSourceControl = mCaptureManager.createSourceControl(); mEncoderControl = mCaptureManager.createEncoderControl(); mSinkControl = mCaptureManager.createSinkControl(); mStreamControl = mCaptureManager.createStreamControl(); mISessionControl = mCaptureManager.createSessionControl(); mStreamControl.createStreamControlNodeFactory(ref mSpreaderNodeFactory); if (mSpreaderNodeFactory == null) { return; } XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSources"]; if (lXmlDataProvider == null) { return; } XmlDocument doc = new XmlDocument(); string lxmldoc = ""; mCaptureManager.getCollectionOfSources(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; XmlDataProvider lXmlContainerTypeProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); lxmldoc = ""; mCaptureManager.getCollectionOfSinks(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlContainerTypeProvider.Document = doc; }
public Recording() { InitializeComponent(); try { mCaptureManager = new CaptureManager("CaptureManager.dll"); } catch (System.Exception exc) { try { mCaptureManager = new CaptureManager(); } catch (System.Exception exc1) { } } if (mCaptureManager == null) { return; } mSourceControl = mCaptureManager.createSourceControl(); mISessionControl = mCaptureManager.createSessionControl(); mSinkControl = mCaptureManager.createSinkControl(); mEncoderControl = mCaptureManager.createEncoderControl(); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); string lxmldoc = ""; mCaptureManager.getCollectionOfSources(ref lxmldoc); if (string.IsNullOrEmpty(lxmldoc)) { return; } doc.LoadXml(lxmldoc); var lSourceNodes = doc.DocumentElement.ChildNodes;// .SelectNodes("//*[Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_MEDIA_TYPE']/Value.ValueParts/ValuePart[@Value='MFMediaType_Video']]"); if (lSourceNodes != null) { foreach (var item in lSourceNodes) { var lNode = (XmlNode)item; if (lNode != null) { var lvalueNode = lNode.SelectSingleNode("Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME']/SingleValue/@Value"); ContainerItem lSourceItem = new ContainerItem() { mFriendlyName = lvalueNode.Value, mXmlNode = lNode }; sourceComboBox.Items.Add(lSourceItem); } } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { var t = new Thread( delegate() { try { mCaptureManager = Program.mCaptureManager; LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent; if (mCaptureManager == null) { return; } mSourceControl = mCaptureManager.createSourceControl(); if (mSourceControl == null) { return; } mEncoderControl = mCaptureManager.createEncoderControl(); if (mEncoderControl == null) { return; } mSinkControl = mCaptureManager.createSinkControl(); if (mSinkControl == null) { return; } mISessionControl = mCaptureManager.createSessionControl(); if (mISessionControl == null) { return; } mStreamControl = mCaptureManager.createStreamControl(); if (mStreamControl == null) { return; } mStreamControl.createStreamControlNodeFactory(ref mSpreaderNodeFactory); if (mSpreaderNodeFactory == null) { return; } mSinkControl.createSinkFactory(Guid.Empty, out mEVRMultiSinkFactory); if (mEVRMultiSinkFactory == null) { return; } mSinkControl.createSinkFactory(Guid.Empty, out mEVRSinkFactory); if (mEVRSinkFactory == null) { return; } XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSources"]; if (lXmlDataProvider == null) { return; } XmlDocument doc = new XmlDocument(); string lxmldoc = ""; mCaptureManager.getCollectionOfSources(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncoders"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); mCaptureManager.getCollectionOfEncoders(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; mCaptureManager.getCollectionOfSinks(ref lxmldoc); lXmlDataProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; } catch (Exception ex) { } finally { } }); t.SetApartmentState(ApartmentState.MTA); t.Start(); }
public MainWindow() { InitializeComponent(); try { mCaptureManager = new CaptureManager("CaptureManager.dll"); } catch (System.Exception) { try { mCaptureManager = new CaptureManager(); } catch (System.Exception) { } } if (mCaptureManager == null) { return; } XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlLogProvider"]; if (lXmlDataProvider == null) { return; } System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); string lxmldoc = ""; mCaptureManager.getCollectionOfSources(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; mSourceControl = mCaptureManager.createSourceControl(); mCaptureManager.getCollectionOfSinks(ref lxmldoc); lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSinkFactoryCollectionProvider"]; if (lXmlDataProvider == null) { return; } doc = new System.Xml.XmlDocument(); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; mISessionControl = mCaptureManager.createSessionControl(); mSinkControl = mCaptureManager.createSinkControl(); mEncoderControl = mCaptureManager.createEncoderControl(); mEncodersComboBox.SelectionChanged += delegate { do { if (mEncoderControl == null) { break; } var lselectedNode = mEncodersComboBox.SelectedItem as XmlNode; if (lselectedNode == null) { break; } var lEncoderNameAttr = lselectedNode.Attributes["Title"]; if (lEncoderNameAttr == null) { break; } var lCLSIDEncoderAttr = lselectedNode.Attributes["CLSID"]; if (lCLSIDEncoderAttr == null) { break; } Guid lCLSIDEncoder; if (!Guid.TryParse(lCLSIDEncoderAttr.Value, out lCLSIDEncoder)) { break; } var lSourceNode = mSourcesComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { return; } var lNode = lSourceNode.SelectSingleNode( "Source.Attributes/Attribute" + "[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK' or @Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_SYMBOLIC_LINK']" + "/SingleValue/@Value"); if (lNode == null) { return; } string lSymbolicLink = lNode.Value; lSourceNode = mStreamsComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { return; } lNode = lSourceNode.SelectSingleNode("@Index"); if (lNode == null) { return; } uint lStreamIndex = 0; if (!uint.TryParse(lNode.Value, out lStreamIndex)) { return; } lSourceNode = mMediaTypesComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { return; } lNode = lSourceNode.SelectSingleNode("@Index"); if (lNode == null) { return; } uint lMediaTypeIndex = 0; if (!uint.TryParse(lNode.Value, out lMediaTypeIndex)) { return; } object lOutputMediaType; if (mSourceControl == null) { return; } mSourceControl.getSourceOutputMediaType( lSymbolicLink, lStreamIndex, lMediaTypeIndex, out lOutputMediaType); string lMediaTypeCollection; if (!mEncoderControl.getMediaTypeCollectionOfEncoder( lOutputMediaType, lCLSIDEncoder, out lMediaTypeCollection)) { break; } XmlDataProvider lXmlEncoderModeDataProvider = (XmlDataProvider)this.Resources["XmlEncoderModeProvider"]; if (lXmlEncoderModeDataProvider == null) { return; } XmlDocument lEncoderModedoc = new XmlDocument(); lEncoderModedoc.LoadXml(lMediaTypeCollection); lXmlEncoderModeDataProvider.Document = lEncoderModedoc; } while (false); }; mEncodingModeComboBox.SelectionChanged += delegate { do { if (mEncoderControl == null) { break; } var lselectedNode = mEncodingModeComboBox.SelectedItem as XmlNode; if (lselectedNode == null) { break; } var lGUIDEncodingModeAttr = lselectedNode.Attributes["GUID"]; if (lGUIDEncodingModeAttr == null) { break; } Guid lGUIDEncodingMode; if (!Guid.TryParse(lGUIDEncodingModeAttr.Value, out lGUIDEncodingMode)) { break; } var lConstantMode = Guid.Parse("{CA37E2BE-BEC0-4B17-946D-44FBC1B3DF55}"); XmlDataProvider lXmlMediaTypeProvider = (XmlDataProvider)this.Resources["XmlMediaTypesCollectionProvider"]; if (lXmlMediaTypeProvider == null) { return; } XmlDocument lMediaTypedoc = new XmlDocument(); var lClonedMediaTypesNode = lMediaTypedoc.ImportNode(lselectedNode, true); lMediaTypedoc.AppendChild(lClonedMediaTypesNode); lXmlMediaTypeProvider.Document = lMediaTypedoc; } while (false); }; mSinkFactoryComboBox.SelectionChanged += delegate { do { if (mEncoderControl == null) { break; } var lselectedNode = mSinkFactoryComboBox.SelectedItem as XmlNode; if (lselectedNode == null) { break; } var lAttr = lselectedNode.Attributes["GUID"]; if (lAttr == null) { throw new System.Exception("GUID is empty"); } mContainerTypeComboBox.IsEnabled = false; mSinkType = SinkType.Node; if (lAttr.Value == "{D6E342E3-7DDD-4858-AB91-4253643864C2}") { mContainerTypeComboBox.IsEnabled = true; mSinkType = SinkType.File; } else if (lAttr.Value == "{2E891049-964A-4D08-8F36-95CE8CB0DE9B}") { mContainerTypeComboBox.IsEnabled = true; mSinkType = SinkType.BitStream; } else if (lAttr.Value == "{759D24FF-C5D6-4B65-8DDF-8A2B2BECDE39}") { } else if (lAttr.Value == "{3D64C48E-EDA4-4EE1-8436-58B64DD7CF13}") { } else if (lAttr.Value == "{2F34AF87-D349-45AA-A5F1-E4104D5C458E}") { } XmlDataProvider lXmlMediaTypeProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"]; if (lXmlMediaTypeProvider == null) { return; } XmlDocument lMediaTypedoc = new XmlDocument(); var lClonedMediaTypesNode = lMediaTypedoc.ImportNode(lselectedNode, true); lMediaTypedoc.AppendChild(lClonedMediaTypesNode); lXmlMediaTypeProvider.Document = lMediaTypedoc; } while (false); }; }
public MainWindow() { InitializeComponent(); try { ThreadPool.SetMinThreads(15, 10); mCaptureManager = new CaptureManager("CaptureManager.dll"); } catch (System.Exception) { try { mCaptureManager = new CaptureManager(); } catch (System.Exception) { } } if (mCaptureManager == null) { return; } XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSourcesProvider"]; if (lXmlDataProvider == null) { return; } System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); string lxmldoc = ""; mCaptureManager.getCollectionOfSources(ref lxmldoc); if (string.IsNullOrEmpty(lxmldoc)) { return; } doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; mIEVRStreamControl = mCaptureManager.createEVRStreamControl(); mSourceControl = mCaptureManager.createSourceControl(); lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncodersProvider"]; if (lXmlDataProvider == null) { return; } mEncoderControl = mCaptureManager.createEncoderControl(); mCaptureManager.getCollectionOfEncoders(ref lxmldoc); doc = new System.Xml.XmlDocument(); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (ControlWindow.mCaptureManager == null) { return; } var t = new Thread( delegate() { try { mSourceControl = ControlWindow.mCaptureManager.createSourceControl(); if (mSourceControl == null) { return; } mEncoderControl = ControlWindow.mCaptureManager.createEncoderControl(); if (mEncoderControl == null) { return; } XmlDocument doc = new XmlDocument(); string lxmldoc = ""; var lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncoders"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); ControlWindow.mCaptureManager.getCollectionOfEncoders(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; ControlWindow.mCaptureManager.getCollectionOfSinks(ref lxmldoc); lXmlDataProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; ControlWindow.mCaptureManager.getCollectionOfSources(ref lxmldoc); doc = new XmlDocument(); doc.LoadXml(lxmldoc); string lxpath = "//*[Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK']/SingleValue[@Value='Temp']]"; lxpath = lxpath.Replace("Temp", mCurrentSymbolicLink); var lNode = doc.SelectSingleNode(lxpath); App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (ThreadStart) delegate() { if (lNode != null) { m_VideoStreamComboBox.DataContext = lNode; } mVideoSourceName.Text = mCurrentSymbolicLink; }); lxpath = "//*[Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_SYMBOLIC_LINK']/SingleValue[@Value='Temp']]"; lxpath = lxpath.Replace("Temp", mAudioSymbolicLink); var lAudioNode = doc.SelectSingleNode(lxpath); App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (ThreadStart) delegate() { if (lNode != null) { m_AudioStreamComboBox.DataContext = lAudioNode; } mAudioSourceName.Text = mAudioSymbolicLink; }); } catch (Exception) { } finally { } }); t.SetApartmentState(ApartmentState.MTA); t.Start(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { mCaptureManager = Program.mCaptureManager; App.mHotKeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(App.Current.MainWindow)); App.mHotKeyHost.AddHotKey(new CustomHotKey("Record", new Action(() => { App.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart) delegate() { mStartStop_Click(null, null); }); } ), Key.P, ModifierKeys.Control | ModifierKeys.Shift, true)); } catch (System.Exception) { try { mCaptureManager = new CaptureManager(); } catch (System.Exception) { } } LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent; if (mCaptureManager == null) { return; } var t = new Thread( delegate() { try { mSourceControl = mCaptureManager.createSourceControl(); if (mSourceControl == null) { return; } mEncoderControl = mCaptureManager.createEncoderControl(); if (mEncoderControl == null) { return; } mSinkControl = mCaptureManager.createSinkControl(); if (mSinkControl == null) { return; } mISessionControl = mCaptureManager.createSessionControl(); if (mISessionControl == null) { return; } mStreamControl = mCaptureManager.createStreamControl(); if (mStreamControl == null) { return; } mStreamControl.createStreamControlNodeFactory(ref mSpreaderNodeFactory); if (mSpreaderNodeFactory == null) { return; } mSinkControl.createSinkFactory(Guid.Empty, out mEVRMultiSinkFactory); if (mEVRMultiSinkFactory == null) { return; } XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSources"]; if (lXmlDataProvider == null) { return; } XmlDocument doc = new XmlDocument(); string lxmldoc = ""; mCaptureManager.getCollectionOfSources(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncoders"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); mCaptureManager.getCollectionOfEncoders(ref lxmldoc); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; mCaptureManager.getCollectionOfSinks(ref lxmldoc); lXmlDataProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"]; if (lXmlDataProvider == null) { return; } doc = new XmlDocument(); doc.LoadXml(lxmldoc); lXmlDataProvider.Document = doc; } catch (Exception) { } finally { } }); t.SetApartmentState(ApartmentState.MTA); t.Start(); }