check audio stream for null

pull/1154/head
Luke Pulverenti 8 years ago
parent 9b0e289602
commit e208ef19b0

@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Dlna
return SplitValue(Container); return SplitValue(Container);
} }
private static List<string> SplitValue(string value) public static List<string> SplitValue(string value)
{ {
List<string> list = new List<string>(); List<string> list = new List<string>();
foreach (string i in (value ?? string.Empty).Split(',')) foreach (string i in (value ?? string.Empty).Split(','))

@ -1231,21 +1231,27 @@ namespace MediaBrowser.Model.Dlna
private static bool IsSubtitleEmbedSupported(MediaStream subtitleStream, SubtitleProfile subtitleProfile, string transcodingSubProtocol, string transcodingContainer) private static bool IsSubtitleEmbedSupported(MediaStream subtitleStream, SubtitleProfile subtitleProfile, string transcodingSubProtocol, string transcodingContainer)
{ {
if (string.Equals(transcodingContainer, "ts", StringComparison.OrdinalIgnoreCase)) if (!string.IsNullOrWhiteSpace(transcodingContainer))
{ {
return false; var normalizedContainers = ContainerProfile.SplitValue(transcodingContainer);
}
if (string.Equals(transcodingContainer, "mpegts", StringComparison.OrdinalIgnoreCase)) if (ContainerProfile.ContainsContainer(normalizedContainers, "ts"))
{ {
return false; return false;
} }
if (string.Equals(transcodingContainer, "mp4", StringComparison.OrdinalIgnoreCase)) if (ContainerProfile.ContainsContainer(normalizedContainers, "mpegts"))
{ {
return false; return false;
} }
if (string.Equals(transcodingContainer, "mkv", StringComparison.OrdinalIgnoreCase)) if (ContainerProfile.ContainsContainer(normalizedContainers, "mp4"))
{ {
return true; return false;
}
if (ContainerProfile.ContainsContainer(normalizedContainers, "mkv") ||
ContainerProfile.ContainsContainer(normalizedContainers, "matroska"))
{
return true;
}
} }
return false; return false;
@ -1572,14 +1578,17 @@ namespace MediaBrowser.Model.Dlna
} }
// Check audio codec // Check audio codec
List<string> audioCodecs = profile.GetAudioCodecs(); if (audioStream != null)
if (audioCodecs.Count > 0)
{ {
// Check audio codecs List<string> audioCodecs = profile.GetAudioCodecs();
string audioCodec = audioStream == null ? null : audioStream.Codec; if (audioCodecs.Count > 0)
if (string.IsNullOrEmpty(audioCodec) || !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
{ {
return false; // Check audio codecs
string audioCodec = audioStream == null ? null : audioStream.Codec;
if (string.IsNullOrEmpty(audioCodec) || !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
{
return false;
}
} }
} }

Loading…
Cancel
Save