private TransformOutput GetTransformOutput(Preset transformPreset, MediaTransformOutput transformOutput) { return(new TransformOutput(transformPreset) { RelativePriority = transformOutput.RelativePriority, OnError = transformOutput.OnError }); }
private string GetTransformName(bool defaultName, string transformName, MediaTransformOutput transformOutput) { if (defaultName) { if (!string.IsNullOrEmpty(transformName)) { transformName = string.Concat(transformName, Constant.Media.Transform.Preset.NameDelimiter); } transformName = string.Concat(transformName, transformOutput.TransformPreset.ToString()); } return(transformName); }
private TransformOutput GetTransformOutput(MediaTransformOutput transformOutput, Image thumbnailCodec) { Preset transformPreset = null; switch (transformOutput.PresetType) { case MediaTransformPreset.AdaptiveStreaming: EncoderNamedPreset presetName = EncoderNamedPreset.AdaptiveStreaming; if (!string.IsNullOrEmpty(transformOutput.PresetName)) { presetName = transformOutput.PresetName; } transformPreset = new BuiltInStandardEncoderPreset(presetName); break; case MediaTransformPreset.ContentAwareEncoding: transformPreset = new BuiltInStandardEncoderPreset(EncoderNamedPreset.ContentAwareEncodingExperimental); break; case MediaTransformPreset.ThumbnailImages: case MediaTransformPreset.ThumbnailSprite: transformPreset = GetThumbnailGeneration(thumbnailCodec); break; case MediaTransformPreset.VideoAnalyzer: transformPreset = new VideoAnalyzerPreset() { InsightsToExtract = InsightsType.VideoInsightsOnly }; break; case MediaTransformPreset.AudioAnalyzer: transformPreset = new AudioAnalyzerPreset(); break; case MediaTransformPreset.FaceDetector: transformPreset = new FaceDetectorPreset(); break; } if (transformPreset == null) { return(null); } else { return(new TransformOutput(transformPreset) { RelativePriority = transformOutput.RelativePriority, OnError = transformOutput.OnError }); } }
public Transform CreateTransform(MediaTransformPreset transformPreset, int?thumbnailSpriteColumns) { List <MediaTransformOutput> transformOutputs = new List <MediaTransformOutput>(); if (transformPreset.HasFlag(MediaTransformPreset.AdaptiveStreaming)) { MediaTransformOutput transformOutput = new MediaTransformOutput() { TransformPreset = MediaTransformPreset.AdaptiveStreaming, RelativePriority = Priority.High, OnError = OnErrorType.StopProcessingJob }; transformOutputs.Add(transformOutput); } if (transformPreset.HasFlag(MediaTransformPreset.ThumbnailImages)) { MediaTransformOutput transformOutput = new MediaTransformOutput() { TransformPreset = MediaTransformPreset.ThumbnailImages, RelativePriority = Priority.Normal, OnError = OnErrorType.ContinueJob }; transformOutputs.Add(transformOutput); } if (transformPreset.HasFlag(MediaTransformPreset.VideoAnalyzer)) { MediaTransformOutput transformOutput = new MediaTransformOutput() { TransformPreset = MediaTransformPreset.VideoAnalyzer, RelativePriority = Priority.Normal, OnError = OnErrorType.ContinueJob }; transformOutputs.Add(transformOutput); } if (transformPreset.HasFlag(MediaTransformPreset.AudioAnalyzer)) { MediaTransformOutput transformOutput = new MediaTransformOutput() { TransformPreset = MediaTransformPreset.AudioAnalyzer, RelativePriority = Priority.Normal, OnError = OnErrorType.ContinueJob }; transformOutputs.Add(transformOutput); } return(CreateTransform(null, null, transformOutputs.ToArray(), thumbnailSpriteColumns)); }
public Transform GetTransform(bool adaptiveStreaming, bool contentAwareEncoding, bool thumbnailImages, bool thumbnailSprite, bool videoAnalyzer, bool audioAnalyzer, bool faceDetector, bool videoIndexer, bool audioIndexer) { List <MediaTransformOutput> transformOutputs = new List <MediaTransformOutput>(); if (adaptiveStreaming) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.AdaptiveStreaming, PresetName = EncoderNamedPreset.AdaptiveStreaming.ToString() }; transformOutputs.Add(transformOutput); } if (contentAwareEncoding) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.ContentAwareEncoding, PresetName = EncoderNamedPreset.ContentAwareEncodingExperimental.ToString() }; transformOutputs.Add(transformOutput); } if (thumbnailImages) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.ThumbnailImages, PresetName = MediaTransformPreset.ThumbnailImages.ToString() }; transformOutputs.Add(transformOutput); } if (thumbnailSprite) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.ThumbnailSprite, PresetName = MediaTransformPreset.ThumbnailSprite.ToString() }; transformOutputs.Add(transformOutput); } if (videoAnalyzer) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.VideoAnalyzer, PresetName = MediaTransformPreset.VideoAnalyzer.ToString() }; transformOutputs.Add(transformOutput); } if (audioAnalyzer) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.AudioAnalyzer, PresetName = MediaTransformPreset.AudioAnalyzer.ToString() }; transformOutputs.Add(transformOutput); } if (faceDetector) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.FaceDetector, PresetName = MediaTransformPreset.FaceDetector.ToString() }; transformOutputs.Add(transformOutput); } if (videoIndexer) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.VideoIndexer, PresetName = MediaTransformPreset.VideoIndexer.ToString() }; transformOutputs.Add(transformOutput); } if (audioIndexer) { MediaTransformOutput transformOutput = new MediaTransformOutput() { PresetType = MediaTransformPreset.AudioIndexer, PresetName = MediaTransformPreset.AudioIndexer.ToString() }; transformOutputs.Add(transformOutput); } return(GetTransform(null, null, transformOutputs.ToArray(), null, false)); }