示例#1
0
        public static CommandOutput SetupCommandOutputMaps <TOutputType>(CommandStage stage, SettingsCollection settings, string fileName)
            where TOutputType : class, IContainer, new()
        {
            var settingsCopy  = settings.Copy();
            var commandOutput = CommandOutput.Create(Resource.CreateOutput <TOutputType>(), settingsCopy);

            stage.StreamIdentifiers.ForEach(streamId =>
            {
                var theStream   = StreamFromStreamIdentifier(stage.Command, streamId);
                var theResource = CommandInputFromStreamIdentifier(stage.Command, streamId);

                if (theResource == null)
                {
                    commandOutput.Settings.Merge(new Map(streamId), FFmpegMergeOptionType.NewWins);
                }
                else
                {
                    var resourceIndex = IndexOfResource(stage.Command, streamId);

                    commandOutput.Settings.Merge(new Map(string.Format("{0}:{1}", resourceIndex, theStream.ResourceIndicator)),
                                                 FFmpegMergeOptionType.NewWins);
                }

                commandOutput.Resource.Streams.Add(theStream.Copy());
            });

            if (!string.IsNullOrWhiteSpace(fileName))
            {
                commandOutput.Resource.Name = fileName;
            }

            return(commandOutput);
        }
示例#2
0
        public static CommandOutput SetupCommandOutput <TOutputType>(FFmpegCommand command, SettingsCollection settings, string fileName)
            where TOutputType : class, IContainer, new()
        {
            var settingsCopy  = settings.Copy();
            var commandOutput = CommandOutput.Create(Resource.CreateOutput <TOutputType>(), settingsCopy);

            commandOutput.Resource.Streams.AddRange(command.Inputs.SelectMany(i => i.Resource.Streams.Select(s => s.Copy())));

            if (!string.IsNullOrWhiteSpace(fileName))
            {
                commandOutput.Resource.Name = fileName;
            }

            return(commandOutput);
        }