Pārlūkot izejas kodu

Merge pull request #1666 from MediaBrowser/dev

Dev
Luke 9 gadi atpakaļ
vecāks
revīzija
dfe6dc0492

+ 1 - 0
MediaBrowser.Api/BrandingService.cs

@@ -10,6 +10,7 @@ namespace MediaBrowser.Api
     }
 
     [Route("/Branding/Css", "GET", Summary = "Gets custom css")]
+    [Route("/Branding/Css.css", "GET", Summary = "Gets custom css")]
     public class GetBrandingCss
     {
     }

+ 2 - 1
MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs

@@ -828,8 +828,9 @@ namespace MediaBrowser.Api.Playback.Hls
             // See if we can save come cpu cycles by avoiding encoding
             if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
             {
-                if (state.VideoStream != null && IsH264(state.VideoStream))
+                if (state.VideoStream != null && IsH264(state.VideoStream) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
                 {
+                    Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
                     args += " -bsf:v h264_mp4toannexb";
                 }
 

+ 5 - 0
MediaBrowser.Api/Playback/Hls/VideoHlsService.cs

@@ -87,6 +87,11 @@ namespace MediaBrowser.Api.Playback.Hls
             if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
             {
                 // if h264_mp4toannexb is ever added, do not use it for live tv
+                if (state.VideoStream != null && IsH264(state.VideoStream) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
+                {
+                    Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
+                    args += " -bsf:v h264_mp4toannexb";
+                }
                 return args;
             }
 

+ 2 - 2
MediaBrowser.Api/Playback/Progressive/VideoService.cs

@@ -139,9 +139,9 @@ namespace MediaBrowser.Api.Playback.Progressive
 
             if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
             {
-                if (state.VideoStream != null && IsH264(state.VideoStream) &&
-                    (string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase)))
+                if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
                 {
+                    Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
                     args += " -bsf:v h264_mp4toannexb";
                 }
 

+ 2 - 0
MediaBrowser.Controller/Entities/TV/Episode.cs

@@ -287,7 +287,9 @@ namespace MediaBrowser.Controller.Entities.TV
                 id.AnimeSeriesIndex = series.AnimeSeriesIndex;
             }
 
+            id.IsMissingEpisode = IsMissingEpisode;
             id.IndexNumberEnd = IndexNumberEnd;
+            id.IsVirtualUnaired = IsVirtualUnaired;
 
             return id;
         }

+ 3 - 0
MediaBrowser.Controller/Providers/EpisodeInfo.cs

@@ -10,6 +10,9 @@ namespace MediaBrowser.Controller.Providers
         public int? IndexNumberEnd { get; set; }
         public int? AnimeSeriesIndex { get; set; }
 
+        public bool IsMissingEpisode { get; set; }
+        public bool IsVirtualUnaired { get; set; }
+
         public EpisodeInfo()
         {
             SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

+ 2 - 2
MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs

@@ -73,9 +73,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
 
             if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
             {
-                if (state.VideoStream != null && IsH264(state.VideoStream) &&
-                    (string.Equals(state.Options.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) || isOutputMkv))
+                if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.Options.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
                 {
+                    Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
                     args += " -bsf:v h264_mp4toannexb";
                 }
 

+ 2 - 1
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -407,7 +407,8 @@ namespace MediaBrowser.MediaEncoding.Probing
                 Profile = streamInfo.profile,
                 Level = streamInfo.level,
                 Index = streamInfo.index,
-                PixelFormat = streamInfo.pix_fmt
+                PixelFormat = streamInfo.pix_fmt,
+                NalLengthSize = streamInfo.nal_length_size
             };
 
             // Filter out junk

+ 3 - 1
MediaBrowser.Model/Entities/MediaStream.cs

@@ -33,7 +33,9 @@ namespace MediaBrowser.Model.Entities
         /// </summary>
         /// <value>The comment.</value>
         public string Comment { get; set; }
-        
+
+        public string NalLengthSize { get; set; }
+
         /// <summary>
         /// Gets or sets a value indicating whether this instance is interlaced.
         /// </summary>

+ 5 - 0
MediaBrowser.Providers/Manager/MetadataService.cs

@@ -310,6 +310,11 @@ namespace MediaBrowser.Providers.Manager
                 return true;
             }
 
+            if (!(item is Audio) && !(item is Video))
+            {
+                return true;
+            }
+
             return false;
         }
 

+ 7 - 1
MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs

@@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.TV
     {
         private readonly IJsonSerializer _jsonSerializer;
         private readonly IHttpClient _httpClient;
-        private OmdbItemProvider _itemProvider;
+        private readonly OmdbItemProvider _itemProvider;
 
         public OmdbEpisodeProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger, ILibraryManager libraryManager)
         {
@@ -41,6 +41,12 @@ namespace MediaBrowser.Providers.TV
                 Item = new Episode()
             };
 
+            // Allowing this will dramatically increase scan times
+            if (info.IsMissingEpisode || info.IsVirtualUnaired)
+            {
+                return result;
+            }
+
             var imdbId = info.GetProviderId(MetadataProviders.Imdb);
             if (string.IsNullOrWhiteSpace(imdbId))
             {

+ 6 - 0
MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs

@@ -64,6 +64,12 @@ namespace MediaBrowser.Providers.TV
         {
             var result = new MetadataResult<Episode>();
 
+            // Allowing this will dramatically increase scan times
+            if (info.IsMissingEpisode || info.IsVirtualUnaired)
+            {
+                return result;
+            }
+
             string seriesTmdbId;
             info.SeriesProviderIds.TryGetValue(MetadataProviders.Tmdb.ToString(), out seriesTmdbId);
 

+ 8 - 1
MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -511,8 +511,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
             if (!(service is EmbyTV.EmbyTV))
             {
                 // We can't trust that we'll be able to direct stream it through emby server,  no matter what the provider says
-                mediaSource.SupportsDirectStream = true;
+                mediaSource.SupportsDirectStream = false;
                 mediaSource.SupportsTranscoding = true;
+                foreach (var stream in mediaSource.MediaStreams)
+                {
+                    if (stream.Type == MediaStreamType.Video && string.IsNullOrWhiteSpace(stream.NalLengthSize))
+                    {
+                        stream.NalLengthSize = "0";
+                    }
+                }
             }
         }
 

+ 8 - 1
MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs

@@ -317,6 +317,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                 videoCodec = "mpeg2video";
             }
 
+            string nal = null;
+            if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
+            {
+                nal = "0";
+            }
+
             var url = GetApiUrl(info, true) + "/auto/v" + channelId;
 
             if (!string.IsNullOrWhiteSpace(profile) && !string.Equals(profile, "native", StringComparison.OrdinalIgnoreCase))
@@ -339,7 +345,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                                 Codec = videoCodec,
                                 Width = width,
                                 Height = height,
-                                BitRate = videoBitrate
+                                BitRate = videoBitrate,
+                                NalLengthSize = nal
 
                             },
                             new MediaStream

+ 19 - 19
MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs

@@ -21,14 +21,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
             AddPixelFormatColumnCommand();
             AddBitDepthCommand();
             AddIsAnamorphicColumn();
-            AddIsCabacColumn();
             AddKeyFramesColumn();
             AddRefFramesCommand();
             AddCodecTagColumn();
             AddCommentColumn();
+            AddNalColumn();
         }
 
-        private void AddCommentColumn()
+        private void AddNalColumn()
         {
             using (var cmd = _connection.CreateCommand())
             {
@@ -42,7 +42,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
                         {
                             var name = reader.GetString(1);
 
-                            if (string.Equals(name, "Comment", StringComparison.OrdinalIgnoreCase))
+                            if (string.Equals(name, "NalLengthSize", StringComparison.OrdinalIgnoreCase))
                             {
                                 return;
                             }
@@ -54,12 +54,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
             var builder = new StringBuilder();
 
             builder.AppendLine("alter table mediastreams");
-            builder.AppendLine("add column Comment TEXT");
+            builder.AppendLine("add column NalLengthSize TEXT");
 
             _connection.RunQueries(new[] { builder.ToString() }, _logger);
         }
 
-        private void AddCodecTagColumn()
+        private void AddCommentColumn()
         {
             using (var cmd = _connection.CreateCommand())
             {
@@ -73,7 +73,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
                         {
                             var name = reader.GetString(1);
 
-                            if (string.Equals(name, "CodecTag", StringComparison.OrdinalIgnoreCase))
+                            if (string.Equals(name, "Comment", StringComparison.OrdinalIgnoreCase))
                             {
                                 return;
                             }
@@ -85,12 +85,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
             var builder = new StringBuilder();
 
             builder.AppendLine("alter table mediastreams");
-            builder.AppendLine("add column CodecTag TEXT");
+            builder.AppendLine("add column Comment TEXT");
 
             _connection.RunQueries(new[] { builder.ToString() }, _logger);
         }
 
-        private void AddPixelFormatColumnCommand()
+        private void AddCodecTagColumn()
         {
             using (var cmd = _connection.CreateCommand())
             {
@@ -104,7 +104,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
                         {
                             var name = reader.GetString(1);
 
-                            if (string.Equals(name, "PixelFormat", StringComparison.OrdinalIgnoreCase))
+                            if (string.Equals(name, "CodecTag", StringComparison.OrdinalIgnoreCase))
                             {
                                 return;
                             }
@@ -116,12 +116,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
             var builder = new StringBuilder();
 
             builder.AppendLine("alter table mediastreams");
-            builder.AppendLine("add column PixelFormat TEXT");
+            builder.AppendLine("add column CodecTag TEXT");
 
             _connection.RunQueries(new[] { builder.ToString() }, _logger);
         }
 
-        private void AddBitDepthCommand()
+        private void AddPixelFormatColumnCommand()
         {
             using (var cmd = _connection.CreateCommand())
             {
@@ -135,7 +135,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
                         {
                             var name = reader.GetString(1);
 
-                            if (string.Equals(name, "BitDepth", StringComparison.OrdinalIgnoreCase))
+                            if (string.Equals(name, "PixelFormat", StringComparison.OrdinalIgnoreCase))
                             {
                                 return;
                             }
@@ -147,12 +147,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
             var builder = new StringBuilder();
 
             builder.AppendLine("alter table mediastreams");
-            builder.AppendLine("add column BitDepth INT NULL");
+            builder.AppendLine("add column PixelFormat TEXT");
 
             _connection.RunQueries(new[] { builder.ToString() }, _logger);
         }
 
-        private void AddRefFramesCommand()
+        private void AddBitDepthCommand()
         {
             using (var cmd = _connection.CreateCommand())
             {
@@ -166,7 +166,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
                         {
                             var name = reader.GetString(1);
 
-                            if (string.Equals(name, "RefFrames", StringComparison.OrdinalIgnoreCase))
+                            if (string.Equals(name, "BitDepth", StringComparison.OrdinalIgnoreCase))
                             {
                                 return;
                             }
@@ -178,12 +178,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
             var builder = new StringBuilder();
 
             builder.AppendLine("alter table mediastreams");
-            builder.AppendLine("add column RefFrames INT NULL");
+            builder.AppendLine("add column BitDepth INT NULL");
 
             _connection.RunQueries(new[] { builder.ToString() }, _logger);
         }
 
-        private void AddIsCabacColumn()
+        private void AddRefFramesCommand()
         {
             using (var cmd = _connection.CreateCommand())
             {
@@ -197,7 +197,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
                         {
                             var name = reader.GetString(1);
 
-                            if (string.Equals(name, "IsCabac", StringComparison.OrdinalIgnoreCase))
+                            if (string.Equals(name, "RefFrames", StringComparison.OrdinalIgnoreCase))
                             {
                                 return;
                             }
@@ -209,7 +209,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
             var builder = new StringBuilder();
 
             builder.AppendLine("alter table mediastreams");
-            builder.AppendLine("add column IsCabac BIT NULL");
+            builder.AppendLine("add column RefFrames INT NULL");
 
             _connection.RunQueries(new[] { builder.ToString() }, _logger);
         }

+ 10 - 7
MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs

@@ -124,7 +124,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
             _connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false);
 
             var createMediaStreamsTableCommand
-               = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, IsCabac BIT NULL, CodecTag TEXT NULL, Comment TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
+               = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
 
             string[] queries = {
 
@@ -389,9 +389,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
             "BitDepth",
             "IsAnamorphic",
             "RefFrames",
-            "IsCabac",
             "CodecTag",
-            "Comment"
+            "Comment",
+            "NalLengthSize"
         };
 
         /// <summary>
@@ -2889,10 +2889,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
                     _saveStreamCommand.GetParameter(index++).Value = stream.BitDepth;
                     _saveStreamCommand.GetParameter(index++).Value = stream.IsAnamorphic;
                     _saveStreamCommand.GetParameter(index++).Value = stream.RefFrames;
-                    _saveStreamCommand.GetParameter(index++).Value = null;
 
                     _saveStreamCommand.GetParameter(index++).Value = stream.CodecTag;
                     _saveStreamCommand.GetParameter(index++).Value = stream.Comment;
+                    _saveStreamCommand.GetParameter(index++).Value = stream.NalLengthSize;
 
                     _saveStreamCommand.Transaction = transaction;
                     _saveStreamCommand.ExecuteNonQuery();
@@ -3041,16 +3041,19 @@ namespace MediaBrowser.Server.Implementations.Persistence
                 item.RefFrames = reader.GetInt32(24);
             }
 
-            // cabac no longer used
+            if (!reader.IsDBNull(25))
+            {
+                item.CodecTag = reader.GetString(25);
+            }
 
             if (!reader.IsDBNull(26))
             {
-                item.CodecTag = reader.GetString(26);
+                item.Comment = reader.GetString(26);
             }
 
             if (!reader.IsDBNull(27))
             {
-                item.Comment = reader.GetString(27);
+                item.NalLengthSize = reader.GetString(27);
             }
 
             return item;

+ 3 - 3
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -101,6 +101,9 @@
     <Content Include="dashboard-ui\autoorganizesmart.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\components\apphost.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\components\chromecasthelpers.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -110,9 +113,6 @@
     <Content Include="dashboard-ui\components\favoriteitems.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\components\filedownloader.js">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\components\filterdialog\filterdialog.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

+ 2 - 2
SharedVersion.cs

@@ -1,4 +1,4 @@
 using System.Reflection;
 
-//[assembly: AssemblyVersion("3.0.*")]
-[assembly: AssemblyVersion("3.0.5930")]
+[assembly: AssemblyVersion("3.0.*")]
+//[assembly: AssemblyVersion("3.0.5930")]