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

com.azure.resourcemanager.mediaservices.models.AacAudio 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;

/**
 * Describes Advanced Audio Codec (AAC) audio encoding settings.
 */
@Fluent
public final class AacAudio extends Audio {
    /*
     * The discriminator for derived types.
     */
    private String odataType = "#Microsoft.Media.AacAudio";

    /*
     * The encoding profile to be used when encoding audio with AAC.
     */
    private AacAudioProfile profile;

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

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

    /**
     * Get the profile property: The encoding profile to be used when encoding audio with AAC.
     * 
     * @return the profile value.
     */
    public AacAudioProfile profile() {
        return this.profile;
    }

    /**
     * Set the profile property: The encoding profile to be used when encoding audio with AAC.
     * 
     * @param profile the profile value to set.
     * @return the AacAudio object itself.
     */
    public AacAudio withProfile(AacAudioProfile profile) {
        this.profile = profile;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AacAudio withChannels(Integer channels) {
        super.withChannels(channels);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AacAudio withSamplingRate(Integer samplingRate) {
        super.withSamplingRate(samplingRate);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AacAudio withBitrate(Integer bitrate) {
        super.withBitrate(bitrate);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AacAudio withLabel(String label) {
        super.withLabel(label);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("label", label());
        jsonWriter.writeNumberField("channels", channels());
        jsonWriter.writeNumberField("samplingRate", samplingRate());
        jsonWriter.writeNumberField("bitrate", bitrate());
        jsonWriter.writeStringField("@odata.type", this.odataType);
        jsonWriter.writeStringField("profile", this.profile == null ? null : this.profile.toString());
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of AacAudio from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of AacAudio 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 AacAudio.
     */
    public static AacAudio fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            AacAudio deserializedAacAudio = new AacAudio();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("label".equals(fieldName)) {
                    deserializedAacAudio.withLabel(reader.getString());
                } else if ("channels".equals(fieldName)) {
                    deserializedAacAudio.withChannels(reader.getNullable(JsonReader::getInt));
                } else if ("samplingRate".equals(fieldName)) {
                    deserializedAacAudio.withSamplingRate(reader.getNullable(JsonReader::getInt));
                } else if ("bitrate".equals(fieldName)) {
                    deserializedAacAudio.withBitrate(reader.getNullable(JsonReader::getInt));
                } else if ("@odata.type".equals(fieldName)) {
                    deserializedAacAudio.odataType = reader.getString();
                } else if ("profile".equals(fieldName)) {
                    deserializedAacAudio.profile = AacAudioProfile.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAacAudio;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy