using System;
using System.Diagnostics;
using System.Runtime.Serialization;
namespace MediaBrowser.Model.Entities
{
    /// 
    /// Class MediaStream
    /// 
    [DebuggerDisplay("StreamType = {Type}")]
    public class MediaStream
    {
        /// 
        /// Gets or sets the codec.
        /// 
        /// The codec.
        public string Codec { get; set; }
        /// 
        /// Gets or sets the language.
        /// 
        /// The language.
        public string Language { get; set; }
        /// 
        /// Gets or sets a value indicating whether this instance is interlaced.
        /// 
        /// true if this instance is interlaced; otherwise, false.
        public bool IsInterlaced { get; set; }
        /// 
        /// Gets or sets the channel layout.
        /// 
        /// The channel layout.
        public string ChannelLayout { get; set; }
        
        /// 
        /// Gets or sets the bit rate.
        /// 
        /// The bit rate.
        public int? BitRate { get; set; }
        /// 
        /// Gets or sets the bit depth.
        /// 
        /// The bit depth.
        public int? BitDepth { get; set; }
        /// 
        /// Gets or sets the length of the packet.
        /// 
        /// The length of the packet.
        public int? PacketLength { get; set; }
        /// 
        /// Gets or sets the channels.
        /// 
        /// The channels.
        public int? Channels { get; set; }
        /// 
        /// Gets or sets the sample rate.
        /// 
        /// The sample rate.
        public int? SampleRate { get; set; }
        /// 
        /// Gets or sets a value indicating whether this instance is default.
        /// 
        /// true if this instance is default; otherwise, false.
        public bool IsDefault { get; set; }
        /// 
        /// Gets or sets a value indicating whether this instance is forced.
        /// 
        /// true if this instance is forced; otherwise, false.
        public bool IsForced { get; set; }
        /// 
        /// Gets or sets the height.
        /// 
        /// The height.
        public int? Height { get; set; }
        /// 
        /// Gets or sets the width.
        /// 
        /// The width.
        public int? Width { get; set; }
        /// 
        /// Gets or sets the average frame rate.
        /// 
        /// The average frame rate.
        public float? AverageFrameRate { get; set; }
        /// 
        /// Gets or sets the real frame rate.
        /// 
        /// The real frame rate.
        public float? RealFrameRate { get; set; }
        /// 
        /// Gets or sets the profile.
        /// 
        /// The profile.
        public string Profile { get; set; }
        /// 
        /// Gets or sets the type.
        /// 
        /// The type.
        public MediaStreamType Type { get; set; }
        /// 
        /// Gets or sets the aspect ratio.
        /// 
        /// The aspect ratio.
        public string AspectRatio { get; set; }
        /// 
        /// Gets or sets the index.
        /// 
        /// The index.
        public int Index { get; set; }
        /// 
        /// Gets or sets a value indicating whether this instance is external.
        /// 
        /// true if this instance is external; otherwise, false.
        public bool IsExternal { get; set; }
        [IgnoreDataMember]
        public bool IsGraphicalSubtitleStream
        {
            get
            {
                if (IsExternal) return false;
                var codec = Codec ?? string.Empty;
                return codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
                       codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1;
            }
        }
        /// 
        /// Gets or sets the filename.
        /// 
        /// The filename.
        public string Path { get; set; }
        /// 
        /// Gets or sets the pixel format.
        /// 
        /// The pixel format.
        public string PixelFormat { get; set; }
        
        /// 
        /// Gets or sets the level.
        /// 
        /// The level.
        public double? Level { get; set; }
    }
}