diff --git a/profiles/latest/mediaservices/mgmt/media/models.go b/profiles/latest/mediaservices/mgmt/media/models.go index 280f46b1b5f4..8ca4f1711d2d 100644 --- a/profiles/latest/mediaservices/mgmt/media/models.go +++ b/profiles/latest/mediaservices/mgmt/media/models.go @@ -292,6 +292,13 @@ const ( OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier OdataType = original.OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier ) +type OdataTypeBasicClipTime = original.OdataTypeBasicClipTime + +const ( + OdataTypeClipTime OdataTypeBasicClipTime = original.OdataTypeClipTime + OdataTypeMicrosoftMediaAbsoluteClipTime OdataTypeBasicClipTime = original.OdataTypeMicrosoftMediaAbsoluteClipTime +) + type OdataTypeBasicCodec = original.OdataTypeBasicCodec const ( @@ -486,6 +493,7 @@ const ( type APIError = original.APIError type AacAudio = original.AacAudio +type AbsoluteClipTime = original.AbsoluteClipTime type AccountFilter = original.AccountFilter type AccountFilterCollection = original.AccountFilterCollection type AccountFilterCollectionIterator = original.AccountFilterCollectionIterator @@ -513,6 +521,7 @@ type AudioOverlay = original.AudioOverlay type BaseClient = original.BaseClient type BasicAudio = original.BasicAudio type BasicAudioAnalyzerPreset = original.BasicAudioAnalyzerPreset +type BasicClipTime = original.BasicClipTime type BasicCodec = original.BasicCodec type BasicContentKeyPolicyConfiguration = original.BasicContentKeyPolicyConfiguration type BasicContentKeyPolicyPlayReadyContentKeyLocation = original.BasicContentKeyPolicyPlayReadyContentKeyLocation @@ -534,6 +543,7 @@ type BuiltInStandardEncoderPreset = original.BuiltInStandardEncoderPreset type CbcsDrmConfiguration = original.CbcsDrmConfiguration type CencDrmConfiguration = original.CencDrmConfiguration type CheckNameAvailabilityInput = original.CheckNameAvailabilityInput +type ClipTime = original.ClipTime type Codec = original.Codec type CommonEncryptionCbcs = original.CommonEncryptionCbcs type CommonEncryptionCenc = original.CommonEncryptionCenc @@ -988,6 +998,9 @@ func PossibleMetricAggregationTypeValues() []MetricAggregationType { func PossibleMetricUnitValues() []MetricUnit { return original.PossibleMetricUnitValues() } +func PossibleOdataTypeBasicClipTimeValues() []OdataTypeBasicClipTime { + return original.PossibleOdataTypeBasicClipTimeValues() +} func PossibleOdataTypeBasicCodecValues() []OdataTypeBasicCodec { return original.PossibleOdataTypeBasicCodecValues() } diff --git a/profiles/preview/mediaservices/mgmt/media/models.go b/profiles/preview/mediaservices/mgmt/media/models.go index df3aa3e06735..bcfa05ee95bd 100644 --- a/profiles/preview/mediaservices/mgmt/media/models.go +++ b/profiles/preview/mediaservices/mgmt/media/models.go @@ -292,6 +292,13 @@ const ( OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier OdataType = original.OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier ) +type OdataTypeBasicClipTime = original.OdataTypeBasicClipTime + +const ( + OdataTypeClipTime OdataTypeBasicClipTime = original.OdataTypeClipTime + OdataTypeMicrosoftMediaAbsoluteClipTime OdataTypeBasicClipTime = original.OdataTypeMicrosoftMediaAbsoluteClipTime +) + type OdataTypeBasicCodec = original.OdataTypeBasicCodec const ( @@ -486,6 +493,7 @@ const ( type APIError = original.APIError type AacAudio = original.AacAudio +type AbsoluteClipTime = original.AbsoluteClipTime type AccountFilter = original.AccountFilter type AccountFilterCollection = original.AccountFilterCollection type AccountFilterCollectionIterator = original.AccountFilterCollectionIterator @@ -513,6 +521,7 @@ type AudioOverlay = original.AudioOverlay type BaseClient = original.BaseClient type BasicAudio = original.BasicAudio type BasicAudioAnalyzerPreset = original.BasicAudioAnalyzerPreset +type BasicClipTime = original.BasicClipTime type BasicCodec = original.BasicCodec type BasicContentKeyPolicyConfiguration = original.BasicContentKeyPolicyConfiguration type BasicContentKeyPolicyPlayReadyContentKeyLocation = original.BasicContentKeyPolicyPlayReadyContentKeyLocation @@ -534,6 +543,7 @@ type BuiltInStandardEncoderPreset = original.BuiltInStandardEncoderPreset type CbcsDrmConfiguration = original.CbcsDrmConfiguration type CencDrmConfiguration = original.CencDrmConfiguration type CheckNameAvailabilityInput = original.CheckNameAvailabilityInput +type ClipTime = original.ClipTime type Codec = original.Codec type CommonEncryptionCbcs = original.CommonEncryptionCbcs type CommonEncryptionCenc = original.CommonEncryptionCenc @@ -988,6 +998,9 @@ func PossibleMetricAggregationTypeValues() []MetricAggregationType { func PossibleMetricUnitValues() []MetricUnit { return original.PossibleMetricUnitValues() } +func PossibleOdataTypeBasicClipTimeValues() []OdataTypeBasicClipTime { + return original.PossibleOdataTypeBasicClipTimeValues() +} func PossibleOdataTypeBasicCodecValues() []OdataTypeBasicCodec { return original.PossibleOdataTypeBasicCodecValues() } diff --git a/services/mediaservices/mgmt/2018-07-01/media/models.go b/services/mediaservices/mgmt/2018-07-01/media/models.go index 7c291558bc08..91ef865c417e 100644 --- a/services/mediaservices/mgmt/2018-07-01/media/models.go +++ b/services/mediaservices/mgmt/2018-07-01/media/models.go @@ -627,6 +627,21 @@ func PossibleOdataTypeValues() []OdataType { return []OdataType{OdataTypeContentKeyPolicyPlayReadyContentKeyLocation, OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, OdataTypeMicrosoftMediaContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier} } +// OdataTypeBasicClipTime enumerates the values for odata type basic clip time. +type OdataTypeBasicClipTime string + +const ( + // OdataTypeClipTime ... + OdataTypeClipTime OdataTypeBasicClipTime = "ClipTime" + // OdataTypeMicrosoftMediaAbsoluteClipTime ... + OdataTypeMicrosoftMediaAbsoluteClipTime OdataTypeBasicClipTime = "#Microsoft.Media.AbsoluteClipTime" +) + +// PossibleOdataTypeBasicClipTimeValues returns an array of possible values for the OdataTypeBasicClipTime const type. +func PossibleOdataTypeBasicClipTimeValues() []OdataTypeBasicClipTime { + return []OdataTypeBasicClipTime{OdataTypeClipTime, OdataTypeMicrosoftMediaAbsoluteClipTime} +} + // OdataTypeBasicCodec enumerates the values for odata type basic codec. type OdataTypeBasicCodec string @@ -1157,6 +1172,44 @@ func (aa AacAudio) AsBasicCodec() (BasicCodec, bool) { return &aa, true } +// AbsoluteClipTime specifies the clip time as an absolute time position in the media file. The absolute +// time can point to a different position depending on whether the media file starts from a timestamp of +// zero or not. +type AbsoluteClipTime struct { + // Time - The time position on the timeline of the input media. It is usually speicified as an ISO8601 period. e.g PT30S for 30 seconds. + Time *string `json:"time,omitempty"` + // OdataType - Possible values include: 'OdataTypeClipTime', 'OdataTypeMicrosoftMediaAbsoluteClipTime' + OdataType OdataTypeBasicClipTime `json:"@odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AbsoluteClipTime. +func (act AbsoluteClipTime) MarshalJSON() ([]byte, error) { + act.OdataType = OdataTypeMicrosoftMediaAbsoluteClipTime + objectMap := make(map[string]interface{}) + if act.Time != nil { + objectMap["time"] = act.Time + } + if act.OdataType != "" { + objectMap["@odata.type"] = act.OdataType + } + return json.Marshal(objectMap) +} + +// AsAbsoluteClipTime is the BasicClipTime implementation for AbsoluteClipTime. +func (act AbsoluteClipTime) AsAbsoluteClipTime() (*AbsoluteClipTime, bool) { + return &act, true +} + +// AsClipTime is the BasicClipTime implementation for AbsoluteClipTime. +func (act AbsoluteClipTime) AsClipTime() (*ClipTime, bool) { + return nil, false +} + +// AsBasicClipTime is the BasicClipTime implementation for AbsoluteClipTime. +func (act AbsoluteClipTime) AsBasicClipTime() (BasicClipTime, bool) { + return &act, true +} + // AccountFilter an Account Filter. type AccountFilter struct { autorest.Response `json:"-"` @@ -2303,6 +2356,82 @@ type CheckNameAvailabilityInput struct { Type *string `json:"type,omitempty"` } +// BasicClipTime base class for specifying a clip time. Use sub classes of this class to specify the time position in +// the media. +type BasicClipTime interface { + AsAbsoluteClipTime() (*AbsoluteClipTime, bool) + AsClipTime() (*ClipTime, bool) +} + +// ClipTime base class for specifying a clip time. Use sub classes of this class to specify the time position +// in the media. +type ClipTime struct { + // OdataType - Possible values include: 'OdataTypeClipTime', 'OdataTypeMicrosoftMediaAbsoluteClipTime' + OdataType OdataTypeBasicClipTime `json:"@odata.type,omitempty"` +} + +func unmarshalBasicClipTime(body []byte) (BasicClipTime, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["@odata.type"] { + case string(OdataTypeMicrosoftMediaAbsoluteClipTime): + var act AbsoluteClipTime + err := json.Unmarshal(body, &act) + return act, err + default: + var ct ClipTime + err := json.Unmarshal(body, &ct) + return ct, err + } +} +func unmarshalBasicClipTimeArray(body []byte) ([]BasicClipTime, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ctArray := make([]BasicClipTime, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ct, err := unmarshalBasicClipTime(*rawMessage) + if err != nil { + return nil, err + } + ctArray[index] = ct + } + return ctArray, nil +} + +// MarshalJSON is the custom marshaler for ClipTime. +func (ct ClipTime) MarshalJSON() ([]byte, error) { + ct.OdataType = OdataTypeClipTime + objectMap := make(map[string]interface{}) + if ct.OdataType != "" { + objectMap["@odata.type"] = ct.OdataType + } + return json.Marshal(objectMap) +} + +// AsAbsoluteClipTime is the BasicClipTime implementation for ClipTime. +func (ct ClipTime) AsAbsoluteClipTime() (*AbsoluteClipTime, bool) { + return nil, false +} + +// AsClipTime is the BasicClipTime implementation for ClipTime. +func (ct ClipTime) AsClipTime() (*ClipTime, bool) { + return &ct, true +} + +// AsBasicClipTime is the BasicClipTime implementation for ClipTime. +func (ct ClipTime) AsBasicClipTime() (BasicClipTime, bool) { + return &ct, true +} + // BasicCodec describes the basic properties of all codecs. type BasicCodec interface { AsAudio() (*Audio, bool) @@ -5570,6 +5699,10 @@ type JobInputAsset struct { AssetName *string `json:"assetName,omitempty"` // Files - List of files. Required for JobInputHttp. Maximum of 4000 characters each. Files *[]string `json:"files,omitempty"` + // Start - Defines a point on the timeline of the input media at which processing will start. Defaults to the beginning of the input media. + Start BasicClipTime `json:"start,omitempty"` + // End - Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. + End BasicClipTime `json:"end,omitempty"` // Label - A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. Label *string `json:"label,omitempty"` // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' @@ -5586,6 +5719,8 @@ func (jia JobInputAsset) MarshalJSON() ([]byte, error) { if jia.Files != nil { objectMap["files"] = jia.Files } + objectMap["start"] = jia.Start + objectMap["end"] = jia.End if jia.Label != nil { objectMap["label"] = jia.Label } @@ -5630,6 +5765,73 @@ func (jia JobInputAsset) AsBasicJobInput() (BasicJobInput, bool) { return &jia, true } +// UnmarshalJSON is the custom unmarshaler for JobInputAsset struct. +func (jia *JobInputAsset) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "assetName": + if v != nil { + var assetName string + err = json.Unmarshal(*v, &assetName) + if err != nil { + return err + } + jia.AssetName = &assetName + } + case "files": + if v != nil { + var files []string + err = json.Unmarshal(*v, &files) + if err != nil { + return err + } + jia.Files = &files + } + case "start": + if v != nil { + start, err := unmarshalBasicClipTime(*v) + if err != nil { + return err + } + jia.Start = start + } + case "end": + if v != nil { + end, err := unmarshalBasicClipTime(*v) + if err != nil { + return err + } + jia.End = end + } + case "label": + if v != nil { + var label string + err = json.Unmarshal(*v, &label) + if err != nil { + return err + } + jia.Label = &label + } + case "@odata.type": + if v != nil { + var odataType OdataTypeBasicJobInput + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + jia.OdataType = odataType + } + } + } + + return nil +} + // BasicJobInputClip represents input files for a Job. type BasicJobInputClip interface { AsJobInputAsset() (*JobInputAsset, bool) @@ -5641,6 +5843,10 @@ type BasicJobInputClip interface { type JobInputClip struct { // Files - List of files. Required for JobInputHttp. Maximum of 4000 characters each. Files *[]string `json:"files,omitempty"` + // Start - Defines a point on the timeline of the input media at which processing will start. Defaults to the beginning of the input media. + Start BasicClipTime `json:"start,omitempty"` + // End - Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. + End BasicClipTime `json:"end,omitempty"` // Label - A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. Label *string `json:"label,omitempty"` // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' @@ -5695,6 +5901,8 @@ func (jic JobInputClip) MarshalJSON() ([]byte, error) { if jic.Files != nil { objectMap["files"] = jic.Files } + objectMap["start"] = jic.Start + objectMap["end"] = jic.End if jic.Label != nil { objectMap["label"] = jic.Label } @@ -5739,12 +5947,74 @@ func (jic JobInputClip) AsBasicJobInput() (BasicJobInput, bool) { return &jic, true } +// UnmarshalJSON is the custom unmarshaler for JobInputClip struct. +func (jic *JobInputClip) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "files": + if v != nil { + var files []string + err = json.Unmarshal(*v, &files) + if err != nil { + return err + } + jic.Files = &files + } + case "start": + if v != nil { + start, err := unmarshalBasicClipTime(*v) + if err != nil { + return err + } + jic.Start = start + } + case "end": + if v != nil { + end, err := unmarshalBasicClipTime(*v) + if err != nil { + return err + } + jic.End = end + } + case "label": + if v != nil { + var label string + err = json.Unmarshal(*v, &label) + if err != nil { + return err + } + jic.Label = &label + } + case "@odata.type": + if v != nil { + var odataType OdataTypeBasicJobInput + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + jic.OdataType = odataType + } + } + } + + return nil +} + // JobInputHTTP represents HTTPS job input. type JobInputHTTP struct { // BaseURI - Base URI for HTTPS job input. It will be concatenated with provided file names. If no base uri is given, then the provided file list is assumed to be fully qualified uris. Maximum length of 4000 characters. BaseURI *string `json:"baseUri,omitempty"` // Files - List of files. Required for JobInputHttp. Maximum of 4000 characters each. Files *[]string `json:"files,omitempty"` + // Start - Defines a point on the timeline of the input media at which processing will start. Defaults to the beginning of the input media. + Start BasicClipTime `json:"start,omitempty"` + // End - Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. + End BasicClipTime `json:"end,omitempty"` // Label - A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. Label *string `json:"label,omitempty"` // OdataType - Possible values include: 'OdataTypeJobInput', 'OdataTypeMicrosoftMediaJobInputClip', 'OdataTypeMicrosoftMediaJobInputs', 'OdataTypeMicrosoftMediaJobInputAsset', 'OdataTypeMicrosoftMediaJobInputHTTP' @@ -5761,6 +6031,8 @@ func (jih JobInputHTTP) MarshalJSON() ([]byte, error) { if jih.Files != nil { objectMap["files"] = jih.Files } + objectMap["start"] = jih.Start + objectMap["end"] = jih.End if jih.Label != nil { objectMap["label"] = jih.Label } @@ -5805,6 +6077,73 @@ func (jih JobInputHTTP) AsBasicJobInput() (BasicJobInput, bool) { return &jih, true } +// UnmarshalJSON is the custom unmarshaler for JobInputHTTP struct. +func (jih *JobInputHTTP) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "baseUri": + if v != nil { + var baseURI string + err = json.Unmarshal(*v, &baseURI) + if err != nil { + return err + } + jih.BaseURI = &baseURI + } + case "files": + if v != nil { + var files []string + err = json.Unmarshal(*v, &files) + if err != nil { + return err + } + jih.Files = &files + } + case "start": + if v != nil { + start, err := unmarshalBasicClipTime(*v) + if err != nil { + return err + } + jih.Start = start + } + case "end": + if v != nil { + end, err := unmarshalBasicClipTime(*v) + if err != nil { + return err + } + jih.End = end + } + case "label": + if v != nil { + var label string + err = json.Unmarshal(*v, &label) + if err != nil { + return err + } + jih.Label = &label + } + case "@odata.type": + if v != nil { + var odataType OdataTypeBasicJobInput + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + jih.OdataType = odataType + } + } + } + + return nil +} + // JobInputs describes a list of inputs to a Job. type JobInputs struct { // Inputs - List of inputs to a Job. @@ -10553,7 +10892,7 @@ func (vVar Video) AsBasicCodec() (BasicCodec, bool) { // VideoAnalyzerPreset a video analyzer preset that extracts insights (rich metadata) from both audio and // video, and outputs a JSON format file. type VideoAnalyzerPreset struct { - // InsightsToExtract - The type of insights to be extracted. If not set then based on the content the type will selected. If the content is audio only then only audio insights are extracted and if it is video only. Possible values include: 'AudioInsightsOnly', 'VideoInsightsOnly', 'AllInsights' + // InsightsToExtract - Defines the type of insights that you want the service to generate. The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and 'AllInsights'. The default is AllInsights. If you set this to AllInsights and the input is audio only, then only audio insights are generated. Similarly if the input is video only, then only video insights are generated. It is recommended that you not use AudioInsightsOnly if you expect some of your inputs to be video only; or use VideoInsightsOnly if you expect some of your inputs to be audio only. Your Jobs in such conditions would error out. Possible values include: 'AudioInsightsOnly', 'VideoInsightsOnly', 'AllInsights' InsightsToExtract InsightsType `json:"insightsToExtract,omitempty"` // AudioLanguage - The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). The list of supported languages are English ('en-US' and 'en-GB'), Spanish ('es-ES' and 'es-MX'), French ('fr-FR'), Italian ('it-IT'), Japanese ('ja-JP'), Portuguese ('pt-BR'), Chinese ('zh-CN'), German ('de-DE'), Arabic ('ar-EG' and 'ar-SY'), Russian ('ru-RU'), Hindi ('hi-IN'), and Korean ('ko-KR'). If you know the language of your content, it is recommended that you specify it. If the language isn't specified or set to null, automatic language detection will choose the first language detected and process with the selected language for the duration of the file. This language detection feature currently supports English, Chinese, French, German, Italian, Japanese, Spanish, Russian, and Portuguese. It does not currently support dynamically switching between languages after the first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'." AudioLanguage *string `json:"audioLanguage,omitempty"`