|
|
|
@ -383,7 +383,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
|
|
|
|
|
if (subtitleStream != null)
|
|
|
|
|
{
|
|
|
|
|
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, directPlay.Value);
|
|
|
|
|
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value);
|
|
|
|
|
|
|
|
|
|
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
|
|
|
|
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
|
|
|
@ -413,7 +413,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
|
|
|
|
|
if (subtitleStream != null)
|
|
|
|
|
{
|
|
|
|
|
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, PlayMethod.Transcode);
|
|
|
|
|
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode);
|
|
|
|
|
|
|
|
|
|
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
|
|
|
|
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
|
|
|
@ -739,7 +739,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
{
|
|
|
|
|
if (subtitleStream != null)
|
|
|
|
|
{
|
|
|
|
|
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, playMethod);
|
|
|
|
|
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, playMethod);
|
|
|
|
|
|
|
|
|
|
if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
|
|
|
|
|
{
|
|
|
|
@ -751,7 +751,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
return IsAudioEligibleForDirectPlay(item, maxBitrate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, EncodingContext context, PlayMethod playMethod)
|
|
|
|
|
public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod)
|
|
|
|
|
{
|
|
|
|
|
if (playMethod != PlayMethod.Transcode && !subtitleStream.IsExternal)
|
|
|
|
|
{
|
|
|
|
@ -775,7 +775,16 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Look for an external profile that matches the stream type (text/graphical)
|
|
|
|
|
// Look for an external or hls profile that matches the stream type (text/graphical) and doesn't require conversion
|
|
|
|
|
return GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, false) ?? GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, false) ?? new SubtitleProfile
|
|
|
|
|
{
|
|
|
|
|
Method = SubtitleDeliveryMethod.Encode,
|
|
|
|
|
Format = subtitleStream.Codec
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static SubtitleProfile GetExternalSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, bool allowConversion)
|
|
|
|
|
{
|
|
|
|
|
foreach (SubtitleProfile profile in subtitleProfiles)
|
|
|
|
|
{
|
|
|
|
|
if (profile.Method != SubtitleDeliveryMethod.External && profile.Method != SubtitleDeliveryMethod.Hls)
|
|
|
|
@ -798,21 +807,24 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
{
|
|
|
|
|
bool requiresConversion = !StringHelper.EqualsIgnoreCase(subtitleStream.Codec, profile.Format);
|
|
|
|
|
|
|
|
|
|
if (subtitleStream.IsTextSubtitleStream || !requiresConversion)
|
|
|
|
|
if (requiresConversion && !allowConversion)
|
|
|
|
|
{
|
|
|
|
|
if (subtitleStream.SupportsExternalStream)
|
|
|
|
|
{
|
|
|
|
|
return profile;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!requiresConversion)
|
|
|
|
|
{
|
|
|
|
|
return profile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (subtitleStream.IsTextSubtitleStream && subtitleStream.SupportsExternalStream)
|
|
|
|
|
{
|
|
|
|
|
return profile;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new SubtitleProfile
|
|
|
|
|
{
|
|
|
|
|
Method = SubtitleDeliveryMethod.Encode,
|
|
|
|
|
Format = subtitleStream.Codec
|
|
|
|
|
};
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, int? maxBitrate)
|
|
|
|
|