< Summary - Jellyfin

Information
Class: MediaBrowser.Model.Dlna.MediaOptions
Assembly: MediaBrowser.Model
File(s): /srv/git/jellyfin/MediaBrowser.Model/Dlna/MediaOptions.cs
Line coverage
44%
Covered lines: 4
Uncovered lines: 5
Coverable lines: 9
Total lines: 145
Line coverage: 44.4%
Branch coverage
30%
Covered branches: 3
Total branches: 10
Branch coverage: 30%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetMaxBitrate(...)30%27.151044.44%

File(s)

/srv/git/jellyfin/MediaBrowser.Model/Dlna/MediaOptions.cs

#LineLine coverage
 1using System;
 2using MediaBrowser.Model.Dto;
 3
 4namespace MediaBrowser.Model.Dlna
 5{
 6    /// <summary>
 7    /// Class MediaOptions.
 8    /// </summary>
 9    public class MediaOptions
 10    {
 11        /// <summary>
 12        /// Initializes a new instance of the <see cref="MediaOptions"/> class.
 13        /// </summary>
 14        public MediaOptions()
 15        {
 16            Context = EncodingContext.Streaming;
 17
 18            EnableDirectPlay = true;
 19            EnableDirectStream = true;
 20        }
 21
 22        /// <summary>
 23        /// Gets or sets a value indicating whether direct playback is allowed.
 24        /// </summary>
 25        public bool EnableDirectPlay { get; set; }
 26
 27        /// <summary>
 28        /// Gets or sets a value indicating whether direct streaming is allowed.
 29        /// </summary>
 30        public bool EnableDirectStream { get; set; }
 31
 32        /// <summary>
 33        /// Gets or sets a value indicating whether direct playback is forced.
 34        /// </summary>
 35        public bool ForceDirectPlay { get; set; }
 36
 37        /// <summary>
 38        /// Gets or sets a value indicating whether direct streaming is forced.
 39        /// </summary>
 40        public bool ForceDirectStream { get; set; }
 41
 42        /// <summary>
 43        /// Gets or sets a value indicating whether audio stream copy is allowed.
 44        /// </summary>
 45        public bool AllowAudioStreamCopy { get; set; }
 46
 47        /// <summary>
 48        /// Gets or sets a value indicating whether video stream copy is allowed.
 49        /// </summary>
 50        public bool AllowVideoStreamCopy { get; set; }
 51
 52        /// <summary>
 53        /// Gets or sets a value indicating whether always burn in subtitles when transcoding.
 54        /// </summary>
 55        public bool AlwaysBurnInSubtitleWhenTranscoding { get; set; }
 56
 57        /// <summary>
 58        /// Gets or sets the item id.
 59        /// </summary>
 60        public Guid ItemId { get; set; }
 61
 62        /// <summary>
 63        /// Gets or sets the media sources.
 64        /// </summary>
 65        public MediaSourceInfo[] MediaSources { get; set; } = Array.Empty<MediaSourceInfo>();
 66
 67        /// <summary>
 68        /// Gets or sets the device profile.
 69        /// </summary>
 70        public required DeviceProfile Profile { get; set; }
 71
 72        /// <summary>
 73        /// Gets or sets a media source id. Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex 
 74        /// </summary>
 75        public string? MediaSourceId { get; set; }
 76
 77        /// <summary>
 78        /// Gets or sets the device id.
 79        /// </summary>
 80        public string? DeviceId { get; set; }
 81
 82        /// <summary>
 83        /// Gets or sets an override of supported number of audio channels
 84        /// Example: DeviceProfile supports five channel, but user only has stereo speakers.
 85        /// </summary>
 86        public int? MaxAudioChannels { get; set; }
 87
 88        /// <summary>
 89        /// Gets or sets the application's configured maximum bitrate.
 90        /// </summary>
 91        public int? MaxBitrate { get; set; }
 92
 93        /// <summary>
 94        /// Gets or sets the context.
 95        /// </summary>
 96        /// <value>The context.</value>
 97        public EncodingContext Context { get; set; }
 98
 99        /// <summary>
 100        /// Gets or sets the audio transcoding bitrate.
 101        /// </summary>
 102        /// <value>The audio transcoding bitrate.</value>
 103        public int? AudioTranscodingBitrate { get; set; }
 104
 105        /// <summary>
 106        /// Gets or sets an override for the audio stream index.
 107        /// </summary>
 108        public int? AudioStreamIndex { get; set; }
 109
 110        /// <summary>
 111        /// Gets or sets an override for the subtitle stream index.
 112        /// </summary>
 113        public int? SubtitleStreamIndex { get; set; }
 114
 115        /// <summary>
 116        /// Gets the maximum bitrate.
 117        /// </summary>
 118        /// <param name="isAudio">Whether or not this is audio.</param>
 119        /// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
 120        public int? GetMaxBitrate(bool isAudio)
 121        {
 808122            if (MaxBitrate.HasValue)
 123            {
 0124                return MaxBitrate;
 125            }
 126
 808127            if (Profile is null)
 128            {
 0129                return null;
 130            }
 131
 808132            if (Context == EncodingContext.Static)
 133            {
 0134                if (isAudio && Profile.MaxStaticMusicBitrate.HasValue)
 135                {
 0136                    return Profile.MaxStaticMusicBitrate;
 137                }
 138
 0139                return Profile.MaxStaticBitrate;
 140            }
 141
 808142            return Profile.MaxStreamingBitrate;
 143        }
 144    }
 145}

Methods/Properties

GetMaxBitrate(System.Boolean)