using MediaBrowser.Common.MediaInfo;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Controller.MediaInfo
{
///
/// Class MediaEncoderHelpers
///
public static class MediaEncoderHelpers
{
///
/// Gets the input argument.
///
/// The video.
/// The iso mount.
/// The type.
/// System.String[][].
public static string[] GetInputArgument(Video video, IIsoMount isoMount, out InputType type)
{
var inputPath = isoMount == null ? new[] { video.Path } : new[] { isoMount.MountedPath };
type = InputType.VideoFile;
switch (video.VideoType)
{
case VideoType.BluRay:
type = InputType.Bluray;
break;
case VideoType.Dvd:
type = InputType.Dvd;
inputPath = video.GetPlayableStreamFiles(inputPath[0]).ToArray();
break;
case VideoType.Iso:
if (video.IsoType.HasValue)
{
switch (video.IsoType.Value)
{
case IsoType.BluRay:
type = InputType.Bluray;
break;
case IsoType.Dvd:
type = InputType.Dvd;
inputPath = video.GetPlayableStreamFiles(inputPath[0]).ToArray();
break;
}
}
break;
case VideoType.VideoFile:
{
if (video.LocationType == LocationType.Remote)
{
type = InputType.Url;
}
break;
}
}
return inputPath;
}
///
/// Gets the type of the input.
///
/// The path.
/// Type of the video.
/// Type of the iso.
/// InputType.
public static InputType GetInputType(string path, VideoType? videoType, IsoType? isoType)
{
var type = InputType.AudioFile;
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;
}
}
}