From d5b5c8e1a5548f2f1321f0f9a63d86919de0b01e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 11 Oct 2016 02:46:59 -0400 Subject: update display of active recordings --- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 40 ++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs') diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 5c3345008..fc1444e1b 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -426,10 +426,24 @@ namespace MediaBrowser.MediaEncoding.Encoder var inputFiles = MediaEncoderHelpers.GetInputArgument(FileSystem, request.InputPath, request.Protocol, request.MountedIso, request.PlayableStreamFileNames); - var probeSizeArgument = GetProbeSizeArgument(inputFiles, request.Protocol); + var probeSize = EncodingUtils.GetProbeSizeArgument(inputFiles.Length); + string analyzeDuration; + + if (request.AnalyzeDurationSections > 0) + { + analyzeDuration = "-analyzeduration " + + (request.AnalyzeDurationSections*1000000).ToString(CultureInfo.InvariantCulture); + } + else + { + analyzeDuration = EncodingUtils.GetAnalyzeDurationArgument(inputFiles.Length); + } + + probeSize = probeSize + " " + analyzeDuration; + probeSize = probeSize.Trim(); return GetMediaInfoInternal(GetInputArgument(inputFiles, request.Protocol), request.InputPath, request.Protocol, extractChapters, - probeSizeArgument, request.MediaType == DlnaProfileType.Audio, request.VideoType, cancellationToken); + probeSize, request.MediaType == DlnaProfileType.Audio, request.VideoType, cancellationToken); } /// @@ -450,9 +464,23 @@ namespace MediaBrowser.MediaEncoding.Encoder /// The input files. /// The protocol. /// System.String. - public string GetProbeSizeArgument(string[] inputFiles, MediaProtocol protocol) + public string GetProbeSizeAndAnalyzeDurationArgument(string[] inputFiles, MediaProtocol protocol) { - return EncodingUtils.GetProbeSizeArgument(inputFiles.Length > 1); + var results = new List(); + + var probeSize = EncodingUtils.GetProbeSizeArgument(inputFiles.Length); + var analyzeDuration = EncodingUtils.GetAnalyzeDurationArgument(inputFiles.Length); + + if (!string.IsNullOrWhiteSpace(probeSize)) + { + results.Add(probeSize); + } + + if (!string.IsNullOrWhiteSpace(analyzeDuration)) + { + results.Add(analyzeDuration); + } + return string.Join(" ", results.ToArray()); } /// @@ -871,7 +899,7 @@ namespace MediaBrowser.MediaEncoding.Encoder var args = useIFrame ? string.Format("-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}{4}\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg, thumbnail) : string.Format("-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg); - var probeSize = GetProbeSizeArgument(new[] { inputPath }, protocol); + var probeSize = GetProbeSizeAndAnalyzeDurationArgument(new[] { inputPath }, protocol); if (!string.IsNullOrEmpty(probeSize)) { @@ -982,7 +1010,7 @@ namespace MediaBrowser.MediaEncoding.Encoder var args = string.Format("-i {0} -threads 0 -v quiet -vf \"{2}\" -f image2 \"{1}\"", inputArgument, outputPath, vf); - var probeSize = GetProbeSizeArgument(new[] { inputArgument }, protocol); + var probeSize = GetProbeSizeAndAnalyzeDurationArgument(new[] { inputArgument }, protocol); if (!string.IsNullOrEmpty(probeSize)) { -- cgit v1.2.3