|
@@ -2,6 +2,7 @@
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
using MediaBrowser.Model.Extensions;
|
|
|
using MediaBrowser.Model.MediaInfo;
|
|
|
+using MediaBrowser.Model.Session;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
|
|
@@ -9,7 +10,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
{
|
|
|
public class StreamBuilder
|
|
|
{
|
|
|
- private string[] _serverTextSubtitleOutputs = new string[] { "srt", "vtt" };
|
|
|
+ private readonly string[] _serverTextSubtitleOutputs = { "srt", "vtt", "ttml" };
|
|
|
|
|
|
public StreamInfo BuildAudioItem(AudioOptions options)
|
|
|
{
|
|
@@ -158,7 +159,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
|
if (all)
|
|
|
{
|
|
|
- playlistItem.IsDirectStream = true;
|
|
|
+ playlistItem.PlayMethod = PlayMethod.DirectStream;
|
|
|
playlistItem.Container = item.Container;
|
|
|
|
|
|
return playlistItem;
|
|
@@ -179,7 +180,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
|
if (transcodingProfile != null)
|
|
|
{
|
|
|
- playlistItem.IsDirectStream = false;
|
|
|
+ playlistItem.PlayMethod = PlayMethod.Transcode;
|
|
|
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
|
|
|
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
|
|
|
playlistItem.Container = transcodingProfile.Container;
|
|
@@ -252,12 +253,12 @@ namespace MediaBrowser.Model.Dlna
|
|
|
|
|
|
if (directPlay != null)
|
|
|
{
|
|
|
- playlistItem.IsDirectStream = true;
|
|
|
+ playlistItem.PlayMethod = PlayMethod.DirectStream;
|
|
|
playlistItem.Container = item.Container;
|
|
|
|
|
|
if (subtitleStream != null)
|
|
|
{
|
|
|
- playlistItem.SubtitleDeliveryMethod = GetDirectStreamSubtitleDeliveryMethod(subtitleStream, options);
|
|
|
+ playlistItem.SubtitleDeliveryMethod = GetSubtitleDeliveryMethod(subtitleStream, options);
|
|
|
}
|
|
|
|
|
|
return playlistItem;
|
|
@@ -279,10 +280,10 @@ namespace MediaBrowser.Model.Dlna
|
|
|
{
|
|
|
if (subtitleStream != null)
|
|
|
{
|
|
|
- playlistItem.SubtitleDeliveryMethod = GetTranscodedSubtitleDeliveryMethod(subtitleStream, options);
|
|
|
+ playlistItem.SubtitleDeliveryMethod = GetSubtitleDeliveryMethod(subtitleStream, options);
|
|
|
}
|
|
|
|
|
|
- playlistItem.IsDirectStream = false;
|
|
|
+ playlistItem.PlayMethod = PlayMethod.Transcode;
|
|
|
playlistItem.Container = transcodingProfile.Container;
|
|
|
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
|
|
|
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
|
|
@@ -499,9 +500,9 @@ namespace MediaBrowser.Model.Dlna
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- SubtitleDeliveryMethod subtitleMethod = GetDirectStreamSubtitleDeliveryMethod(subtitleStream, options);
|
|
|
+ SubtitleDeliveryMethod subtitleMethod = GetSubtitleDeliveryMethod(subtitleStream, options);
|
|
|
|
|
|
- if (subtitleMethod != SubtitleDeliveryMethod.External && subtitleMethod != SubtitleDeliveryMethod.Direct)
|
|
|
+ if (subtitleMethod != SubtitleDeliveryMethod.External && subtitleMethod != SubtitleDeliveryMethod.Embed)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
@@ -510,34 +511,7 @@ namespace MediaBrowser.Model.Dlna
|
|
|
return IsAudioEligibleForDirectPlay(item, maxBitrate);
|
|
|
}
|
|
|
|
|
|
- private SubtitleDeliveryMethod GetDirectStreamSubtitleDeliveryMethod(MediaStream subtitleStream,
|
|
|
- VideoOptions options)
|
|
|
- {
|
|
|
- if (subtitleStream.IsTextSubtitleStream)
|
|
|
- {
|
|
|
- string subtitleFormat = NormalizeSubtitleFormat(subtitleStream.Codec);
|
|
|
-
|
|
|
- bool supportsDirect = ContainsSubtitleFormat(options.Profile.SoftSubtitleProfiles, new[] { subtitleFormat });
|
|
|
-
|
|
|
- if (supportsDirect)
|
|
|
- {
|
|
|
- return SubtitleDeliveryMethod.Direct;
|
|
|
- }
|
|
|
-
|
|
|
- // See if the device can retrieve the subtitles externally
|
|
|
- bool supportsSubsExternally = options.Context == EncodingContext.Streaming &&
|
|
|
- ContainsSubtitleFormat(options.Profile.ExternalSubtitleProfiles, _serverTextSubtitleOutputs);
|
|
|
-
|
|
|
- if (supportsSubsExternally)
|
|
|
- {
|
|
|
- return SubtitleDeliveryMethod.External;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return SubtitleDeliveryMethod.Encode;
|
|
|
- }
|
|
|
-
|
|
|
- private SubtitleDeliveryMethod GetTranscodedSubtitleDeliveryMethod(MediaStream subtitleStream,
|
|
|
+ private SubtitleDeliveryMethod GetSubtitleDeliveryMethod(MediaStream subtitleStream,
|
|
|
VideoOptions options)
|
|
|
{
|
|
|
if (subtitleStream.IsTextSubtitleStream)
|