private void DoSubClip()
        {
            var subclipConfig = this.GetSubclippingConfiguration();

            if (subclipConfig.Reencode) // reencode the clip
            {
                List<IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard);
                EncodingAMEStandard form2 = new EncodingAMEStandard(_context, subclipConfig)
                {
                    EncodingLabel = (_selectedAssets.Count > 1) ? _selectedAssets.Count + " assets have been selected. " + _selectedAssets.Count + " jobs will be submitted." : "Asset '" + _selectedAssets.FirstOrDefault().Name + "' will be encoded.",
                    EncodingProcessorsList = Procs,
                    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(
                       form2.EncodingProcessorSelected,
                       _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(_contextdynmanifest, _context, null, selasset, subclipConfig);
                if (formAF.ShowDialog() == DialogResult.OK)
                {
                    AssetFilter myassetfilter = new AssetFilter(selasset);

                    Filter filter = formAF.GetFilter;
                    myassetfilter.Name = filter.Name;
                    myassetfilter.PresentationTimeRange = filter.PresentationTimeRange;
                    myassetfilter.Tracks = filter.Tracks;
                    myassetfilter._context = filter._context;
                    try
                    {
                        myassetfilter.Create();
                        _mainform.TextBoxLogWriteLine("Asset filter '{0}' created.", myassetfilter.Name);
                    }
                    catch (Exception ex)
                    {
                        _mainform.TextBoxLogWriteLine("Error when creating filter '{0}'.", myassetfilter.Name, true);
                        _mainform.TextBoxLogWriteLine(ex);
                    }

                    _mainform.DoRefreshGridFiltersV(false);
                }

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

                _mainform.LaunchJobs(
                    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);
            }
        }
Beispiel #2
0
        private void DoSubClip()
        {
            var subclipConfig = this.GetSubclippingConfiguration();

            if (subclipConfig.Reencode) // reencode the clip
            {
                List <IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard);
                EncodingAMEStandard    form2 = new EncodingAMEStandard(_context, _selectedAssets.Count, 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).",

                    EncodingProcessorsList  = Procs,
                    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(
                        form2.EncodingProcessorSelected,
                        _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(
                    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);
            }
        }
Beispiel #3
0
        private async Task DoSubClipAsync()
        {
            var subclipConfig = this.GetSubclippingInternalConfiguration();

            if (subclipConfig.Reencode) // reencode the clip
            {
                ProcessFromTransform form = new ProcessFromTransform(_amsClientV3, _mainform, _selectedAssets, null, subclipConfig.StartTime, subclipConfig.EndTime, true);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    await _mainform.CreateAndSubmitJobsAsync(new List <Transform>() { form.SelectedTransform }, _selectedAssets, form.StartClipTime, form.EndClipTime);
                }

                /*
                 * var processor = Mainform.GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard);
                 * EncodingMES form2 = new EncodingMES(_context, new List<IAsset>(), processor.Version, _mainform, subclipConfig, disableOverlay: true)
                 * {
                 *  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.MESPresetFilesCurrentFolder,
                 *  EncodingAMEStdPresetJSONFilesFolder = Application.StartupPath + Constants.PathMESFiles,
                 *  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.OutputAssetsFormatOption,
                 *     form2.JobOptions.TasksOptionsSetting,
                 *     form2.JobOptions.StorageSelected);
                 * }
                 */
            }
            else if (subclipConfig.CreateAssetFilter) // create a asset filter
            {
                Asset             selasset = _selectedAssets.FirstOrDefault();
                DynManifestFilter formAF   = new DynManifestFilter(_amsClientV3, null, selasset, subclipConfig);
                if (formAF.ShowDialog() == DialogResult.OK)
                {
                    FilterCreationInfo filterinfo = null;
                    try
                    {
                        filterinfo = formAF.GetFilterInfo;
                        AssetFilter assetFilter = new AssetFilter()
                        {
                            PresentationTimeRange = filterinfo.Presentationtimerange
                        };

                        await _amsClientV3.AMSclient.AssetFilters.CreateOrUpdateAsync(_amsClientV3.credentialsEntry.ResourceGroup, _amsClientV3.credentialsEntry.AccountName, selasset.Name, filterinfo.Name, assetFilter);

                        _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);
                    }

                    await _mainform.DoRefreshGridFiltersVAsync(false);
                }
            }
            else // no reencode or asset filter but stream copy
            {
                ClipTime startTime = null;
                ClipTime endTime   = null;

                if (checkBoxTrimming.Checked)
                {
                    startTime = new AbsoluteClipTime()
                    {
                        Time = subclipConfig.StartTime
                    };

                    endTime = new AbsoluteClipTime()
                    {
                        Time = subclipConfig.EndTime
                    };
                }

                var transform = await _mainform.CreateAndGetCopyCodecTransformIfNeededAsync();

                await _mainform.CreateAndSubmitJobsAsync(new List <Transform>() { transform }, _selectedAssets, startTime, endTime, EncodingJobName, EncodingOutputAssetName);

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

            GenerateUniqueNamesForJobAndOutput();
        }
        private void DoFilterInfo()
        {
            var filters = ReturnSelectedFilters();
            if (filters.Count == 1)
            {
                var filter = filters.FirstOrDefault();
                DynManifestFilter form = new DynManifestFilter(myContext, (IStreamingFilter)filter, myAsset);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    FilterCreationInfo filtertoupdate = null;
                    try
                    {
                        filtertoupdate = form.GetFilterInfo;
                        filter.PresentationTimeRange = filtertoupdate.Presentationtimerange;
                        filter.Tracks = filtertoupdate.Trackconditions;
                        filter.Update();
                        myMainForm.TextBoxLogWriteLine("Asset filter '{0}' has been updated.", filtertoupdate.Name);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Error when updating asset filter." + Constants.endline + Program.GetErrorMessage(e), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        myMainForm.TextBoxLogWriteLine("Error when updating asset filter '{0}'.", filter.Name, true);
                        myMainForm.TextBoxLogWriteLine(e);
                    }
                    DisplayAssetFilters();
                }
            }
        }
        private void DoCreateAssetFilter()
        {
            DynManifestFilter form = new DynManifestFilter(myContext, null, myAsset);

            if (form.ShowDialog() == DialogResult.OK)
            {

                FilterCreationInfo filterinfo = null;
                try
                {
                    filterinfo = form.GetFilterInfo;
                    myAsset.AssetFilters.Create(filterinfo.Name, filterinfo.Presentationtimerange, filterinfo.Trackconditions);
                    myMainForm.TextBoxLogWriteLine("Asset filter '{0}' has been created.", filterinfo.Name);
                }
                catch (Exception e)
                {
                    MessageBox.Show("Error when creating asset filter." + Constants.endline + Program.GetErrorMessage(e), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    myMainForm.TextBoxLogWriteLine("Error when creating asset filter '{0}'.", (filterinfo != null && filterinfo.Name != null) ? filterinfo.Name : "unknown name", true);
                    myMainForm.TextBoxLogWriteLine(e);
                }
                DisplayAssetFilters();
            }
        }
        private void DoUpdateFilter()
        {
            IStreamingFilter filter = ReturnSelectedFilters().FirstOrDefault();
            DynManifestFilter form = new DynManifestFilter(_context, filter);

            if (form.ShowDialog() == DialogResult.OK)
            {
                FilterCreationInfo filterinfotoupdate = null;
                try
                {
                    filterinfotoupdate = form.GetFilterInfo;
                    filter.PresentationTimeRange = filterinfotoupdate.Presentationtimerange;
                    filter.Tracks = filterinfotoupdate.Trackconditions;
                    filter.Update();
                    TextBoxLogWriteLine("Global filter '{0}' updated.", filter.Name);
                }
                catch (Exception e)
                {
                    TextBoxLogWriteLine("Error when creating filter '{0}'.", filter.Name, true);
                    TextBoxLogWriteLine(e);
                }
                DoRefreshGridFiltersV(false);
            }
        }
        private void DoCreateAssetFilter()
        {
            IAsset selasset = ReturnSelectedAssetsFromProgramsOrAssets().FirstOrDefault();

            DynManifestFilter form = new DynManifestFilter(_context, null, selasset);

            if (form.ShowDialog() == DialogResult.OK)
            {
                FilterCreationInfo filterinfo = null;
                try
                {
                    filterinfo = form.GetFilterInfo;
                    selasset.AssetFilters.Create(filterinfo.Name, filterinfo.Presentationtimerange, filterinfo.Trackconditions);
                    TextBoxLogWriteLine("Asset filter '{0}' created.", filterinfo.Name);
                }
                catch (Exception e)
                {
                    TextBoxLogWriteLine("Error when creating filter '{0}'.", (filterinfo != null && filterinfo.Name != null) ? filterinfo.Name : "unknown name", true);
                    TextBoxLogWriteLine(e);
                }
                dataGridViewAssetsV.PurgeCacheAsset(selasset);
                dataGridViewAssetsV.AnalyzeItemsInBackground();
            }

        }
        private void DoUpdateFilter()
        {
            Filter filter = ReturnSelectedFilters().FirstOrDefault();
            DynManifestFilter form = new DynManifestFilter(_contextdynmanifest, _context, filter);

            if (form.ShowDialog() == DialogResult.OK)
            {
                Filter filtertoupdate = form.GetFilter;
                try
                {
                    filtertoupdate.Delete();
                    filtertoupdate.Create();
                    TextBoxLogWriteLine("Global filter '{0}' recreated.", filtertoupdate.Name);
                }
                catch (Exception e)
                {
                    TextBoxLogWriteLine("Error when creating filter '{0}'.", filtertoupdate.Name, true);
                    TextBoxLogWriteLine(e);
                }
                DoRefreshGridFiltersV(false);
            }
        }
        private void DoCreateFilter()
        {
            DynManifestFilter form = new DynManifestFilter(_context);

            if (form.ShowDialog() == DialogResult.OK)
            {
                FilterCreationInfo filterinfo = null;
                try
                {
                    filterinfo = form.GetFilterInfo;
                    _context.Filters.Create(filterinfo.Name, filterinfo.Presentationtimerange, filterinfo.Trackconditions);
                    TextBoxLogWriteLine("Global filter '{0}' created.", filterinfo.Name);
                }
                catch (Exception e)
                {
                    TextBoxLogWriteLine("Error when creating filter '{0}'.", (filterinfo != null && filterinfo.Name != null) ? filterinfo.Name : "unknown name", true);
                    TextBoxLogWriteLine(e);
                }
                DoRefreshGridFiltersV(false);
            }
        }
        private void DoCreateAssetFilter()
        {
            IAsset selasset = ReturnSelectedAssetsFromProgramsOrAssets().FirstOrDefault();

            DynManifestFilter form = new DynManifestFilter(_contextdynmanifest, _context, null, selasset);

            if (form.ShowDialog() == DialogResult.OK)
            {
                AssetFilter myassetfilter = new AssetFilter(selasset);

                Filter filter = form.GetFilter;
                myassetfilter.Name = filter.Name;
                myassetfilter.PresentationTimeRange = filter.PresentationTimeRange;
                myassetfilter.Tracks = filter.Tracks;
                myassetfilter._context = filter._context;
                try
                {
                    myassetfilter.Create();
                    TextBoxLogWriteLine("Asset filter '{0}' created.", myassetfilter.Name);
                }
                catch (Exception e)
                {
                    TextBoxLogWriteLine("Error when creating filter '{0}'.", myassetfilter.Name, true);
                    TextBoxLogWriteLine(e);
                }
                DoRefreshGridFiltersV(false);
            }

        }
        private void DoCreateFilter()
        {
            DynManifestFilter form = new DynManifestFilter(_contextdynmanifest, _context);

            if (form.ShowDialog() == DialogResult.OK)
            {

                var myfilter = form.GetFilter;
                try
                {
                    myfilter.Create();
                    TextBoxLogWriteLine("Global filter '{0}' created.", myfilter.Name);
                }
                catch (Exception e)
                {
                    TextBoxLogWriteLine("Error when creating filter '{0}'.", myfilter.Name, true);
                    TextBoxLogWriteLine(e);
                }
                DoRefreshGridFiltersV(false);
            }

        }
        public void DoDisplayFilter(object sender, System.EventArgs e)
        {
            IAsset myasset = ReturnSelectedAssetsFromProgramsOrAssets().FirstOrDefault();
            var myassetfilters = _contextdynmanifest.ListAssetFilters(myasset);
            var myassetfilter = myassetfilters.Where(f => f.Name == sender.ToString()).FirstOrDefault();
            if (myassetfilter != null)
            {
                DynManifestFilter form = new DynManifestFilter(_contextdynmanifest, _context, (Filter)myassetfilter, myasset);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    AssetFilter filtertoupdate = (AssetFilter)form.GetFilter;
                    try
                    {
                        filtertoupdate.Delete();
                        filtertoupdate.Create();
                        TextBoxLogWriteLine("Asset filter '{0}' has been updated.", filtertoupdate.Name);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error when updating asset filter.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        TextBoxLogWriteLine("Error when updating asset filter '{0}'.", filtertoupdate.Name, true);
                        TextBoxLogWriteLine(ex);
                    }
                }
            }
        }
        private void DoCreateAssetFilter()
        {
            DynManifestFilter form = new DynManifestFilter(_contextdynmanifest, myContext, null, myAsset);
            form.CreateAssetFilterFromAssetName = myAsset.Name;

            if (form.ShowDialog() == DialogResult.OK)
            {
                AssetFilter myassetfilter = new AssetFilter(myAsset);

                Filter filter = form.GetFilter;
                myassetfilter.Name = filter.Name;
                myassetfilter.PresentationTimeRange = filter.PresentationTimeRange;
                myassetfilter.Tracks = filter.Tracks;
                myassetfilter._context = filter._context;
                try
                {
                    myassetfilter.Create();
                    myMainForm.TextBoxLogWriteLine("Asset filter '{0}' has been created.", filter.Name);
                }
                catch (Exception e)
                {
                    MessageBox.Show("Error when creating asset filter.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    myMainForm.TextBoxLogWriteLine("Error when creating asset filter '{0}'.", filter.Name, true);
                    myMainForm.TextBoxLogWriteLine(e);
                }
                DisplayAssetFilters();
            }
        }
        private void DoFilterInfo()
        {
            var filters = ReturnSelectedFilters();
            if (filters.Count == 1)
            {
                DynManifestFilter form = new DynManifestFilter(_contextdynmanifest, myContext, (Filter)filters.FirstOrDefault(), myAsset);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    AssetFilter filtertoupdate = (AssetFilter)form.GetFilter;
                    try
                    {
                        filtertoupdate.Delete();
                        filtertoupdate.Create();
                        myMainForm.TextBoxLogWriteLine("Asset filter '{0}' has been updated.", filtertoupdate.Name);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Error when updating asset filter.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        myMainForm.TextBoxLogWriteLine("Error when updating asset filter '{0}'.", filtertoupdate.Name, true);
                        myMainForm.TextBoxLogWriteLine(e);
                    }
                    DisplayAssetFilters();
                }
            }
        }
Beispiel #15
0
        private void DoSubClip()
        {
            var subclipConfig = this.GetSubclippingConfiguration();

            if (subclipConfig.Reencode) // reencode the clip
            {
                List <IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard);
                EncodingAMEStandard    form2 = new EncodingAMEStandard(_context, subclipConfig)
                {
                    EncodingLabel           = (_selectedAssets.Count > 1) ? _selectedAssets.Count + " assets have been selected. " + _selectedAssets.Count + " jobs will be submitted." : "Asset '" + _selectedAssets.FirstOrDefault().Name + "' will be encoded.",
                    EncodingProcessorsList  = Procs,
                    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(
                        form2.EncodingProcessorSelected,
                        _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(_contextdynmanifest, _context, null, selasset, subclipConfig);
                if (formAF.ShowDialog() == DialogResult.OK)
                {
                    AssetFilter myassetfilter = new AssetFilter(selasset);

                    Filter filter = formAF.GetFilter;
                    myassetfilter.Name = filter.Name;
                    myassetfilter.PresentationTimeRange = filter.PresentationTimeRange;
                    myassetfilter.Tracks   = filter.Tracks;
                    myassetfilter._context = filter._context;
                    try
                    {
                        myassetfilter.Create();
                        _mainform.TextBoxLogWriteLine("Asset filter '{0}' created.", myassetfilter.Name);
                    }
                    catch (Exception ex)
                    {
                        _mainform.TextBoxLogWriteLine("Error when creating filter '{0}'.", myassetfilter.Name, true);
                        _mainform.TextBoxLogWriteLine(ex);
                    }

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

                _mainform.LaunchJobs(
                    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);
            }
        }
        private void DoSubClip()
        {
            var subclipConfig = this.GetSubclippingConfiguration();

            if (subclipConfig.Reencode) // reencode the clip
            {
                List<IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard);
                EncodingAMEStandard form2 = new EncodingAMEStandard(_context, _selectedAssets.Count, 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).",

                    EncodingProcessorsList = Procs,
                    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(
                       form2.EncodingProcessorSelected,
                       _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(
                    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);
            }
        }