소스 검색

Move depreciated audio re-sample into audio filters

tikuf 11 년 전
부모
커밋
a2c6f687ae
2개의 변경된 파일24개의 추가작업 그리고 22개의 파일을 삭제
  1. 8 7
      MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
  2. 16 15
      MediaBrowser.Api/Playback/Progressive/VideoService.cs

+ 8 - 7
MediaBrowser.Api/Playback/Hls/VideoHlsService.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Common.MediaInfo;
+using MediaBrowser.Common.MediaInfo;
 using MediaBrowser.Controller;
 using MediaBrowser.Controller.Dto;
 using MediaBrowser.Controller.Library;
@@ -79,11 +79,6 @@ namespace MediaBrowser.Api.Playback.Hls
                     args += " -ac " + channels.Value;
                 }
 
-                if (state.Request.AudioSampleRate.HasValue)
-                {
-                    args += " -ar " + state.Request.AudioSampleRate.Value;
-                }
-
                 var bitrate = GetAudioBitrateParam(state);
 
                 if (bitrate.HasValue)
@@ -92,14 +87,20 @@ namespace MediaBrowser.Api.Playback.Hls
                 }
 
                 var volParam = 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)
                 {
                     volParam = ",volume=2.000000";
                 }
+                
+                if (state.Request.AudioSampleRate.HasValue)
+                {
+                    AudioSampleRate= state.Request.AudioSampleRate.Value + ":";
+                }
 
-                args += string.Format(" -af \"adelay=1,aresample=async=1000{0}\"", volParam);
+                args += string.Format(" -af \"adelay=1,aresample={0}async=1000{1}\"",AudioSampleRate, volParam);
 
                 return args;
             }

+ 16 - 15
MediaBrowser.Api/Playback/Progressive/VideoService.cs

@@ -1,4 +1,4 @@
-using MediaBrowser.Common.MediaInfo;
+using MediaBrowser.Common.MediaInfo;
 using MediaBrowser.Controller;
 using MediaBrowser.Controller.Drawing;
 using MediaBrowser.Controller.Dto;
@@ -219,11 +219,6 @@ namespace MediaBrowser.Api.Playback.Progressive
                 args += " -ac " + channels.Value;
             }
 
-            if (request.AudioSampleRate.HasValue)
-            {
-                args += " -ar " + request.AudioSampleRate.Value;
-            }
-
             var bitrate = GetAudioBitrateParam(state);
 
             if (bitrate.HasValue)
@@ -231,18 +226,24 @@ namespace MediaBrowser.Api.Playback.Progressive
                 args += " -ab " + bitrate.Value.ToString(UsCulture);
             }
 
-            var volParam = string.Empty;
+                var volParam = 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)
-            {
-                volParam = ",volume=2.000000";
-            }
+                // 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)
+                {
+                    volParam = ",volume=2.000000";
+                }
+                
+                if (state.Request.AudioSampleRate.HasValue)
+                {
+                    AudioSampleRate= state.Request.AudioSampleRate.Value + ":";
+                }
 
-            args += string.Format(" -af \"aresample=async=1000{0}\"", volParam);
+                args += string.Format(" -af \"aresample={0}async=1000{1}\"",AudioSampleRate, volParam);
 
-            return args;
-        }
+                return args;
+            }
 
         /// <summary>
         /// Gets the video bitrate to specify on the command line