diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-08-09 15:59:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-09 15:59:26 -0400 |
| commit | c2996935c8a873662e6d301f139c88df8a542ed2 (patch) | |
| tree | cf405f91e893fe6a3fc20dfa1622f027666d4848 /MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs | |
| parent | ab834f8fdffb64b562ece0512a53f361c62f7f6f (diff) | |
| parent | 7a74c705e584774534b74e11c1ab86144cb454c6 (diff) | |
Merge pull request #2800 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs deleted file mode 100644 index dc3cb5f5e..000000000 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs +++ /dev/null @@ -1,70 +0,0 @@ -using MediaBrowser.Model.MediaInfo; -using System.Collections.Generic; -using System.Linq; - -namespace MediaBrowser.MediaEncoding.Encoder -{ - public static class EncodingUtils - { - public static string GetInputArgument(List<string> inputFiles, MediaProtocol protocol) - { - if (protocol != MediaProtocol.File) - { - var url = inputFiles.First(); - - return string.Format("\"{0}\"", url); - } - - return GetConcatInputArgument(inputFiles); - } - - /// <summary> - /// Gets the concat input argument. - /// </summary> - /// <param name="inputFiles">The input files.</param> - /// <returns>System.String.</returns> - private static string GetConcatInputArgument(IReadOnlyList<string> inputFiles) - { - // Get all streams - // If there's more than one we'll need to use the concat command - if (inputFiles.Count > 1) - { - var files = string.Join("|", inputFiles.Select(NormalizePath).ToArray()); - - return string.Format("concat:\"{0}\"", files); - } - - // Determine the input path for video files - return GetFileInputArgument(inputFiles[0]); - } - - /// <summary> - /// Gets the file input argument. - /// </summary> - /// <param name="path">The path.</param> - /// <returns>System.String.</returns> - private static string GetFileInputArgument(string path) - { - if (path.IndexOf("://") != -1) - { - return string.Format("\"{0}\"", path); - } - - // Quotes are valid path characters in linux and they need to be escaped here with a leading \ - path = NormalizePath(path); - - return string.Format("file:\"{0}\"", path); - } - - /// <summary> - /// Normalizes the path. - /// </summary> - /// <param name="path">The path.</param> - /// <returns>System.String.</returns> - private static string NormalizePath(string path) - { - // Quotes are valid path characters in linux and they need to be escaped here with a leading \ - return path.Replace("\"", "\\\""); - } - } -} |
