< Summary - Jellyfin

Information
Class: MediaBrowser.Model.Dlna.DirectPlayProfile
Assembly: MediaBrowser.Model
File(s): /srv/git/jellyfin/MediaBrowser.Model/Dlna/DirectPlayProfile.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 65
Line coverage: 100%
Branch coverage
66%
Covered branches: 4
Total branches: 6
Branch coverage: 66.6%
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
SupportsContainer(...)100%11100%
SupportsVideoCodec(...)50%22100%
SupportsAudioCodec(...)75%44100%

File(s)

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

#LineLine coverage
 1using System.Xml.Serialization;
 2using MediaBrowser.Model.Extensions;
 3
 4namespace MediaBrowser.Model.Dlna;
 5
 6/// <summary>
 7/// Defines the <see cref="DirectPlayProfile"/>.
 8/// </summary>
 9public class DirectPlayProfile
 10{
 11    /// <summary>
 12    /// Gets or sets the container.
 13    /// </summary>
 14    [XmlAttribute("container")]
 15    public string Container { get; set; } = string.Empty;
 16
 17    /// <summary>
 18    /// Gets or sets the audio codec.
 19    /// </summary>
 20    [XmlAttribute("audioCodec")]
 21    public string? AudioCodec { get; set; }
 22
 23    /// <summary>
 24    /// Gets or sets the video codec.
 25    /// </summary>
 26    [XmlAttribute("videoCodec")]
 27    public string? VideoCodec { get; set; }
 28
 29    /// <summary>
 30    /// Gets or sets the Dlna profile type.
 31    /// </summary>
 32    [XmlAttribute("type")]
 33    public DlnaProfileType Type { get; set; }
 34
 35    /// <summary>
 36    /// Returns whether the <see cref="Container"/> supports the <paramref name="container"/>.
 37    /// </summary>
 38    /// <param name="container">The container to match against.</param>
 39    /// <returns>True if supported.</returns>
 40    public bool SupportsContainer(string? container)
 41    {
 173942        return ContainerHelper.ContainsContainer(Container, container);
 43    }
 44
 45    /// <summary>
 46    /// Returns whether the <see cref="VideoCodec"/> supports the <paramref name="codec"/>.
 47    /// </summary>
 48    /// <param name="codec">The codec to match against.</param>
 49    /// <returns>True if supported.</returns>
 50    public bool SupportsVideoCodec(string? codec)
 51    {
 107952        return Type == DlnaProfileType.Video && ContainerHelper.ContainsContainer(VideoCodec, codec);
 53    }
 54
 55    /// <summary>
 56    /// Returns whether the <see cref="AudioCodec"/> supports the <paramref name="codec"/>.
 57    /// </summary>
 58    /// <param name="codec">The codec to match against.</param>
 59    /// <returns>True if supported.</returns>
 60    public bool SupportsAudioCodec(string? codec)
 61    {
 62        // Video profiles can have audio codec restrictions too, therefore incude Video as valid type.
 112263        return (Type == DlnaProfileType.Audio || Type == DlnaProfileType.Video) && ContainerHelper.ContainsContainer(Aud
 64    }
 65}