private void CreateVideoCaptureSource() { try { if (VideoCaptureDevice == null) { Trace.WriteLine("Error no videocapturedevice set"); return; } //VideoCaptureSource IMFAttributes pAttributes = null; int hr = MFExtern.MFCreateAttributes(out pAttributes, 2); hr = pAttributes.SetGUID(MFAttributesClsid.MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, CLSID.MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID); MFError.ThrowExceptionForHR(hr); hr = pAttributes.SetString(MFAttributesClsid.MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, VideoCaptureDevice.DevicePath); MFError.ThrowExceptionForHR(hr); IMFMediaSource ppMediaSource = null; hr = MFExtern.MFCreateDeviceSource(pAttributes, out ppMediaSource); MFError.ThrowExceptionForHR(hr); m_pSource = ppMediaSource; //GetCaptureFormats(m_pSource); } catch (Exception e) { Marshal.GetHRForException(e); Trace.WriteLine("SetupGraph Exception " + e.ToString()); } }
public HResult SetString(Guid guidKey, string wszValue) { return(m_Attribs.SetString(guidKey, wszValue)); }