| | | 1 | | using System.Xml.Serialization; |
| | | 2 | | using MediaBrowser.Model.Extensions; |
| | | 3 | | |
| | | 4 | | namespace MediaBrowser.Model.Dlna; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Defines the <see cref="DirectPlayProfile"/>. |
| | | 8 | | /// </summary> |
| | | 9 | | public 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 | | { |
| | 1905 | 42 | | 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 | | { |
| | 1209 | 52 | | 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 include Video as valid type. |
| | 1252 | 63 | | return (Type == DlnaProfileType.Audio || Type == DlnaProfileType.Video) && ContainerHelper.ContainsContainer(Aud |
| | | 64 | | } |
| | | 65 | | } |