Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Support for audioanalyzerpreset and batter management of job input st…
Browse files Browse the repository at this point in the history
…art and end
  • Loading branch information
xpouyat committed Nov 16, 2023
1 parent 3bd1b5d commit 95836a3
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 33 deletions.
2 changes: 1 addition & 1 deletion MK.IO/CsharpDotNet2/Model/TransformOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class TransformOutput
/// <value>Preset that describes the operations that will be used to modify, transcode, or extract insights from the source file to generate the output. Only BultiInStandardEncoderPreset is supported currently.</value>
[DataMember(Name = "preset", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "preset")]
public EncoderPreset Preset { get; set; }
public TransformOutputPreset Preset { get; set; }

/// <summary>
/// Sets the relative priority of the TransformOutputs within a Transform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@
using System.Runtime.Serialization;
using System.Text;

namespace MK.IO.Models
namespace MK.IO
{

/// <summary>
///
/// </summary>
[DataContract]
public class AbsoluteClipTime
public class AbsoluteClipTime : JobInputTime
{
/// <summary>
/// The discriminator for derived types.
/// </summary>
/// <value>The discriminator for derived types.</value>
[DataMember(Name = "@odata.type", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "@odata.type")]
public string OdataType { get; set; }
[JsonProperty("@odata.type")]
internal string OdataType => "#Microsoft.Media.AbsoluteClipTime";

/// <summary>
/// The time position on the timeline of the input media. It is usually specified as an ISO8601 period. e.g PT30S for 30 seconds.
Expand Down
13 changes: 13 additions & 0 deletions MK.IO/Job/Models/JobInputHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace MK.IO
{
Expand All @@ -24,6 +25,18 @@ public JobInputHttp(string baseUri, List<string> files)
[JsonProperty("baseUri")]
public string BaseUri { get; set; }

/// <summary>
/// Gets or Sets Start
/// </summary>
[JsonProperty("start")]
public JobInputTime Start { get; set; }

/// <summary>
/// Gets or Sets End
/// </summary>
[JsonProperty("end")]
public JobInputTime End { get; set; }

/// <summary>
/// List of files. Required for JobInputHttp.
/// </summary>
Expand Down
22 changes: 22 additions & 0 deletions MK.IO/Job/Models/JobInputTime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using JsonSubTypes;
using Newtonsoft.Json;
namespace MK.IO
{

[JsonConverter(typeof(JsonSubtypes), "@odata.type")]
[JsonSubtypes.KnownSubType(typeof(UtcClipTime), "#Microsoft.Media.UtcClipTime")]
[JsonSubtypes.KnownSubType(typeof(AbsoluteClipTime), "#Microsoft.Media.AbsoluteClipTime")]

//
// Summary:
// Base class for Job Start. A derived class must be used
// to create a configuration.
public class JobInputTime
{
[JsonProperty("@odata.type")]
internal virtual string OdataType { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,24 @@
using System.Runtime.Serialization;
using System.Text;

namespace MK.IO.Models
namespace MK.IO
{

/// <summary>
///
/// </summary>
[DataContract]
public class UtcClipTime
public class UtcClipTime : JobInputTime
{
/// <summary>
/// The discriminator for derived types.
/// </summary>
/// <value>The discriminator for derived types.</value>
[DataMember(Name = "@odata.type", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "@odata.type")]
public string OdataType { get; set; }
[JsonProperty("@odata.type")]
internal string OdataType => "#Microsoft.Media.UtcClipTime";

/// <summary>
/// The time position on the timeline of the input media based on Utc time.
/// </summary>
/// <value>The time position on the timeline of the input media based on Utc time.</value>
[DataMember(Name = "time", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "time")]
public TimeSpan Time { get; set; }
public DateTime Time { get; set; }


/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions MK.IO/Script/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Classes generated from Swagger.

Namespace changed with ps1 script.

In TransformOutput.cs, public OneOfTransformOutputPreset Preset { get; set; } changed to public EncoderPreset Preset { get; set; }
In TransformOutput.cs, public OneOfTransformOutputPreset Preset { get; set; } changed to public TransformOutputPreset Preset { get; set; }
In JobProperties.cs, public OneOfJobPropertiesInput Input { get; set; } changed to public JobInput Input { get; set; }
In JobProperties.cs, public OneOfJobPropertiesInput Input { get; set; } changed to public JobInput Input { get; set; }

Deleted : OneOfTransformOutputPreset.cs, OneOfJobPropertiesInput.cs, BuiltInStandardEncoderPreset.cs, JobInputAsset.cs, JobInputHttp.cs, ContentKeyPolicyOption
Deleted : AbsoluteClipTime, AudioAnalyzerPreset, UtcClipTime, OneOfTransformOutputPreset.cs, OneOfJobPropertiesInput.cs, BuiltInStandardEncoderPreset.cs, JobInputAsset.cs, JobInputHttp.cs, ContentKeyPolicyOption
and all OneOfJobInput....cs

In JobOutputAsset.cs, public string EndTime changed to public DateTime? EndTime, and public string StartTime changed to public DateTime? StartTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
using System.Runtime.Serialization;
using System.Text;

namespace MK.IO.Models
namespace MK.IO
{

/// <summary>
///
/// </summary>
[DataContract]
public class AudioAnalyzerPreset
public class AudioAnalyzerPreset : TransformOutputPreset
{
/// <summary>
/// The discriminator for derived types.
/// </summary>
/// <value>The discriminator for derived types.</value>
[DataMember(Name = "@odata.type", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "@odata.type")]
public string OdataType { get; set; }
[JsonProperty("@odata.type")]
internal string OdataType => "#Microsoft.Media.AudioAnalyzerPreset";

/// <summary>
/// The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US')
Expand All @@ -37,13 +36,13 @@ public class AudioAnalyzerPreset

/// <summary>
/// Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen.
/// Use AudioAnalyzerPresetMode to list values.
/// </summary>
/// <value>Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen.</value>
[DataMember(Name = "mode", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "mode")]
public string Mode { get; set; }


/// <summary>
/// Get the string presentation of the object
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions MK.IO/Transform/Models/AudioAnalyzerPresetMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace MK.IO
{
/// <summary> The modes to use with Audio Analyzer. </summary>
public readonly partial struct AudioAnalyzerPresetMode
{
public static readonly string Standard = "Standard";
public static readonly string Basic = "Basic";
}
}
3 changes: 2 additions & 1 deletion MK.IO/Transform/Models/BuiltInStandardEncoderPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace MK.IO
{
public class BuiltInStandardEncoderPreset : EncoderPreset
public class BuiltInStandardEncoderPreset : TransformOutputPreset
{

public BuiltInStandardEncoderPreset(string presetName)
Expand All @@ -16,6 +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; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ namespace MK.IO

[JsonConverter(typeof(JsonSubtypes), "@odata.type")]
[JsonSubtypes.KnownSubType(typeof(BuiltInStandardEncoderPreset), "#Microsoft.Media.BuiltInStandardEncoderPreset")]
[JsonSubtypes.KnownSubType(typeof(AudioAnalyzerPreset), "#Microsoft.Media.AudioAnalyzerPreset")]

//
// Summary:
// Base class for Encoder preset configuration. A derived class must be used
// Base class for Transform Output preset configuration. A derived class must be used
// to create a configuration.
public class EncoderPreset
public class TransformOutputPreset
{
[JsonProperty("@odata.type")]
internal virtual string OdataType { get; set; }
Expand Down

0 comments on commit 95836a3

Please sign in to comment.