public override bool Build(DirectShowLib.IPin source, IBuild build) { bool result = false; if (Abstract.FindCaptureDeviceNameByIdentifier(this.device).NotNull()) { DirectShowLib.IBaseFilter filter = Abstract.FindCaptureDeviceByIdentifier(this.device, false); if (filter.NotNull() && this.SetFormat(filter)) { if (build.Graph.AddFilter(filter, "Capture") == 0) { foreach (Filters.Abstract candidate in this.Next) { if (result = candidate.Build(filter, 0, build)) { break; } } } else { Error.Log.Append(Error.Level.Debug, "Unable to open capture.", "DirectShow was unable to capture \"" + this.device + "\"."); Exception.GraphError.Check(build.Graph.RemoveFilter(filter)); } } } return(result); }
public override bool Build(DirectShowLib.IPin source, IBuild build) { bool result = false; DirectShowLib.IBaseFilter filter = this.Create(); if (filter.NotNull()) { Exception.GraphError.Check((filter as DirectShowLib.IFileSourceFilter).Load(this.file, new DirectShowLib.AMMediaType())); if (build.Graph.AddFilter(filter, "Asf Reader") == 0) { foreach (Abstract candidate in this.Next) { if (result = candidate.Build(filter, build)) { break; } } } else { Error.Log.Append(Error.Level.Debug, "Unable to open file.", "DirectShow was unable to open file \"" + this.file + "\"."); Exception.GraphError.Check(build.Graph.RemoveFilter(filter)); } } return(result); }
public override bool Build(DirectShowLib.IPin source, IBuild build) { bool result = false; DirectShowLib.IBaseFilter filter = this.Create(); if (filter.NotNull() && build.Graph.AddFilter(filter, this.Description) == 0 && this.PreConfiguration(build)) { result = true; DirectShowLib.PinInfo pinInformation; Exception.GraphError.Check(source.QueryPinInfo(out pinInformation)); DirectShowLib.FilterInfo filterInformation; Exception.GraphError.Check(pinInformation.filter.QueryFilterInfo(out filterInformation)); switch (filterInformation.achName) { case "Capture": this.CreateSource(DirectShowLib.PinCategory.Capture, pinInformation.filter, filter, build); break; case "Source": this.CreateSource(null, pinInformation.filter, filter, build); break; default: if (!(result = (this.FuzzyMatch ? 0 <= build.Graph.Connect(source, DirectShowLib.DsFindPin.ByDirection(filter, DirectShowLib.PinDirection.Input, 0)) : 0 == build.Graph.ConnectDirect(source, DirectShowLib.DsFindPin.ByDirection(filter, DirectShowLib.PinDirection.Input, 0), new DirectShowLib.AMMediaType())))) { Error.Log.Append(Error.Level.Debug, "Unable to connect.", "DirectShow was unable to connect \"" + filterInformation.achName + "\" with \"" + this.Description + "\"."); Exception.GraphError.Check(source.Disconnect()); Exception.GraphError.Check(build.Graph.RemoveFilter(filter)); } break; } if (result &= this.PostConfiguration(build)) { if (this.WaitForOutput.Ticks > 0) { System.Threading.Thread.Sleep(this.WaitForOutput); } for (int i = 0; i < this.Followers.Length; i++) { foreach (Filters.Abstract candidate in this.Followers[i]) { if (result &= candidate.Build(filter, build)) { break; } } } } } return(result); }
public override DirectShowLib.IBaseFilter Create() { DirectShowLib.AMMediaType sourceMedia = new DirectShowLib.AMMediaType() { majorType = DirectShowLib.MediaType.Stream, subType = new Guid("555DC977-D6F1-4C2E-8D64-F58221A91234") }; DirectShowLib.IBaseFilter result = base.Create(); if (result.NotNull()) { DirectShow.Binding.Exception.GraphError.Check((result as DirectShowLib.IFileSourceFilter).Load(this.file, sourceMedia)); } return(result); }
public override DirectShowLib.IBaseFilter Create() { DirectShowLib.AMMediaType sourceMedia = new DirectShowLib.AMMediaType() { majorType = DirectShowLib.MediaType.Stream, subType = DirectShowLib.MediaSubType.Mpeg2Transport }; DirectShowLib.IBaseFilter result = base.Create(); if (result.NotNull()) { DirectShow.Binding.Exception.GraphError.Check((result as DirectShowLib.IFileSourceFilter).Load(this.file, sourceMedia)); } return(result); }
public override DirectShowLib.IBaseFilter Create() { DirectShowLib.AMMediaType sourceMedia = new DirectShowLib.AMMediaType() { majorType = DirectShowLib.MediaType.Video, subType = DirectShowLib.MediaSubType.H264, formatType = DirectShowLib.FormatType.Mpeg2Video }; // { majorType = DirectShowLib.MediaType.Stream, subType = new Guid("D607A0E7-BE64-4869-B70D-46F2E05D66D0") }; DirectShowLib.IBaseFilter result = base.Create(); if (result.NotNull()) { DirectShow.Binding.Exception.GraphError.Check((result as DirectShowLib.IFileSourceFilter).Load(this.url, sourceMedia)); } return(result); }
public override DirectShowLib.IBaseFilter Create() { DirectShowLib.AMMediaType media = new DirectShowLib.AMMediaType() { majorType = DirectShowLib.MediaType.Stream, subType = DirectShowLib.MediaSubType.Mpeg2Program }; DirectShowLib.IBaseFilter result = base.Create(); if (result.NotNull()) { DirectShowLib.FilterInfo info; result.QueryFilterInfo(out info); string info2; result.QueryVendorInfo(out info2); DirectShow.Binding.Exception.GraphError.Check((result as DirectShowLib.IFileSinkFilter).SetFileName(this.filename, media)); } return(result); }
public override bool Build(DirectShowLib.IPin source, Imint.Media.DirectShow.Binding.IBuild build) { bool result = false; DirectShowLib.IBaseFilter filter = this.Create(); if (filter.NotNull() && build.Graph.AddFilter(filter, this.Description) == 0) { foreach (DirectShow.Binding.Filters.Abstract candidate in this.Next) { if (result = candidate.Build(filter, build)) { break; } } } else { Error.Log.Append(Error.Level.Debug, "Unable to open file.", "DirectShow was unable to open file \"" + this.file + "\"."); Binding.Exception.GraphError.Check(build.Graph.RemoveFilter(filter)); } return(result); }