Browse Source

set MediaSource SupportsDirectStream

Luke Pulverenti 10 years ago
parent
commit
814c38abfc

+ 6 - 1
MediaBrowser.Model/Dlna/StreamBuilder.cs

@@ -275,7 +275,7 @@ namespace MediaBrowser.Model.Dlna
             if (directPlayProfile != null)
             {
                 // 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);
                 }
@@ -581,6 +581,11 @@ namespace MediaBrowser.Model.Dlna
                     return PlayMethod.DirectPlay;
                 }
             }
+
+            if (!mediaSource.SupportsDirectStream)
+            {
+                return null;
+            }
             
             return PlayMethod.DirectStream;
         }

+ 2 - 0
MediaBrowser.Model/Dto/MediaSourceInfo.cs

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

+ 9 - 1
MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs

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