mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Remove PlayableStreamFileNames as unused
Since ffmpeg can play and transcode ISO files and BDMV folders directly, there's no use of that property.
This commit is contained in:
parent
3ad6232973
commit
cd4641dca0
@ -136,7 +136,7 @@ namespace Emby.Server.Implementations.MediaEncoder
|
||||
// Add some time for the first chapter to make sure we don't end up with a black image
|
||||
var time = chapter.StartPositionTicks == 0 ? TimeSpan.FromTicks(Math.Min(_firstChapterTicks, video.RunTimeTicks ?? 0)) : TimeSpan.FromTicks(chapter.StartPositionTicks);
|
||||
|
||||
var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, Array.Empty<string>());
|
||||
var inputPath = video.Path;
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
|
@ -762,11 +762,6 @@ namespace Jellyfin.Api.Helpers
|
||||
|
||||
private async Task AcquireResources(StreamState state, CancellationTokenSource cancellationTokenSource)
|
||||
{
|
||||
if (state.VideoType == VideoType.Iso && state.IsoType.HasValue && state.IsoType == IsoType.Dvd && _isoManager.CanMount(state.MediaPath))
|
||||
{
|
||||
state.IsoMount = await _isoManager.Mount(state.MediaPath, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (state.MediaSource.RequiresOpening && string.IsNullOrWhiteSpace(state.Request.LiveStreamId))
|
||||
{
|
||||
var liveStreamResponse = await _mediaSourceManager.OpenLiveStream(
|
||||
|
@ -143,26 +143,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The video3 D format.</value>
|
||||
public Video3DFormat? Video3DFormat { get; set; }
|
||||
|
||||
public string[] GetPlayableStreamFileNames()
|
||||
{
|
||||
var videoType = VideoType;
|
||||
|
||||
if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.BluRay)
|
||||
{
|
||||
videoType = VideoType.BluRay;
|
||||
}
|
||||
else if (videoType == VideoType.Iso && IsoType == Model.Entities.IsoType.Dvd)
|
||||
{
|
||||
videoType = VideoType.Dvd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the aspect ratio.
|
||||
/// </summary>
|
||||
@ -415,31 +395,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return updateType;
|
||||
}
|
||||
|
||||
public static string[] QueryPlayableStreamFiles(string rootPath, VideoType videoType)
|
||||
{
|
||||
if (videoType == VideoType.Dvd)
|
||||
{
|
||||
return FileSystem.GetFiles(rootPath, new[] { ".vob" }, false, true)
|
||||
.OrderByDescending(i => i.Length)
|
||||
.ThenBy(i => i.FullName)
|
||||
.Take(1)
|
||||
.Select(i => i.FullName)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
if (videoType == VideoType.BluRay)
|
||||
{
|
||||
return FileSystem.GetFiles(rootPath, new[] { ".m2ts" }, false, true)
|
||||
.OrderByDescending(i => i.Length)
|
||||
.ThenBy(i => i.FullName)
|
||||
.Take(1)
|
||||
.Select(i => i.FullName)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [is3 D].
|
||||
/// </summary>
|
||||
|
@ -2323,18 +2323,10 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
}
|
||||
|
||||
public string GetProbeSizeArgument(int numInputFiles)
|
||||
=> numInputFiles > 1 ? "-probesize " + _configuration.GetFFmpegProbeSize() : string.Empty;
|
||||
|
||||
public string GetAnalyzeDurationArgument(int numInputFiles)
|
||||
=> numInputFiles > 1 ? "-analyzeduration " + _configuration.GetFFmpegAnalyzeDuration() : string.Empty;
|
||||
|
||||
public string GetInputModifier(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
{
|
||||
var inputModifier = string.Empty;
|
||||
|
||||
var numInputFiles = state.PlayableStreamFileNames.Length > 0 ? state.PlayableStreamFileNames.Length : 1;
|
||||
var probeSizeArgument = GetProbeSizeArgument(numInputFiles);
|
||||
var probeSizeArgument = string.Empty;
|
||||
|
||||
string analyzeDurationArgument;
|
||||
if (state.MediaSource.AnalyzeDurationMs.HasValue)
|
||||
@ -2343,7 +2335,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
else
|
||||
{
|
||||
analyzeDurationArgument = GetAnalyzeDurationArgument(numInputFiles);
|
||||
analyzeDurationArgument = string.Empty;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(probeSizeArgument))
|
||||
@ -2526,28 +2518,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
state.IsoType = mediaSource.IsoType;
|
||||
|
||||
if (mediaSource.VideoType.HasValue)
|
||||
{
|
||||
state.VideoType = mediaSource.VideoType.Value;
|
||||
|
||||
if (mediaSource.VideoType.Value == VideoType.Dvd)
|
||||
{
|
||||
state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, mediaSource.VideoType.Value).Select(Path.GetFileName).ToArray();
|
||||
}
|
||||
else if (mediaSource.VideoType.Value == VideoType.Iso && state.IsoType == IsoType.Dvd)
|
||||
{
|
||||
state.PlayableStreamFileNames = Video.QueryPlayableStreamFiles(state.MediaPath, VideoType.Dvd).Select(Path.GetFileName).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
state.PlayableStreamFileNames = Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state.PlayableStreamFileNames = Array.Empty<string>();
|
||||
}
|
||||
|
||||
if (mediaSource.Timestamp.HasValue)
|
||||
{
|
||||
state.InputTimestamp = mediaSource.Timestamp.Value;
|
||||
|
@ -33,10 +33,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
public bool IsInputVideo { get; set; }
|
||||
|
||||
public IIsoMount IsoMount { get; set; }
|
||||
|
||||
public string[] PlayableStreamFileNames { get; set; }
|
||||
|
||||
public string OutputAudioCodec { get; set; }
|
||||
|
||||
public int? OutputVideoBitrate { get; set; }
|
||||
@ -308,7 +304,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
TranscodingType = jobType;
|
||||
RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
PlayableStreamFileNames = Array.Empty<string>();
|
||||
SupportedAudioCodecs = Array.Empty<string>();
|
||||
SupportedVideoCodecs = Array.Empty<string>();
|
||||
SupportedSubtitleCodecs = Array.Empty<string>();
|
||||
|
@ -62,14 +62,14 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// <summary>
|
||||
/// Extracts the video image.
|
||||
/// </summary>
|
||||
Task<string> ExtractVideoImage(string[] inputFiles, string container, MediaSourceInfo mediaSource, MediaStream videoStream, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
|
||||
Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream videoStream, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
|
||||
|
||||
Task<string> ExtractVideoImage(string[] inputFiles, string container, MediaSourceInfo mediaSource, MediaStream imageStream, int? imageStreamIndex, CancellationToken cancellationToken);
|
||||
Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream imageStream, int? imageStreamIndex, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the video images on interval.
|
||||
/// </summary>
|
||||
Task ExtractVideoImagesOnInterval(string[] inputFiles,
|
||||
Task ExtractVideoImagesOnInterval(string inputFile,
|
||||
string container,
|
||||
MediaStream videoStream,
|
||||
MediaSourceInfo mediaSource,
|
||||
@ -91,10 +91,10 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// <summary>
|
||||
/// Gets the input argument.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="inputFile">The input file.</param>
|
||||
/// <param name="mediaSource">The mediaSource.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetInputArgument(IReadOnlyList<string> inputFiles, MediaSourceInfo mediaSource);
|
||||
string GetInputArgument(string inputFile, MediaSourceInfo mediaSource);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time parameter.
|
||||
|
@ -13,32 +13,5 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// </summary>
|
||||
public static class MediaEncoderHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the input argument.
|
||||
/// </summary>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <param name="videoPath">The video path.</param>
|
||||
/// <param name="playableStreamFileNames">The playable stream file names.</param>
|
||||
/// <returns>string[].</returns>
|
||||
public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, IReadOnlyCollection<string> playableStreamFileNames)
|
||||
{
|
||||
if (playableStreamFileNames.Count > 0)
|
||||
{
|
||||
return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames);
|
||||
}
|
||||
|
||||
return new[] { videoPath };
|
||||
}
|
||||
|
||||
private static string[] GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, IEnumerable<string> filenames)
|
||||
{
|
||||
var allFiles = fileSystem
|
||||
.GetFilePaths(rootPath, true)
|
||||
.ToArray();
|
||||
|
||||
return filenames.Select(name => allFiles.FirstOrDefault(f => string.Equals(Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(f => !string.IsNullOrEmpty(f))
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
@ -14,14 +12,5 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
public bool ExtractChapters { get; set; }
|
||||
|
||||
public DlnaProfileType MediaType { get; set; }
|
||||
|
||||
public IIsoMount MountedIso { get; set; }
|
||||
|
||||
public string[] PlayableStreamFileNames { get; set; }
|
||||
|
||||
public MediaInfoRequest()
|
||||
{
|
||||
PlayableStreamFileNames = Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ namespace MediaBrowser.MediaEncoding.Attachments
|
||||
if (!File.Exists(outputPath))
|
||||
{
|
||||
await ExtractAttachmentInternal(
|
||||
_mediaEncoder.GetInputArgument(new[] { inputFile }, mediaSource),
|
||||
_mediaEncoder.GetInputArgument(inputFile, mediaSource),
|
||||
attachmentStreamIndex,
|
||||
outputPath,
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
@ -1,46 +1,35 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.MediaEncoding.Encoder
|
||||
{
|
||||
public static class EncodingUtils
|
||||
{
|
||||
public static string GetInputArgument(string inputPrefix, IReadOnlyList<string> inputFiles, MediaProtocol protocol)
|
||||
public static string GetInputArgument(string inputPrefix, string inputFile, MediaProtocol protocol)
|
||||
{
|
||||
if (protocol != MediaProtocol.File)
|
||||
{
|
||||
var url = inputFiles[0];
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, "\"{0}\"", url);
|
||||
return string.Format(CultureInfo.InvariantCulture, "\"{0}\"", inputFile);
|
||||
}
|
||||
|
||||
return GetConcatInputArgument(inputFiles, inputPrefix);
|
||||
return GetConcatInputArgument(inputFile, inputPrefix);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the concat input argument.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="inputFile">The input file.</param>
|
||||
/// <param name="inputPrefix">The input prefix.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string GetConcatInputArgument(IReadOnlyList<string> inputFiles, string inputPrefix)
|
||||
private static string GetConcatInputArgument(string inputFile, string inputPrefix)
|
||||
{
|
||||
// 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));
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, "concat:\"{0}\"", files);
|
||||
}
|
||||
|
||||
// Determine the input path for video files
|
||||
return GetFileInputArgument(inputFiles[0], inputPrefix);
|
||||
return GetFileInputArgument(inputFile, inputPrefix);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -83,8 +83,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
_jsonSerializerOptions = JsonDefaults.GetOptions();
|
||||
}
|
||||
|
||||
private EncodingHelper EncodingHelper => _encodingHelperFactory.Value;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string EncoderPath => _ffmpegPath;
|
||||
|
||||
@ -319,33 +317,24 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
public Task<MediaInfo> GetMediaInfo(MediaInfoRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
var extractChapters = request.MediaType == DlnaProfileType.Video && request.ExtractChapters;
|
||||
var inputFile = request.MediaSource.Path;
|
||||
|
||||
var inputFiles = MediaEncoderHelpers.GetInputArgument(_fileSystem, request.MediaSource.Path, request.PlayableStreamFileNames);
|
||||
|
||||
var probeSize = EncodingHelper.GetProbeSizeArgument(inputFiles.Length);
|
||||
string analyzeDuration;
|
||||
string analyzeDuration = string.Empty;
|
||||
|
||||
if (request.MediaSource.AnalyzeDurationMs > 0)
|
||||
{
|
||||
analyzeDuration = "-analyzeduration " +
|
||||
(request.MediaSource.AnalyzeDurationMs * 1000).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
analyzeDuration = EncodingHelper.GetAnalyzeDurationArgument(inputFiles.Length);
|
||||
}
|
||||
|
||||
probeSize = probeSize + " " + analyzeDuration;
|
||||
probeSize = probeSize.Trim();
|
||||
|
||||
var forceEnableLogging = request.MediaSource.Protocol != MediaProtocol.File;
|
||||
|
||||
return GetMediaInfoInternal(
|
||||
GetInputArgument(inputFiles, request.MediaSource),
|
||||
GetInputArgument(inputFile, request.MediaSource),
|
||||
request.MediaSource.Path,
|
||||
request.MediaSource.Protocol,
|
||||
extractChapters,
|
||||
probeSize,
|
||||
analyzeDuration,
|
||||
request.MediaType == DlnaProfileType.Audio,
|
||||
request.MediaSource.VideoType,
|
||||
forceEnableLogging,
|
||||
@ -355,11 +344,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
/// <summary>
|
||||
/// Gets the input argument.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="inputFile">The input file.</param>
|
||||
/// <param name="mediaSource">The mediaSource.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="ArgumentException">Unrecognized InputType.</exception>
|
||||
public string GetInputArgument(IReadOnlyList<string> inputFiles, MediaSourceInfo mediaSource)
|
||||
public string GetInputArgument(string inputFile, MediaSourceInfo mediaSource)
|
||||
{
|
||||
var prefix = "file";
|
||||
if (mediaSource.VideoType == VideoType.BluRay || mediaSource.VideoType == VideoType.Iso)
|
||||
@ -367,7 +356,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
prefix = "bluray";
|
||||
}
|
||||
|
||||
return EncodingUtils.GetInputArgument(prefix, inputFiles, mediaSource.Protocol);
|
||||
return EncodingUtils.GetInputArgument(prefix, inputFile, mediaSource.Protocol);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -471,21 +460,21 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
Protocol = MediaProtocol.File
|
||||
};
|
||||
|
||||
return ExtractImage(new[] { path }, null, null, imageStreamIndex, mediaSource, true, null, null, cancellationToken);
|
||||
return ExtractImage(path, null, null, imageStreamIndex, mediaSource, true, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string> ExtractVideoImage(string[] inputFiles, string container, MediaSourceInfo mediaSource, MediaStream videoStream, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken)
|
||||
public Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream videoStream, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken)
|
||||
{
|
||||
return ExtractImage(inputFiles, container, videoStream, null, mediaSource, false, threedFormat, offset, cancellationToken);
|
||||
return ExtractImage(inputFile, container, videoStream, null, mediaSource, false, threedFormat, offset, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string> ExtractVideoImage(string[] inputFiles, string container, MediaSourceInfo mediaSource, MediaStream imageStream, int? imageStreamIndex, CancellationToken cancellationToken)
|
||||
public Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream imageStream, int? imageStreamIndex, CancellationToken cancellationToken)
|
||||
{
|
||||
return ExtractImage(inputFiles, container, imageStream, imageStreamIndex, mediaSource, false, null, null, cancellationToken);
|
||||
return ExtractImage(inputFile, container, imageStream, imageStreamIndex, mediaSource, false, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
private async Task<string> ExtractImage(
|
||||
string[] inputFiles,
|
||||
string inputFile,
|
||||
string container,
|
||||
MediaStream videoStream,
|
||||
int? imageStreamIndex,
|
||||
@ -495,7 +484,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
TimeSpan? offset,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var inputArgument = GetInputArgument(inputFiles, mediaSource);
|
||||
var inputArgument = GetInputArgument(inputFile, mediaSource);
|
||||
|
||||
if (isAudio)
|
||||
{
|
||||
@ -572,8 +561,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
var args = useIFrame ? string.Format(CultureInfo.InvariantCulture, "-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}{4}\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg, thumbnail) :
|
||||
string.Format(CultureInfo.InvariantCulture, "-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg);
|
||||
|
||||
var probeSizeArgument = EncodingHelper.GetProbeSizeArgument(1);
|
||||
var analyzeDurationArgument = EncodingHelper.GetAnalyzeDurationArgument(1);
|
||||
var probeSizeArgument = string.Empty;
|
||||
var analyzeDurationArgument = string.Empty;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(probeSizeArgument))
|
||||
{
|
||||
@ -682,7 +671,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
|
||||
public async Task ExtractVideoImagesOnInterval(
|
||||
string[] inputFiles,
|
||||
string inputFile,
|
||||
string container,
|
||||
MediaStream videoStream,
|
||||
MediaSourceInfo mediaSource,
|
||||
@ -693,7 +682,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
int? maxWidth,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var inputArgument = GetInputArgument(inputFiles, mediaSource);
|
||||
var inputArgument = GetInputArgument(inputFile, mediaSource);
|
||||
|
||||
var vf = "fps=fps=1/" + interval.TotalSeconds.ToString(_usCulture);
|
||||
|
||||
@ -709,8 +698,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
|
||||
var args = string.Format(CultureInfo.InvariantCulture, "-i {0} -threads 0 -v quiet -vf \"{2}\" -f image2 \"{1}\"", inputArgument, outputPath, vf);
|
||||
|
||||
var probeSizeArgument = EncodingHelper.GetProbeSizeArgument(1);
|
||||
var analyzeDurationArgument = EncodingHelper.GetAnalyzeDurationArgument(1);
|
||||
var probeSizeArgument = string.Empty;
|
||||
var analyzeDurationArgument = string.Empty;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(probeSizeArgument))
|
||||
{
|
||||
|
@ -168,18 +168,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
MediaStream subtitleStream,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
string[] inputFiles;
|
||||
|
||||
if (mediaSource.VideoType.HasValue
|
||||
&& (mediaSource.VideoType.Value == VideoType.BluRay || mediaSource.VideoType.Value == VideoType.Dvd))
|
||||
{
|
||||
var mediaSourceItem = (Video)_libraryManager.GetItemById(new Guid(mediaSource.Id));
|
||||
inputFiles = mediaSourceItem.GetPlayableStreamFileNames();
|
||||
}
|
||||
else
|
||||
{
|
||||
inputFiles = new[] { mediaSource.Path };
|
||||
}
|
||||
var inputFile = mediaSource.Path;
|
||||
|
||||
var protocol = mediaSource.Protocol;
|
||||
if (subtitleStream.IsExternal)
|
||||
@ -187,7 +176,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
protocol = _mediaSourceManager.GetPathProtocol(subtitleStream.Path);
|
||||
}
|
||||
|
||||
var fileInfo = await GetReadableFile(mediaSource.Path, inputFiles, mediaSource, subtitleStream, cancellationToken).ConfigureAwait(false);
|
||||
var fileInfo = await GetReadableFile(mediaSource.Path, inputFile, mediaSource, subtitleStream, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var stream = await GetSubtitleStream(fileInfo.Path, fileInfo.Protocol, fileInfo.IsExternal, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@ -220,7 +209,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
|
||||
private async Task<SubtitleInfo> GetReadableFile(
|
||||
string mediaPath,
|
||||
string[] inputFiles,
|
||||
string inputFile,
|
||||
MediaSourceInfo mediaSource,
|
||||
MediaStream subtitleStream,
|
||||
CancellationToken cancellationToken)
|
||||
@ -254,7 +243,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
// Extract
|
||||
var outputPath = GetSubtitleCachePath(mediaPath, mediaSource, subtitleStream.Index, "." + outputFormat);
|
||||
|
||||
await ExtractTextSubtitle(inputFiles, mediaSource, subtitleStream.Index, outputCodec, outputPath, cancellationToken)
|
||||
await ExtractTextSubtitle(inputFile, mediaSource, subtitleStream.Index, outputCodec, outputPath, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return new SubtitleInfo(outputPath, MediaProtocol.File, outputFormat, false);
|
||||
@ -515,7 +504,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
/// <summary>
|
||||
/// Extracts the text subtitle.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="inputFile">The input file.</param>
|
||||
/// <param name="mediaSource">The mediaSource.</param>
|
||||
/// <param name="subtitleStreamIndex">Index of the subtitle stream.</param>
|
||||
/// <param name="outputCodec">The output codec.</param>
|
||||
@ -524,7 +513,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="ArgumentException">Must use inputPath list overload.</exception>
|
||||
private async Task ExtractTextSubtitle(
|
||||
string[] inputFiles,
|
||||
string inputFile,
|
||||
MediaSourceInfo mediaSource,
|
||||
int subtitleStreamIndex,
|
||||
string outputCodec,
|
||||
@ -540,7 +529,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
if (!File.Exists(outputPath))
|
||||
{
|
||||
await ExtractTextSubtitleInternal(
|
||||
_mediaEncoder.GetInputArgument(inputFiles, mediaSource),
|
||||
_mediaEncoder.GetInputArgument(inputFile, mediaSource),
|
||||
subtitleStreamIndex,
|
||||
outputCodec,
|
||||
outputPath,
|
||||
|
@ -116,7 +116,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
streamFileNames = Array.Empty<string>();
|
||||
}
|
||||
|
||||
mediaInfoResult = await GetMediaInfo(item, streamFileNames, cancellationToken).ConfigureAwait(false);
|
||||
mediaInfoResult = await GetMediaInfo(item, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
@ -128,7 +128,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
|
||||
private Task<Model.MediaInfo.MediaInfo> GetMediaInfo(
|
||||
Video item,
|
||||
string[] streamFileNames,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
@ -145,7 +144,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
return _mediaEncoder.GetMediaInfo(
|
||||
new MediaInfoRequest
|
||||
{
|
||||
PlayableStreamFileNames = streamFileNames,
|
||||
ExtractChapters = true,
|
||||
MediaType = DlnaProfileType.Video,
|
||||
MediaSource = new MediaSourceInfo
|
||||
|
@ -70,10 +70,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
{
|
||||
var protocol = item.PathProtocol ?? MediaProtocol.File;
|
||||
|
||||
var inputPath = MediaEncoderHelpers.GetInputArgument(
|
||||
_fileSystem,
|
||||
item.Path,
|
||||
item.GetPlayableStreamFileNames());
|
||||
var inputPath = item.Path;
|
||||
|
||||
var mediaStreams =
|
||||
item.GetMediaStreams();
|
||||
|
Loading…
x
Reference in New Issue
Block a user