Beispiel #1
0
        private void DoSubClip()
        {
            var subclipConfig = this.GetSubclippingConfiguration();

            if (subclipConfig.Reencode) // reencode the clip
            {
                var processor             = Mainform.GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard);
                EncodingAMEStandard form2 = new EncodingAMEStandard(_context, _selectedAssets.Count, processor.Version, subclipConfig)
                {
                    EncodingLabel = (_selectedAssets.Count > 1) ?
                                    string.Format("{0} asset{1} selected. You are going to submit {0} job{1} with 1 task.", _selectedAssets.Count, Program.ReturnS(_selectedAssets.Count), _selectedAssets.Count)
                                    :
                                    "Asset '" + _selectedAssets.FirstOrDefault().Name + "' will be encoded (1 job with 1 task).",

                    EncodingJobName         = "Subclipping with reencoding of " + Constants.NameconvInputasset,
                    EncodingOutputAssetName = Constants.NameconvInputasset + "- Subclipped with reencoding",
                    EncodingAMEStdPresetJSONFilesUserFolder = Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder,
                    EncodingAMEStdPresetJSONFilesFolder     = Application.StartupPath + Constants.PathAMEStdFiles,
                    SelectedAssets = _selectedAssets
                };

                if (form2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string taskname = "Subclipping with reencoding of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername;
                    _mainform.LaunchJobs_OneJobPerInputAsset_OneTaskPerfConfig(
                        processor,
                        _selectedAssets,
                        form2.EncodingJobName,
                        form2.JobOptions.Priority,
                        taskname,
                        form2.EncodingOutputAssetName,
                        new List <string>()
                    {
                        form2.EncodingConfiguration
                    },
                        form2.JobOptions.OutputAssetsCreationOptions,
                        form2.JobOptions.TasksOptionsSetting,
                        form2.JobOptions.StorageSelected);
                }
            }
            else if (subclipConfig.CreateAssetFilter) // create a asset filter
            {
                IAsset            selasset = _selectedAssets.FirstOrDefault();
                DynManifestFilter formAF   = new DynManifestFilter(_context, null, selasset, subclipConfig);
                if (formAF.ShowDialog() == DialogResult.OK)
                {
                    FilterCreationInfo filterinfo = null;
                    try
                    {
                        filterinfo = formAF.GetFilterInfo;
                        selasset.AssetFilters.Create(filterinfo.Name, filterinfo.Presentationtimerange, filterinfo.Trackconditions);
                        _mainform.TextBoxLogWriteLine("Asset filter '{0}' created.", filterinfo.Name);
                    }
                    catch (Exception ex)
                    {
                        _mainform.TextBoxLogWriteLine("Error when creating filter '{0}'.", (filterinfo != null && filterinfo.Name != null) ? filterinfo.Name : "unknown name", true);
                        _mainform.TextBoxLogWriteLine(ex);
                    }

                    _mainform.DoRefreshGridFiltersV(false);
                }
            }
            else // no reencode or asset filter but stream copy
            {
                string          taskname = "Subclipping (archive extraction) of " + Constants.NameconvInputasset;
                IMediaProcessor Proc     = Mainform.GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard);

                _mainform.LaunchJobs_OneJobPerInputAsset_OneTaskPerfConfig(
                    Proc,
                    _selectedAssets,
                    this.EncodingJobName,
                    this.JobOptions.Priority,
                    taskname,
                    this.EncodingOutputAssetName,
                    new List <string>()
                {
                    this.GetSubclippingConfiguration().Configuration
                },
                    this.JobOptions.OutputAssetsCreationOptions,
                    this.JobOptions.TasksOptionsSetting,
                    this.JobOptions.StorageSelected);

                MessageBox.Show("Subclipping job(s) submitted", "Sublipping", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }