Merge pull request #2756 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-07-14 11:58:24 -04:00 committed by GitHub
commit 2f8591e54a
6 changed files with 56 additions and 84 deletions

View File

@ -56,8 +56,9 @@ namespace Emby.Dlna.PlayTo
if (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;
}

View File

@ -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());

View File

@ -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());

View File

@ -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.Dlna
return 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>();

View File

@ -491,14 +491,9 @@ namespace MediaBrowser.Model.Dlna
var videoSupported = false;
foreach (var profile in directPlayProfiles)
{
if (profile.Container.Length > 0)
{
// Check container type
string mediaContainer = item.Container ?? string.Empty;
foreach (string i in profile.GetContainers())
{
if (StringHelper.EqualsIgnoreCase(i, mediaContainer))
if (profile.SupportsContainer(item.Container))
{
containerSupported = true;
@ -539,8 +534,6 @@ namespace MediaBrowser.Model.Dlna
}
}
}
}
}
if (!containerSupported)
{
@ -1537,25 +1530,12 @@ namespace MediaBrowser.Model.Dlna
}
private bool IsAudioDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream audioStream)
{
if (profile.Container.Length > 0)
{
// 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)
if (!profile.SupportsContainer(item.Container))
{
return false;
}
}
// Check audio codec
List<string> audioCodecs = profile.GetAudioCodecs();
@ -1573,25 +1553,12 @@ namespace MediaBrowser.Model.Dlna
}
private bool IsVideoDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream)
{
if (profile.Container.Length > 0)
{
// 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)
if (!profile.SupportsContainer(item.Container))
{
return false;
}
}
// Check video codec
List<string> videoCodecs = profile.GetVideoCodecs();

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.25.3")]
[assembly: AssemblyVersion("3.2.25.4")]