From 2802c13ea9ca4a2026abf1e95d1fdd9e43e19bff Mon Sep 17 00:00:00 2001 From: Xavier Pouyat Date: Thu, 16 Nov 2023 18:22:25 +0100 Subject: [PATCH] Update to enum --- .../CsharpDotNet2/Model/LiveEventEncoding.cs | 2 +- MK.IO/CsharpDotNet2/Model/LiveEventInput.cs | 2 +- .../LiveEvent/Models/LiveEventEncodingType.cs | 37 ++++++--- .../Models/LiveEventInputProtocol.cs | 25 +++++- MK.IO/Transform/Models/AudioAnalyzerMode.cs | 30 +++++++ MK.IO/Transform/Models/AudioAnalyzerPreset.cs | 3 +- .../Models/AudioAnalyzerPresetMode.cs | 12 --- .../Models/BuiltInStandardEncoderPreset.cs | 5 +- MK.IO/Transform/Models/EncoderNamedPreset.cs | 78 +++++++++++++++---- 9 files changed, 148 insertions(+), 46 deletions(-) create mode 100644 MK.IO/Transform/Models/AudioAnalyzerMode.cs delete mode 100644 MK.IO/Transform/Models/AudioAnalyzerPresetMode.cs diff --git a/MK.IO/CsharpDotNet2/Model/LiveEventEncoding.cs b/MK.IO/CsharpDotNet2/Model/LiveEventEncoding.cs index 185f5c5..9495178 100644 --- a/MK.IO/CsharpDotNet2/Model/LiveEventEncoding.cs +++ b/MK.IO/CsharpDotNet2/Model/LiveEventEncoding.cs @@ -17,7 +17,7 @@ public class LiveEventEncoding /// Live event type. When encodingType is set to PassthroughBasic or PassthroughStandard, the service simply passes through the incoming video and audio layer(s) to the output. When encodingType is set to Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates or layers [DataMember(Name = "encodingType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "encodingType")] - public string EncodingType { get; set; } + public LiveEventEncodingType EncodingType { get; set; } /// /// Use an ISO 8601 time value between 1 and 10 seconds to specify the output fragment length for the video and audio tracks of an encoding live event. For example, use PT2S to indicate 2 seconds. For the video track it also defines the key frame interval, or the length of a GoP (group of pictures). If this value is not set for an encoding live event, the fragment duration defaults to 2 seconds. The value cannot be set for pass-through live events. diff --git a/MK.IO/CsharpDotNet2/Model/LiveEventInput.cs b/MK.IO/CsharpDotNet2/Model/LiveEventInput.cs index 745777a..71e9268 100644 --- a/MK.IO/CsharpDotNet2/Model/LiveEventInput.cs +++ b/MK.IO/CsharpDotNet2/Model/LiveEventInput.cs @@ -48,7 +48,7 @@ public class LiveEventInput /// The input protocol for the live event. This is specified at creation time and cannot be updated. Must be one of RTMP or SRT. fmp4 smooth input is not supported. [DataMember(Name = "streamingProtocol", EmitDefaultValue = false)] [JsonProperty(PropertyName = "streamingProtocol")] - public string StreamingProtocol { get; set; } + public LiveEventInputProtocol StreamingProtocol { get; set; } /// /// The metadata endpoints for the live event. diff --git a/MK.IO/LiveEvent/Models/LiveEventEncodingType.cs b/MK.IO/LiveEvent/Models/LiveEventEncodingType.cs index c47b97e..41f3362 100644 --- a/MK.IO/LiveEvent/Models/LiveEventEncodingType.cs +++ b/MK.IO/LiveEvent/Models/LiveEventEncodingType.cs @@ -1,30 +1,47 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; + namespace MK.IO { - /// The encoding types for live event. - public readonly partial struct LiveEventEncodingType + /// + /// Live event type. When encodingType is set to PassthroughBasic or PassthroughStandard, the service simply passes through the incoming video and audio layer(s) to the output. When encodingType is set to Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates or layers + /// + /// Live event type. When encodingType is set to PassthroughBasic or PassthroughStandard, the service simply passes through the incoming video and audio layer(s) to the output. When encodingType is set to Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates or layers + [JsonConverter(typeof(StringEnumConverter))] + public enum LiveEventEncodingType { + /// + /// Enum None for value: None + /// + [EnumMember(Value = "None")] + None = 1, /// - /// The ingested stream passes through the live event from the contribution encoder. + /// Enum PassthroughBasic for value: PassthroughBasic /// - public static readonly string PassthroughBasic = "PassthroughBasic"; + [EnumMember(Value = "PassthroughBasic")] + PassthroughBasic = 2, /// - /// The ingested stream passes through the live event from the contribution encoder. + /// Enum PassthroughStandard for value: PassthroughStandard /// - public static readonly string PassthroughStandard = "PassthroughStandard"; + [EnumMember(Value = "PassthroughStandard")] + PassthroughStandard = 3, /// - /// A live encoder transcodes the incoming stream into multiple bitrates or layers + /// Enum Premium1080p for value: Premium1080p /// - public static readonly string Standard = "Standard "; + [EnumMember(Value = "Premium1080p")] + Premium1080p = 4, /// - /// A live encoder transcodes the incoming stream into multiple bitrates or layers + /// Enum Standard for value: Standard /// - public static readonly string Premium1080p = "Premium1080p "; + [EnumMember(Value = "Standard")] + Standard = 5 } } \ No newline at end of file diff --git a/MK.IO/LiveEvent/Models/LiveEventInputProtocol.cs b/MK.IO/LiveEvent/Models/LiveEventInputProtocol.cs index 5e28a7c..be4bc0d 100644 --- a/MK.IO/LiveEvent/Models/LiveEventInputProtocol.cs +++ b/MK.IO/LiveEvent/Models/LiveEventInputProtocol.cs @@ -1,12 +1,29 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; + namespace MK.IO { - /// The input protocols for live event. - public readonly partial struct LiveEventInputProtocol + /// + /// The input protocol for the live event. This is specified at creation time and cannot be updated. Must be one of RTMP or SRT. fmp4 smooth input is not supported. + /// + /// The input protocol for the live event. This is specified at creation time and cannot be updated. Must be one of RTMP or SRT. fmp4 smooth input is not supported. + [JsonConverter(typeof(StringEnumConverter))] + public enum LiveEventInputProtocol { - public static readonly string RTMP = "RTMP"; - public static readonly string SRT = "SRT "; + /// + /// Enum RTMP for value: RTMP + /// + [EnumMember(Value = "RTMP")] + RTMP = 1, + + /// + /// Enum SRT for value: SRT + /// + [EnumMember(Value = "SRT")] + SRT = 2 } } \ No newline at end of file diff --git a/MK.IO/Transform/Models/AudioAnalyzerMode.cs b/MK.IO/Transform/Models/AudioAnalyzerMode.cs new file mode 100644 index 0000000..b237543 --- /dev/null +++ b/MK.IO/Transform/Models/AudioAnalyzerMode.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; + +namespace MK.IO +{ + /// + /// Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. + /// + /// Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. + [JsonConverter(typeof(StringEnumConverter))] + public enum AudioAnalyzerMode + { + /// + /// Enum Basic for value: Basic + /// + [EnumMember(Value = "Basic")] + Basic = 1, + + /// + /// Enum Standard for value: Standard + /// + [EnumMember(Value = "Standard")] + Standard = 2 + } +} \ No newline at end of file diff --git a/MK.IO/Transform/Models/AudioAnalyzerPreset.cs b/MK.IO/Transform/Models/AudioAnalyzerPreset.cs index 39899ac..254596e 100644 --- a/MK.IO/Transform/Models/AudioAnalyzerPreset.cs +++ b/MK.IO/Transform/Models/AudioAnalyzerPreset.cs @@ -36,12 +36,11 @@ public class AudioAnalyzerPreset : TransformOutputPreset /// /// Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. - /// Use AudioAnalyzerPresetMode to list values. /// /// Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. [DataMember(Name = "mode", EmitDefaultValue = false)] [JsonProperty(PropertyName = "mode")] - public string Mode { get; set; } + public AudioAnalyzerMode Mode { get; set; } /// /// Get the string presentation of the object diff --git a/MK.IO/Transform/Models/AudioAnalyzerPresetMode.cs b/MK.IO/Transform/Models/AudioAnalyzerPresetMode.cs deleted file mode 100644 index 58c3d4d..0000000 --- a/MK.IO/Transform/Models/AudioAnalyzerPresetMode.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace MK.IO -{ - /// The modes to use with Audio Analyzer. - public readonly partial struct AudioAnalyzerPresetMode - { - public static readonly string Standard = "Standard"; - public static readonly string Basic = "Basic"; - } -} \ No newline at end of file diff --git a/MK.IO/Transform/Models/BuiltInStandardEncoderPreset.cs b/MK.IO/Transform/Models/BuiltInStandardEncoderPreset.cs index d5f0c57..ab93620 100644 --- a/MK.IO/Transform/Models/BuiltInStandardEncoderPreset.cs +++ b/MK.IO/Transform/Models/BuiltInStandardEncoderPreset.cs @@ -8,7 +8,7 @@ namespace MK.IO public class BuiltInStandardEncoderPreset : TransformOutputPreset { - public BuiltInStandardEncoderPreset(string presetName) + public BuiltInStandardEncoderPreset(EncoderNamedPreset presetName) { PresetName = presetName; } @@ -16,8 +16,7 @@ public BuiltInStandardEncoderPreset(string presetName) [JsonProperty("@odata.type")] internal string OdataType => "#Microsoft.Media.BuiltInStandardEncoderPreset"; - // Use EncoderNamedPreset to list possible values for this property [JsonProperty("presetName")] - public string PresetName { get; set; } + public EncoderNamedPreset PresetName { get; set; } } } \ No newline at end of file diff --git a/MK.IO/Transform/Models/EncoderNamedPreset.cs b/MK.IO/Transform/Models/EncoderNamedPreset.cs index 531785a..b42f723 100644 --- a/MK.IO/Transform/Models/EncoderNamedPreset.cs +++ b/MK.IO/Transform/Models/EncoderNamedPreset.cs @@ -1,22 +1,74 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; + namespace MK.IO { /// The built-in preset to be used for encoding videos. - public readonly partial struct EncoderNamedPreset + [JsonConverter(typeof(StringEnumConverter))] + public enum EncoderNamedPreset { - public static readonly string H264SingleBitrateSD = "H264SingleBitrateSD"; - public static readonly string H264SingleBitrate720p = "H264SingleBitrate720p"; - public static readonly string H264SingleBitrate1080p = "H264SingleBitrate1080p"; - public static readonly string H264MultipleBitrate1080p = "H264MultipleBitrate1080p"; - public static readonly string H264MultipleBitrate720p = "H264MultipleBitrate720p"; - public static readonly string H264MultipleBitrateSD = "H264MultipleBitrateSD"; - - public static readonly string H265SingleBitrate720p = "H265SingleBitrate720p"; - public static readonly string H265SingleBitrate1080p = "H265SingleBitrate1080p"; - public static readonly string H265SingleBitrate4K = "H265SingleBitrate4K"; - - public static readonly string AACGoodQualityAudio = "AACGoodQualityAudio"; + /// + /// Enum H264SingleBitrateSD for value: H264SingleBitrateSD + /// + [EnumMember(Value = "H264SingleBitrateSD")] + H264SingleBitrateSD = 1, + + /// + /// Enum H264SingleBitrate720p for value: H264SingleBitrate720p + /// + [EnumMember(Value = "H264SingleBitrate720p")] + H264SingleBitrate720p = 2, + + /// + /// Enum H264SingleBitrate1080p for value: H264SingleBitrate1080p + /// + [EnumMember(Value = "H264SingleBitrate1080p")] + H264SingleBitrate1080p = 3, + + /// + /// Enum H264MultipleBitrateSD for value: H264MultipleBitrateSD + /// + [EnumMember(Value = "H264MultipleBitrateSD")] + H264MultipleBitrateSD = 4, + + /// + /// Enum H264MultipleBitrate720p for value: H264MultipleBitrate720p + /// + [EnumMember(Value = "H264MultipleBitrate720p")] + H264MultipleBitrate720p = 5, + + /// + /// Enum H264MultipleBitrate1080p for value: H264MultipleBitrate1080p + /// + [EnumMember(Value = "H264MultipleBitrate1080p")] + H264MultipleBitrate1080p = 6, + + /// + /// Enum H265SingleBitrate720p for value: H265SingleBitrate720p + /// + [EnumMember(Value = "H265SingleBitrate720p")] + H265SingleBitrate720p = 7, + + /// + /// Enum H265SingleBitrate1080p for value: H265SingleBitrate1080p + /// + [EnumMember(Value = "H265SingleBitrate1080p")] + H265SingleBitrate1080p = 8, + + /// + /// Enum H265SingleBitrate4K for value: H265SingleBitrate4K + /// + [EnumMember(Value = "H265SingleBitrate4K")] + H265SingleBitrate4K = 9, + + /// + /// Enum AACGoodQualityAudio for value: AACGoodQualityAudio + /// + [EnumMember(Value = "AACGoodQualityAudio")] + AACGoodQualityAudio = 10 } } \ No newline at end of file