aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-07-23 02:12:16 -0400
committerGitHub <noreply@github.com>2017-07-23 02:12:16 -0400
commit5ec9d4e9fe4b3e5109ca1abf6c1ffdb87fd2d4dd (patch)
treee49cc827583b6dffeabb142af5fae889b1a09581 /MediaBrowser.Model
parente99bc61d53f393dc475e265e3b5bc8c19b186594 (diff)
parent0d1b5ad733e6f1bbf6d730e723969495dda99016 (diff)
Merge pull request #2767 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Dlna/DirectPlayProfile.cs18
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs134
-rw-r--r--MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs4
-rw-r--r--MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs4
-rw-r--r--MediaBrowser.Model/Session/TranscodingInfo.cs3
-rw-r--r--MediaBrowser.Model/Sync/SyncJob.cs5
6 files changed, 86 insertions, 82 deletions
diff --git a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs
index 0b6ecf385..df511b0da 100644
--- a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs
+++ b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs
@@ -1,6 +1,7 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Xml.Serialization;
-using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
@@ -28,6 +29,19 @@ namespace MediaBrowser.Model.Dlna
return list;
}
+ public bool SupportsContainer(string container)
+ {
+ var all = GetContainers();
+
+ // Only allow unknown container if the profile is all inclusive
+ if (string.IsNullOrWhiteSpace(container))
+ {
+ return all.Count == 0;
+ }
+
+ return all.Count == 0 || all.Contains(container, StringComparer.OrdinalIgnoreCase);
+ }
+
public List<string> GetAudioCodecs()
{
List<string> list = new List<string>();
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index de6cbf4bb..48f9a4212 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -492,52 +492,45 @@ namespace MediaBrowser.Model.Dlna
foreach (var profile in directPlayProfiles)
{
- if (profile.Container.Length > 0)
+ // Check container type
+ if (profile.SupportsContainer(item.Container))
{
- // Check container type
- string mediaContainer = item.Container ?? string.Empty;
- foreach (string i in profile.GetContainers())
+ containerSupported = true;
+
+ if (videoStream != null)
{
- if (StringHelper.EqualsIgnoreCase(i, mediaContainer))
+ // Check video codec
+ List<string> videoCodecs = profile.GetVideoCodecs();
+ if (videoCodecs.Count > 0)
{
- containerSupported = true;
-
- if (videoStream != null)
+ string videoCodec = videoStream.Codec;
+ if (!string.IsNullOrEmpty(videoCodec) && ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec))
{
- // Check video codec
- List<string> videoCodecs = profile.GetVideoCodecs();
- if (videoCodecs.Count > 0)
- {
- string videoCodec = videoStream.Codec;
- if (!string.IsNullOrEmpty(videoCodec) && ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec))
- {
- videoSupported = true;
- }
- }
- else
- {
- videoSupported = true;
- }
+ videoSupported = true;
}
+ }
+ else
+ {
+ videoSupported = true;
+ }
+ }
- if (audioStream != null)
+ if (audioStream != null)
+ {
+ // Check audio codec
+ List<string> audioCodecs = profile.GetAudioCodecs();
+ if (audioCodecs.Count > 0)
+ {
+ string audioCodec = audioStream.Codec;
+ if (!string.IsNullOrEmpty(audioCodec) && ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
{
- // Check audio codec
- List<string> audioCodecs = profile.GetAudioCodecs();
- if (audioCodecs.Count > 0)
- {
- string audioCodec = audioStream.Codec;
- if (!string.IsNullOrEmpty(audioCodec) && ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
- {
- audioSupported = true;
- }
- }
- else
- {
- audioSupported = true;
- }
+ audioSupported = true;
}
}
+ else
+ {
+ audioSupported = true;
+ }
}
}
}
@@ -635,8 +628,10 @@ namespace MediaBrowser.Model.Dlna
MediaStream videoStream = item.VideoStream;
// TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough
- bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true), subtitleStream, options, PlayMethod.DirectPlay));
- bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || IsEligibleForDirectPlay(item, options.GetMaxBitrate(false), subtitleStream, options, PlayMethod.DirectStream));
+ var directPlayEligibilityResult = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true), subtitleStream, options, PlayMethod.DirectPlay);
+ var directStreamEligibilityResult = IsEligibleForDirectPlay(item, options.GetMaxBitrate(false), subtitleStream, options, PlayMethod.DirectStream);
+ bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || directPlayEligibilityResult.Item1);
+ bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || directStreamEligibilityResult.Item1);
_logger.Info("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
options.Profile.Name ?? "Unknown Profile",
@@ -669,6 +664,16 @@ namespace MediaBrowser.Model.Dlna
transcodeReasons.AddRange(directPlayInfo.Item2);
}
+ if (directPlayEligibilityResult.Item2.HasValue)
+ {
+ transcodeReasons.Add(directPlayEligibilityResult.Item2.Value);
+ }
+
+ if (directStreamEligibilityResult.Item2.HasValue)
+ {
+ transcodeReasons.Add(directStreamEligibilityResult.Item2.Value);
+ }
+
// Can't direct play, find the transcoding profile
TranscodingProfile transcodingProfile = null;
foreach (TranscodingProfile i in options.Profile.TranscodingProfiles)
@@ -1136,7 +1141,7 @@ namespace MediaBrowser.Model.Dlna
mediaSource.Path ?? "Unknown path");
}
- private bool IsEligibleForDirectPlay(MediaSourceInfo item,
+ private Tuple<bool, TranscodeReason?> IsEligibleForDirectPlay(MediaSourceInfo item,
long? maxBitrate,
MediaStream subtitleStream,
VideoOptions options,
@@ -1149,11 +1154,18 @@ namespace MediaBrowser.Model.Dlna
if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
{
_logger.Info("Not eligible for {0} due to unsupported subtitles", playMethod);
- return false;
+ return new Tuple<bool, TranscodeReason?>(false, TranscodeReason.SubtitleCodecNotSupported);
}
}
- return IsAudioEligibleForDirectPlay(item, maxBitrate, playMethod);
+ var result = IsAudioEligibleForDirectPlay(item, maxBitrate, playMethod);
+
+ if (result)
+ {
+ return new Tuple<bool, TranscodeReason?>(result, null);
+ }
+
+ return new Tuple<bool, TranscodeReason?>(result, TranscodeReason.ContainerBitrateExceedsLimit);
}
public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, string transcodingSubProtocol, string transcodingContainer)
@@ -1519,23 +1531,10 @@ namespace MediaBrowser.Model.Dlna
private bool IsAudioDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream audioStream)
{
- if (profile.Container.Length > 0)
+ // Check container type
+ if (!profile.SupportsContainer(item.Container))
{
- // Check container type
- string mediaContainer = item.Container ?? string.Empty;
- bool any = false;
- foreach (string i in profile.GetContainers())
- {
- if (StringHelper.EqualsIgnoreCase(i, mediaContainer))
- {
- any = true;
- break;
- }
- }
- if (!any)
- {
- return false;
- }
+ return false;
}
// Check audio codec
@@ -1555,23 +1554,10 @@ namespace MediaBrowser.Model.Dlna
private bool IsVideoDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream)
{
- if (profile.Container.Length > 0)
+ // Check container type
+ if (!profile.SupportsContainer(item.Container))
{
- // Check container type
- string mediaContainer = item.Container ?? string.Empty;
- bool any = false;
- foreach (string i in profile.GetContainers())
- {
- if (StringHelper.EqualsIgnoreCase(i, mediaContainer))
- {
- any = true;
- break;
- }
- }
- if (!any)
- {
- return false;
- }
+ return false;
}
// Check video codec
diff --git a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs
index 025f1bc7a..dedbb428d 100644
--- a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs
+++ b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs
@@ -17,13 +17,13 @@ namespace MediaBrowser.Model.MediaInfo
public bool EnableDirectPlay { get; set; }
public bool EnableDirectStream { get; set; }
- public bool ForceDirectPlayRemoteMediaSource { get; set; }
+ public bool EnableMediaProbe { get; set; }
public LiveStreamRequest()
{
- ForceDirectPlayRemoteMediaSource = true;
EnableDirectPlay = true;
EnableDirectStream = true;
+ EnableMediaProbe = true;
}
public LiveStreamRequest(AudioOptions options)
diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
index 1843fb69a..df39f0556 100644
--- a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
+++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs
@@ -27,19 +27,19 @@ namespace MediaBrowser.Model.MediaInfo
public bool EnableDirectPlay { get; set; }
public bool EnableDirectStream { get; set; }
public bool EnableTranscoding { get; set; }
- public bool ForceDirectPlayRemoteMediaSource { get; set; }
public bool AllowVideoStreamCopy { get; set; }
public bool AllowAudioStreamCopy { get; set; }
public bool AutoOpenLiveStream { get; set; }
+ public bool EnableMediaProbe { get; set; }
public PlaybackInfoRequest()
{
- ForceDirectPlayRemoteMediaSource = true;
EnableDirectPlay = true;
EnableDirectStream = true;
EnableTranscoding = true;
AllowVideoStreamCopy = true;
AllowAudioStreamCopy = true;
+ EnableMediaProbe = true;
}
}
}
diff --git a/MediaBrowser.Model/Session/TranscodingInfo.cs b/MediaBrowser.Model/Session/TranscodingInfo.cs
index f1cbacd90..f58e605b2 100644
--- a/MediaBrowser.Model/Session/TranscodingInfo.cs
+++ b/MediaBrowser.Model/Session/TranscodingInfo.cs
@@ -48,6 +48,7 @@ namespace MediaBrowser.Model.Session
VideoFramerateNotSupported = 17,
VideoLevelNotSupported = 18,
VideoProfileNotSupported = 19,
- AudioBitDepthNotSupported = 20
+ AudioBitDepthNotSupported = 20,
+ SubtitleCodecNotSupported = 21
}
} \ No newline at end of file
diff --git a/MediaBrowser.Model/Sync/SyncJob.cs b/MediaBrowser.Model/Sync/SyncJob.cs
index 6709426b8..f0e262c50 100644
--- a/MediaBrowser.Model/Sync/SyncJob.cs
+++ b/MediaBrowser.Model/Sync/SyncJob.cs
@@ -59,7 +59,7 @@ namespace MediaBrowser.Model.Sync
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
- public SyncJobStatus Status { get; set; }
+ public SyncJobStatus Status { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
@@ -105,9 +105,12 @@ namespace MediaBrowser.Model.Sync
public string PrimaryImageItemId { get; set; }
public string PrimaryImageTag { get; set; }
+ public bool EnableAutomaticResync { get; set; }
+
public SyncJob()
{
RequestedItemIds = new List<string>();
+ EnableAutomaticResync = true;
}
}
}