public Subclipping(CloudMediaContext context, MediaServiceContextForDynManifest contextdynmanifest, List<IAsset> assetlist, Mainform mainform) { InitializeComponent(); buttonJobOptions.Initialize(context); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _contextdynmanifest = contextdynmanifest; _parentassetmanifestdata = new ManifestTimingData(); _selectedAssets = assetlist; _mainform = mainform; if (_selectedAssets.Count == 1 && _selectedAssets.FirstOrDefault() != null) // one asset only { var myAsset = assetlist.FirstOrDefault(); textBoxAssetName.Text = myAsset.Name; // let's try to read asset timing _parentassetmanifestdata = AssetInfo.GetManifestTimingData(myAsset); if (!_parentassetmanifestdata.Error) // we were able to read asset timings and not live { _timescale = timeControlStart.TimeScale = timeControlEnd.TimeScale = _parentassetmanifestdata.TimeScale; timeControlStart.ScaledFirstTimestampOffset = timeControlEnd.ScaledFirstTimestampOffset = _parentassetmanifestdata.TimestampOffset; textBoxOffset.Text = _parentassetmanifestdata.TimestampOffset.ToString(); labelOffset.Visible = textBoxOffset.Visible = true; textBoxFilterTimeScale.Text = _timescale.ToString(); textBoxFilterTimeScale.Visible = labelAssetTimescale.Visible = true; timeControlStart.Max = timeControlEnd.Max = new TimeSpan(AssetInfo.ReturnTimestampInTicks(_parentassetmanifestdata.AssetDuration, _parentassetmanifestdata.TimeScale)); labelassetduration.Visible = textBoxAssetDuration.Visible = true; textBoxAssetDuration.Text = timeControlStart.Max.ToString(@"d\.hh\:mm\:ss") + (_parentassetmanifestdata.IsLive ? " (LIVE)" : ""); // let set duration and active track bat timeControlStart.ScaledTotalDuration = timeControlEnd.ScaledTotalDuration = _parentassetmanifestdata.AssetDuration; timeControlStart.DisplayTrackBar = true; timeControlEnd.DisplayTrackBar = true; timeControlEnd.SetTimeStamp(timeControlEnd.Max); } else // one asset but not able to read asset timings { timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false; timeControlStart.TimeScale = timeControlEnd.TimeScale = _timescale; timeControlStart.Max = timeControlEnd.Max = TimeSpan.MaxValue; //timeControlEnd.SetTimeStamp(timeControlEnd.Max); } } else // several assets { groupBoxTrimming.Enabled = panelAssetInfo.Visible = false; // no trimming and no asset info radioButtonAssetFilter.Enabled = false; // no asset filter option timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false; timeControlStart.TimeScale = timeControlEnd.TimeScale = _timescale; timeControlStart.Max = timeControlEnd.Max = TimeSpan.MaxValue; //timeControlEnd.SetTimeStamp(timeControlEnd.Max); } }
public Subclipping(CloudMediaContext context, MediaServiceContextForDynManifest contextdynmanifest, List <IAsset> assetlist, Mainform mainform) { InitializeComponent(); buttonJobOptions.Initialize(context); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _contextdynmanifest = contextdynmanifest; _parentassetmanifestdata = new ManifestTimingData(); _selectedAssets = assetlist; _mainform = mainform; if (_selectedAssets.Count == 1 && _selectedAssets.FirstOrDefault() != null) // one asset only { var myAsset = assetlist.FirstOrDefault(); textBoxAssetName.Text = myAsset.Name; // let's try to read asset timing _parentassetmanifestdata = AssetInfo.GetManifestTimingData(myAsset); if (!_parentassetmanifestdata.Error) // we were able to read asset timings and not live { _timescale = timeControlStart.TimeScale = timeControlEnd.TimeScale = _parentassetmanifestdata.TimeScale; timeControlStart.ScaledFirstTimestampOffset = timeControlEnd.ScaledFirstTimestampOffset = _parentassetmanifestdata.TimestampOffset; textBoxOffset.Text = _parentassetmanifestdata.TimestampOffset.ToString(); labelOffset.Visible = textBoxOffset.Visible = true; textBoxFilterTimeScale.Text = _timescale.ToString(); textBoxFilterTimeScale.Visible = labelAssetTimescale.Visible = true; timeControlStart.Max = timeControlEnd.Max = new TimeSpan(AssetInfo.ReturnTimestampInTicks(_parentassetmanifestdata.AssetDuration, _parentassetmanifestdata.TimeScale)); labelassetduration.Visible = textBoxAssetDuration.Visible = true; textBoxAssetDuration.Text = timeControlStart.Max.ToString(@"d\.hh\:mm\:ss") + (_parentassetmanifestdata.IsLive ? " (LIVE)" : ""); // let set duration and active track bat timeControlStart.ScaledTotalDuration = timeControlEnd.ScaledTotalDuration = _parentassetmanifestdata.AssetDuration; timeControlStart.DisplayTrackBar = true; timeControlEnd.DisplayTrackBar = true; timeControlEnd.SetTimeStamp(timeControlEnd.Max); } else // one asset but not able to read asset timings { timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false; timeControlStart.TimeScale = timeControlEnd.TimeScale = _timescale; timeControlStart.Max = timeControlEnd.Max = TimeSpan.MaxValue; //timeControlEnd.SetTimeStamp(timeControlEnd.Max); } } else // several assets { groupBoxTrimming.Enabled = panelAssetInfo.Visible = false; // no trimming and no asset info radioButtonAssetFilter.Enabled = false; // no asset filter option timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false; timeControlStart.TimeScale = timeControlEnd.TimeScale = _timescale; timeControlStart.Max = timeControlEnd.Max = TimeSpan.MaxValue; //timeControlEnd.SetTimeStamp(timeControlEnd.Max); } }
public ProgramInformation(Mainform mainform, CloudMediaContext context, MediaServiceContextForDynManifest contextdynman) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; MyMainForm = mainform; MyContext = context; MyDynManifestContext = contextdynman; }
public DynManifestFilter(MediaServiceContextForDynManifest contextdynman, CloudMediaContext context, Filter filterToDisplay = null, IAsset parentAsset = null, SubClipConfiguration subclipconfig = null) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _contextdynman = contextdynman; _context = context; _filterToDisplay = filterToDisplay; _parentAsset = parentAsset; _subclipconfig = subclipconfig; }
public void SetContext(MediaServiceContextForDynManifest context) { _context = context; }
private bool EncodingRUFeatureOn = true; // On some test account, there is no Encoding RU so let's switch to OFF the feature in that case public Mainform() { InitializeComponent(); // for player control embedded in UI Program.SetWebBrowserFeatures(); this.Icon = Bitmaps.Azure_Explorer_ico; // USER SETTINSG CHECKS & UPDATES // upgrade settings from previous version if (Properties.Settings.Default.CallUpgrade) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.CallUpgrade = false; } _configurationXMLFiles = Application.StartupPath + Constants.PathConfigFiles; // AME Standard preset folder if ((Properties.Settings.Default.WAMEPresetXMLFilesCurrentFolder == string.Empty) || (!Directory.Exists(Properties.Settings.Default.WAMEPresetXMLFilesCurrentFolder))) { Properties.Settings.Default.WAMEPresetXMLFilesCurrentFolder = Application.StartupPath + Constants.PathAMEFiles; } // AME Premium Workflow preset folder if ((Properties.Settings.Default.PremiumWorkflowPresetXMLFilesCurrentFolder == string.Empty) || (!Directory.Exists(Properties.Settings.Default.PremiumWorkflowPresetXMLFilesCurrentFolder))) { Properties.Settings.Default.PremiumWorkflowPresetXMLFilesCurrentFolder = Application.StartupPath + Constants.PathPremiumWorkflowFiles; } // AME Standard preset folder if ((Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder == string.Empty) || (!Directory.Exists(Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder))) { Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder = Application.StartupPath + Constants.PathAMEStdFiles; } // Default Slate Image if ((Properties.Settings.Default.DefaultSlateCurrentFolder == string.Empty) || (!Directory.Exists(Properties.Settings.Default.DefaultSlateCurrentFolder))) { Properties.Settings.Default.DefaultSlateCurrentFolder = Application.StartupPath + Constants.PathDefaultSlateJPG; } Program.SaveAndProtectUserConfig(); // to save settings _HelpFiles = Application.StartupPath + Constants.PathHelpFiles; AMSLogin form = new AMSLogin(); if (form.ShowDialog() == DialogResult.Cancel) { Environment.Exit(0); } _credentials = form.LoginCredentials; DisplaySplashDuringLoading = true; ThreadPool.QueueUserWorkItem((x) => { using (var splashForm = new Splash(_credentials.AccountName)) { splashForm.Show(); while (DisplaySplashDuringLoading) Application.DoEvents(); splashForm.Close(); } }); // Get the service context. _context = Program.ConnectAndGetNewContext(_credentials); // Dynamic filter _contextdynmanifest = new MediaServiceContextForDynManifest(_credentials); _contextdynmanifest.AccessToken = _context.Credentials.AccessToken; _contextdynmanifest.CheckForRedirection(); // mainform title toolStripStatusLabelConnection.Text = String.Format("Version {0}", Assembly.GetExecutingAssembly().GetName().Version) + " - Connected to " + _context.Credentials.ClientId; // notification title notifyIcon1.Text = string.Format(notifyIcon1.Text, _context.Credentials.ClientId); // name of the ams acount in the title of the form - useful when several instances to navigate with icons this.Text = string.Format(this.Text, _context.Credentials.ClientId); // Let's check storage credentials if (string.IsNullOrEmpty(_credentials.StorageKey)) { havestoragecredentials = false; } else { bool ret = Program.ConnectToStorage(_context, _credentials); } if ((GetLatestMediaProcessorByName(Constants.ZeniumEncoder) == null) && (GetLatestMediaProcessorByName(Constants.AzureMediaEncoderPremiumWorkflow) == null)) { AMEPremiumWorkflowPresent = false; encodeAssetWithPremiumWorkflowToolStripMenuItem.Enabled = false; //menu ContextMenuItemPremiumWorkflow.Enabled = false; // mouse context menu } if (GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard) == null) { AMEStandardPresent = false; encodeAssetsWithAMEStandardToolStripMenuItem.Visible = false; encodeAssetWithAMEStandardToolStripMenuItem.Visible = false; toolStripSeparator35.Visible = false; toolStripSeparator32.Visible = false; // subclipping subclipLiveStreamsarchivesToolStripMenuItem.Visible = false; subclipProgramsToolStripMenuItem.Visible = false; subclipToolStripMenuItem.Visible = false; } if (GetLatestMediaProcessorByName(Constants.AzureMediaHyperlapse) == null) { HyperlapsePresent = false; processAssetsWithHyperlapseToolStripMenuItem.Enabled = false; processAssetsWithHyperlapseToolStripMenuItem1.Enabled = false; } // Timer Auto Refresh TimerAutoRefresh = new System.Timers.Timer(Properties.Settings.Default.AutoRefreshTime * 1000); TimerAutoRefresh.Elapsed += new ElapsedEventHandler(OnTimedEvent); // Let's check if there is one streaming unit running if (_context.StreamingEndpoints.AsEnumerable().Where(o => o.State == StreamingEndpointState.Running).ToList().Count == 0) TextBoxLogWriteLine("There is no streaming endpoint running in this account.", true); // Warning // Let's check if there is one streaming scale units if (_context.StreamingEndpoints.Where(o => o.ScaleUnits > 0).ToList().Count == 0) TextBoxLogWriteLine("There is no reserved unit streaming endpoint in this account. Dynamic packaging and live streaming output will not work.", true); // Warning // Let's check if there is enough streaming scale units for the channels double nbchannels = (double)_context.Channels.Count(); double nbse = (double)_context.StreamingEndpoints.Where(o => o.ScaleUnits > 0).ToList().Count; if (nbse > 0 && nbchannels > 0 && (nbchannels / nbse) > 5) TextBoxLogWriteLine("There are {0} channels and {1} streaming endpoint(s). Recommandation is to provision at least 1 streaming endpoint per group of 5 channels.", nbchannels, nbse, true); // Warning // let's check the encoding reserved unit and type try { if ((_context.EncodingReservedUnits.FirstOrDefault().CurrentReservedUnits == 0) && (_context.EncodingReservedUnits.FirstOrDefault().ReservedUnitType != ReservedUnitType.Basic)) TextBoxLogWriteLine("There is no reserved encoding unit (encoding will use a shared pool) but unit type is not set to BASIC.", true); // Warning } catch // can occur on test account { EncodingRUFeatureOn = false; TextBoxLogWriteLine("There is an error when accessing to the Encoding Reserved Units API. Some controls are disabled in the processors tab.", true); // Warning } ApplySettingsOptions(true); }
public void Init(CloudMediaContext context, MediaServiceContextForDynManifest contextDynManifest) { Debug.WriteLine("AssetsInit"); IEnumerable<AssetEntry> assetquery; _context = context; _contextDynManifest = contextDynManifest; assetquery = from a in context.Assets orderby a.LastModified descending select new AssetEntry { Name = a.Name, Id = a.Id, LastModified = ((DateTime)a.LastModified).ToLocalTime(), Storage = a.StorageAccountName }; DataGridViewCellStyle cellstyle = new DataGridViewCellStyle() { NullValue = null, Alignment = DataGridViewContentAlignment.MiddleCenter }; DataGridViewImageColumn imageCol = new DataGridViewImageColumn() { DefaultCellStyle = cellstyle, Name = _publication, DataPropertyName = _publication, }; this.Columns.Add(imageCol); DataGridViewImageColumn imageCol2 = new DataGridViewImageColumn() { DefaultCellStyle = cellstyle, Name = _statEnc, DataPropertyName = _statEnc, }; this.Columns.Add(imageCol2); DataGridViewImageColumn imageCol3 = new DataGridViewImageColumn() { DefaultCellStyle = cellstyle, Name = _dynEnc, DataPropertyName = _dynEnc, }; this.Columns.Add(imageCol3); DataGridViewImageColumn imageCol4 = new DataGridViewImageColumn() { DefaultCellStyle = cellstyle, Name = _filter, DataPropertyName = _filter, }; this.Columns.Add(imageCol4); BindingList<AssetEntry> MyObservAssethisPage = new BindingList<AssetEntry>(assetquery.Take(0).ToList()); // just to create columns this.DataSource = MyObservAssethisPage; int lastColumn_sIndex = this.Columns.GetLastColumn(DataGridViewElementStates.Visible, DataGridViewElementStates.None).DisplayIndex; this.Columns[_statEncMouseOver].Visible = false; this.Columns[_dynEncMouseOver].Visible = false; this.Columns[_publicationMouseOver].Visible = false; this.Columns[_filterMouseOver].Visible = false; this.Columns[_locatorexpirationdatewarning].Visible = false; // used to store warning and put color in red this.Columns["Type"].HeaderText = "Type (streams nb)"; this.Columns["LastModified"].HeaderText = "Last modified"; this.Columns["Id"].Visible = Properties.Settings.Default.DisplayAssetIDinGrid; this.Columns["Storage"].Visible = Properties.Settings.Default.DisplayAssetStorageinGrid; this.Columns["SizeLong"].Visible = false; this.Columns[_filter].DisplayIndex = lastColumn_sIndex; this.Columns[_filter].DefaultCellStyle.NullValue = null; this.Columns[_publication].DisplayIndex = lastColumn_sIndex - 1; this.Columns[_publication].DefaultCellStyle.NullValue = null; this.Columns[_dynEnc].DisplayIndex = lastColumn_sIndex - 2; this.Columns[_dynEnc].DefaultCellStyle.NullValue = null; this.Columns[_statEnc].DisplayIndex = lastColumn_sIndex - 3; this.Columns[_statEnc].DefaultCellStyle.NullValue = null; this.Columns[_statEnc].HeaderText = "Static Encryption"; this.Columns[_dynEnc].HeaderText = "Dynamic Encryption"; this.Columns["Type"].Width = 140; this.Columns["Size"].Width = 80; this.Columns[_statEnc].Width = 80; this.Columns[_dynEnc].Width = 80; this.Columns[_publication].Width = 90; this.Columns[_filter].Width = 50; this.Columns[_locatorexpirationdate].HeaderText = "Publication Expiration"; this.Columns[_locatorexpirationdate].DisplayIndex = this.Columns.Count - 1; this.Columns[_locatorexpirationdate].Width = 130; this.Columns["LastModified"].Width = 140; this.Columns["Id"].Width = 300; this.Columns["Storage"].Width = 140; WorkerAnalyzeAssets = new BackgroundWorker() { WorkerSupportsCancellation = true }; WorkerAnalyzeAssets.DoWork += new System.ComponentModel.DoWorkEventHandler(this.WorkerAnalyzeAssets_DoWork); _initialized = true; }