All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.mediaservices.models.AudioTrack Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.mediaservices.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Represents an audio track in the asset.
 */
@Fluent
public final class AudioTrack extends TrackBase {
    /*
     * The discriminator for derived types.
     */
    private String odataType = "#Microsoft.Media.AudioTrack";

    /*
     * The file name to the source file. This file is located in the storage container of the asset.
     */
    private String fileName;

    /*
     * The display name of the audio track on a video player. In HLS, this maps to the NAME attribute of EXT-X-MEDIA.
     */
    private String displayName;

    /*
     * The RFC5646 language code for the audio track.
     */
    private String languageCode;

    /*
     * The HLS specific setting for the audio track.
     */
    private HlsSettings hlsSettings;

    /*
     * The DASH specific setting for the audio track.
     */
    private DashSettings dashSettings;

    /*
     * The MPEG-4 audio track ID for the audio track.
     */
    private Integer mpeg4TrackId;

    /*
     * The stream bit rate for the audio track.
     */
    private Integer bitRate;

    /**
     * Creates an instance of AudioTrack class.
     */
    public AudioTrack() {
    }

    /**
     * Get the odataType property: The discriminator for derived types.
     * 
     * @return the odataType value.
     */
    @Override
    public String odataType() {
        return this.odataType;
    }

    /**
     * Get the fileName property: The file name to the source file. This file is located in the storage container of the
     * asset.
     * 
     * @return the fileName value.
     */
    public String fileName() {
        return this.fileName;
    }

    /**
     * Set the fileName property: The file name to the source file. This file is located in the storage container of the
     * asset.
     * 
     * @param fileName the fileName value to set.
     * @return the AudioTrack object itself.
     */
    public AudioTrack withFileName(String fileName) {
        this.fileName = fileName;
        return this;
    }

    /**
     * Get the displayName property: The display name of the audio track on a video player. In HLS, this maps to the
     * NAME attribute of EXT-X-MEDIA.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The display name of the audio track on a video player. In HLS, this maps to the
     * NAME attribute of EXT-X-MEDIA.
     * 
     * @param displayName the displayName value to set.
     * @return the AudioTrack object itself.
     */
    public AudioTrack withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the languageCode property: The RFC5646 language code for the audio track.
     * 
     * @return the languageCode value.
     */
    public String languageCode() {
        return this.languageCode;
    }

    /**
     * Set the languageCode property: The RFC5646 language code for the audio track.
     * 
     * @param languageCode the languageCode value to set.
     * @return the AudioTrack object itself.
     */
    public AudioTrack withLanguageCode(String languageCode) {
        this.languageCode = languageCode;
        return this;
    }

    /**
     * Get the hlsSettings property: The HLS specific setting for the audio track.
     * 
     * @return the hlsSettings value.
     */
    public HlsSettings hlsSettings() {
        return this.hlsSettings;
    }

    /**
     * Set the hlsSettings property: The HLS specific setting for the audio track.
     * 
     * @param hlsSettings the hlsSettings value to set.
     * @return the AudioTrack object itself.
     */
    public AudioTrack withHlsSettings(HlsSettings hlsSettings) {
        this.hlsSettings = hlsSettings;
        return this;
    }

    /**
     * Get the dashSettings property: The DASH specific setting for the audio track.
     * 
     * @return the dashSettings value.
     */
    public DashSettings dashSettings() {
        return this.dashSettings;
    }

    /**
     * Set the dashSettings property: The DASH specific setting for the audio track.
     * 
     * @param dashSettings the dashSettings value to set.
     * @return the AudioTrack object itself.
     */
    public AudioTrack withDashSettings(DashSettings dashSettings) {
        this.dashSettings = dashSettings;
        return this;
    }

    /**
     * Get the mpeg4TrackId property: The MPEG-4 audio track ID for the audio track.
     * 
     * @return the mpeg4TrackId value.
     */
    public Integer mpeg4TrackId() {
        return this.mpeg4TrackId;
    }

    /**
     * Set the mpeg4TrackId property: The MPEG-4 audio track ID for the audio track.
     * 
     * @param mpeg4TrackId the mpeg4TrackId value to set.
     * @return the AudioTrack object itself.
     */
    public AudioTrack withMpeg4TrackId(Integer mpeg4TrackId) {
        this.mpeg4TrackId = mpeg4TrackId;
        return this;
    }

    /**
     * Get the bitRate property: The stream bit rate for the audio track.
     * 
     * @return the bitRate value.
     */
    public Integer bitRate() {
        return this.bitRate;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (hlsSettings() != null) {
            hlsSettings().validate();
        }
        if (dashSettings() != null) {
            dashSettings().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("@odata.type", this.odataType);
        jsonWriter.writeStringField("fileName", this.fileName);
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeStringField("languageCode", this.languageCode);
        jsonWriter.writeJsonField("hlsSettings", this.hlsSettings);
        jsonWriter.writeJsonField("dashSettings", this.dashSettings);
        jsonWriter.writeNumberField("mpeg4TrackId", this.mpeg4TrackId);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of AudioTrack from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of AudioTrack if the JsonReader was pointing to an instance of it, or null if it was pointing
     * to JSON null.
     * @throws IOException If an error occurs while reading the AudioTrack.
     */
    public static AudioTrack fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            AudioTrack deserializedAudioTrack = new AudioTrack();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("@odata.type".equals(fieldName)) {
                    deserializedAudioTrack.odataType = reader.getString();
                } else if ("fileName".equals(fieldName)) {
                    deserializedAudioTrack.fileName = reader.getString();
                } else if ("displayName".equals(fieldName)) {
                    deserializedAudioTrack.displayName = reader.getString();
                } else if ("languageCode".equals(fieldName)) {
                    deserializedAudioTrack.languageCode = reader.getString();
                } else if ("hlsSettings".equals(fieldName)) {
                    deserializedAudioTrack.hlsSettings = HlsSettings.fromJson(reader);
                } else if ("dashSettings".equals(fieldName)) {
                    deserializedAudioTrack.dashSettings = DashSettings.fromJson(reader);
                } else if ("mpeg4TrackId".equals(fieldName)) {
                    deserializedAudioTrack.mpeg4TrackId = reader.getNullable(JsonReader::getInt);
                } else if ("bitRate".equals(fieldName)) {
                    deserializedAudioTrack.bitRate = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAudioTrack;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy