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);
        }
        private void Fill(FFmpegCommand command, Filterchain filterchain)
        {
            filterchain.ReceiptList.ForEach(streamId =>
            {
                var resourceIndexOf = CommandHelperUtility.IndexOfResource(command, streamId);
                if (resourceIndexOf > -1)
                {
                    DependecyTree.Add(MetadataInfoTreeSource.Create(command.Inputs[resourceIndexOf]));
                }

                var filterchainIndexOf = CommandHelperUtility.IndexOfFilterchain(command, streamId);
                if (filterchainIndexOf > -1)
                {
                    DependecyTree.Add(Create(command, command.Filtergraph[filterchainIndexOf]));
                }
            });
        }