Fix more codec names

pull/12310/head
Bond_009 4 months ago
parent 1e7aca8a3d
commit 406320cb98

@ -1,7 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using BDInfo; using BDInfo;
using Jellyfin.Extensions;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.MediaInfo;
@ -104,7 +106,7 @@ public class BdInfoExaminer : IBlurayExaminer
BitRate = Convert.ToInt32(videoStream.BitRate), BitRate = Convert.ToInt32(videoStream.BitRate),
Width = videoStream.Width, Width = videoStream.Width,
Height = videoStream.Height, Height = videoStream.Height,
Codec = videoStream.CodecShortName, Codec = GetNormalizedCodec(videoStream),
IsInterlaced = videoStream.IsInterlaced, IsInterlaced = videoStream.IsInterlaced,
Type = MediaStreamType.Video, Type = MediaStreamType.Video,
Index = index Index = index
@ -131,9 +133,10 @@ public class BdInfoExaminer : IBlurayExaminer
{ {
var stream = new MediaStream var stream = new MediaStream
{ {
Codec = audioStream.CodecShortName, Codec = GetNormalizedCodec(audioStream),
Language = audioStream.LanguageCode, Language = audioStream.LanguageCode,
Channels = audioStream.ChannelCount, ChannelLayout = string.Format(CultureInfo.InvariantCulture, "{0:D}.{1:D}", audioStream.ChannelCount, audioStream.LFE),
Channels = audioStream.ChannelCount + audioStream.LFE,
SampleRate = audioStream.SampleRate, SampleRate = audioStream.SampleRate,
Type = MediaStreamType.Audio, Type = MediaStreamType.Audio,
Index = index Index = index
@ -146,11 +149,6 @@ public class BdInfoExaminer : IBlurayExaminer
stream.BitRate = bitrate; stream.BitRate = bitrate;
} }
if (audioStream.LFE > 0)
{
stream.Channels = audioStream.ChannelCount + 1;
}
streams.Add(stream); streams.Add(stream);
} }
@ -159,24 +157,26 @@ public class BdInfoExaminer : IBlurayExaminer
/// </summary> /// </summary>
/// <param name="streams">The streams.</param> /// <param name="streams">The streams.</param>
/// <param name="index">The stream index.</param> /// <param name="index">The stream index.</param>
/// <param name="textStream">The stream.</param> /// <param name="stream">The stream.</param>
private void AddSubtitleStream(List<MediaStream> streams, int index, TSStream textStream) private void AddSubtitleStream(List<MediaStream> streams, int index, TSStream stream)
{ {
streams.Add(new MediaStream streams.Add(new MediaStream
{ {
Language = textStream.LanguageCode, Language = stream.LanguageCode,
Codec = NormalizeSubtitleCodec(textStream.StreamType), Codec = GetNormalizedCodec(stream),
Type = MediaStreamType.Subtitle, Type = MediaStreamType.Subtitle,
Index = index Index = index
}); });
} }
private string NormalizeSubtitleCodec(TSStreamType codec) private string GetNormalizedCodec(TSStream stream)
=> codec switch => stream.StreamType switch
{ {
TSStreamType.INTERACTIVE_GRAPHICS => "igs", TSStreamType.MPEG1_VIDEO => "mpeg1video",
TSStreamType.MPEG2_VIDEO => "mpeg2video",
TSStreamType.VC1_VIDEO => "vc1",
TSStreamType.AC3_PLUS_AUDIO | TSStreamType.AC3_PLUS_SECONDARY_AUDIO => "eac3",
TSStreamType.PRESENTATION_GRAPHICS => "pgssub", TSStreamType.PRESENTATION_GRAPHICS => "pgssub",
TSStreamType.SUBTITLE => "sub", _ => stream.CodecShortName
_ => throw new ArgumentOutOfRangeException(nameof(codec), $"Invalid stream type for subtitle: {codec}")
}; };
} }

Loading…
Cancel
Save