public DynManifestFilter(CloudMediaContext context, IStreamingFilter filterToDisplay = null, IAsset parentAsset = null, SubClipConfiguration subclipconfig = null) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _filterToDisplay = filterToDisplay; _parentAsset = parentAsset; _subclipconfig = subclipconfig; }
private SubClipConfiguration GetSubclippingInternalConfiguration() { if (radioButtonArchiveAllBitrate.Checked || radioButtonArchiveTopBitrate.Checked) // Archive, no reencoding { // Prepare the Subclipping xml XDocument doc = XDocument.Load(Path.Combine(Application.StartupPath + Constants.PathConfigFiles, "RenderedSubclip.xml")); XNamespace ns = "http://www.windowsazure.com/media/encoding/Preset/2014/03"; var presetxml = doc.Element(ns + "Preset"); var sourcexml = presetxml.Element(ns + "Sources").Element(ns + "Source"); var streamsxml = sourcexml.Element(ns + "Streams"); var output = presetxml.Element(ns + "Outputs").Element(ns + "Output"); ; string filter = radioButtonArchiveAllBitrate.Checked ? "*" : "TopBitrate"; string mode = radioButtonArchiveAllBitrate.Checked ? "ArchiveAllBitrates" : "ArchiveTopBitrate"; streamsxml.Add(new XElement(ns + "VideoStream", filter)); streamsxml.Add(new XElement(ns + "AudioStream", filter)); output.Attribute("FileName").SetValue(mode + "_{Basename}.mp4"); if (checkBoxTrimming.Checked) { var subdata = GetSubClipTrimmingDataXMLSerialized(); sourcexml.SetAttributeValue("StartTime", subdata.StartTime); sourcexml.SetAttributeValue("Duration", subdata.Duration); } return new SubClipConfiguration() { Configuration = doc.Declaration.ToString() + doc.ToString(), Reencode = false, Trimming = false, CreateAssetFilter = false }; } else if (radioButtonClipWithReencode.Checked) // means Reencoding { var config = new SubClipConfiguration() { Reencode = true, Trimming = false, CreateAssetFilter = false }; if (checkBoxTrimming.Checked) { var subdata = GetSubClipTrimmingDataXMLSerialized(); config.Trimming = true; config.StartTimeForReencode = subdata.StartTime; config.DurationForReencode = subdata.Duration; } return config; } else // means asset filter { var config = new SubClipConfiguration() { Reencode = false, Trimming = false, CreateAssetFilter = true, }; if (checkBoxTrimming.Checked) { var subdata = GetSubClipTrimmingDataTimeSpan(); config.Trimming = true; config.StartTimeForAssetFilter = subdata.StartTime; config.EndTimeForAssetFilter = subdata.EndTime; } return config; } }
public EncodingAMEStandard(CloudMediaContext context, int nbInputAssets, string processorVersion, SubClipConfiguration subclipConfig = null, bool ThumbnailsModeOnly = false, bool disableOverlay = false, bool disableSourceTrimming = false) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _processorVersion = processorVersion; _subclipConfig = subclipConfig; // used for trimming buttonJobOptions.Initialize(_context); _nbInputAssets = nbInputAssets; _ThumbnailsModeOnly = ThumbnailsModeOnly; // used for thumbnail only mode from the menu _disableOverlay = disableOverlay; _disableSourceTrimming = disableSourceTrimming; }
public EncodingAMEStandard(CloudMediaContext context, SubClipConfiguration subclipConfig = null) { InitializeComponent(); this.Icon = Bitmaps.Azure_Explorer_ico; _context = context; _subclipConfig = subclipConfig; // used for trimming buttonJobOptions.Initialize(_context); }
private SubClipConfiguration GetSubclippingInternalConfiguration() { if (radioButtonArchiveAllBitrate.Checked || radioButtonArchiveTopBitrate.Checked) // Archive, no reencoding { /* SAMPLE JSON { "Version": 1.0, "Sources": [ { "StartTime": "20.13:05:33.0520000", "Duration": "00:00:44.7100000", "Streams": [ { "Type": "AudioStream", "Value": "TopBitrate" }, { "Type": "VideoStream", "Value": "TopBitrate" } ] } ], "Outputs": [ { "FileName": "ArchiveTopBitrate_{Basename}.mp4", "Format": { "Type": "MP4Format" } } ], "Codecs": [ { "Type": "CopyVideo" }, { "Type": "CopyAudio" } ] } */ var obj = new JObject() as dynamic; obj.Version = 1.0; // Sources obj.Sources = new JArray() as dynamic; dynamic sourceEntry = new JObject() as dynamic; // trimming if (checkBoxTrimming.Checked) { sourceEntry.StartTime = timeControlStart.GetTimeStampAsTimeSpanWithOffset(); sourceEntry.Duration = timeControlEnd.GetTimeStampAsTimeSpanWithOffset() - timeControlStart.GetTimeStampAsTimeSpanWithOffset(); } sourceEntry.Streams = new JArray() as dynamic; string filter = radioButtonArchiveAllBitrate.Checked ? "*" : "TopBitrate"; string mode = radioButtonArchiveAllBitrate.Checked ? "ArchiveAllBitrates" : "ArchiveTopBitrate"; dynamic stream = new JObject(); stream.Type = "AudioStream"; stream.Value = filter; sourceEntry.Streams.Add(stream); stream = new JObject(); stream.Type = "VideoStream"; stream.Value = filter; sourceEntry.Streams.Add(stream); obj.Sources.Add(sourceEntry); obj.Outputs = new JArray() as dynamic; dynamic output = new JObject(); output.FileName = mode + "_{Basename}.mp4"; dynamic formatentry = new JObject(); formatentry.Type = "MP4Format"; output.Format = formatentry; obj.Outputs.Add(output); obj.Codecs = new JArray(); dynamic streamcopy = new JObject(); streamcopy.Type = "CopyVideo"; obj.Codecs.Add(streamcopy); streamcopy = new JObject(); streamcopy.Type = "CopyAudio"; obj.Codecs.Add(streamcopy); return new SubClipConfiguration() { Configuration = obj.ToString(), Reencode = false, Trimming = false, CreateAssetFilter = false }; } else if (radioButtonClipWithReencode.Checked) // means Reencoding { var config = new SubClipConfiguration() { Reencode = true, Trimming = false, CreateAssetFilter = false }; if (checkBoxTrimming.Checked) { var subdata = GetSubClipTrimmingDataTimeSpan(); config.Trimming = true; config.StartTimeForReencode = subdata.StartTime; config.DurationForReencode = subdata.Duration; } return config; } else // means asset filter { var config = new SubClipConfiguration() { Reencode = false, Trimming = false, CreateAssetFilter = true, }; if (checkBoxTrimming.Checked) { var subdata = GetSubClipTrimmingDataTimeSpan(); config.Trimming = true; config.StartTimeForAssetFilter = subdata.StartTime; config.EndTimeForAssetFilter = subdata.EndTime; } return config; } }
private SubClipConfiguration GetSubclippingInternalConfiguration() { if (radioButtonArchiveAllBitrate.Checked || radioButtonArchiveTopBitrate.Checked) // Archive, no reencoding { /* SAMPLE JSON { "Version": 1.0, "Sources": [ { "StartTime": "20.13:05:33.0520000", "Duration": "00:00:44.7100000", "Streams": [ { "Type": "AudioStream", "Value": "TopBitrate" }, { "Type": "VideoStream", "Value": "TopBitrate" } ] } ], "Outputs": [ { "FileName": "ArchiveTopBitrate_{Basename}.mp4", "Format": { "Type": "MP4Format" } } ], "Codecs": [ { "Type": "CopyVideo" }, { "Type": "CopyAudio" } ] } */ var obj = new JObject() as dynamic; obj.Version = 1.0; // Sources obj.Sources = new JArray() as dynamic; string filter = radioButtonArchiveAllBitrate.Checked ? "*" : "TopBitrate"; string mode = radioButtonArchiveAllBitrate.Checked ? "ArchiveAllBitrates" : "ArchiveTopBitrate"; dynamic stream_a = new JObject(); stream_a.Type = "AudioStream"; stream_a.Value = filter; dynamic stream_v = new JObject(); stream_v.Type = "VideoStream"; stream_v.Value = filter; if (checkBoxTrimming.Checked && checkBoxUseEDL.Checked) // EDL { foreach (var entry in buttonShowEDL.EDLEntries) { dynamic sourceEntry = new JObject() as dynamic; sourceEntry.StartTime = entry.Start + buttonShowEDL.Offset; sourceEntry.Duration = entry.Duration; sourceEntry.Streams = new JArray() as dynamic; sourceEntry.Streams.Add(stream_a); sourceEntry.Streams.Add(stream_v); obj.Sources.Add(sourceEntry); } } else // No EDL { dynamic sourceEntry = new JObject() as dynamic; if (checkBoxTrimming.Checked) // with trimming { sourceEntry.StartTime = timeControlStart.TimeStampWithOffset; sourceEntry.Duration = timeControlEnd.TimeStampWithOffset - timeControlStart.TimeStampWithOffset; } sourceEntry.Streams = new JArray() as dynamic; sourceEntry.Streams.Add(stream_a); sourceEntry.Streams.Add(stream_v); obj.Sources.Add(sourceEntry); } obj.Outputs = new JArray() as dynamic; dynamic output = new JObject(); output.FileName = mode + "_{Basename}.mp4"; dynamic formatentry = new JObject(); formatentry.Type = "MP4Format"; output.Format = formatentry; obj.Outputs.Add(output); obj.Codecs = new JArray(); dynamic streamcopy = new JObject(); streamcopy.Type = "CopyVideo"; obj.Codecs.Add(streamcopy); streamcopy = new JObject(); streamcopy.Type = "CopyAudio"; obj.Codecs.Add(streamcopy); return new SubClipConfiguration() { Configuration = obj.ToString(), Reencode = false, Trimming = false, CreateAssetFilter = false }; } else if (radioButtonClipWithReencode.Checked) // means Reencoding { var config = new SubClipConfiguration() { Reencode = true, Trimming = false, CreateAssetFilter = false }; if (checkBoxTrimming.Checked) { config.Trimming = true; var list = new List<ExplorerEDLEntryInOut>(); if (checkBoxUseEDL.Checked) // EDL { foreach (var entry in buttonShowEDL.EDLEntries) { list.Add(new ExplorerEDLEntryInOut() { Start = entry.Start, End = entry.End }); } config.OffsetForReencode = timeControlStart.GetOffSetAsTimeSpan(); } else // No EDL { var subdata = GetSubClipTrimmingDataTimeSpan(); list.Add(new ExplorerEDLEntryInOut() { Start = subdata.StartTime - subdata.Offset, End = subdata.EndTime - subdata.Offset }); config.OffsetForReencode = subdata.Offset; } config.InOutForReencode = list; } return config; } else // means asset filter { var config = new SubClipConfiguration() { Reencode = false, Trimming = false, CreateAssetFilter = true, }; if (checkBoxTrimming.Checked) { var subdata = GetSubClipTrimmingDataTimeSpan(); config.Trimming = true; config.StartTimeForAssetFilter = subdata.StartTime; config.EndTimeForAssetFilter = subdata.EndTime; } return config; } }