subtitle profile fixes
This commit is contained in:
parent
71bdb8dc8a
commit
be070a0bfe
|
@ -10,8 +10,6 @@ namespace MediaBrowser.Model.Dlna
|
||||||
{
|
{
|
||||||
public class StreamBuilder
|
public class StreamBuilder
|
||||||
{
|
{
|
||||||
private readonly string[] _serverTextSubtitleOutputs = { "srt", "vtt", "ttml" };
|
|
||||||
|
|
||||||
public StreamInfo BuildAudioItem(AudioOptions options)
|
public StreamInfo BuildAudioItem(AudioOptions options)
|
||||||
{
|
{
|
||||||
ValidateAudioInput(options);
|
ValidateAudioInput(options);
|
||||||
|
@ -544,16 +542,18 @@ namespace MediaBrowser.Model.Dlna
|
||||||
|
|
||||||
private SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, VideoOptions options)
|
private SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, VideoOptions options)
|
||||||
{
|
{
|
||||||
|
// Look for an external profile that matches the stream type (text/graphical)
|
||||||
|
foreach (SubtitleProfile profile in options.Profile.SubtitleProfiles)
|
||||||
|
{
|
||||||
|
if (profile.Method == SubtitleDeliveryMethod.External && subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format))
|
||||||
|
{
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (subtitleStream.IsTextSubtitleStream)
|
if (subtitleStream.IsTextSubtitleStream)
|
||||||
{
|
{
|
||||||
SubtitleProfile externalProfile = GetSubtitleProfile(options.Profile.SubtitleProfiles, SubtitleDeliveryMethod.External, _serverTextSubtitleOutputs);
|
SubtitleProfile embedProfile = GetSubtitleProfile(options.Profile.SubtitleProfiles, SubtitleDeliveryMethod.Embed);
|
||||||
|
|
||||||
if (externalProfile != null)
|
|
||||||
{
|
|
||||||
return externalProfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
SubtitleProfile embedProfile = GetSubtitleProfile(options.Profile.SubtitleProfiles, SubtitleDeliveryMethod.Embed, _serverTextSubtitleOutputs);
|
|
||||||
|
|
||||||
if (embedProfile != null)
|
if (embedProfile != null)
|
||||||
{
|
{
|
||||||
|
@ -581,6 +581,19 @@ namespace MediaBrowser.Model.Dlna
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SubtitleProfile GetSubtitleProfile(SubtitleProfile[] profiles, SubtitleDeliveryMethod method)
|
||||||
|
{
|
||||||
|
foreach (SubtitleProfile profile in profiles)
|
||||||
|
{
|
||||||
|
if (method == profile.Method)
|
||||||
|
{
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, int? maxBitrate)
|
private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, int? maxBitrate)
|
||||||
{
|
{
|
||||||
// Honor the max bitrate setting
|
// Honor the max bitrate setting
|
||||||
|
|
|
@ -141,16 +141,20 @@ namespace MediaBrowser.Model.Entities
|
||||||
{
|
{
|
||||||
if (Type != MediaStreamType.Subtitle) return false;
|
if (Type != MediaStreamType.Subtitle) return false;
|
||||||
|
|
||||||
string codec = Codec ?? string.Empty;
|
return IsTextFormat(Codec);
|
||||||
|
|
||||||
// sub = external .sub file
|
|
||||||
|
|
||||||
return StringHelper.IndexOfIgnoreCase(codec, "pgs") == -1 &&
|
|
||||||
StringHelper.IndexOfIgnoreCase(codec, "dvd") == -1 &&
|
|
||||||
!StringHelper.EqualsIgnoreCase(codec, "sub");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsTextFormat(string format)
|
||||||
|
{
|
||||||
|
string codec = format ?? string.Empty;
|
||||||
|
|
||||||
|
// sub = external .sub file
|
||||||
|
|
||||||
|
return StringHelper.IndexOfIgnoreCase(codec, "pgs") == -1 &&
|
||||||
|
StringHelper.IndexOfIgnoreCase(codec, "dvd") == -1 &&
|
||||||
|
!StringHelper.EqualsIgnoreCase(codec, "sub");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the filename.
|
/// Gets or sets the filename.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user