set MediaSource SupportsDirectStream

This commit is contained in:
Luke Pulverenti 2015-03-16 23:51:35 -04:00
parent ae6792a436
commit 814c38abfc
3 changed files with 17 additions and 2 deletions

View File

@ -275,7 +275,7 @@ namespace MediaBrowser.Model.Dlna
if (directPlayProfile != null) if (directPlayProfile != null)
{ {
// While options takes the network and other factors into account. Only applies to direct stream // While options takes the network and other factors into account. Only applies to direct stream
if (IsAudioEligibleForDirectPlay(item, options.GetMaxBitrate())) if (item.SupportsDirectStream && IsAudioEligibleForDirectPlay(item, options.GetMaxBitrate()))
{ {
playMethods.Add(PlayMethod.DirectStream); playMethods.Add(PlayMethod.DirectStream);
} }
@ -581,6 +581,11 @@ namespace MediaBrowser.Model.Dlna
return PlayMethod.DirectPlay; return PlayMethod.DirectPlay;
} }
} }
if (!mediaSource.SupportsDirectStream)
{
return null;
}
return PlayMethod.DirectStream; return PlayMethod.DirectStream;
} }

View File

@ -23,6 +23,7 @@ namespace MediaBrowser.Model.Dto
public long? RunTimeTicks { get; set; } public long? RunTimeTicks { get; set; }
public bool ReadAtNativeFramerate { get; set; } public bool ReadAtNativeFramerate { get; set; }
public bool SupportsTranscoding { get; set; } public bool SupportsTranscoding { get; set; }
public bool SupportsDirectStream { get; set; }
public VideoType? VideoType { get; set; } public VideoType? VideoType { get; set; }
@ -47,6 +48,7 @@ namespace MediaBrowser.Model.Dto
RequiredHttpHeaders = new Dictionary<string, string>(); RequiredHttpHeaders = new Dictionary<string, string>();
PlayableStreamFileNames = new List<string>(); PlayableStreamFileNames = new List<string>();
SupportsTranscoding = true; SupportsTranscoding = true;
SupportsDirectStream = true;
} }
public int? DefaultAudioStreamIndex { get; set; } public int? DefaultAudioStreamIndex { get; set; }

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Channels; using System.IO;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
@ -11,6 +12,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Server.Implementations.Library namespace MediaBrowser.Server.Implementations.Library
{ {
@ -160,6 +162,12 @@ namespace MediaBrowser.Server.Implementations.Library
foreach (var source in dynamicMediaSources) foreach (var source in dynamicMediaSources)
{ {
source.SupportsTranscoding = false; source.SupportsTranscoding = false;
if (source.Protocol == MediaProtocol.File)
{
source.SupportsDirectStream = File.Exists(source.Path);
}
list.Add(source); list.Add(source);
} }