aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Channels/ChannelMediaInfo.cs11
-rw-r--r--MediaBrowser.Controller/Dto/IDtoService.cs7
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs3
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs2
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvChannel.cs7
-rw-r--r--MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs41
-rw-r--r--MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs93
7 files changed, 36 insertions, 128 deletions
diff --git a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
index 2e2f1912a..e8369f573 100644
--- a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
+++ b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
@@ -1,4 +1,5 @@
-using System;
+using MediaBrowser.Model.MediaInfo;
+using System;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Channels
@@ -20,16 +21,18 @@ namespace MediaBrowser.Controller.Channels
public int? AudioChannels { get; set; }
public int? AudioSampleRate { get; set; }
- public bool IsRemote { get; set; }
-
public string VideoProfile { get; set; }
public float? VideoLevel { get; set; }
public float? Framerate { get; set; }
+ public MediaProtocol Protocol { get; set; }
+
public ChannelMediaInfo()
{
RequiredHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- IsRemote = true;
+
+ // This is most common
+ Protocol = MediaProtocol.Http;
}
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs
index b2081fe6b..0482e140b 100644
--- a/MediaBrowser.Controller/Dto/IDtoService.cs
+++ b/MediaBrowser.Controller/Dto/IDtoService.cs
@@ -68,13 +68,6 @@ namespace MediaBrowser.Controller.Dto
ChapterInfoDto GetChapterInfoDto(ChapterInfo chapterInfo, BaseItem item);
/// <summary>
- /// Gets the media sources.
- /// </summary>
- /// <param name="item">The item.</param>
- /// <returns>List{MediaSourceInfo}.</returns>
- List<MediaSourceInfo> GetMediaSources(BaseItem item);
-
- /// <summary>
/// Gets the item by name dto.
/// </summary>
/// <param name="item">The item.</param>
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index e14563ea4..bd407f91b 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -191,7 +192,7 @@ namespace MediaBrowser.Controller.Entities.Audio
var info = new MediaSourceInfo
{
Id = i.Id.ToString("N"),
- LocationType = locationType,
+ Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
MediaStreams = ItemRepository.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(),
Name = i.Name,
Path = enablePathSubstituion ? GetMappedPath(i.Path, locationType) : i.Path,
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 3df3f7440..61404949e 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.Entities
{
Id = i.Id.ToString("N"),
IsoType = i.IsoType,
- LocationType = locationType,
+ Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
MediaStreams = mediaStreams,
Name = GetMediaSourceName(i, mediaStreams),
Path = enablePathSubstitution ? GetMappedPath(i.Path, locationType) : i.Path,
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
index 5b78b6789..3c1c9f442 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
@@ -6,7 +6,7 @@ using System.Linq;
namespace MediaBrowser.Controller.LiveTv
{
- public class LiveTvChannel : BaseItem, IItemByName
+ public class LiveTvChannel : BaseItem, IItemByName, IHasMediaSources
{
/// <summary>
/// Gets the user data key.
@@ -114,5 +114,10 @@ namespace MediaBrowser.Controller.LiveTv
{
return new List<BaseItem>();
}
+
+ public IEnumerable<Model.Dto.MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
+ {
+ throw new System.NotImplementedException();
+ }
}
}
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.
/// </summary>
/// <param name="inputFiles">The input files.</param>
- /// <param name="type">The type.</param>
+ /// <param name="protocol">The protocol.</param>
/// <param name="threedFormat">The threed format.</param>
/// <param name="offset">The offset.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Stream}.</returns>
- Task<Stream> ExtractVideoImage(string[] inputFiles, InputType type, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
+ Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
/// <summary>
/// Gets the media info.
/// </summary>
/// <param name="inputFiles">The input files.</param>
- /// <param name="type">The type.</param>
+ /// <param name="protocol">The protocol.</param>
/// <param name="isAudio">if set to <c>true</c> [is audio].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task<InternalMediaInfoResult> GetMediaInfo(string[] inputFiles, InputType type, bool isAudio, CancellationToken cancellationToken);
+ Task<InternalMediaInfoResult> GetMediaInfo(string[] inputFiles, MediaProtocol protocol, bool isAudio, CancellationToken cancellationToken);
/// <summary>
/// Gets the probe size argument.
/// </summary>
- /// <param name="type">The type.</param>
+ /// <param name="inputFiles">The input files.</param>
+ /// <param name="protocol">The protocol.</param>
/// <returns>System.String.</returns>
- string GetProbeSizeArgument(InputType type);
+ string GetProbeSizeArgument(string[] inputFiles, MediaProtocol protocol);
/// <summary>
/// Gets the input argument.
/// </summary>
/// <param name="inputFiles">The input files.</param>
- /// <param name="type">The type.</param>
+ /// <param name="protocol">The protocol.</param>
/// <returns>System.String.</returns>
- string GetInputArgument(string[] inputFiles, InputType type);
- }
-
- /// <summary>
- /// Enum InputType
- /// </summary>
- public enum InputType
- {
- /// <summary>
- /// The file
- /// </summary>
- File,
- /// <summary>
- /// The bluray
- /// </summary>
- Bluray,
- /// <summary>
- /// The DVD
- /// </summary>
- Dvd,
- /// <summary>
- /// The URL
- /// </summary>
- 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.
/// </summary>
/// <param name="videoPath">The video path.</param>
- /// <param name="isRemote">if set to <c>true</c> [is remote].</param>
- /// <param name="videoType">Type of the video.</param>
- /// <param name="isoType">Type of the iso.</param>
+ /// <param name="protocol">The protocol.</param>
/// <param name="isoMount">The iso mount.</param>
/// <param name="playableStreamFileNames">The playable stream file names.</param>
- /// <param name="type">The type.</param>
/// <returns>System.String[][].</returns>
- public static string[] GetInputArgument(string videoPath, bool isRemote, VideoType videoType, IsoType? isoType, IIsoMount isoMount, IEnumerable<string> playableStreamFileNames, out InputType type)
+ public static string[] GetInputArgument(string videoPath, MediaProtocol protocol, IIsoMount isoMount, List<string> 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<string> GetPlayableStreamFiles(string rootPath, IEnumerable<string> filenames)
@@ -80,46 +47,6 @@ namespace MediaBrowser.Controller.MediaEncoding
.ToList();
}
- /// <summary>
- /// Gets the type of the input.
- /// </summary>
- /// <param name="videoType">Type of the video.</param>
- /// <param name="isoType">Type of the iso.</param>
- /// <returns>InputType.</returns>
- 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[] { };