1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-27 23:06:29 -04:00

New: Bump FFMpegCore to 5.4.0 and FFprobe to 8.0.1

This commit is contained in:
Bogdan
2025-10-20 16:37:38 +03:00
committed by Mark McDowall
parent 5f9f8fddad
commit 227db9ef39
8 changed files with 117 additions and 116 deletions
@@ -1,4 +1,5 @@
using FluentAssertions;
using System;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Test.Common;
@@ -8,7 +9,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
[TestFixture]
public class FormatAudioCodecFixture : TestBase
{
private static string sceneName = "My.Series.S01E01-Sonarr";
private const string SceneName = "My.Series.S01E01-Sonarr";
[TestCase("mp2, , ", "droned.s01e03.swedish.720p.hdtv.x264-prince", "MP2")]
[TestCase("vorbis, , ", "DB Super HDTV", "Vorbis")]
@@ -18,25 +19,33 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
[TestCase("truehd, thd+, ", "Atmos", "TrueHD Atmos")]
[TestCase("truehd, thd+, ", "TrueHD.Atmos.7.1", "TrueHD Atmos")]
[TestCase("truehd, thd+, ", "", "TrueHD Atmos")]
[TestCase("truehd, , Dolby TrueHD + Dolby Atmos", "Atmos", "TrueHD Atmos")]
[TestCase("truehd, , Dolby TrueHD + Dolby Atmos", "TrueHD.Atmos.7.1", "TrueHD Atmos")]
[TestCase("truehd, , Dolby TrueHD + Dolby Atmos", "", "TrueHD Atmos")]
[TestCase("wmav1, , ", "Droned.wmv", "WMA")]
[TestCase("wmav2, , ", "B.N.S04E18.720p.WEB-DL", "WMA")]
[TestCase("opus, , ", "Roadkill Ep3x11 - YouTube.webm", "Opus")]
[TestCase("mp3, , ", "climbing.mp4", "MP3")]
[TestCase("dts, , DTS-HD MA", "DTS-HD.MA", "DTS-HD MA")]
[TestCase("dts, , DTS:X", "DTS-X", "DTS-X")]
[TestCase("dts, , DTS-HD MA + DTS:X IMAX", "DTS-X", "DTS-X")]
[TestCase("dts, , DTS-HD MA", "DTS-HD.MA", "DTS-HD MA")]
[TestCase("dts, , DTS-ES", "DTS-ES", "DTS-ES")]
[TestCase("dts, , DTS-ES", "DTS", "DTS-ES")]
[TestCase("dts, , DTS-HD HRA", "DTSHD-HRA", "DTS-HD HRA")]
[TestCase("dts, , DTS", "DTS", "DTS")]
[TestCase("eac3, ec+3, ", "EAC3.Atmos", "EAC3 Atmos")]
[TestCase("eac3, , Dolby Digital Plus + Dolby Atmos", "EAC3.Atmos", "EAC3 Atmos")]
[TestCase("eac3, , ", "DDP5.1", "EAC3")]
[TestCase("ac3, , ", "DD5.1", "AC3")]
[TestCase("aac, , ", "AAC2.0", "AAC")]
[TestCase("aac, , HE-AAC", "AAC2.0", "HE-AAC")]
[TestCase("aac, , xHE-AAC", "AAC2.0", "xHE-AAC")]
[TestCase("adpcm_ima_qt, , ", "Custom?", "PCM")]
[TestCase("adpcm_ms, , ", "Custom", "PCM")]
public void should_format_audio_format(string audioFormatPack, string sceneName, string expectedFormat)
{
var split = audioFormatPack.Split(new string[] { ", " }, System.StringSplitOptions.None);
var split = audioFormatPack.Split(',', StringSplitOptions.TrimEntries);
var mediaInfoModel = new MediaInfoModel
{
AudioFormat = split[0],
@@ -56,7 +65,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo.MediaInfoFormatterTests
AudioCodecID = "Other Audio Codec"
};
MediaInfoFormatter.FormatAudioCodec(mediaInfoModel, sceneName).Should().Be(mediaInfoModel.AudioFormat);
MediaInfoFormatter.FormatAudioCodec(mediaInfoModel, SceneName).Should().Be(mediaInfoModel.AudioFormat);
}
}
}
@@ -1,12 +1,11 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using FFMpegCore;
using System.Text.Json.Nodes;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.Categories;
@@ -103,39 +102,39 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
info.Title.Should().Be("Sample Title");
}
[TestCase(8, "", "", "", null, HdrFormat.None)]
[TestCase(10, "", "", "", null, HdrFormat.None)]
[TestCase(10, "bt709", "bt709", "", null, HdrFormat.None)]
[TestCase(8, "bt2020", "smpte2084", "", null, HdrFormat.None)]
[TestCase(10, "bt2020", "bt2020-10", "", null, HdrFormat.None)]
[TestCase(10, "bt2020", "arib-std-b67", "", null, HdrFormat.Hlg10)]
[TestCase(10, "bt2020", "smpte2084", "", null, HdrFormat.Pq10)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.SideData", null, HdrFormat.Pq10)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.MasteringDisplayMetadata", null, HdrFormat.Hdr10)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.ContentLightLevelMetadata", null, HdrFormat.Hdr10)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.HdrDynamicMetadataSpmte2094", null, HdrFormat.Hdr10Plus)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.DoviConfigurationRecordSideData", null, HdrFormat.DolbyVision)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.DoviConfigurationRecordSideData", 1, HdrFormat.DolbyVisionHdr10)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.DoviConfigurationRecordSideData,FFMpegCore.HdrDynamicMetadataSpmte2094", 1, HdrFormat.DolbyVisionHdr10Plus)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.DoviConfigurationRecordSideData,FFMpegCore.HdrDynamicMetadataSpmte2094", 6, HdrFormat.DolbyVisionHdr10Plus)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.DoviConfigurationRecordSideData", 2, HdrFormat.DolbyVisionSdr)]
[TestCase(10, "bt2020", "smpte2084", "FFMpegCore.DoviConfigurationRecordSideData", 4, HdrFormat.DolbyVisionHlg)]
public void should_detect_hdr_correctly(int bitDepth, string colourPrimaries, string transferFunction, string sideDataTypes, int? doviConfigId, HdrFormat expected)
[TestCase(8, "", "", null, null, HdrFormat.None)]
[TestCase(10, "", "", null, null, HdrFormat.None)]
[TestCase(10, "bt709", "bt709", null, null, HdrFormat.None)]
[TestCase(8, "bt2020", "smpte2084", null, null, HdrFormat.None)]
[TestCase(10, "bt2020", "bt2020-10", null, null, HdrFormat.None)]
[TestCase(10, "bt2020", "arib-std-b67", null, null, HdrFormat.Hlg10)]
[TestCase(10, "bt2020", "smpte2084", null, null, HdrFormat.Pq10)]
[TestCase(10, "bt2020", "smpte2084", new[] { "" }, null, HdrFormat.Pq10)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.MasteringDisplayMetadata }, null, HdrFormat.Hdr10)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.ContentLightLevelMetadata }, null, HdrFormat.Hdr10)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.HdrDynamicMetadataSpmte2094 }, null, HdrFormat.Hdr10Plus)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.DoviConfigurationRecordSideData }, null, HdrFormat.DolbyVision)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.DoviConfigurationRecordSideData }, 1, HdrFormat.DolbyVisionHdr10)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.DoviConfigurationRecordSideData, FFMpegCoreSideDataTypes.HdrDynamicMetadataSpmte2094 }, 1, HdrFormat.DolbyVisionHdr10Plus)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.DoviConfigurationRecordSideData, FFMpegCoreSideDataTypes.HdrDynamicMetadataSpmte2094 }, 6, HdrFormat.DolbyVisionHdr10Plus)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.DoviConfigurationRecordSideData }, 2, HdrFormat.DolbyVisionSdr)]
[TestCase(10, "bt2020", "smpte2084", new[] { FFMpegCoreSideDataTypes.DoviConfigurationRecordSideData }, 4, HdrFormat.DolbyVisionHlg)]
public void should_detect_hdr_correctly(int bitDepth, string colourPrimaries, string transferFunction, string[] sideDataTypes, int? doviConfigId, HdrFormat expected)
{
var assembly = Assembly.GetAssembly(typeof(FFProbe));
var types = sideDataTypes.Split(",").Select(x => x.Trim()).ToList();
var sideData = types.Where(x => x.IsNotNullOrWhiteSpace()).Select(x => assembly.CreateInstance(x)).Cast<SideData>().ToList();
if (doviConfigId.HasValue)
var sideData = sideDataTypes?.Select(sideDataType =>
{
sideData.ForEach(x =>
var sideData = new Dictionary<string, JsonNode>
{
if (x.GetType().Name == "DoviConfigurationRecordSideData")
{
((DoviConfigurationRecordSideData)x).DvBlSignalCompatibilityId = doviConfigId.Value;
}
});
}
{ "side_data_type", JsonValue.Create(sideDataType) }
};
if (doviConfigId.HasValue)
{
sideData.Add("dv_bl_signal_compatibility_id", JsonValue.Create(doviConfigId.Value));
}
return sideData;
}).ToList();
var result = VideoFileInfoReader.GetHdrFormat(bitDepth, colourPrimaries, transferFunction, sideData);