aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model/Dlna')
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs1
-rw-r--r--MediaBrowser.Model/Dlna/StreamInfo.cs55
-rw-r--r--MediaBrowser.Model/Dlna/TranscodingProfile.cs4
3 files changed, 29 insertions, 31 deletions
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 61e04a8134..42cb208d08 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -610,7 +610,6 @@ namespace MediaBrowser.Model.Dlna
playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
playlistItem.EnableMpegtsM2TsMode = transcodingProfile.EnableMpegtsM2TsMode;
- playlistItem.BreakOnNonKeyFrames = transcodingProfile.BreakOnNonKeyFrames;
playlistItem.EnableAudioVbrEncoding = transcodingProfile.EnableAudioVbrEncoding;
if (transcodingProfile.MinSegments > 0)
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 13acd15a3f..551bee89e3 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -87,11 +87,6 @@ public class StreamInfo
public int? MinSegments { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether the stream can be broken on non-keyframes.
- /// </summary>
- public bool BreakOnNonKeyFrames { get; set; }
-
- /// <summary>
/// Gets or sets a value indicating whether the stream requires AVC.
/// </summary>
public bool RequireAvc { get; set; }
@@ -1018,9 +1013,6 @@ public class StreamInfo
sb.Append("&MinSegments=");
sb.Append(MinSegments.Value.ToString(CultureInfo.InvariantCulture));
}
-
- sb.Append("&BreakOnNonKeyFrames=");
- sb.Append(BreakOnNonKeyFrames.ToString(CultureInfo.InvariantCulture));
}
else
{
@@ -1250,30 +1242,37 @@ public class StreamInfo
if (info.DeliveryMethod == SubtitleDeliveryMethod.External)
{
- if (MediaSource.Protocol == MediaProtocol.File || !string.Equals(stream.Codec, subtitleProfile.Format, StringComparison.OrdinalIgnoreCase) || !stream.IsExternal)
- {
- info.Url = string.Format(
- CultureInfo.InvariantCulture,
- "{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}",
- baseUrl,
- ItemId,
- MediaSourceId,
- stream.Index.ToString(CultureInfo.InvariantCulture),
- startPositionTicks.ToString(CultureInfo.InvariantCulture),
- subtitleProfile.Format);
-
- if (!string.IsNullOrEmpty(accessToken))
- {
- info.Url += "?ApiKey=" + accessToken;
- }
-
- info.IsExternalUrl = false;
- }
- else
+ // Default to using the API URL
+ info.Url = string.Format(
+ CultureInfo.InvariantCulture,
+ "{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}",
+ baseUrl,
+ ItemId,
+ MediaSourceId,
+ stream.Index.ToString(CultureInfo.InvariantCulture),
+ startPositionTicks.ToString(CultureInfo.InvariantCulture),
+ subtitleProfile.Format);
+ info.IsExternalUrl = false;
+
+ // Check conditions for potentially using the direct path
+ if (stream.IsExternal // Must be external
+ && stream.SupportsExternalStream
+ && string.Equals(stream.Codec, subtitleProfile.Format, StringComparison.OrdinalIgnoreCase) // Format must match (no conversion needed)
+ && !string.IsNullOrEmpty(stream.Path) // Path must exist
+ && Uri.TryCreate(stream.Path, UriKind.Absolute, out Uri? uriResult) // Path must be an absolute URI
+ && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)) // Scheme must be HTTP or HTTPS
{
+ // All conditions met, override with the direct path
info.Url = stream.Path;
info.IsExternalUrl = true;
}
+
+ // Append ApiKey only if we are using the API URL
+ if (!info.IsExternalUrl && !string.IsNullOrEmpty(accessToken))
+ {
+ // Use "?ApiKey=" as seen in HEAD and other parts of the code
+ info.Url += "?ApiKey=" + accessToken;
+ }
}
return info;
diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
index 5797d42506..f49b24976a 100644
--- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs
+++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs
@@ -41,7 +41,6 @@ public class TranscodingProfile
MaxAudioChannels = other.MaxAudioChannels;
MinSegments = other.MinSegments;
SegmentLength = other.SegmentLength;
- BreakOnNonKeyFrames = other.BreakOnNonKeyFrames;
Conditions = other.Conditions;
EnableAudioVbrEncoding = other.EnableAudioVbrEncoding;
}
@@ -143,7 +142,8 @@ public class TranscodingProfile
/// </summary>
[DefaultValue(false)]
[XmlAttribute("breakOnNonKeyFrames")]
- public bool BreakOnNonKeyFrames { get; set; }
+ [Obsolete("This is always false")]
+ public bool? BreakOnNonKeyFrames { get; set; }
/// <summary>
/// Gets or sets the profile conditions.