update hls subtitles

This commit is contained in:
Luke Pulverenti 2016-07-13 15:16:51 -04:00
parent 2254546ea5
commit e44a24d9e5
5 changed files with 21 additions and 1 deletions

View File

@ -1568,6 +1568,13 @@ namespace MediaBrowser.Api.Playback
{ {
request.TranscodingMaxAudioChannels = int.Parse(val, UsCulture); request.TranscodingMaxAudioChannels = int.Parse(val, UsCulture);
} }
else if (i == 28)
{
if (videoRequest != null)
{
videoRequest.EnableSubtitlesInManifest = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
}
}
} }
} }
@ -2140,6 +2147,7 @@ namespace MediaBrowser.Api.Playback
{ {
state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps; state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps;
state.VideoRequest.ForceLiveStream = transcodingProfile.ForceLiveStream; state.VideoRequest.ForceLiveStream = transcodingProfile.ForceLiveStream;
state.VideoRequest.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
} }
} }
} }

View File

@ -525,10 +525,16 @@ namespace MediaBrowser.Api.Playback.Hls
var subtitleGroup = subtitleStreams.Count > 0 && var subtitleGroup = subtitleStreams.Count > 0 &&
request is GetMasterHlsVideoPlaylist && request is GetMasterHlsVideoPlaylist &&
(((GetMasterHlsVideoPlaylist)request).SubtitleMethod == SubtitleDeliveryMethod.Hls || ((GetMasterHlsVideoPlaylist)request).EnableSubtitlesInManifest) ? (state.VideoRequest.SubtitleMethod == SubtitleDeliveryMethod.Hls || state.VideoRequest.EnableSubtitlesInManifest) ?
"subs" : "subs" :
null; null;
// If we're burning in subtitles then don't add additional subs to the manifest
if (state.SubtitleStream != null && state.VideoRequest.SubtitleMethod == SubtitleDeliveryMethod.Encode)
{
subtitleGroup = null;
}
if (!string.IsNullOrWhiteSpace(subtitleGroup)) if (!string.IsNullOrWhiteSpace(subtitleGroup))
{ {
AddSubtitles(state, subtitleStreams, builder); AddSubtitles(state, subtitleStreams, builder);

View File

@ -480,6 +480,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.VideoCodec = transcodingProfile.VideoCodec; playlistItem.VideoCodec = transcodingProfile.VideoCodec;
playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps; playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
playlistItem.ForceLiveStream = transcodingProfile.ForceLiveStream; playlistItem.ForceLiveStream = transcodingProfile.ForceLiveStream;
playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels)) if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
{ {

View File

@ -37,6 +37,7 @@ namespace MediaBrowser.Model.Dlna
public bool CopyTimestamps { get; set; } public bool CopyTimestamps { get; set; }
public bool ForceLiveStream { get; set; } public bool ForceLiveStream { get; set; }
public bool EnableSubtitlesInManifest { get; set; }
public string[] AudioCodecs { get; set; } public string[] AudioCodecs { get; set; }
public int? AudioStreamIndex { get; set; } public int? AudioStreamIndex { get; set; }
@ -249,6 +250,7 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty)); list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty));
list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? StringHelper.ToStringCultureInvariant(item.TranscodingMaxAudioChannels.Value) : string.Empty)); list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? StringHelper.ToStringCultureInvariant(item.TranscodingMaxAudioChannels.Value) : string.Empty));
list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString().ToLower()));
return list; return list;
} }

View File

@ -38,6 +38,9 @@ namespace MediaBrowser.Model.Dlna
[XmlAttribute("forceLiveStream")] [XmlAttribute("forceLiveStream")]
public bool ForceLiveStream { get; set; } public bool ForceLiveStream { get; set; }
[XmlAttribute("enableSubtitlesInManifest")]
public bool EnableSubtitlesInManifest { get; set; }
[XmlAttribute("maxAudioChannels")] [XmlAttribute("maxAudioChannels")]
public string MaxAudioChannels { get; set; } public string MaxAudioChannels { get; set; }