public static MetadataInfoTreeContainer GetMetadataInfo(FFmpegCommand command, StreamIdentifier streamId) { //first validate that the streamId does in fact belong to the command. if (!CommandHelperUtility.ReceiptBelongsToCommand(command, streamId)) { throw new ArgumentException("The provided streamId is not part of the provided ffmpeg command.", "streamId"); } var resourceIndex = CommandHelperUtility.IndexOfResource(command, streamId); if (resourceIndex > -1) { return ResourceMetadataInfo(command, resourceIndex); } var filterchainIndex = CommandHelperUtility.IndexOfFilterchain(command, streamId); if (filterchainIndex > -1) { return FilterchainMetadataInfo(command, filterchainIndex); } var outputIndex = CommandHelperUtility.IndexOfOutput(command, streamId); if (outputIndex > -1) { return OutputMetadataInfo(command, outputIndex); } return null; }
public static IStream StreamFromStreamIdentifier(FFmpegCommand command, StreamIdentifier streamId) { var commandInput = CommandInputFromStreamIdentifier(command, streamId); if (commandInput != null) { return(commandInput.Resource.Streams.FirstOrDefault(si => si.Map == streamId.Map)); } var commandOutput = CommandOutputFromStreamIdentifier(command, streamId); if (commandOutput != null) { return(commandOutput.Resource.Streams.FirstOrDefault(si => si.Map == streamId.Map)); } var filterchain = FilterchainFromStreamIdentifier(command, streamId); if (filterchain != null) { var filterchainOutput = filterchain.OutputList.First(si => si.Stream.Map == streamId.Map); return(filterchainOutput.Stream); } throw new StreamNotFoundException(); }
public static int IndexOfOutput(FFmpegCommand command, StreamIdentifier streamId) { var matchingOutput = CommandOutputFromStreamIdentifier(command, streamId); if (matchingOutput == null) { return(-1); } return(command.Outputs.IndexOf(matchingOutput)); }
public static int IndexOfResource(FFmpegCommand command, StreamIdentifier streamId) { var matchingResource = CommandInputFromStreamIdentifier(command, streamId); if (matchingResource == null) { return(-1); } return(command.Inputs.IndexOf(matchingResource)); }
public static int IndexOfFilterchain(FFmpegCommand command, StreamIdentifier streamId) { var matchingFilterchain = FilterchainFromStreamIdentifier(command, streamId); if (matchingFilterchain == null) { return(-1); } return(command.Filtergraph.IndexOf(matchingFilterchain)); }
public StreamIdentifier GetStreamIdentifier <TStreamType>() where TStreamType : class, IStream { var streamInReference = Resource.Streams.OfType <TStreamType>().FirstOrDefault(); if (streamInReference == null) { throw new StreamNotFoundException(typeof(TStreamType)); } return(StreamIdentifier.Create(Owner.Owner.Id, Owner.Id, streamInReference.Map)); }
public bool ContainsStream(StreamIdentifier streamId) { return Filtergraph.FilterchainList.Any(f => f.GetStreamIdentifiers().Any(r => r.Equals(streamId))); }
public bool ContainsInput(StreamIdentifier streamId) { return Inputs.Any(input => input.GetStreamIdentifiers().Any(s => s.Equals(streamId))); }
public bool ContainsStream(StreamIdentifier streamId) { return(Filtergraph.FilterchainList.Any(f => f.GetStreamIdentifiers().Any(r => r.Equals(streamId)))); }
public bool ContainsInput(StreamIdentifier streamId) { return(Inputs.Any(input => input.GetStreamIdentifiers().Any(s => s.Equals(streamId)))); }
public Map(StreamIdentifier streamId) { Stream = streamId.Map; }
public static Filterchain FilterchainFromStreamIdentifier(FFmpegCommand command, StreamIdentifier streamId) { if (streamId == null) { throw new ArgumentNullException("streamId"); } return(command.Objects.Filtergraph.FilterchainList.FirstOrDefault(f => f.GetStreamIdentifiers().Any(r => r.Equals(streamId)))); }
public static CommandOutput CommandOutputFromStreamIdentifier(FFmpegCommand command, StreamIdentifier streamId) { if (streamId == null) { throw new ArgumentNullException("streamId"); } return(command.Objects.Outputs.FirstOrDefault(i => i.GetStreamIdentifiers().Any(si => si.Map == streamId.Map))); }
public static bool ReceiptBelongsToCommand(FFmpegCommand command, StreamIdentifier streamId) { return(command.Owner.Id == streamId.FactoryId && command.Id == streamId.CommandId); }
public bool Equals(StreamIdentifier streamId) { return(Map == streamId.Map && CommandId == streamId.CommandId && FactoryId == streamId.FactoryId); }
public List <StreamIdentifier> GetStreamIdentifiers() { return(Resource.Streams .Select(s => StreamIdentifier.Create(Owner.Owner.Id, Owner.Id, s.Map)) .ToList()); }
public Map(StreamIdentifier streamId) : base(SettingType) { Stream = streamId.Map; }