#nullable disable
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Dto;
namespace MediaBrowser.Model.Dlna
{
    /// 
    /// Class AudioOptions.
    /// 
    public class AudioOptions
    {
        public AudioOptions()
        {
            Context = EncodingContext.Streaming;
            EnableDirectPlay = true;
            EnableDirectStream = true;
        }
        public bool EnableDirectPlay { get; set; }
        public bool EnableDirectStream { get; set; }
        public bool ForceDirectPlay { get; set; }
        public bool ForceDirectStream { get; set; }
        public Guid ItemId { get; set; }
        public MediaSourceInfo[] MediaSources { get; set; }
        public DeviceProfile Profile { get; set; }
        /// 
        /// Gets or sets a media source id. Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
        /// 
        public string MediaSourceId { get; set; }
        public string DeviceId { get; set; }
        /// 
        /// Gets or sets an override of supported number of audio channels
        /// Example: DeviceProfile supports five channel, but user only has stereo speakers.
        /// 
        public int? MaxAudioChannels { get; set; }
        /// 
        /// Gets or sets the application's configured quality setting.
        /// 
        public int? MaxBitrate { get; set; }
        /// 
        /// Gets or sets the context.
        /// 
        /// The context.
        public EncodingContext Context { get; set; }
        /// 
        /// Gets or sets the audio transcoding bitrate.
        /// 
        /// The audio transcoding bitrate.
        public int? AudioTranscodingBitrate { get; set; }
        /// 
        /// Gets the maximum bitrate.
        /// 
        /// Whether or not this is audio.
        /// System.Nullable<System.Int32>.
        public int? GetMaxBitrate(bool isAudio)
        {
            if (MaxBitrate.HasValue)
            {
                return MaxBitrate;
            }
            if (Profile == null)
            {
                return null;
            }
            if (Context == EncodingContext.Static)
            {
                if (isAudio && Profile.MaxStaticMusicBitrate.HasValue)
                {
                    return Profile.MaxStaticMusicBitrate;
                }
                return Profile.MaxStaticBitrate;
            }
            return Profile.MaxStreamingBitrate;
        }
    }
}