Merge pull request #7802 from jellyfin/external

(cherry picked from commit 9954cbd550)
Signed-off-by: crobibero <cody@robibe.ro>
pull/7916/head
Cody Robibero 3 years ago committed by crobibero
parent b8722d02a3
commit 3a95d4b04e

@ -106,15 +106,23 @@ namespace MediaBrowser.Providers.MediaInfo
if (mediaInfo.MediaStreams.Count == 1) if (mediaInfo.MediaStreams.Count == 1)
{ {
MediaStream mediaStream = mediaInfo.MediaStreams[0]; MediaStream mediaStream = mediaInfo.MediaStreams[0];
if ((mediaStream.Type == MediaStreamType.Audio && _type == DlnaProfileType.Audio)
|| (mediaStream.Type == MediaStreamType.Subtitle && _type == DlnaProfileType.Subtitle))
{
mediaStream.Index = startIndex++; mediaStream.Index = startIndex++;
mediaStream.IsDefault = pathInfo.IsDefault || mediaStream.IsDefault; mediaStream.IsDefault = pathInfo.IsDefault || mediaStream.IsDefault;
mediaStream.IsForced = pathInfo.IsForced || mediaStream.IsForced; mediaStream.IsForced = pathInfo.IsForced || mediaStream.IsForced;
mediaStreams.Add(MergeMetadata(mediaStream, pathInfo)); mediaStreams.Add(MergeMetadata(mediaStream, pathInfo));
} }
}
else else
{ {
foreach (MediaStream mediaStream in mediaInfo.MediaStreams) foreach (MediaStream mediaStream in mediaInfo.MediaStreams)
{
if ((mediaStream.Type == MediaStreamType.Audio && _type == DlnaProfileType.Audio)
|| (mediaStream.Type == MediaStreamType.Subtitle && _type == DlnaProfileType.Subtitle))
{ {
mediaStream.Index = startIndex++; mediaStream.Index = startIndex++;
@ -123,6 +131,7 @@ namespace MediaBrowser.Providers.MediaInfo
} }
} }
} }
}
return mediaStreams.AsReadOnly(); return mediaStreams.AsReadOnly();
} }
@ -222,13 +231,6 @@ namespace MediaBrowser.Providers.MediaInfo
mediaStream.Title = string.IsNullOrEmpty(mediaStream.Title) ? (string.IsNullOrEmpty(pathInfo.Title) ? null : pathInfo.Title) : mediaStream.Title; mediaStream.Title = string.IsNullOrEmpty(mediaStream.Title) ? (string.IsNullOrEmpty(pathInfo.Title) ? null : pathInfo.Title) : mediaStream.Title;
mediaStream.Language = string.IsNullOrEmpty(mediaStream.Language) ? (string.IsNullOrEmpty(pathInfo.Language) ? null : pathInfo.Language) : mediaStream.Language; mediaStream.Language = string.IsNullOrEmpty(mediaStream.Language) ? (string.IsNullOrEmpty(pathInfo.Language) ? null : pathInfo.Language) : mediaStream.Language;
mediaStream.Type = _type switch
{
DlnaProfileType.Audio => MediaStreamType.Audio,
DlnaProfileType.Subtitle => MediaStreamType.Subtitle,
_ => mediaStream.Type
};
return mediaStream; return mediaStream;
} }
} }

@ -43,6 +43,9 @@ public class AudioResolverTests
MediaStreams = new List<MediaStream> MediaStreams = new List<MediaStream>
{ {
new() new()
{
Type = MediaStreamType.Audio
}
} }
})); }));

@ -359,7 +359,10 @@ public class MediaInfoResolverTests
var mediaStreams = new List<MediaStream>(); var mediaStreams = new List<MediaStream>();
for (int i = 0; i < streamCount; i++) for (int i = 0; i < streamCount; i++)
{ {
mediaStreams.Add(new()); mediaStreams.Add(new()
{
Type = MediaStreamType.Subtitle
});
} }
return mediaStreams; return mediaStreams;

@ -43,6 +43,9 @@ public class SubtitleResolverTests
MediaStreams = new List<MediaStream> MediaStreams = new List<MediaStream>
{ {
new() new()
{
Type = MediaStreamType.Subtitle
}
} }
})); }));

Loading…
Cancel
Save