mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
Fixed: FLAC audio channels in media info
(cherry picked from commit ab45910e5643aa8390797ae98af94eac690b3bb5)
This commit is contained in:
parent
7e70166b62
commit
6e46720d7b
@ -64,6 +64,21 @@ public void should_use_AudioChannels_if_schema_revision_is_3_and_other_propertie
|
|||||||
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(2);
|
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_use_AudioChannels_if_schema_revision_is_3_and_AudioChannelPositions_is_0()
|
||||||
|
{
|
||||||
|
var mediaInfoModel = new MediaInfoModel
|
||||||
|
{
|
||||||
|
AudioFormat = "FLAC",
|
||||||
|
AudioChannelsContainer = 6,
|
||||||
|
AudioChannelPositions = "0/0/0",
|
||||||
|
AudioChannelPositionsTextContainer = null,
|
||||||
|
SchemaRevision = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(5.1m);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_sum_AudioChannelPositions()
|
public void should_sum_AudioChannelPositions()
|
||||||
{
|
{
|
||||||
@ -128,6 +143,21 @@ public void should_format_8_channel_blank_as_71_if_dtsx()
|
|||||||
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m);
|
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(7.1m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_format_6_channel_zero_as_51_if_flac()
|
||||||
|
{
|
||||||
|
var mediaInfoModel = new MediaInfoModel
|
||||||
|
{
|
||||||
|
AudioFormat = "FLAC",
|
||||||
|
AudioChannelsContainer = 6,
|
||||||
|
AudioChannelPositions = "0/0/0",
|
||||||
|
AudioChannelPositionsTextContainer = null,
|
||||||
|
SchemaRevision = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
MediaInfoFormatter.FormatAudioChannels(mediaInfoModel).Should().Be(5.1m);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_ignore_culture_on_channel_summary()
|
public void should_ignore_culture_on_channel_summary()
|
||||||
{
|
{
|
||||||
|
@ -21,12 +21,12 @@ public static decimal FormatAudioChannels(MediaInfoModel mediaInfo)
|
|||||||
{
|
{
|
||||||
var audioChannels = FormatAudioChannelsFromAudioChannelPositions(mediaInfo);
|
var audioChannels = FormatAudioChannelsFromAudioChannelPositions(mediaInfo);
|
||||||
|
|
||||||
if (audioChannels == null)
|
if (audioChannels == null || audioChannels == 0.0m)
|
||||||
{
|
{
|
||||||
audioChannels = FormatAudioChannelsFromAudioChannelPositionsText(mediaInfo);
|
audioChannels = FormatAudioChannelsFromAudioChannelPositionsText(mediaInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audioChannels == null)
|
if (audioChannels == null || audioChannels == 0.0m)
|
||||||
{
|
{
|
||||||
audioChannels = FormatAudioChannelsFromAudioChannels(mediaInfo);
|
audioChannels = FormatAudioChannelsFromAudioChannels(mediaInfo);
|
||||||
}
|
}
|
||||||
@ -565,6 +565,12 @@ public static string FormatVideoCodecLegacy(MediaInfoModel mediaInfo, string sce
|
|||||||
return audioChannelsContainer - 1 + 0.1m;
|
return audioChannelsContainer - 1 + 0.1m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FLAC 6 channels is likely 5.1
|
||||||
|
if (audioFormat.ContainsIgnoreCase("FLAC") && audioChannelsContainer == 6)
|
||||||
|
{
|
||||||
|
return 5.1m;
|
||||||
|
}
|
||||||
|
|
||||||
if (mediaInfo.SchemaRevision > 5)
|
if (mediaInfo.SchemaRevision > 5)
|
||||||
{
|
{
|
||||||
return audioChannelsStream > 0 ? audioChannelsStream : audioChannelsContainer;
|
return audioChannelsStream > 0 ? audioChannelsStream : audioChannelsContainer;
|
||||||
|
Loading…
Reference in New Issue
Block a user