Explorar o código

fixes #619 - Command line fail for internal subs

Luke Pulverenti %!s(int64=11) %!d(string=hai) anos
pai
achega
7dd75e079a

+ 3 - 4
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -1,5 +1,4 @@
-using System.Globalization;
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.IO;
 using MediaBrowser.Common.MediaInfo;
 using MediaBrowser.Controller;
@@ -11,15 +10,15 @@ using MediaBrowser.Controller.MediaInfo;
 using MediaBrowser.Model.Drawing;
 using MediaBrowser.Model.Dto;
 using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.IO;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.Diagnostics;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
-using MediaBrowser.Model.IO;
 
 namespace MediaBrowser.Api.Playback
 {

+ 16 - 12
MediaBrowser.Api/Playback/Hls/VideoHlsService.cs

@@ -88,7 +88,7 @@ namespace MediaBrowser.Api.Playback.Hls
                 }
 
                 var volParam = string.Empty;
-                var AudioSampleRate = string.Empty;
+                var audioSampleRate = string.Empty;
 
                 // Boost volume to 200% when downsampling from 6ch to 2ch
                 if (channels.HasValue && channels.Value <= 2 && state.AudioStream.Channels.HasValue && state.AudioStream.Channels.Value > 5)
@@ -98,10 +98,10 @@ namespace MediaBrowser.Api.Playback.Hls
                 
                 if (state.Request.AudioSampleRate.HasValue)
                 {
-                    AudioSampleRate= state.Request.AudioSampleRate.Value + ":";
+                    audioSampleRate= state.Request.AudioSampleRate.Value + ":";
                 }
 
-                args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",AudioSampleRate, volParam);
+                args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",audioSampleRate, volParam);
 
                 return args;
             }
@@ -127,6 +127,10 @@ namespace MediaBrowser.Api.Playback.Hls
 
             const string keyFrameArg = " -force_key_frames expr:if(isnan(prev_forced_t),gte(t,.1),gte(t,prev_forced_t+5))";
 
+            var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal &&
+                                 (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
+                                  state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1);
+            
             var args = "-codec:v:0 " + codec + " -preset superfast" + keyFrameArg;
 
             var bitrate = GetVideoBitrateParam(state);
@@ -137,9 +141,12 @@ namespace MediaBrowser.Api.Playback.Hls
             }
             
             // Add resolution params, if specified
-            if (state.VideoRequest.Width.HasValue || state.VideoRequest.Height.HasValue || state.VideoRequest.MaxHeight.HasValue || state.VideoRequest.MaxWidth.HasValue)
+            if (!hasGraphicalSubs)
             {
-                args += GetOutputSizeParam(state, codec, performSubtitleConversion);
+                if (state.VideoRequest.Width.HasValue || state.VideoRequest.Height.HasValue || state.VideoRequest.MaxHeight.HasValue || state.VideoRequest.MaxWidth.HasValue)
+                {
+                    args += GetOutputSizeParam(state, codec, performSubtitleConversion);
+                }
             }
 
             if (state.VideoRequest.Framerate.HasValue)
@@ -158,14 +165,11 @@ namespace MediaBrowser.Api.Playback.Hls
             {
                 args += " -level " + state.VideoRequest.Level;
             }
-            
-            if (state.SubtitleStream != null)
+
+            // This is for internal graphical subs
+            if (hasGraphicalSubs)
             {
-                // This is for internal graphical subs
-                if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1))
-                {
-                    args += GetInternalGraphicalSubtitleParam(state, codec);
-                }
+                args += GetInternalGraphicalSubtitleParam(state, codec);
             }
          
             return args;

+ 12 - 8
MediaBrowser.Api/Playback/Progressive/VideoService.cs

@@ -143,12 +143,19 @@ namespace MediaBrowser.Api.Playback.Progressive
 
             args += keyFrameArg;
 
+            var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsExternal &&
+                                   (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 ||
+                                    state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1);
+
             var request = state.VideoRequest;
 
             // Add resolution params, if specified
-            if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue)
+            if (!hasGraphicalSubs)
             {
-                args += GetOutputSizeParam(state, codec, performSubtitleConversion);
+                if (request.Width.HasValue || request.Height.HasValue || request.MaxHeight.HasValue || request.MaxWidth.HasValue)
+                {
+                    args += GetOutputSizeParam(state, codec, performSubtitleConversion);
+                }
             }
 
             if (request.Framerate.HasValue)
@@ -175,13 +182,10 @@ namespace MediaBrowser.Api.Playback.Progressive
                 args += " -level " + state.VideoRequest.Level;
             }
 
-            if (state.SubtitleStream != null)
+            // This is for internal graphical subs
+            if (hasGraphicalSubs)
             {
-                // This is for internal graphical subs
-                if (!state.SubtitleStream.IsExternal && (state.SubtitleStream.Codec.IndexOf("pgs", StringComparison.OrdinalIgnoreCase) != -1 || state.SubtitleStream.Codec.IndexOf("dvd", StringComparison.OrdinalIgnoreCase) != -1))
-                {
-                    args += GetInternalGraphicalSubtitleParam(state, codec);
-                }
+                args += GetInternalGraphicalSubtitleParam(state, codec);
             }
 
             return args;

+ 0 - 1
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -1244,7 +1244,6 @@ namespace MediaBrowser.Controller.Entities
         /// <summary>
         /// Adds the tagline.
         /// </summary>
-        /// <param name="item">The item.</param>
         /// <param name="tagline">The tagline.</param>
         /// <exception cref="System.ArgumentNullException">tagline</exception>
         public void AddTagline(string tagline)