Преглед изворни кода

Merge pull request #2522 from MediaBrowser/dev

Dev
Luke пре 8 година
родитељ
комит
3962361ad9

+ 33 - 13
Emby.Server.Core/ApplicationHost.cs

@@ -107,7 +107,7 @@ using Emby.Server.Implementations.Playlists;
 using Emby.Server.Implementations;
 using Emby.Server.Implementations.ServerManager;
 using Emby.Server.Implementations.Session;
-using Emby.Server.Implementations.Social;
+using Emby.Server.Implementations.Windows;
 using Emby.Server.Implementations.TV;
 using Emby.Server.Implementations.Updates;
 using MediaBrowser.Model.Activity;
@@ -796,17 +796,25 @@ namespace Emby.Server.Core
                 info.FFMpegFilename = "ffmpeg";
                 info.FFProbeFilename = "ffprobe";
                 info.ArchiveType = "7z";
-                info.Version = "20160215";
+                info.Version = "20170308";
                 info.DownloadUrls = GetLinuxDownloadUrls();
             }
             else if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
             {
                 info.FFMpegFilename = "ffmpeg.exe";
                 info.FFProbeFilename = "ffprobe.exe";
-                info.Version = "20160410";
+                info.Version = "20170308";
                 info.ArchiveType = "7z";
                 info.DownloadUrls = GetWindowsDownloadUrls();
             }
+            else if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)
+            {
+                info.FFMpegFilename = "ffmpeg";
+                info.FFProbeFilename = "ffprobe";
+                info.ArchiveType = "7z";
+                info.Version = "20170308";
+                info.DownloadUrls = GetMacDownloadUrls();
+            }
             else
             {
                 // No version available - user requirement
@@ -816,6 +824,20 @@ namespace Emby.Server.Core
             return info;
         }
 
+        private string[] GetMacDownloadUrls()
+        {
+            switch (EnvironmentInfo.SystemArchitecture)
+            {
+                case Architecture.X64:
+                    return new[]
+                    {
+                                "https://embydata.com/downloads/ffmpeg/osx/ffmpeg-x64-20170308.7z"
+                    };
+            }
+
+            return new string[] { };
+        }
+
         private string[] GetWindowsDownloadUrls()
         {
             switch (EnvironmentInfo.SystemArchitecture)
@@ -823,12 +845,12 @@ namespace Emby.Server.Core
                 case Architecture.X64:
                     return new[]
                     {
-                                "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z"
+                                "https://embydata.com/downloads/ffmpeg/windows/ffmpeg-20170308-win64.7z"
                     };
                 case Architecture.X86:
                     return new[]
                     {
-                                "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z"
+                                "https://embydata.com/downloads/ffmpeg/windows/ffmpeg-20170308-win32.7z"
                     };
             }
 
@@ -842,12 +864,12 @@ namespace Emby.Server.Core
                 case Architecture.X64:
                     return new[]
                     {
-                                "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"
+                                "https://embydata.com/downloads/ffmpeg/linux/ffmpeg-git-20170301-64bit-static.7z"
                     };
                 case Architecture.X86:
                     return new[]
                     {
-                                "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
+                                "https://embydata.com/downloads/ffmpeg/linux/ffmpeg-git-20170301-32bit-static.7z"
                     };
             }
 
@@ -1716,12 +1738,10 @@ namespace Emby.Server.Core
 
         public void EnableLoopback(string appName)
         {
-            EnableLoopbackInternal(appName);
-        }
-
-        protected virtual void EnableLoopbackInternal(string appName)
-        {
-            
+            if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
+            {
+                LoopUtil.Run(appName);
+            }
         }
 
         private void RegisterModules()

+ 1 - 0
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -269,6 +269,7 @@
     <Compile Include="Updates\InstallationManager.cs" />
     <Compile Include="UserViews\CollectionFolderImageProvider.cs" />
     <Compile Include="UserViews\DynamicImageProvider.cs" />
+    <Compile Include="Windows\LoopUtil.cs" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Localization\iso6392.txt" />

+ 1 - 1
Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs

@@ -258,7 +258,7 @@ namespace Emby.Server.Implementations.Images
                 {
                     return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
                 }
-                if (item is Playlist || item is MusicGenre)
+                if (item is Playlist || item is MusicGenre || item is Genre || item is GameGenre)
                 {
                     return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
                 }

+ 32 - 0
Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs

@@ -11,6 +11,7 @@ using System.Linq;
 using System.Threading.Tasks;
 using Emby.Server.Implementations.Images;
 using MediaBrowser.Common.IO;
+using MediaBrowser.Controller.Entities.Movies;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Controller.Library;
@@ -101,4 +102,35 @@ namespace Emby.Server.Implementations.Playlists
         //}
     }
 
+    public class GenreImageProvider : BaseDynamicImageProvider<Genre>
+    {
+        private readonly ILibraryManager _libraryManager;
+
+        public GenreImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
+        {
+            _libraryManager = libraryManager;
+        }
+
+        protected override Task<List<BaseItem>> GetItemsWithImages(IHasImages item)
+        {
+            var items = _libraryManager.GetItemList(new InternalItemsQuery
+            {
+                Genres = new[] { item.Name },
+                IncludeItemTypes = new[] { typeof(Series).Name, typeof(Movie).Name },
+                SortBy = new[] { ItemSortBy.Random },
+                Limit = 4,
+                Recursive = true,
+                ImageTypes = new[] { ImageType.Primary }
+
+            }).ToList();
+
+            return Task.FromResult(GetFinalItems(items));
+        }
+
+        //protected override Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
+        //{
+        //    return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
+        //}
+    }
+
 }

+ 4 - 4
MediaBrowser.ServerApplication/Native/LoopbackUtil.cs → Emby.Server.Implementations/Windows/LoopUtil.cs

@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MediaBrowser.ServerApplication.Native
+namespace Emby.Server.Implementations.Windows
 {
     /// <summary>
     /// http://blogs.msdn.com/b/fiddler/archive/2011/12/10/fiddler-windows-8-apps-enable-LoopUtil-network-isolation-exemption.aspx
@@ -71,12 +71,12 @@ namespace MediaBrowser.ServerApplication.Native
         [DllImport("advapi32.dll", SetLastError = true)]
         internal static extern bool ConvertStringSidToSid(string strSid, out IntPtr pSid);
 
-        [DllImport("advapi32", CharSet = CharSet.Auto, SetLastError = true)]
+        [DllImport("advapi32", /*CharSet = CharSet.Auto,*/ SetLastError = true)]
         static extern bool ConvertSidToStringSid(
             [MarshalAs(UnmanagedType.LPArray)] byte[] pSID,
             out IntPtr ptrSid);
 
-        [DllImport("advapi32", CharSet = CharSet.Auto, SetLastError = true)]
+        [DllImport("advapi32", /*CharSet = CharSet.Auto,*/ SetLastError = true)]
         static extern bool ConvertSidToStringSid(IntPtr pSid, out string strSid);
 
         // Use this API to convert a string reference (e.g. "@{blah.pri?ms-resource://whatever}") into a plain string 
@@ -178,7 +178,7 @@ namespace MediaBrowser.ServerApplication.Native
 
             foreach (var app in Apps)
             {
-                if ((app.appContainerName ?? string.Empty).IndexOf(appName, StringComparison.OrdinalIgnoreCase) != -1 || 
+                if ((app.appContainerName ?? string.Empty).IndexOf(appName, StringComparison.OrdinalIgnoreCase) != -1 ||
                     (app.displayName ?? string.Empty).IndexOf(appName, StringComparison.OrdinalIgnoreCase) != -1)
                 {
                     if (!app.LoopUtil)

+ 38 - 30
MediaBrowser.Api/Playback/MediaInfoService.cs

@@ -127,7 +127,7 @@ namespace MediaBrowser.Api.Playback
 
                 SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate,
                     request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex,
-                    request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId, true, true, true);
+                    request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId, true, true, true, true);
             }
             else
             {
@@ -169,7 +169,7 @@ namespace MediaBrowser.Api.Playback
             {
                 var mediaSourceId = request.MediaSourceId;
 
-                SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.EnableDirectStream, request.EnableTranscoding);
+                SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.ForceDirectPlayRemoteMediaSource, request.EnableDirectStream, request.EnableTranscoding);
             }
 
             return info;
@@ -253,6 +253,7 @@ namespace MediaBrowser.Api.Playback
             int? maxAudioChannels,
             string userId,
             bool enableDirectPlay,
+            bool forceDirectPlayRemoteMediaSource,
             bool enableDirectStream,
             bool enableTranscoding)
         {
@@ -260,7 +261,7 @@ namespace MediaBrowser.Api.Playback
 
             foreach (var mediaSource in result.MediaSources)
             {
-                SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId, enableDirectPlay, enableDirectStream, enableTranscoding);
+                SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId, enableDirectPlay, forceDirectPlayRemoteMediaSource, enableDirectStream, enableTranscoding);
             }
 
             SortMediaSources(result, maxBitrate);
@@ -279,6 +280,7 @@ namespace MediaBrowser.Api.Playback
             string playSessionId,
             string userId,
             bool enableDirectPlay,
+            bool forceDirectPlayRemoteMediaSource,
             bool enableDirectStream,
             bool enableTranscoding)
         {
@@ -318,43 +320,49 @@ namespace MediaBrowser.Api.Playback
 
             if (mediaSource.SupportsDirectPlay)
             {
-                var supportsDirectStream = mediaSource.SupportsDirectStream;
+                if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource)
+                {
+                }
+                else
+                {
+                    var supportsDirectStream = mediaSource.SupportsDirectStream;
 
-                // Dummy this up to fool StreamBuilder
-                mediaSource.SupportsDirectStream = true;
-                options.MaxBitrate = maxBitrate;
+                    // Dummy this up to fool StreamBuilder
+                    mediaSource.SupportsDirectStream = true;
+                    options.MaxBitrate = maxBitrate;
 
-                if (item is Audio)
-                {
-                    if (!user.Policy.EnableAudioPlaybackTranscoding)
+                    if (item is Audio)
                     {
-                        options.ForceDirectPlay = true;
+                        if (!user.Policy.EnableAudioPlaybackTranscoding)
+                        {
+                            options.ForceDirectPlay = true;
+                        }
                     }
-                }
-                else if (item is Video)
-                {
-                    if (!user.Policy.EnableAudioPlaybackTranscoding && !user.Policy.EnableVideoPlaybackTranscoding && !user.Policy.EnablePlaybackRemuxing)
+                    else if (item is Video)
                     {
-                        options.ForceDirectPlay = true;
+                        if (!user.Policy.EnableAudioPlaybackTranscoding && !user.Policy.EnableVideoPlaybackTranscoding && !user.Policy.EnablePlaybackRemuxing)
+                        {
+                            options.ForceDirectPlay = true;
+                        }
                     }
-                }
 
-                // The MediaSource supports direct stream, now test to see if the client supports it
-                var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
-                    streamBuilder.BuildAudioItem(options) :
-                    streamBuilder.BuildVideoItem(options);
+                    // The MediaSource supports direct stream, now test to see if the client supports it
+                    var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
+                        streamBuilder.BuildAudioItem(options) :
+                        streamBuilder.BuildVideoItem(options);
 
-                if (streamInfo == null || !streamInfo.IsDirectStream)
-                {
-                    mediaSource.SupportsDirectPlay = false;
-                }
+                    if (streamInfo == null || !streamInfo.IsDirectStream)
+                    {
+                        mediaSource.SupportsDirectPlay = false;
+                    }
 
-                // Set this back to what it was
-                mediaSource.SupportsDirectStream = supportsDirectStream;
+                    // Set this back to what it was
+                    mediaSource.SupportsDirectStream = supportsDirectStream;
 
-                if (streamInfo != null)
-                {
-                    SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
+                    if (streamInfo != null)
+                    {
+                        SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
+                    }
                 }
             }
 

+ 5 - 0
MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs

@@ -1670,6 +1670,11 @@ namespace MediaBrowser.Controller.MediaEncoding
                         case "h264":
                             if (_mediaEncoder.SupportsDecoder("h264_qsv"))
                             {
+                                // qsv decoder does not support 10-bit input
+                                if ((state.VideoStream.BitDepth ?? 8) > 8)
+                                {
+                                    return null;
+                                }
                                 return "-c:v h264_qsv ";
                             }
                             break;

+ 2 - 0
MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs

@@ -27,9 +27,11 @@ 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 PlaybackInfoRequest()
         {
+            ForceDirectPlayRemoteMediaSource = true;
             EnableDirectPlay = true;
             EnableDirectStream = true;
             EnableTranscoding = true;

+ 0 - 36
MediaBrowser.Server.Mac/MacAppHost.cs

@@ -56,42 +56,6 @@ namespace MediaBrowser.Server.Mac
 			return new SyncManager();
 		}
 
-        protected override FFMpegInstallInfo GetFfmpegInstallInfo()
-        {
-            var info = new FFMpegInstallInfo();
-
-            info.ArchiveType = "7z";
-
-            switch (EnvironmentInfo.SystemArchitecture)
-            {
-                case Architecture.X64:
-                    info.Version = "20160124";
-                    break;
-                case Architecture.X86:
-                    info.Version = "20150110";
-                    break;
-            }
-
-            info.DownloadUrls = GetDownloadUrls();
-
-            return info;
-        }
-
-        private string[] GetDownloadUrls()
-        {
-            switch (EnvironmentInfo.SystemArchitecture)
-            {
-                case Architecture.X64:
-                    return new[]
-                    {
-                                "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
-                            };
-            }
-
-            // No version available 
-            return new string[] { };
-        }
-
         protected override void RestartInternal()
         {
             MainClass.Restart();

+ 0 - 1
MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj

@@ -143,7 +143,6 @@
     </Compile>
     <Compile Include="MainStartup.cs" />
     <Compile Include="Native\LnkShortcutHandler.cs" />
-    <Compile Include="Native\LoopbackUtil.cs" />
     <Compile Include="Native\PowerManagement.cs" />
     <Compile Include="Native\Standby.cs" />
     <Compile Include="Native\ServerAuthorization.cs" />

+ 1 - 5
MediaBrowser.ServerApplication/WindowsAppHost.cs

@@ -10,6 +10,7 @@ using Emby.Server.Core;
 using Emby.Server.Implementations;
 using Emby.Server.Implementations.EntryPoints;
 using Emby.Server.Implementations.FFMpeg;
+using Emby.Server.Implementations.Windows;
 using Emby.Server.Sync;
 using MediaBrowser.Controller.Connect;
 using MediaBrowser.Controller.Sync;
@@ -107,11 +108,6 @@ namespace MediaBrowser.ServerApplication
             }
         }
 
-        protected override void EnableLoopbackInternal(string appName)
-        {
-            LoopUtil.Run(appName);
-        }
-
         public override bool SupportsRunningAsService
         {
             get

+ 1 - 1
SharedVersion.cs

@@ -1,3 +1,3 @@
 using System.Reflection;
 
-[assembly: AssemblyVersion("3.2.7.1")]
+[assembly: AssemblyVersion("3.2.7.2")]

+ 1 - 1
SocketHttpListener.Portable/Net/HttpListenerRequest.cs

@@ -456,7 +456,7 @@ namespace SocketHttpListener.Net
 
         public long ContentLength64
         {
-            get { return content_length; }
+            get { return is_chunked ? -1 : content_length; }
         }
 
         public string ContentType