allow strm probe to succeed

This commit is contained in:
whiteowl3 2022-03-11 06:54:25 +00:00
parent a5ffde0e9c
commit 6f25291931
2 changed files with 20 additions and 15 deletions

View File

@ -458,17 +458,19 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
_logger.LogDebug("{ProcessFileName} {ProcessArgs}", process.StartInfo.FileName, process.StartInfo.Arguments);
}
using (var processWrapper = new ProcessWrapper(process, this))
{
MemoryStream memoryStream = new MemoryStream();
_logger.LogDebug("Starting ffprobe with args {Args}", args);
StartProcess(processWrapper);
await process.StandardOutput.BaseStream.CopyToAsync(memoryStream, cancellationToken: cancellationToken);
memoryStream.Seek(0, SeekOrigin.Begin);
InternalMediaInfoResult result;
try
{
result = await JsonSerializer.DeserializeAsync<InternalMediaInfoResult>(
process.StandardOutput.BaseStream,
memoryStream,
_jsonSerializerOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}

View File

@ -100,25 +100,28 @@ namespace MediaBrowser.Providers.MediaInfo
foreach (var pathInfo in pathInfos)
{
var mediaInfo = await GetMediaInfo(pathInfo.Path, _type, cancellationToken).ConfigureAwait(false);
if (mediaInfo.MediaStreams.Count == 1)
if (!pathInfo.Path.EndsWith(".strm"))
{
MediaStream mediaStream = mediaInfo.MediaStreams[0];
mediaStream.Index = startIndex++;
mediaStream.IsDefault = pathInfo.IsDefault || mediaStream.IsDefault;
mediaStream.IsForced = pathInfo.IsForced || mediaStream.IsForced;
var mediaInfo = await GetMediaInfo(pathInfo.Path, _type, cancellationToken).ConfigureAwait(false);
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
}
else
{
foreach (MediaStream mediaStream in mediaInfo.MediaStreams)
if (mediaInfo.MediaStreams.Count == 1)
{
MediaStream mediaStream = mediaInfo.MediaStreams[0];
mediaStream.Index = startIndex++;
mediaStream.IsDefault = pathInfo.IsDefault || mediaStream.IsDefault;
mediaStream.IsForced = pathInfo.IsForced || mediaStream.IsForced;
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
}
else
{
foreach (MediaStream mediaStream in mediaInfo.MediaStreams)
{
mediaStream.Index = startIndex++;
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
}
}
}
}