From 21fd761b05584481d9f6293ca48e373f356c80b6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 16 Jun 2014 21:56:23 -0400 Subject: fixes #838 - Support rtmp protocol with channels --- .../MediaEncoding/IMediaEncoder.cs | 41 +++------- .../MediaEncoding/MediaEncoderHelpers.cs | 93 +++------------------- 2 files changed, 20 insertions(+), 114 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 0de119ae5..f7e8554d1 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.Entities; +using MediaBrowser.Model.MediaInfo; using System; using System.IO; using System.Threading; @@ -35,59 +36,37 @@ namespace MediaBrowser.Controller.MediaEncoding /// Extracts the video image. /// /// The input files. - /// The type. + /// The protocol. /// The threed format. /// The offset. /// The cancellation token. /// Task{Stream}. - Task ExtractVideoImage(string[] inputFiles, InputType type, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken); + Task ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken); /// /// Gets the media info. /// /// The input files. - /// The type. + /// The protocol. /// if set to true [is audio]. /// The cancellation token. /// Task. - Task GetMediaInfo(string[] inputFiles, InputType type, bool isAudio, CancellationToken cancellationToken); + Task GetMediaInfo(string[] inputFiles, MediaProtocol protocol, bool isAudio, CancellationToken cancellationToken); /// /// Gets the probe size argument. /// - /// The type. + /// The input files. + /// The protocol. /// System.String. - string GetProbeSizeArgument(InputType type); + string GetProbeSizeArgument(string[] inputFiles, MediaProtocol protocol); /// /// Gets the input argument. /// /// The input files. - /// The type. + /// The protocol. /// System.String. - string GetInputArgument(string[] inputFiles, InputType type); - } - - /// - /// Enum InputType - /// - public enum InputType - { - /// - /// The file - /// - File, - /// - /// The bluray - /// - Bluray, - /// - /// The DVD - /// - Dvd, - /// - /// The URL - /// - Url + string GetInputArgument(string[] inputFiles, MediaProtocol protocol); } } diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index 6a37626b7..37dd06da9 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -1,5 +1,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; +using MediaBrowser.Model.MediaInfo; using System; using System.Collections.Generic; using System.Globalization; @@ -17,56 +18,22 @@ namespace MediaBrowser.Controller.MediaEncoding /// Gets the input argument. /// /// The video path. - /// if set to true [is remote]. - /// Type of the video. - /// Type of the iso. + /// The protocol. /// The iso mount. /// The playable stream file names. - /// The type. /// System.String[][]. - public static string[] GetInputArgument(string videoPath, bool isRemote, VideoType videoType, IsoType? isoType, IIsoMount isoMount, IEnumerable playableStreamFileNames, out InputType type) + public static string[] GetInputArgument(string videoPath, MediaProtocol protocol, IIsoMount isoMount, List playableStreamFileNames) { - var inputPath = isoMount == null ? new[] { videoPath } : new[] { isoMount.MountedPath }; - - type = InputType.File; - - switch (videoType) + if (playableStreamFileNames.Count > 0) { - case VideoType.BluRay: - type = InputType.Bluray; - inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray(); - break; - case VideoType.Dvd: - type = InputType.Dvd; - inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray(); - break; - case VideoType.Iso: - if (isoType.HasValue) - { - switch (isoType.Value) - { - case IsoType.BluRay: - type = InputType.Bluray; - inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray(); - break; - case IsoType.Dvd: - type = InputType.Dvd; - inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray(); - break; - } - } - break; - case VideoType.VideoFile: - { - if (isRemote) - { - type = InputType.Url; - } - break; - } + if (isoMount == null) + { + return GetPlayableStreamFiles(videoPath, playableStreamFileNames).ToArray(); + } + return GetPlayableStreamFiles(isoMount.MountedPath, playableStreamFileNames).ToArray(); } - return inputPath; + return new[] {videoPath}; } public static List GetPlayableStreamFiles(string rootPath, IEnumerable filenames) @@ -80,46 +47,6 @@ namespace MediaBrowser.Controller.MediaEncoding .ToList(); } - /// - /// Gets the type of the input. - /// - /// Type of the video. - /// Type of the iso. - /// InputType. - public static InputType GetInputType(VideoType? videoType, IsoType? isoType) - { - var type = InputType.File; - - if (videoType.HasValue) - { - switch (videoType.Value) - { - case VideoType.BluRay: - type = InputType.Bluray; - break; - case VideoType.Dvd: - type = InputType.Dvd; - break; - case VideoType.Iso: - if (isoType.HasValue) - { - switch (isoType.Value) - { - case IsoType.BluRay: - type = InputType.Bluray; - break; - case IsoType.Dvd: - type = InputType.Dvd; - break; - } - } - break; - } - } - - return type; - } - public static MediaInfo GetMediaInfo(InternalMediaInfoResult data) { var internalStreams = data.streams ?? new MediaStreamInfo[] { }; -- cgit v1.2.3