public static Guid GetPinCategory(IPin pPin) { var guidRet = Guid.Empty; var iSize = Marshal.SizeOf(typeof(Guid)); var ipOut = Marshal.AllocCoTaskMem(iSize); try { var g = PropSetID.Pin; var pKs = pPin as IKsPropertySet; if (pKs != null) { int cbBytes; var hr = pKs.Get(g, (int)AMPropertyPin.Category, IntPtr.Zero, 0, ipOut, iSize, out cbBytes); DsError.ThrowExceptionForHR(hr); guidRet = (Guid)Marshal.PtrToStructure(ipOut, typeof(Guid)); } } finally { Marshal.FreeCoTaskMem(ipOut); } return guidRet; }
/// <summary> /// Returns the PinCategory of the specified pin. Usually a member of PinCategory. Not all pins have a category. /// </summary> /// <param name="pPin"></param> /// <returns>Guid indicating pin category or Guid.Empty on no category. Usually a member of PinCategory</returns> public static Guid GetPinCategory(IPin pPin) { Guid guidRet = Guid.Empty; // Memory to hold the returned guid int iSize = Marshal.SizeOf(typeof(Guid)); IntPtr ipOut = Marshal.AllocCoTaskMem(iSize); try { int hr; int cbBytes; Guid g = PropSetID.Pin; // Get an IKsPropertySet from the pin IKsPropertySet pKs = pPin as IKsPropertySet; if (pKs != null) { // Query for the Category hr = pKs.Get(g, (int)AMPropertyPin.Category, IntPtr.Zero, 0, ipOut, iSize, out cbBytes); DsError.ThrowExceptionForHR(hr); // Marshal it to the return variable guidRet = (Guid)Marshal.PtrToStructure(ipOut, typeof(Guid)); } } finally { Marshal.FreeCoTaskMem(ipOut); ipOut = IntPtr.Zero; } return guidRet; }
/// <summary> Release unmanaged resources. </summary> protected override void Dispose(bool disposing) { if (_Pin != null) Marshal.ReleaseComObject(_Pin); _Pin = null; base.Dispose(disposing); }
/// <summary> Retrieve the friendly name of a connectorType. </summary> private string GetName(IPin pin) { string str = "Unknown pin"; PinInfo pinInfo = new PinInfo(); // Direction matches, so add pin name to listbox int errorCode = pin.QueryPinInfo(out pinInfo); if (errorCode == 0) { str = pinInfo.name ?? ""; } else { Marshal.ThrowExceptionForHR(errorCode); } // The pininfo structure contains a reference to an IBaseFilter, // so you must release its reference to prevent resource a leak. if (pinInfo.filter != null) { Marshal.ReleaseComObject(pinInfo.filter); } pinInfo.filter = null; return str; }
public AmMediaType GetMinimumFreq(IPin OutputPin) { AmMediaType[] types = OutputPin.GetAllMediaTypes(); IAMStreamConfig cfg = (IAMStreamConfig)OutputPin; AmMediaType currentType = cfg.GetFormat(); WaveFormatEx currentWave = currentType.GetStruct<WaveFormatEx>(); ShowMsg(String.Format( "CurrentOut: bps:{0} bit; ch:{1}, freq:{2} Hz", currentWave.wBitsPerSample, currentWave.nChannels, currentWave.nSamplesPerSec )); AmMediaType minimum = currentType; foreach (AmMediaType type in types) { WaveFormatEx wave = type.GetStruct<WaveFormatEx>(); ShowMsg(String.Format( "bps:{0} bit; ch:{1}, freq:{2} Hz", wave.wBitsPerSample, wave.nChannels, wave.nSamplesPerSec )); if (wave.wFormatTag == currentWave.wFormatTag && wave.nChannels == currentWave.nChannels && wave.wBitsPerSample == currentWave.wBitsPerSample && wave.nSamplesPerSec < currentWave.nSamplesPerSec) { minimum = type; currentWave = minimum.GetStruct<WaveFormatEx>(); } } ShowMsg(String.Format( "Selected: bps:{0} bit; ch:{1}, freq:{2} Hz", currentWave.wBitsPerSample, currentWave.nChannels, currentWave.nSamplesPerSec )); return minimum; }
public static IPin GetPin(this IBaseFilter filter, PinDirection dir, int num) { IPin[] pin = new IPin[1]; IEnumPins pinsEnum = null; if (filter.EnumPins(out pinsEnum) == 0) { PinDirection pinDir; int n; while (pinsEnum.Next(1, pin, out n) == 0) { pin[0].QueryDirection(out pinDir); if (pinDir == dir) { if (num == 0) return pin[0]; num--; } Marshal.ReleaseComObject(pin[0]); pin[0] = null; } } return null; }
// Get pin of the filter public IPin GetPin(PinDirection dir, int num) { IPin[] pin = new IPin[1]; IEnumPins pinsEnum = null; // enum filter pins if (m_Filter.EnumPins(out pinsEnum) == 0) { PinDirection pinDir; int n; // get next pin while (pinsEnum.Next(1, pin, out n) == 0) { // query pin`s direction pin[0].QueryDirection(out pinDir); if (pinDir == dir) { if (num == 0) return pin[0]; num--; } Marshal.ReleaseComObject(pin[0]); pin[0] = null; } } return null; }
/// <summary> /// Gets iSC's available _AMMediaTypes, without freeing pbFormat /// Caller should call MediaType.Free(_AMMediaType[]) when done /// </summary> public static _AMMediaType[] GetMediaTypes(IPin pin) { IEnumMediaTypes iEnum; pin.EnumMediaTypes(out iEnum); ArrayList alMTs = new ArrayList(); IntPtr[] ptrs = new IntPtr[1]; uint fetched; iEnum.Next(1, ptrs, out fetched); while(fetched == 1) { _AMMediaType mt = (_AMMediaType)Marshal.PtrToStructure(ptrs[0], typeof(_AMMediaType)); alMTs.Add(mt); Marshal.FreeCoTaskMem(ptrs[0]); ptrs[0] = IntPtr.Zero; iEnum.Next(1, ptrs, out fetched); } _AMMediaType[] mts = new _AMMediaType[alMTs.Count]; alMTs.CopyTo(mts); return mts; }
public static IBaseFilter CreateAudioCompressor(DisposalCleanup dc, IGraphBuilder graph, IPin outPin, AudioFormat settings) { if (dc == null) throw new ArgumentNullException("dc"); if (graph == null) throw new ArgumentNullException("graph"); if (outPin == null) throw new ArgumentNullException("outPin"); if (settings == null) throw new ArgumentNullException("settings"); int hr = 0; using (AudioCompressor compressor = AudioCompressorFactory.Create(settings)) { IBaseFilter compressorFilter = compressor.Filter; dc.Add(compressorFilter); hr = graph.AddFilter(compressorFilter, settings.AudioCompressor); DsError.ThrowExceptionForHR(hr); FilterGraphTools.ConnectFilters(graph, outPin, compressorFilter, true); // set the media type on the output pin of the compressor if (compressor.MediaType != null) { FilterGraphTools.SetFilterFormat(compressor.MediaType, compressorFilter); } return compressorFilter; } }
public CrossbarHelper(IPin startingVideoInputPin) { foreach (PhysicalConnectorType type in Enum.GetValues(typeof(PhysicalConnectorType))) this.pinNameByPhysicalConnectorType[type] = StringFromPinType(type); int hr = BuildRoutingList(startingVideoInputPin, new Routing(), 0 /* Depth */); }
internal IPin Pin; // audio mixer interface (COM object) // -------------------- Constructors/Destructors ---------------------- /// <summary> Constructor. This class cannot be created directly. </summary> internal AudioSource( IPin pin ) { if ( (pin as IAMAudioInputMixer) == null ) throw new NotSupportedException( "The input pin does not support the IAMAudioInputMixer interface" ); this.Pin = pin; this.name = getName( pin ); }
public int ConnectedTo(out IPin pin) { // temporal pin = null; //throw new NotImplementedException(); return 0; }
internal AudioSource(IPin pin) { if (!(pin is IAMAudioInputMixer)) { throw new NotSupportedException("The input pin does not support the IAMAudioInputMixer interface"); } this.Pin = pin; base.name = this.GetName(pin); }
/// <summary> Release unmanaged resources. </summary> public override void Dispose() { if (Pin != null) { Marshal.ReleaseComObject(Pin); } Pin = null; base.Dispose(); }
public object GetValue(IPin pin) { if (Dispatcher == null) { return pin.GetValue(); } return Dispatcher.Invoke(() => pin.GetValue()); }
public VideoOutPinConfiguration( IBaseFilter filter, IPin pin, int format_id, VideoInfoHeader header ) { this.filter = filter; this.pin = pin; this.width = header.BmiHeader.Width; this.height = header.BmiHeader.Height; this.fps = 10000000 / header.AvgTimePerFrame; this.format_id = format_id; }
public static IPin FindPin(IBaseFilter filter, PinDirection direction, Guid mediaType, Guid pinCategory, string preferredName) { if (Guid.Empty != pinCategory) { int idx = 0; do { IPin pinByCategory = DsFindPin.ByCategory(filter, pinCategory, idx); if (pinByCategory != null) { if (IsMatchingPin(pinByCategory, direction, mediaType)) return PrintInfoAndReturnPin(filter, pinByCategory, direction, mediaType, pinCategory, "found by category"); Marshal.ReleaseComObject(pinByCategory); } else break; idx++; } while (true); } if (!string.IsNullOrEmpty(preferredName)) { IPin pinByName = DsFindPin.ByName(filter, preferredName); if (pinByName != null && IsMatchingPin(pinByName, direction, mediaType)) return PrintInfoAndReturnPin(filter, pinByName, direction, mediaType, pinCategory, "found by name"); Marshal.ReleaseComObject(pinByName); } IEnumPins pinsEnum; IPin[] pins = new IPin[1]; int hr = filter.EnumPins(out pinsEnum); DsError.ThrowExceptionForHR(hr); while (pinsEnum.Next(1, pins, IntPtr.Zero) == 0) { IPin pin = pins[0]; if (pin != null) { if (IsMatchingPin(pin, direction, mediaType)) return PrintInfoAndReturnPin(filter, pin, direction, mediaType, pinCategory, "found by direction and media type"); Marshal.ReleaseComObject(pin); } } return null; }
public PinViewModel(NodeViewModel nodeViewModel, IPin pin, IControlTypesResolver controlTypesResolver) { ControlTypesResolver = controlTypesResolver; NodeViewModel = nodeViewModel; Pin = pin; Name = pin.Name; Type = pin.Type; Point = new CanvasPoint(); var changablePin = pin as INotifyPropertyChanged; if (changablePin != null) { changablePin.PropertyChanged += OnPinPropertyChanged; _disposable = Disposable.Create(() => changablePin.PropertyChanged -= OnPinPropertyChanged); } UpdateValue(); }
/// <summary> /// Disposes the teletext component /// </summary> public void Dispose() { if (_filterWstDecoder != null) { Release.ComObject("wst codec filter", _filterWstDecoder); _filterWstDecoder = null; } if (_teeSink != null) { Release.ComObject("teesink filter", _teeSink); _teeSink = null; } if (_pinWST_VBI != null) { Release.ComObject("wst/vbi codec pinout", _pinWST_VBI); _pinWST_VBI = null; } }
/// <summary> Retrieve the friendly name of a connectorType. </summary> private string getName(IPin pin) { string s = "Unknown pin"; PinInfo pinInfo = new PinInfo(); // Direction matches, so add pin name to listbox int hr = pin.QueryPinInfo(out pinInfo); Marshal.ThrowExceptionForHR(hr); s = pinInfo.name + ""; // The pininfo structure contains a reference to an IBaseFilter, // so you must release its reference to prevent resource a leak. if (pinInfo.filter != null) Marshal.ReleaseComObject(pinInfo.filter); pinInfo.filter = null; return (s); }
public override void AddedToGraph(FilgraphManager fgm) { IGraphBuilder gb = (IGraphBuilder)fgm; //Add the Blackmagic Decoder filter and connect it. try { bfDecoder = Filter.CreateBaseFilterByName("Blackmagic Design Decoder (DMO)"); gb.AddFilter(bfDecoder, "Blackmagic Design Decoder (DMO)"); IPin decoderInput; bfDecoder.FindPin("in0", out decoderInput); bfDecoder.FindPin("out0", out decoderOutput); captureOutput = GetPin(filter, _PinDirection.PINDIR_OUTPUT, Pin.PIN_CATEGORY_CAPTURE, Guid.Empty, false, 0); gb.Connect(captureOutput, decoderInput); } catch { throw new ApplicationException("Failed to add the BlackMagic Decoder filter to the graph"); } base.AddedToGraph(fgm); }
private static bool IsMatchingPin(IPin pin, PinDirection direction, Guid mediaType) { PinDirection pinDirection; int hr = pin.QueryDirection(out pinDirection); DsError.ThrowExceptionForHR(hr); if (pinDirection != direction) // The pin lacks direction return false; IPin connectedPin; hr = pin.ConnectedTo(out connectedPin); if ((uint)hr != 0x80040209 /* Pin is not connected */) DsError.ThrowExceptionForHR(hr); if (connectedPin != null) { // The pin is already connected Marshal.ReleaseComObject(connectedPin); return false; } IEnumMediaTypes mediaTypesEnum; hr = pin.EnumMediaTypes(out mediaTypesEnum); DsError.ThrowExceptionForHR(hr); AMMediaType[] mediaTypes = new AMMediaType[1]; while (mediaTypesEnum.Next(1, mediaTypes, IntPtr.Zero) == 0) { Guid majorType = mediaTypes[0].majorType; DsUtils.FreeAMMediaType(mediaTypes[0]); if (majorType == mediaType) { // We have found the pin we were looking for return true; } } return false; }
private string getName(IPin pin) { string str = "Unknown pin"; PinInfo pInfo = new PinInfo(); int errorCode = pin.QueryPinInfo(out pInfo); if (errorCode == 0) { str = pInfo.name ?? ""; } else { Marshal.ThrowExceptionForHR(errorCode); } if (pInfo.filter != null) { Marshal.ReleaseComObject(pInfo.filter); } pInfo.filter = null; return str; }
public viPin FindPin(IPin hdepin) { foreach (viNode n in this.Nodes) { foreach (viInputPin i in n.InputPins) { if (i.HdePin == hdepin) { return i; } } foreach (viOutputPin i in n.OutputPins) { if (i.HdePin == hdepin) { return i; } } } return null; }
public DX11Pin FindPin(IPin hdepin) { foreach (DX11Node n in this.Nodes) { foreach (DX11InputPin i in n.InputPins) { if (i.HdePin == hdepin) { return i; } } foreach (DX11OutputPin i in n.OutputPins) { if (i.HdePin == hdepin) { return i; } } } return null; }
/// <summary> /// Gets a specific pin of a specific filter /// </summary> /// <param name="filter">Filter to retrieve the pin for (defines which object should make this method available)</param> /// <param name="dir">Direction</param> /// <param name="num">Number</param> /// <returns>IPin object or null</returns> public static IPin GetPin(this IBaseFilter filter, PinDirection dir, int num) { // Declare variables IPin[] pin = new IPin[1]; IEnumPins pinsEnum = null; // Enumerator the pins if (filter.EnumPins(out pinsEnum) == 0) { // Get the pin direction PinDirection pinDir; int n = 0; ; // Loop the pins while (pinsEnum.Next(1, pin, out n) == 0) { // Query the direction pin[0].QueryDirection(out pinDir); // Is the pin direction correct? if (pinDir == dir) { // Yes, check the pins if (num == 0) { return pin[0]; } num--; } // Release the pin, this is not the one we are looking for Marshal.ReleaseComObject(pin[0]); pin[0] = null; } } // Not found return null; }
/// <summary> /// Get filter's pin. /// </summary> /// /// <param name="filter">Filter to get pin of.</param> /// <param name="dir">Pin's direction.</param> /// <param name="num">Pin's number.</param> /// /// <returns>Returns filter's pin.</returns> /// public static IPin GetPin( IBaseFilter filter, PinDirection dir, int num ) { IPin[] pin = new IPin[1]; IEnumPins pinsEnum; // enum filter pins if ( filter.EnumPins( out pinsEnum ) == 0 ) { try { // get next pin int n; while ( pinsEnum.Next( 1, pin, out n ) == 0 ) { // query pin`s direction if (pin[0] != null) { PinDirection pinDir; pin[0].QueryDirection(out pinDir); if (pinDir == dir) { if (num == 0) return pin[0]; num--; } Marshal.ReleaseComObject(pin[0]); } pin[0] = null; } } finally { Marshal.ReleaseComObject( pinsEnum ); } } return null; }
public static bool DisconnectAllPins(IGraphBuilder graphBuilder, IBaseFilter filter) { IEnumPins pinEnum; int hr = filter.EnumPins(out pinEnum); if (hr != 0 || pinEnum == null) { return false; } FilterInfo info; filter.QueryFilterInfo(out info); Marshal.ReleaseComObject(info.pGraph); bool allDisconnected = true; for (; ; ) { IPin[] pins = new IPin[1]; IntPtr fetched = IntPtr.Zero; hr = pinEnum.Next(1, pins, fetched); if (hr != 0 || fetched == IntPtr.Zero) { break; } PinInfo pinInfo; pins[0].QueryPinInfo(out pinInfo); DsUtils.FreePinInfo(pinInfo); if (pinInfo.dir == PinDirection.Output) { if (!DisconnectPin(graphBuilder, pins[0])) { allDisconnected = false; } } Marshal.ReleaseComObject(pins[0]); } Marshal.ReleaseComObject(pinEnum); return allDisconnected; }
public static void FixFlippedVideo(IAMVideoControl videoControl, IPin pPin) { VideoControlFlags pCapsFlags; int hr = videoControl.GetCaps(pPin, out pCapsFlags); DsError.ThrowExceptionForHR(hr); if ((pCapsFlags & VideoControlFlags.FlipVertical) > 0) { hr = videoControl.GetMode(pPin, out pCapsFlags); DsError.ThrowExceptionForHR(hr); hr = videoControl.SetMode(pPin, pCapsFlags & ~VideoControlFlags.FlipVertical); DsError.ThrowExceptionForHR(hr); PinInfo pinInfo; hr = pPin.QueryPinInfo(out pinInfo); DsError.ThrowExceptionForHR(hr); Trace.WriteLine("Fixing 'FlipVertical' video for pin " + pinInfo.name); } if ((pCapsFlags & VideoControlFlags.FlipHorizontal) > 0) { hr = videoControl.GetMode(pPin, out pCapsFlags); DsError.ThrowExceptionForHR(hr); hr = videoControl.SetMode(pPin, pCapsFlags | VideoControlFlags.FlipHorizontal); DsError.ThrowExceptionForHR(hr); PinInfo pinInfo; hr = pPin.QueryPinInfo(out pinInfo); DsError.ThrowExceptionForHR(hr); Trace.WriteLine("Fixing 'FlipHorizontal' video for pin " + pinInfo.name); } }
protected IPin GetUnconnectedPin(IBaseFilter filter, PinDirection direction) { IPin destPin = null; IEnumPins iEnum; var pins = new IPin[1]; var hr = filter.EnumPins(out iEnum); Marshal.ThrowExceptionForHR(hr); var fetched = Marshal.AllocCoTaskMem(4); hr = iEnum.Next(1, pins, fetched); Marshal.ThrowExceptionForHR(hr); while (Marshal.ReadInt32(fetched) == 1) { PinDirection pinDir; IPin pPin; destPin = pins[0]; hr = destPin.QueryDirection(out pinDir); Marshal.ThrowExceptionForHR(hr); PinInfo info; destPin.QueryPinInfo(out info); //var name = info.name; destPin.ConnectedTo(out pPin); if (pPin == null && pinDir == direction) break; hr = iEnum.Next(1, pins, fetched); Marshal.ThrowExceptionForHR(hr); } Marshal.FreeCoTaskMem(fetched); return destPin; }
public ISpiBus CreateSpiBus(IPin clock, IPin mosi, IPin miso, long speed) { throw new NotImplementedException(); }
public Ssd1327(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin) { this.spiBus = (SpiBus)spiBus; spiBuffer = new byte[Width * Height / 2]; spiReceive = new byte[Width * Height / 2]; dataCommandPort = device.CreateDigitalOutputPort(dcPin, false); if (resetPin != null) { resetPort = device.CreateDigitalOutputPort(resetPin, true); } if (chipSelectPin != null) { chipSelectPort = device.CreateDigitalOutputPort(chipSelectPin, false); } spiPeripheral = new SpiPeripheral(spiBus, chipSelectPort); Initialize(); Thread.Sleep(300); FillBuffer(); Show(); }
/// <inheritdoc /> public bool CanConnectTo(IPin other) { return(other is FlowOutputPin); }
public ConnectionEventArgs(IPluginIO pluginIO, IPin otherPin) { PluginIO = pluginIO; OtherPin = otherPin; }
private void SetupGraph(DsDevice dev, int iWidth, int iHeight, short iBPP) { int hr; //IGraphBuilder pBuilder = null; //IBaseFilter pNullF = null; ISampleGrabber sampGrabber = null; IBaseFilter capFilter = null; IPin pCaptureOut = null; IPin pSampleIn = null; IPin pRenderIn = null; m_FilterGraph = new FilterGraph() as IFilterGraph2; try { hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, dev.Name, out capFilter); DsError.ThrowExceptionForHR(hr); m_pinStill = DsFindPin.ByCategory(capFilter, PinCategory.Still, 0); if (m_pinStill == null) { m_pinStill = DsFindPin.ByCategory(capFilter, PinCategory.Preview, 0); } if (m_pinStill == null) { IPin pRaw = null; IPin pSmart = null; m_VidControl = null; IBaseFilter iSmartTee = (IBaseFilter) new SmartTee(); try { hr = m_FilterGraph.AddFilter(iSmartTee, "SmartTee"); DsError.ThrowExceptionForHR(hr); pRaw = DsFindPin.ByCategory(capFilter, PinCategory.Capture, 0); pSmart = DsFindPin.ByDirection(iSmartTee, PinDirection.Input, 0); hr = m_FilterGraph.Connect(pRaw, pSmart); DsError.ThrowExceptionForHR(hr); m_pinStill = DsFindPin.ByName(iSmartTee, "Preview"); pCaptureOut = DsFindPin.ByName(iSmartTee, "Capture"); if (iHeight + iWidth + iBPP > 0) { SetConfigParms(pRaw, iWidth, iHeight, iBPP); } } finally { if (pRaw != null) { Marshal.ReleaseComObject(pRaw); } if (pRaw != pSmart) { Marshal.ReleaseComObject(pSmart); } if (pRaw != iSmartTee) { Marshal.ReleaseComObject(iSmartTee); } } } else { m_VidControl = capFilter as IAMVideoControl; pCaptureOut = DsFindPin.ByCategory(capFilter, PinCategory.Capture, 0); if (iHeight + iWidth + iBPP > 0) { SetConfigParms(m_pinStill, iWidth, iHeight, iBPP); } } sampGrabber = new SampleGrabber() as ISampleGrabber; IBaseFilter baseGrabFlt = sampGrabber as IBaseFilter; ConfigureSampleGrabber(sampGrabber); pSampleIn = DsFindPin.ByDirection(baseGrabFlt, PinDirection.Input, 0); IBaseFilter pRenderer = new VideoRendererDefault() as IBaseFilter; hr = m_FilterGraph.AddFilter(pRenderer, "Renderer"); //hr = m_FilterGraph.AddFilter(null, "Null render"); DsError.ThrowExceptionForHR(hr); pRenderIn = DsFindPin.ByDirection(pRenderer, PinDirection.Input, 0); hr = m_FilterGraph.AddFilter(baseGrabFlt, "Ds.NET Grabber"); DsError.ThrowExceptionForHR(hr); if (m_VidControl == null) { hr = m_FilterGraph.Connect(m_pinStill, pSampleIn); DsError.ThrowExceptionForHR(hr); hr = m_FilterGraph.Connect(pCaptureOut, pRenderIn); DsError.ThrowExceptionForHR(hr); } else { hr = m_FilterGraph.Connect(pCaptureOut, pRenderIn); DsError.ThrowExceptionForHR(hr); hr = m_FilterGraph.Connect(m_pinStill, pSampleIn); DsError.ThrowExceptionForHR(hr); } SaveSizeInfo(sampGrabber); IMediaControl mediaCtrl = m_FilterGraph as IMediaControl; hr = mediaCtrl.Run(); DsError.ThrowExceptionForHR(hr); } finally { if (sampGrabber != null) { Marshal.ReleaseComObject(sampGrabber); sampGrabber = null; } if (pCaptureOut != null) { Marshal.ReleaseComObject(pCaptureOut); pCaptureOut = null; } if (pRenderIn != null) { Marshal.ReleaseComObject(pRenderIn); pRenderIn = null; } if (pSampleIn != null) { Marshal.ReleaseComObject(pSampleIn); pSampleIn = null; } } }
/// <summary> /// Opens the media by initializing the DirectShow graph // // +----------------+ +----------------+ +-----------------------+ // +---------------------+ | LavVideo | | VobSub | | EVR+CustomPresenter | // | LavSplitterSource | |----------------| |----------------| |-----------------------| // +---------------------+ | | | | | | // | | | | | | | VIDEO | // | video +|->+---------+<-+ IN OUT +->+------+<-+ VID_IN OUT +-> +-+ <-+ RENDERER | // | | +----------------+ | | | | // | audio +|->+------+ | | +-----------------------+ // | | | +----------------+ +-+<-+ TXT_IN | // | subtitle +|->+--+ | | LavAudio | | | | // +---------------------+ | | |----------------| | +----------------+ +-----------------------+ // | | | | | | DShow output device | // | | | | xxx |-----------------------| // | +--+<-+ IN OUT +->+--x | x-----------------------+ | | // | +----------------+ | | AUDIO | // | | <-+ RENDERER | // | | | | // +--------------------------------+ +-----------------------+ // /// </summary> // protected virtual void OpenSource() // { // /* Make sure we clean up any remaining mess */ // //if (m_graph != null) RemoveAllFilters(m_graph); // FreeResources(); // if (m_sourceUri == null) // return; // string fileSource = m_sourceUri.OriginalString; // if (string.IsNullOrEmpty(fileSource)) // return; // try // { // if (m_graph != null) Marshal.ReleaseComObject(m_graph); // /* Creates the GraphBuilder COM object */ // m_graph = new FilterGraphNoThread() as IGraphBuilder; // if (m_graph == null) // throw new Exception("Could not create a graph"); // /* Add our prefered audio renderer */ // var audioRenderer = InsertAudioRenderer(AudioRenderer); // if (_audioRenderer != null) Marshal.ReleaseComObject(_audioRenderer); // _audioRenderer = audioRenderer; // if ((System.Environment.OSVersion.Platform == PlatformID.Win32NT && // (System.Environment.OSVersion.Version.Major == 5))) // VideoRenderer = VideoRendererType.VideoMixingRenderer9; // IBaseFilter renderer = CreateVideoRenderer(VideoRenderer, m_graph, 2); // if (_renderer != null) Marshal.ReleaseComObject(_renderer); // _renderer = renderer; // //if (_renderer != null) // // m_graph.AddFilter((IBaseFilter)_renderer, "Renderer"); // var filterGraph = m_graph as IFilterGraph2; // if (filterGraph == null) // throw new Exception("Could not QueryInterface for the IFilterGraph2"); // ILAVAudioSettings lavAudioSettings; // ILAVAudioStatus lavStatus; // IBaseFilter audioDecoder = FilterProvider.GetAudioFilter(out lavAudioSettings, out lavStatus); // if (audioDecoder != null) // { // if (_audio != null) Marshal.ReleaseComObject(_audio); // _audio = audioDecoder; // lavAudioSettings.SetRuntimeConfig(true); // m_graph.AddFilter((IBaseFilter)_audio, "LavAudio"); // } // ILAVSplitterSettings splitterSettings; // IFileSourceFilter splitter = FilterProvider.GetSplitterSource(out splitterSettings); // //IBaseFilter splitter = FilterProvider.GetSplitter(out splitterSettings); // if (splitter != null) // { // splitter.Load(fileSource, null); // if (_splitter != null) Marshal.ReleaseComObject(_splitter); // _splitter = splitter; // splitterSettings.SetRuntimeConfig(true); // m_graph.AddFilter((IBaseFilter)splitter, "LavSplitter"); // } // int hr = 0; // /* We will want to enum all the pins on the source filter */ // IEnumPins pinEnum; // hr = ((IBaseFilter)splitter).EnumPins(out pinEnum); // DsError.ThrowExceptionForHR(hr); // IntPtr fetched = IntPtr.Zero; // IPin[] pins = { null }; // /* Counter for how many pins successfully rendered */ // if (VideoRenderer == VideoRendererType.VideoMixingRenderer9) // { // var mixer = renderer as IVMRMixerControl9; // if (mixer != null) // { // VMR9MixerPrefs dwPrefs; // mixer.GetMixingPrefs(out dwPrefs); // dwPrefs &= ~VMR9MixerPrefs.RenderTargetMask; // dwPrefs |= VMR9MixerPrefs.RenderTargetRGB; // //mixer.SetMixingPrefs(dwPrefs); // } // } // // Test using FFDShow Video Decoder Filter // ILAVVideoSettings lavVideoSettings; // IBaseFilter lavVideo = FilterProvider.GetVideoFilter(out lavVideoSettings); // if (_video != null) Marshal.ReleaseComObject(_video); // _video = lavVideo; // IBaseFilter vobSub = FilterProvider.GetVobSubFilter(); // if (vobSub != null) // { // m_graph.AddFilter(vobSub, "VobSub"); // IDirectVobSub vss = vobSub as IDirectVobSub; // if (_vobsub != null) Marshal.ReleaseComObject(_vobsub); // _vobsub = vss; // InitSubSettings(); // } // if (lavVideo != null) // { // lavVideoSettings.SetRuntimeConfig(true); // m_graph.AddFilter(lavVideo, "LavVideo"); // } // int ret; // IBaseFilter dcDsp = FilterProvider.GetDCDSPFilter(); // if (dcDsp != null) // { // _dspFilter = (IDCDSPFilterInterface)dcDsp; // //hr = i.set_PCMDataBeforeMainDSP(true); // hr = m_graph.AddFilter((IBaseFilter)dcDsp, "VobSub"); // ret = m_graph.Connect(DsFindPin.ByName((IBaseFilter)splitter, "Audio"), DsFindPin.ByDirection(audioDecoder, PinDirection.Input, 0)); // ret = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)audioDecoder, PinDirection.Output, 0), DsFindPin.ByDirection(_dspFilter, PinDirection.Input, 0)); // ret = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_dspFilter, PinDirection.Output, 0), DsFindPin.ByDirection(audioRenderer, PinDirection.Input, 0)); // //bool d = false; // //int delay = 0; // //hr = i.get_EnableDelay(ref d); // int cnt = 0; // object intf = null; // //hr = i.set_EnableDelay(true); // //hr = i.set_Delay(0); // hr = _dspFilter.set_AddFilter(0, TDCFilterType.ftEqualizer); // hr = _dspFilter.get_FilterCount(ref cnt); // hr = _dspFilter.get_FilterInterface(0, out intf); // _equalizer = (IDCEqualizer)intf; // hr = _dspFilter.set_AddFilter(0, TDCFilterType.ftDownMix); // hr = _dspFilter.get_FilterInterface(0, out intf); // _downmix = (IDCDownMix)intf; // hr = _dspFilter.set_AddFilter(0, TDCFilterType.ftAmplify); // hr = _dspFilter.get_FilterInterface(0, out intf); // _amplify = (IDCAmplify)intf; // _equalizer.set_Seperate(false); // } // bool subconnected = false; // ret = m_graph.Connect(DsFindPin.ByName((IBaseFilter)splitter, "Video"), DsFindPin.ByDirection(lavVideo, PinDirection.Input, 0)); // ret = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)lavVideo, PinDirection.Output, 0), DsFindPin.ByDirection(vobSub, PinDirection.Input, 0)); // if (ret == 0) // { // int lc; // ((IDirectVobSub)vobSub).get_LanguageCount(out lc); // subconnected = (lc != 0); // IPin pn = DsFindPin.ByName((IBaseFilter)splitter, "Subtitle"); // if (pn != null) // { // ret = m_graph.Connect(pn, DsFindPin.ByDirection(vobSub, PinDirection.Input, 1)); // ((IDirectVobSub)vobSub).get_LanguageCount(out lc); // subconnected = (lc != 0); // } // ret = m_graph.Connect(DsFindPin.ByDirection(vobSub, PinDirection.Output, 0), // DsFindPin.ByDirection(renderer, PinDirection.Input, 0)); // } // else // { // ret = m_graph.Connect(DsFindPin.ByDirection(lavVideo, PinDirection.Output, 0), // DsFindPin.ByDirection(renderer, PinDirection.Input, 0)); // } // /* Loop over each pin of the source filter */ // while (pinEnum.Next(pins.Length, pins, fetched) == 0) // { // IPin cTo; // pins[0].ConnectedTo(out cTo); // if (cTo == null) // { // // this should not happen if the filtegraph is manually connected in a good manner // ret = filterGraph.RenderEx(pins[0], AMRenderExFlags.RenderToExistingRenderers, IntPtr.Zero); // } // else // { // Marshal.ReleaseComObject(cTo); // } // Marshal.ReleaseComObject(pins[0]); // } // if (lavVideoSettings != null) // { // if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_CUDA) != 0) // { // ret = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_CUDA); // } // else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_QuickSync) != 0) // { // ret = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_QuickSync); // } // else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2Native) != 0) // { // ret = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2Native); // } // else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2) != 0) // { // ret = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2); // } // else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2CopyBack) != 0) // { // ret = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2CopyBack); // } // } // //hr = m_graph.RenderFile(fileSource, null); // Marshal.ReleaseComObject(pinEnum); // IAMStreamSelect selector = splitter as IAMStreamSelect; // int numstreams; // selector.Count(out numstreams); // AMMediaType mt; // AMStreamSelectInfoFlags fl; // SubtitleStreams.Clear(); // VideoStreams.Clear(); // AudioStreams.Clear(); // for (int i = 0; i < numstreams; i++) // { // int lcid; // int group; // string name; // object o, o2; // selector.Info(i, out mt, out fl, out lcid, out group, out name, out o, out o2); // switch (group) // { // case 0: // VideoStreams.Add(name); // break; // case 1: // AudioStreams.Add(name); // break; // case 2: // SubtitleStreams.Add(name); // break; // } // if (o != null) Marshal.ReleaseComObject(o); // if (o2 != null) Marshal.ReleaseComObject(o2); // } // OnPropertyChanged("SubtitleStreams"); // OnPropertyChanged("VideoStreams"); // OnPropertyChanged("AudioStreams"); // //Marshal.ReleaseComObject(splitter); // /* Configure the graph in the base class */ // SetupFilterGraph(m_graph); //#if DEBUG // /* Adds the GB to the ROT so we can view //* it in graphedit */ // m_dsRotEntry = new DsROTEntry(m_graph); //#endif // //if (_splitterSettings != null) // //{ // // Marshal.ReleaseComObject(_splitterSettings); // // _splitterSettings = null; // //} // if (_splitterSettings != null) Marshal.ReleaseComObject(_splitterSettings); // _splitterSettings = (ILAVSplitterSettings)splitter; // //ret = _splitterSettings.SetRuntimeConfig(true); // //if (ret != 0) // // throw new Exception("Could not set SetRuntimeConfig to true"); // //string sss = "*:*"; // //LAVSubtitleMode mode = LAVSubtitleMode.LAVSubtitleMode_NoSubs; // //mode = _splitterSettings.GetSubtitleMode(); // //if (mode != LAVSubtitleMode.LAVSubtitleMode_Default) // // throw new Exception("Could not set GetAdvancedSubtitleConfige"); // //ret = _splitterSettings.SetSubtitleMode(LAVSubtitleMode.LAVSubtitleMode_Advanced); // //if (ret != 1) // // throw new Exception("Could not set SetAdvancedSubtitleConfige"); // //ret = _splitterSettings.SetAdvancedSubtitleConfig(sss); // //if (ret != 1) // // throw new Exception("Could not set SetAdvancedSubtitleConfige"); // //sss = ""; // //ret = _splitterSettings.GetAdvancedSubtitleConfig(out sss); // //if (ret != 0) // // throw new Exception("Could not set GetAdvancedSubtitleConfige"); // //IPin sub = DsFindPin.ByDirection((IBaseFilter)splitter, PinDirection.Output, 2); // //PinInfo pi; // //sub.QueryPinInfo(out pi); // SIZE a, b; // if ((_displayControl).GetNativeVideoSize(out a, out b) == 0) // { // if (a.cx > 0 && a.cy > 0) // { // HasVideo = true; // SetNativePixelSizes(a); // } // } // if (!subconnected) // { // InvokeNoSubtitleLoaded(new EventArgs()); // } // else // { // InitSubSettings(); // } // /* Sets the NaturalVideoWidth/Height */ // //SetNativePixelSizes(renderer); // //InvokeMediaFailed(new MediaFailedEventArgs(sss, null)); // } // catch (Exception ex) // { // /* This exection will happen usually if the media does // * not exist or could not open due to not having the // * proper filters installed */ // FreeResources(); // /* Fire our failed event */ // InvokeMediaFailed(new MediaFailedEventArgs(ex.Message, ex)); // } // finally // { // string filters = string.Join(Environment.NewLine, EnumAllFilters(m_graph).ToArray()); // System.Diagnostics.Debug.WriteLine(filters); // } // InvokeMediaOpened(); // } protected virtual void OpenSource() { //if (m_graph != null) //{ // //RemoveAllFilters(m_graph); // Marshal.ReleaseComObject(m_graph); //} /* Make sure we clean up any remaining mess */ FreeResources(); if (m_sourceUri == null) { return; } string fileSource = m_sourceUri.OriginalString; if (string.IsNullOrEmpty(fileSource)) { return; } try { int hr = 0; /* Creates the GraphBuilder COM object */ m_graph = new FilterGraphNoThread() as IGraphBuilder; if (_displayControl != null) { Marshal.ReleaseComObject(_displayControl); _displayControl = null; } if (_displayControlVMR != null) { Marshal.ReleaseComObject(_displayControlVMR); _displayControlVMR = null; } if (m_graph == null) { throw new Exception("Could not create a graph"); } var filterGraph = m_graph as IFilterGraph2; var flt = EnumAllFilters(m_graph).ToList(); if (filterGraph == null) { throw new Exception("Could not QueryInterface for the IFilterGraph2"); } /* Add our prefered audio renderer */ var audioRenderer = InsertAudioRenderer(AudioRenderer); if (audioRenderer != null) { if (_audioRenderer != null) { Marshal.ReleaseComObject(_audioRenderer); } _audioRenderer = audioRenderer; } if ((System.Environment.OSVersion.Platform == PlatformID.Win32NT && (System.Environment.OSVersion.Version.Major == 5))) { VideoRenderer = VideoRendererType.VideoMixingRenderer9; } if (_presenterSettings != null) { Marshal.ReleaseComObject(_presenterSettings); } if (_renderer != null) { Marshal.ReleaseComObject(_renderer); } IBaseFilter renderer = InsertVideoRenderer(VideoRenderer, m_graph, 1); _renderer = renderer; ILAVAudioSettings lavAudioSettings; ILAVAudioStatus lavStatus; IBaseFilter audioDecoder = FilterProvider.GetAudioFilter(out lavAudioSettings, out lavStatus); if (audioDecoder != null) { if (_audio != null) { Marshal.ReleaseComObject(_audio); } _audio = audioDecoder; _audioStatus = lavStatus; _audioSettings = lavAudioSettings; hr = (int)lavAudioSettings.SetRuntimeConfig(true); hr = m_graph.AddFilter((IBaseFilter)audioDecoder, "LavAudio"); DsError.ThrowExceptionForHR(hr); #if DEBUG hr = (int)lavAudioSettings.SetTrayIcon(true); #endif } ILAVSplitterSettings splitterSettings; IFileSourceFilter splitter = FilterProvider.GetSplitterSource(out splitterSettings); if (splitter != null) { if (_splitter != null) { Marshal.ReleaseComObject(_splitter); } _splitter = splitter; _splitterSettings = (ILAVSplitterSettings)splitterSettings; hr = splitterSettings.SetRuntimeConfig(true); hr = splitter.Load(fileSource, null); if (hr != 0) { throw new Exception("Playback of this file is not supported!"); } hr = m_graph.AddFilter((IBaseFilter)splitter, "LavSplitter"); DsError.ThrowExceptionForHR(hr); } IEnumPins pinEnum; hr = ((IBaseFilter)splitter).EnumPins(out pinEnum); DsError.ThrowExceptionForHR(hr); IntPtr fetched = IntPtr.Zero; IPin[] pins = { null }; if (VideoRenderer == VideoRendererType.VideoMixingRenderer9) { var mixer = _renderer as IVMRMixerControl9; if (mixer != null) { VMR9MixerPrefs dwPrefs; mixer.GetMixingPrefs(out dwPrefs); dwPrefs &= ~VMR9MixerPrefs.RenderTargetMask; dwPrefs |= VMR9MixerPrefs.RenderTargetRGB; mixer.SetMixingPrefs(dwPrefs); } } ILAVVideoSettings lavVideoSettings; IBaseFilter lavVideo = FilterProvider.GetVideoFilter(out lavVideoSettings); if (lavVideo != null) { if (_video != null) { Marshal.ReleaseComObject(_video); } _video = lavVideo; if (lavVideoSettings != null) { _videoSettings = lavVideoSettings; lavVideoSettings.SetRuntimeConfig(true); hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_None); // check for best acceleration available //if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_CUDA) != 0) //{ // hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_CUDA); // hr = lavVideoSettings.SetHWAccelResolutionFlags(LAVHWResFlag.SD | LAVHWResFlag.HD | LAVHWResFlag.UHD); //} //else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_QuickSync) != 0) //{ // hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_QuickSync); // hr = lavVideoSettings.SetHWAccelResolutionFlags(LAVHWResFlag.SD | LAVHWResFlag.HD | LAVHWResFlag.UHD); //} //else if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2Native) != 0) { hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2Native); hr = lavVideoSettings.SetHWAccelResolutionFlags(LAVHWResFlag.SD | LAVHWResFlag.HD | LAVHWResFlag.UHD); } //else //if (lavVideoSettings.CheckHWAccelSupport(LAVHWAccel.HWAccel_DXVA2CopyBack) != 0) //{ // hr = lavVideoSettings.SetHWAccel(LAVHWAccel.HWAccel_DXVA2CopyBack); // hr = lavVideoSettings.SetHWAccelResolutionFlags(LAVHWResFlag.SD | LAVHWResFlag.HD | LAVHWResFlag.UHD); //} #if DEBUG hr = lavVideoSettings.SetTrayIcon(true); #endif } hr = m_graph.AddFilter(_video, "LavVideo"); DsError.ThrowExceptionForHR(hr); } IBaseFilter vobSub = FilterProvider.GetVobSubFilter(); if (vobSub != null) { try { hr = m_graph.AddFilter(vobSub, "VobSub"); DsError.ThrowExceptionForHR(hr); IDirectVobSub vss = vobSub as IDirectVobSub; if (_vobsub != null) { Marshal.ReleaseComObject(_vobsub); } _vobsub = vss; InitSubSettings(); } catch { } } hr = m_graph.Connect(DsFindPin.ByName((IBaseFilter)splitter, "Audio"), DsFindPin.ByDirection(_audio, PinDirection.Input, 0)); if (hr == 0) { HasAudio = true; } else { HasAudio = false; } IBaseFilter dcDsp = FilterProvider.GetDCDSPFilter(); if (dcDsp != null) { if (_dspFilter != null) { Marshal.ReleaseComObject(_dspFilter); } _dspFilter = (IDCDSPFilterInterface)dcDsp; if (HasAudio) { hr = m_graph.AddFilter((IBaseFilter)_dspFilter, "AudioProcessor"); hr = _dspFilter.set_EnableBitrateConversionBeforeDSP(true); hr = ((IDCDSPFilterVisualInterface)_dspFilter).set_VISafterDSP(true); hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_audio, PinDirection.Output, 0), DsFindPin.ByDirection(_dspFilter, PinDirection.Input, 0)); DsError.ThrowExceptionForHR(hr); hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_dspFilter, PinDirection.Output, 0), DsFindPin.ByDirection(_audioRenderer, PinDirection.Input, 0)); var cb = new AudioCallback(this); hr = _dspFilter.set_CallBackPCM(cb); object intf = null; hr = _dspFilter.set_AddFilter(0, TDCFilterType.ftEqualizer); hr = _dspFilter.get_FilterInterface(0, out intf); _equalizer = (IDCEqualizer)intf; _equalizer.set_Seperate(false); } } else { if (HasAudio) { hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_audio, PinDirection.Output, 0), DsFindPin.ByDirection(_audioRenderer, PinDirection.Input, 0)); } } bool subconnected = false; hr = m_graph.Connect(DsFindPin.ByName((IBaseFilter)_splitter, "Video"), DsFindPin.ByDirection(_video, PinDirection.Input, 0)); if (hr == 0) { HasVideo = true; } else { HasVideo = false; } if (HasVideo) { hr = m_graph.Connect(DsFindPin.ByDirection((IBaseFilter)_video, PinDirection.Output, 0), DsFindPin.ByDirection(vobSub, PinDirection.Input, 0)); DsError.ThrowExceptionForHR(hr); if (hr == 0) { int lc; ((IDirectVobSub)vobSub).get_LanguageCount(out lc); subconnected = (lc != 0); IPin pn = DsFindPin.ByName((IBaseFilter)splitter, "Subtitle"); if (pn != null) { hr = m_graph.Connect(pn, DsFindPin.ByDirection(vobSub, PinDirection.Input, 1)); ((IDirectVobSub)vobSub).get_LanguageCount(out lc); subconnected = (lc != 0); } hr = m_graph.Connect(DsFindPin.ByDirection(vobSub, PinDirection.Output, 0), DsFindPin.ByDirection(_renderer, PinDirection.Input, 0)); } else { if (_vobsub != null) { Marshal.ReleaseComObject(_vobsub); } _vobsub = null; hr = m_graph.Connect(DsFindPin.ByDirection(_video, PinDirection.Output, 0), DsFindPin.ByDirection(_renderer, PinDirection.Input, 0)); } } /* Loop over each pin of the source filter */ while (pinEnum.Next(pins.Length, pins, fetched) == 0) { IPin cTo; pins[0].ConnectedTo(out cTo); if (cTo == null) { // this should not happen if the filtegraph is manually connected in a good manner hr = filterGraph.RenderEx(pins[0], AMRenderExFlags.RenderToExistingRenderers, IntPtr.Zero); } else { Marshal.ReleaseComObject(cTo); } Marshal.ReleaseComObject(pins[0]); } Marshal.ReleaseComObject(pinEnum); var selector = splitter as IAMStreamSelect; int numstreams; selector.Count(out numstreams); AMMediaType mt; AMStreamSelectInfoFlags fl; SubtitleStreams.Clear(); VideoStreams.Clear(); AudioStreams.Clear(); for (int i = 0; i < numstreams; i++) { int lcid; int group; string name; object o, o2; selector.Info(i, out mt, out fl, out lcid, out group, out name, out o, out o2); switch (group) { case 0: VideoStreams.Add(name); break; case 1: AudioStreams.Add(name); break; case 2: SubtitleStreams.Add(name); break; } if (o != null) { Marshal.ReleaseComObject(o); } if (o2 != null) { Marshal.ReleaseComObject(o2); } } OnPropertyChanged("SubtitleStreams"); OnPropertyChanged("VideoStreams"); OnPropertyChanged("AudioStreams"); /* Configure the graph in the base class */ SetupFilterGraph(m_graph); #if DEBUG /* Adds the GB to the ROT so we can view * it in graphedit */ m_dsRotEntry = new DsROTEntry(m_graph); #endif SIZE a, b; if (HasVideo && _displayControl != null && (_displayControl).GetNativeVideoSize(out a, out b) == 0) { var sz = MediaPlayerBase.GetVideoSize(_renderer, PinDirection.Input, 0); if (a.cx > 0 && a.cy > 0) { SetNativePixelSizes(a); } } if (!subconnected) { InvokeNoSubtitleLoaded(new EventArgs()); } else { InitSubSettings(); } } catch (Exception ex) { /* This exection will happen usually if the media does * not exist or could not open due to not having the * proper filters installed */ FreeResources(); /* Fire our failed event */ InvokeMediaFailed(new MediaFailedEventArgs(ex.Message, ex)); } InvokeMediaOpened(); }
public static IEnumerator <WavFormatInfo> EnumerateFormatsForDirection(IBaseFilter filter, PinDirection direction) { if (filter == null) { throw new ArgumentNullException("filter"); } IEnumPins pinsEnum = null; try { int hr = filter.EnumPins(out pinsEnum); DsError.ThrowExceptionForHR(hr); if (pinsEnum == null) { throw new InvalidOperationException("pinsEnum is null"); } var pins = new IPin[1]; while (true) { try { int fetched = 0; IntPtr pcFetched = Marshal.AllocCoTaskMem(4); try { hr = pinsEnum.Next(pins.Length, pins, pcFetched); DsError.ThrowExceptionForHR(hr); fetched = Marshal.ReadInt32(pcFetched); } finally { Marshal.FreeCoTaskMem(pcFetched); } if (fetched == 1) { // we have something IPin pin = pins[0]; string queryId; hr = pin.QueryId(out queryId); DsError.ThrowExceptionForHR(hr); PinInfo pinInfo; hr = pin.QueryPinInfo(out pinInfo); DsError.ThrowExceptionForHR(hr); if (pinInfo.dir != direction) { continue; } IEnumMediaTypes mediaTypesEnum = null; try { hr = pin.EnumMediaTypes(out mediaTypesEnum); DsError.ThrowExceptionForHR(hr); var mediaTypes = new AMMediaType[1]; while (true) { IntPtr mtFetched = Marshal.AllocCoTaskMem(4); try { hr = mediaTypesEnum.Next(1, mediaTypes, mtFetched); DsError.ThrowExceptionForHR(hr); fetched = Marshal.ReadInt32(mtFetched); } finally { Marshal.FreeCoTaskMem(mtFetched); } if (fetched == 1) { if (mediaTypes[0].formatType == FormatType.WaveEx) { yield return(new WavFormatInfo(mediaTypes[0])); } } else { break; } } } finally { if (mediaTypesEnum != null) { Marshal.ReleaseComObject(mediaTypesEnum); } } } else { break; } } finally { if (pins[0] != null) { Marshal.ReleaseComObject(pins[0]); } pins[0] = null; } } } finally { if (pinsEnum != null) { Marshal.ReleaseComObject(pinsEnum); } } }
/// <summary> /// Create a new SFSR02 object with an IO Device /// </summary> /// <param name="triggerEchoPin"></param> /// <param name="device"></param> public Sfsr02(IIODevice device, IPin triggerEchoPin) : this(device.CreateBiDirectionalPort(triggerEchoPin, false)) { }
public void CaptureVideo() { int hr = 0; try { int width = INI.Default["DirectShow Player"]["Video Player/Device Source Width", "352"].Integer; int Height = INI.Default["DirectShow Player"]["Video Player/Device Source Height", "240"].Integer; int fps = INI.Default["DirectShow Player"]["Video Player/Frames Per Second (0 unlimited)", "30"].Integer; bool antenna_input = INI.Default[Options.ProgramName]["Video Player/Capture Tuner from antenna", "true"].Bool; bool capture_TV = INI.Default[Options.ProgramName]["Video Player/Capture Tuner", "true"].Bool; bool capture_is_audio = INI.Default[Options.ProgramName]["Video Player/Capture Video is Audio also", "true"].Bool; IPin cap_pin = null; IPin cap_audio_pin; crossbar_to_tuner = capture_TV; // Get DirectShow interfaces GetInterfaces(); // Attach the filter graph to the capture graph hr = this.captureGraphBuilder.SetFiltergraph(this.graphBuilder); DsError.ThrowExceptionForHR(hr); // Use the system device enumerator and class enumerator to find // a video capture/preview device, such as a desktop USB video camera. sourceFilter = this.DeviceFinder.FindVideoCaptureDevice(false); if (sourceFilter == null) { Network.SendStatus(channel, volume, false); return; } #if use_bda bda_filter = FindVideoCaptureDevice(true); #endif if (!capture_is_audio) { sourceAudioFilter = this.DeviceFinder.FindAudioCaptureDevice(); } else { sourceAudioFilter = sourceFilter; } //reclock_video_filter = FindVideoRenderDevice(); //scale_filter = FindVideoScaleDevice(); reclock_filter = this.DeviceFinder.FindAudioRenderDevice(); IAMAnalogVideoDecoder decoder = sourceFilter as IAMAnalogVideoDecoder; if (decoder != null) { AnalogVideoStandard oldStandard; decoder.get_TVFormat(out oldStandard); if (oldStandard != AnalogVideoStandard.NTSC_M) { decoder.put_TVFormat(AnalogVideoStandard.NTSC_M); } decoder = null; } // this is really for which input - the tuner we shouldn't adjust //if( !capture_TV ) // Add Capture filter to our graph. hr = this.graphBuilder.AddFilter(sourceFilter, "Video Capture"); DsError.ThrowExceptionForHR(hr); if (scale_filter != null) { hr = this.graphBuilder.AddFilter(scale_filter, "Video Scaler"); DsError.ThrowExceptionForHR(hr); } this.graphBuilder.Connect(null, null); #if use_bda if (bda_filter != null) { hr = this.graphBuilder.AddFilter(bda_filter, "Video Tuner"); DsError.ThrowExceptionForHR(hr); } #endif if (capture_TV && !capture_is_audio) { if (sourceAudioFilter != null) { hr = this.graphBuilder.AddFilter(sourceAudioFilter, "Audio Capture"); DsError.ThrowExceptionForHR(hr); } } if (reclock_filter != null) { Log.log("Adding 'reclock' which is the audio output device?"); hr = this.graphBuilder.AddFilter(reclock_filter, "Audio Renderer"); DsError.ThrowExceptionForHR(hr); } //this.graphBuilder.AddFilter( AdjustCrossbarPin(); bool cap_is_preview; { // set the video input size on the preview pin. cap_audio_pin = DsFindPin.ByCategory((IBaseFilter)sourceAudioFilter, PinCategory.Preview, 0); cap_pin = DsFindPin.ByCategory((IBaseFilter)sourceFilter, PinCategory.Preview, 0); if (cap_pin == null) { cap_is_preview = false; cap_audio_pin = DsFindPin.ByCategory((IBaseFilter)sourceAudioFilter, PinCategory.Capture, 0); cap_pin = DsFindPin.ByCategory((IBaseFilter)sourceFilter, PinCategory.Capture, 0); } else { cap_is_preview = true; } //Log.log( "Cap pin + " + cap_pin ); } // Render the preview pin on the video capture filter // Use this instead of this.graphBuilder.RenderFile if (cap_is_preview) { //hr = this.captureGraphBuilder.RenderStream( PinCategory.Preview, MediaType.Video, scale_filter, null, null ); //DsError.ThrowExceptionForHR( hr ); hr = this.captureGraphBuilder.RenderStream(PinCategory.Preview, MediaType.Video, sourceFilter, null, null); DsError.ThrowExceptionForHR(hr); if (sourceAudioFilter != null) { hr = this.captureGraphBuilder.RenderStream(PinCategory.Preview, MediaType.Audio, sourceAudioFilter, null, reclock_filter); DsError.ThrowExceptionForHR(hr); } } else { //hr = this.captureGraphBuilder.RenderStream( PinCategory.Capture, MediaType.Video, scale_filter, null, null ); //DsError.ThrowExceptionForHR( hr ); hr = this.captureGraphBuilder.RenderStream(PinCategory.Capture, MediaType.Video, sourceFilter, null, null); DsError.ThrowExceptionForHR(hr); if (sourceAudioFilter != null) { //IBaseFilter renderer = null; //Log.log( "reclock is " + reclock_filter ); hr = this.captureGraphBuilder.RenderStream(PinCategory.Capture, MediaType.Audio, sourceAudioFilter, null, reclock_filter); if (hr != 0) { Log.log("Bad audio stream"); } //DsError.ThrowExceptionForHR( hr ); } } IAMStreamConfig stream = cap_pin as IAMStreamConfig; if (stream != null) { // 352x240 AMMediaType media; VideoInfoHeader vih = new VideoInfoHeader(); stream.GetFormat(out media); Marshal.PtrToStructure(media.formatPtr, vih); //vih.BmiHeader.Width = width; //vih.BmiHeader.Height = Height; if (fps > 0) { vih.AvgTimePerFrame = (10000000L / fps); } //Log.log( "set the bitmap override..." ); Marshal.StructureToPtr(vih, media.formatPtr, false); hr = stream.SetFormat(media); if (hr != 0) { Log.log("Failed to set format (preview)." + hr); } } else { Log.log("Failed to get stream config from source filter"); } //graph_filter.SetSyncSource( ref_clock ); object o; hr = captureGraphBuilder.FindInterface(null, null, sourceFilter, typeof(IReferenceClock).GUID, out o); if (hr == 0) { ref_clock = (IReferenceClock)o; } if (ref_clock == null) { hr = captureGraphBuilder.FindInterface(null, null, sourceAudioFilter, typeof(IReferenceClock).GUID, out o); ref_clock = (IReferenceClock)o; } hr = captureGraphBuilder.FindInterface(null, null, sourceFilter, typeof(IAMTVTuner).GUID, out o); //graphBuilder.sa. if (hr >= 0) { tuner = (IAMTVTuner)o; o = null; } if (tuner != null) { if (antenna_input) { TunerInputType type; hr = tuner.get_InputType(0, out type); if (type != TunerInputType.Antenna) { tuner.put_InputType(0, TunerInputType.Antenna); hr = tuner.get_InputType(0, out type); } } else { if (tuner != null) { TunerInputType type; hr = tuner.get_InputType(0, out type); if (type != TunerInputType.Cable) { tuner.put_InputType(0, TunerInputType.Cable); hr = tuner.get_InputType(0, out type); } } } tuner.ChannelMinMax(out min_channel, out max_channel); min_channel = INI.Default["DirectShow Player"]["Video Player/Minimum Channel", min_channel.ToString()].Integer; max_channel = INI.Default["DirectShow Player"]["Video Player/Maximum Channel", max_channel.ToString()].Integer; } // Now that the filter has been added to the graph and we have // rendered its stream, we can release this reference to the filter. if (sourceAudioFilter != null) { //hr = captureGraphBuilder.FindInterface( null, null, sourceFilter, typeof( IAMTVAudio ).GUID, out o ); hr = captureGraphBuilder.FindInterface(null, null, sourceAudioFilter, typeof(IBasicAudio).GUID, out o); if (hr >= 0) { audio_mixer = (IBasicAudio)o; o = null; } } Marshal.ReleaseComObject(sourceFilter); if (audio_mixer != null) { audio_mixer.get_Volume(out volume); } if (tuner != null) { tuner.get_Channel(out channel, out sub_channel, out sub_channel2); } //this.graphBuilder.SetDefaultSyncSource(); if (ref_clock != null) { this.graph_filter.SetSyncSource(ref_clock); } graph_streams.SyncUsingStreamOffset(true); // Set video window style and position SetupVideoWindow(); // Add our graph to the running object table, which will allow // the GraphEdit application to "spy" on our graph rot = new DsROTEntry(this.graphBuilder); //this.mediaControl.set // Start previewing video data hr = this.mediaControl.Run(); DsError.ThrowExceptionForHR(hr); // Remember current state this.currentState = PlayState.Running; Network.SendStatus(channel, volume, (this.currentState == PlayState.Running)); } catch (Exception e) { MessageBox.Show("An unrecoverable error has occurred : " + e.Message); this.DialogResult = DialogResult.Abort; this.Close(); Application.Exit(); } }
/// <summary> /// Checks whether or not the pin passed in exists on the chip. /// </summary> protected bool IsValidPin(IPin pin) { return(Pins.AllPins.Contains(pin)); }
/// <summary> /// Creates a LED through a pin directly from the Digital IO of the board /// </summary> /// <param name="pin"></param> public Led(IIODevice device, IPin pin) : this(device.CreateDigitalOutputPort(pin, false)) { }
public IDigitalInputPort CreateDigitalInputPort(IPin pin, InterruptMode interruptMode = InterruptMode.None, ResistorMode resistorMode = ResistorMode.Disabled, int debounceDuration = 0, int glitchFilterCycleCount = 0) { throw new NotImplementedException(); }
public IBiDirectionalPort CreateBiDirectionalPort(IPin pin, bool initialState = false, bool glitchFilter = false, InterruptMode interruptMode = InterruptMode.None, ResistorMode resistorMode = ResistorMode.Disabled, PortDirectionType initialDirection = PortDirectionType.Input) { throw new NotImplementedException(); }
public II2cBus CreateI2cBus(IPin clock, IPin data, ushort speed = 100) { throw new NotImplementedException(); }
/// <summary> /// Create a new HCSR04 object with an IO Device /// </summary> /// <param name="triggerPin"></param> /// <param name="echoPin"></param> public Hcsr04(IIODevice device, IPin triggerPin, IPin echoPin) : this(device.CreateDigitalOutputPort(triggerPin, false), device.CreateDigitalInputPort(echoPin, InterruptMode.EdgeBoth)) { }
public SSD1351(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, uint width, uint height) : base(device, spiBus, chipSelectPin, dcPin, resetPin, width, height) { Initialize(); }
/// <summary> /// Initializes the graph for which the capture data will be piped into /// </summary> /// <param name="p_capDev">The device to be capturesd</param> private void buildGraph(DsDevice p_capDev) { int hr = 0; //For error checking if (m_graph != null) { m_graph = null; } m_graph = (IGraphBuilder) new FilterGraph(); IBaseFilter captureFilter; //Filter for the captureDevice ICaptureGraphBuilder2 pBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); //Rendering portion //Add the graph to the builder, like adding canvas to the stand hr = pBuilder.SetFiltergraph(m_graph); DsError.ThrowExceptionForHR(hr); //Initialize captureFilter with the unique identifier from capDev and add it to the graph captureFilter = createFilterByDevice(p_capDev); hr = m_graph.AddFilter(captureFilter, "CapFilter"); DsError.ThrowExceptionForHR(hr); //Create a sample grabber and add it to the graph m_sampleGrabber = (IBaseFilter)Activator.CreateInstance(typeof(CamSampleGrabber)); hr = m_graph.AddFilter(m_sampleGrabber, "SampleGrabber"); DsError.ThrowExceptionForHR(hr); //Set the callback function for the sample grabber. It will be CamCaptureGrabberCallBack.bufferCB() // this is because sampleCB only support single image getting. hr = ((CamSampleGrabber)m_sampleGrabber).SetCallback(new CamCaptureGrabberCallBack(), 1); DsError.ThrowExceptionForHR(hr); hr = ((ISampleGrabber)m_sampleGrabber).SetOneShot(false); DsError.ThrowExceptionForHR(hr); //Get pins IPin capPin = DsFindPin.ByCategory(captureFilter, PinCategory.Capture, 0); IPin samPin = DsFindPin.ByDirection(m_sampleGrabber, PinDirection.Input, 0); m_camControl = captureFilter as IAMCameraControl; //Create the media type, just a video RGB24 with VideoInfo formatType AMMediaType media = null; hr = getMedia(capPin, out media); DsError.ThrowExceptionForHR(hr); media.majorType = MediaType.Video; hr = ((IAMStreamConfig)capPin).SetFormat(media); DsError.ThrowExceptionForHR(hr); DsUtils.FreeAMMediaType(media); //Connect capture device to the sample grabber hr = m_graph.Connect(capPin, samPin); DsError.ThrowExceptionForHR(hr); //Render video // For a filter with only an output filter (ie. m_sample) then the first two // parameters are null. The 4 and 5 parameter could not be null, however the 4th // is an intermediate filter which i don't want and the 5th is the sink if not defined // will end up being a default filter. hr = pBuilder.RenderStream(null, null, m_sampleGrabber, null, null); DsError.ThrowExceptionForHR(hr); }
public Gp2D12(IIODevice device, IPin analogInputPin) { analogInputPort = device.CreateAnalogInputPort(analogInputPin); analogInputPort.Changed += AnalogInputPort_Changed; }
/// <summary> /// New instance of the AnalogTemperatureSensor class. /// </summary> /// <param name="analogPin">Analog pin the temperature sensor is connected to.</param> /// <param name="sensorType">Type of sensor attached to the analog port.</param> /// <param name="calibration">Calibration for the analog temperature sensor.</param> /// <param name="updateInterval">Number of milliseconds between samples (0 indicates polling to be used)</param> /// <param name="temperatureChangeNotificationThreshold">Changes in temperature greater than this value will trigger an event when updatePeriod > 0.</param> public AnalogTemperature(IIODevice device, IPin analogPin, KnownSensorType sensorType, Calibration calibration = null, ushort updateInterval = MinimumPollingPeriod, float temperatureChangeNotificationThreshold = 0.001F) { if (temperatureChangeNotificationThreshold < 0) { throw new ArgumentOutOfRangeException(nameof(temperatureChangeNotificationThreshold), "Temperature threshold should be >= 0"); } if ((updateInterval != 0) && (updateInterval < MinimumPollingPeriod)) { throw new ArgumentOutOfRangeException(nameof(updateInterval), "Update period should be 0 or >= than " + MinimumPollingPeriod); } // // If the calibration object is null use the defaults for TMP35. // if (calibration == null) { calibration = new Calibration(); } TemperatureChangeNotificationThreshold = temperatureChangeNotificationThreshold; _updateInterval = updateInterval; AnalogPort = null; // ToDo: needs device.CreateAnalogInputPort() ..... new AnalogInputPort(analogPin); switch (sensorType) { case KnownSensorType.TMP35: case KnownSensorType.LM35: case KnownSensorType.LM45: _yIntercept = 0; _millivoltsPerDegreeCentigrade = 10; break; case KnownSensorType.LM50: case KnownSensorType.TMP36: _yIntercept = 500; _millivoltsPerDegreeCentigrade = 10; break; case KnownSensorType.TMP37: _yIntercept = 0; _millivoltsPerDegreeCentigrade = 20; break; case KnownSensorType.Custom: _yIntercept = calibration.MillivoltsAtSampleReading - (calibration.SampleReading * calibration.MillivoltsAtSampleReading); _millivoltsPerDegreeCentigrade = calibration.MillivoltsPerDegreeCentigrade; break; default: throw new ArgumentException("Unknown sensor type", nameof(sensorType)); } if (updateInterval > 0) { StartUpdating(); } else { Update(); } }
public Ili9481(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, uint width = 320, uint height = 480, DisplayColorMode displayColorMode = DisplayColorMode.Format12bppRgb444) : base(device, spiBus, chipSelectPin, dcPin, resetPin, width, height, displayColorMode) { Initialize(); SetRotation(Rotation.Normal); }
public EpdColorBase(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, IPin busyPin, uint width, uint height) { _width = width; _height = height; dataCommandPort = device.CreateDigitalOutputPort(dcPin, false); resetPort = device.CreateDigitalOutputPort(resetPin, true); busyPort = device.CreateDigitalInputPort(busyPin); spi = new SpiPeripheral(spiBus, device.CreateDigitalOutputPort(chipSelectPin)); blackImageBuffer = new byte[Width * Height / 8]; colorImageBuffer = new byte[Width * Height / 8]; for (int i = 0; i < blackImageBuffer.Length; i++) { blackImageBuffer[i] = 0xFF; colorImageBuffer[i] = 0xFF; } Initialize(); }
public Il3897(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, IPin busyPin, int width = 122, int height = 250) : base(device, spiBus, chipSelectPin, dcPin, resetPin, busyPin, width, height) { }
private void ConnectFilters(IPin upPin, IPin downPin, bool useIntelligentConnect) { FilterGraphTools.ConnectFilters(_graphBuilder, upPin, downPin, useIntelligentConnect); }
/// <summary> /// Create a new SSD1306 object using the default parameters for /// </summary> /// <remarks> /// Note that by default, any pixels out of bounds will throw and exception. /// This can be changed by setting the <seealso cref="IgnoreOutOfBoundsPixels" /> /// property to true. /// </remarks> /// <param name="displayType">Type of SSD1306 display</param> /// public SSD1306Bitmap(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, DisplayType displayType) { this.dataCommandPort = device.CreateDigitalOutputPort(dcPin, false); this.resetPort = device.CreateDigitalOutputPort(resetPin, true); this.chipSelectPort = device.CreateDigitalOutputPort(chipSelectPin, false); this.spiPeripheral = new SpiPeripheral(spiBus, chipSelectPort); this.connectionType = ConnectionType.SPI; this.InitSSD1306(displayType); }
public EPD1i54c(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, IPin busyPin) : base(device, spiBus, chipSelectPin, dcPin, resetPin, busyPin) { }
/// <summary> /// Create a new MAG3110 object using the default parameters for the component. /// </summary> /// <param name="device"></param> /// <param name="interruptPin">Digital pin connected to the alarm interrupt pin on the RTC.</param> public Ds3231(IIODevice device, II2cBus i2cBus, IPin interruptPin) : this(i2cBus, device.CreateDigitalInputPort(interruptPin)) { }
public St7735(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, uint width, uint height, DisplayType displayType = DisplayType.ST7735R) : base(device, spiBus, chipSelectPin, dcPin, resetPin, width, height) { this.displayType = displayType; Initialize(); }
public static void AddPreferredFilters(IGraphBuilder graphBuilder, IBaseFilter sourceFilter) { using (Settings xmlreader = new MPSettings()) { bool autodecodersettings = xmlreader.GetValueAsBool("movieplayer", "autodecodersettings", false); if (!autodecodersettings) // the user has not chosen automatic graph building by merits { // bool vc1ICodec,vc1Codec,xvidCodec = false; - will come later bool aacCodec = false; bool h264Codec = false; // check the output pins of the splitter for known media types IEnumPins pinEnum = null; if (sourceFilter.EnumPins(out pinEnum) == 0) { int fetched = 0; IPin[] pins = new IPin[1]; while (pinEnum.Next(1, pins, out fetched) == 0 && fetched > 0) { IPin pin = pins[0]; PinDirection pinDirection; if (pin.QueryDirection(out pinDirection) == 0 && pinDirection == PinDirection.Output) { IEnumMediaTypes enumMediaTypesVideo = null; if (pin.EnumMediaTypes(out enumMediaTypesVideo) == 0) { AMMediaType[] mediaTypes = new AMMediaType[1]; int typesFetched; while (enumMediaTypesVideo.Next(1, mediaTypes, out typesFetched) == 0 && typesFetched > 0) { if (mediaTypes[0].majorType == MediaType.Video && (mediaTypes[0].subType == MediaSubType.H264 || mediaTypes[0].subType == MEDIASUBTYPE_AVC1)) { Log.Instance.Info("found H264 video on output pin"); h264Codec = true; } else if (mediaTypes[0].majorType == MediaType.Audio && mediaTypes[0].subType == MediaSubType.LATMAAC) { Log.Instance.Info("found AAC audio on output pin"); aacCodec = true; } } DirectShowUtil.ReleaseComObject(enumMediaTypesVideo); } } DirectShowUtil.ReleaseComObject(pin); } DirectShowUtil.ReleaseComObject(pinEnum); } // add filters for found media types to the graph as configured in MP if (h264Codec) { DirectShowUtil.ReleaseComObject( DirectShowUtil.AddFilterToGraph(graphBuilder, xmlreader.GetValueAsString("movieplayer", "h264videocodec", ""))); } else { DirectShowUtil.ReleaseComObject( DirectShowUtil.AddFilterToGraph(graphBuilder, xmlreader.GetValueAsString("movieplayer", "mpeg2videocodec", ""))); } if (aacCodec) { DirectShowUtil.ReleaseComObject( DirectShowUtil.AddFilterToGraph(graphBuilder, xmlreader.GetValueAsString("movieplayer", "aacaudiocodec", ""))); } else { DirectShowUtil.ReleaseComObject( DirectShowUtil.AddFilterToGraph(graphBuilder, xmlreader.GetValueAsString("movieplayer", "mpeg2audiocodec", ""))); } } } }
public IPwmPort CreatePwmPort(IPin pin, float frequency = 100, float dutyCycle = 0.5F, bool invert = false) { throw new NotImplementedException(); }
public IAnalogInputPort CreateAnalogInputPort(IPin pin, float voltageReference = 3.3F) { throw new NotImplementedException(); }