The Free Software Media System - Server Backend & API
support all inclusive direct play profile
Luke Pulverentia0e7cdd2dc36
diff --git a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs b/Emby.Dlna/PlayTo/PlaylistItemFactory.csindex 3eb2bc1d5c..d31dc155e9 100644--- a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs+++ b/Emby.Dlna/PlayTo/PlaylistItemFactory.cs@@ -56,8 +56,9 @@ namespace Emby.Dlna.PlayToif (profile.Container.Length > 0){// Check container type- var mediaContainer = Path.GetExtension(mediaPath);- if (!profile.GetContainers().Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))+ var mediaContainer = (Path.GetExtension(mediaPath) ?? string.Empty).TrimStart('.');++ if (!profile.SupportsContainer(mediaContainer)){return false;}diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.csindex 93ccd3cb28..2fc8fccbee 100644--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs@@ -855,11 +855,6 @@ namespace MediaBrowser.Api.Playback.Hls{return string.Empty;}- // No known video stream- if (state.VideoStream == null)- {- return string.Empty;- }var codec = EncodingHelper.GetVideoEncoder(state, ApiEntryPoint.Instance.GetEncodingOptions());diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.csindex d11e6f2151..227b55b1bc 100644--- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs+++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs@@ -79,11 +79,6 @@ namespace MediaBrowser.Api.Playback.Hls{return string.Empty;}- // No known video stream- if (state.VideoStream == null)- {- return string.Empty;- }var codec = EncodingHelper.GetVideoEncoder(state, ApiEntryPoint.Instance.GetEncodingOptions());diff --git a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs b/MediaBrowser.Model/Dlna/DirectPlayProfile.csindex 0b6ecf3857..df511b0da0 100644--- a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs+++ b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs@@ -1,6 +1,7 @@-using System.Collections.Generic;+using System;+using System.Collections.Generic;+using System.Linq;using System.Xml.Serialization;-using MediaBrowser.Model.Dlna;namespace MediaBrowser.Model.Dlna{@@ -28,6 +29,19 @@ namespace MediaBrowser.Model.Dlnareturn list;}+ public bool SupportsContainer(string container)+ {+ var all = GetContainers();++ // Only allow unknown container if the profile is all inclusive+ if (string.IsNullOrWhiteSpace(container))+ {+ return all.Count == 0;+ }++ return all.Count == 0 || all.Contains(container, StringComparer.OrdinalIgnoreCase);+ }+public List<string> GetAudioCodecs(){List<string> list = new List<string>();diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.csindex 3536b17b21..48f9a4212a 100644--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs@@ -492,52 +492,45 @@ namespace MediaBrowser.Model.Dlnaforeach (var profile in directPlayProfiles){- if (profile.Container.Length > 0)+ // Check container type+ if (profile.SupportsContainer(item.Container)){- // Check container type- string mediaContainer = item.Container ?? string.Empty;- foreach (string i in profile.GetContainers())+ containerSupported = true;++ if (videoStream != null){- if (StringHelper.EqualsIgnoreCase(i, mediaContainer))+ // Check video codec+ List<string> videoCodecs = profile.GetVideoCodecs();+ if (videoCodecs.Count > 0){- containerSupported = true;-- if (videoStream != null)+ string videoCodec = videoStream.Codec;+ if (!string.IsNullOrEmpty(videoCodec) && ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec)){- // Check video codec- List<string> videoCodecs = profile.GetVideoCodecs();- if (videoCodecs.Count > 0)- {- string videoCodec = videoStream.Codec;- if (!string.IsNullOrEmpty(videoCodec) && ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec))- {- videoSupported = true;- }- }- else- {- videoSupported = true;- }+ videoSupported = true;}+ }+ else+ {+ videoSupported = true;+ }+ }- if (audioStream != null)+ if (audioStream != null)+ {+ // Check audio codec+ List<string> audioCodecs = profile.GetAudioCodecs();+ if (audioCodecs.Count > 0)+ {+ string audioCodec = audioStream.Codec;+ if (!string.IsNullOrEmpty(audioCodec) && ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec)){- // Check audio codec- List<string> audioCodecs = profile.GetAudioCodecs();- if (audioCodecs.Count > 0)- {- string audioCodec = audioStream.Codec;- if (!string.IsNullOrEmpty(audioCodec) && ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))- {- audioSupported = true;- }- }- else- {- audioSupported = true;- }+ audioSupported = true;}}+ else+ {+ audioSupported = true;+ }}}}@@ -1538,23 +1531,10 @@ namespace MediaBrowser.Model.Dlnaprivate bool IsAudioDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream audioStream){- if (profile.Container.Length > 0)+ // Check container type+ if (!profile.SupportsContainer(item.Container)){- // Check container type- string mediaContainer = item.Container ?? string.Empty;- bool any = false;- foreach (string i in profile.GetContainers())- {- if (StringHelper.EqualsIgnoreCase(i, mediaContainer))- {- any = true;- break;- }- }- if (!any)- {- return false;- }+ return false;}// Check audio codec@@ -1574,23 +1554,10 @@ namespace MediaBrowser.Model.Dlnaprivate bool IsVideoDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream){- if (profile.Container.Length > 0)+ // Check container type+ if (!profile.SupportsContainer(item.Container)){- // Check container type- string mediaContainer = item.Container ?? string.Empty;- bool any = false;- foreach (string i in profile.GetContainers())- {- if (StringHelper.EqualsIgnoreCase(i, mediaContainer))- {- any = true;- break;- }- }- if (!any)- {- return false;- }+ return false;}// Check video codecdiff --git a/SharedVersion.cs b/SharedVersion.csindex bbac8d0c8c..a12afc2e97 100644--- a/SharedVersion.cs+++ b/SharedVersion.cs@@ -1,3 +1,3 @@using System.Reflection;-[assembly: AssemblyVersion("3.2.25.3")]+[assembly: AssemblyVersion("3.2.25.4")]