mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
Merge remote-tracking branch 'upstream/master' into json-nullable-number
This commit is contained in:
commit
33f6e410ac
5 changed files with 40 additions and 58 deletions
|
@ -41,7 +41,7 @@
|
||||||
<PackageReference Include="ServiceStack.Text.Core" Version="5.9.2" />
|
<PackageReference Include="ServiceStack.Text.Core" Version="5.9.2" />
|
||||||
<PackageReference Include="sharpcompress" Version="0.26.0" />
|
<PackageReference Include="sharpcompress" Version="0.26.0" />
|
||||||
<PackageReference Include="SQLitePCL.pretty.netstandard" Version="2.1.0" />
|
<PackageReference Include="SQLitePCL.pretty.netstandard" Version="2.1.0" />
|
||||||
<PackageReference Include="DotNet.Glob" Version="3.0.9" />
|
<PackageReference Include="DotNet.Glob" Version="3.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -4,7 +4,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
@ -100,20 +99,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{ "libpostproc", new Version(55, 1) }
|
{ "libpostproc", new Version(55, 1) }
|
||||||
};
|
};
|
||||||
|
|
||||||
// This lookup table is to be maintained with the following command line:
|
|
||||||
// $ ffmpeg -version | perl -ne ' print "$1=$2.$3," if /^(lib\w+)\s+(\d+)\.\s*(\d+)/'
|
|
||||||
private static readonly IReadOnlyDictionary<string, Version> _ffmpegVersionMap = new Dictionary<string, Version>
|
|
||||||
{
|
|
||||||
{ "libavutil=56.51,libavcodec=58.91,libavformat=58.45,libavdevice=58.10,libavfilter=7.85,libswscale=5.7,libswresample=3.7,libpostproc=55.7,", new Version(4, 3) },
|
|
||||||
{ "libavutil=56.31,libavcodec=58.54,libavformat=58.29,libavdevice=58.8,libavfilter=7.57,libswscale=5.5,libswresample=3.5,libpostproc=55.5,", new Version(4, 2) },
|
|
||||||
{ "libavutil=56.22,libavcodec=58.35,libavformat=58.20,libavdevice=58.5,libavfilter=7.40,libswscale=5.3,libswresample=3.3,libpostproc=55.3,", new Version(4, 1) },
|
|
||||||
{ "libavutil=56.14,libavcodec=58.18,libavformat=58.12,libavdevice=58.3,libavfilter=7.16,libswscale=5.1,libswresample=3.1,libpostproc=55.1,", new Version(4, 0) },
|
|
||||||
{ "libavutil=55.78,libavcodec=57.107,libavformat=57.83,libavdevice=57.10,libavfilter=6.107,libswscale=4.8,libswresample=2.9,libpostproc=54.7,", new Version(3, 4) },
|
|
||||||
{ "libavutil=55.58,libavcodec=57.89,libavformat=57.71,libavdevice=57.6,libavfilter=6.82,libswscale=4.6,libswresample=2.7,libpostproc=54.5,", new Version(3, 3) },
|
|
||||||
{ "libavutil=55.34,libavcodec=57.64,libavformat=57.56,libavdevice=57.1,libavfilter=6.65,libswscale=4.2,libswresample=2.3,libpostproc=54.1,", new Version(3, 2) },
|
|
||||||
{ "libavutil=54.31,libavcodec=56.60,libavformat=56.40,libavdevice=56.4,libavfilter=5.40,libswscale=3.1,libswresample=1.2,libpostproc=53.3,", new Version(2, 8) }
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly string _encoderPath;
|
private readonly string _encoderPath;
|
||||||
|
@ -130,6 +115,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
Decoder
|
Decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When changing this, also change the minimum library versions in _ffmpegMinimumLibraryVersions
|
||||||
public static Version MinVersion { get; } = new Version(4, 0);
|
public static Version MinVersion { get; } = new Version(4, 0);
|
||||||
|
|
||||||
public static Version MaxVersion { get; } = null;
|
public static Version MaxVersion { get; } = null;
|
||||||
|
@ -227,28 +213,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{
|
{
|
||||||
return new Version(match.Groups[1].Value);
|
return new Version(match.Groups[1].Value);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!TryGetFFmpegLibraryVersions(output, out string versionString, out IReadOnlyDictionary<string, Version> versionMap))
|
|
||||||
{
|
|
||||||
_logger.LogError("No ffmpeg library versions found");
|
|
||||||
|
|
||||||
return null;
|
var versionMap = GetFFmpegLibraryVersions(output);
|
||||||
}
|
|
||||||
|
|
||||||
// First try to lookup the full version string
|
|
||||||
if (_ffmpegVersionMap.TryGetValue(versionString, out Version version))
|
|
||||||
{
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then try to test for minimum library versions
|
|
||||||
return TestMinimumFFmpegLibraryVersions(versionMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Version TestMinimumFFmpegLibraryVersions(IReadOnlyDictionary<string, Version> versionMap)
|
|
||||||
{
|
|
||||||
var allVersionsValidated = true;
|
var allVersionsValidated = true;
|
||||||
|
|
||||||
foreach (var minimumVersion in _ffmpegMinimumLibraryVersions)
|
foreach (var minimumVersion in _ffmpegMinimumLibraryVersions)
|
||||||
|
@ -281,10 +248,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="output">The 'ffmpeg -version' output.</param>
|
/// <param name="output">The 'ffmpeg -version' output.</param>
|
||||||
/// <returns>The library names and major.minor version numbers.</returns>
|
/// <returns>The library names and major.minor version numbers.</returns>
|
||||||
private static bool TryGetFFmpegLibraryVersions(string output, out string versionString, out IReadOnlyDictionary<string, Version> versionMap)
|
private static IReadOnlyDictionary<string, Version> GetFFmpegLibraryVersions(string output)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder(144);
|
|
||||||
|
|
||||||
var map = new Dictionary<string, Version>();
|
var map = new Dictionary<string, Version>();
|
||||||
|
|
||||||
foreach (Match match in Regex.Matches(
|
foreach (Match match in Regex.Matches(
|
||||||
|
@ -292,24 +257,14 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
@"((?<name>lib\w+)\s+(?<major>[0-9]+)\.\s*(?<minor>[0-9]+))",
|
@"((?<name>lib\w+)\s+(?<major>[0-9]+)\.\s*(?<minor>[0-9]+))",
|
||||||
RegexOptions.Multiline))
|
RegexOptions.Multiline))
|
||||||
{
|
{
|
||||||
sb.Append(match.Groups["name"])
|
var version = new Version(
|
||||||
.Append('=')
|
int.Parse(match.Groups["major"].Value),
|
||||||
.Append(match.Groups["major"])
|
int.Parse(match.Groups["minor"].Value));
|
||||||
.Append('.')
|
|
||||||
.Append(match.Groups["minor"])
|
|
||||||
.Append(',');
|
|
||||||
|
|
||||||
var str = $"{match.Groups["major"]}.{match.Groups["minor"]}";
|
|
||||||
|
|
||||||
var version = Version.Parse(str);
|
|
||||||
|
|
||||||
map.Add(match.Groups["name"].Value, version);
|
map.Add(match.Groups["name"].Value, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
versionString = sb.ToString();
|
return map;
|
||||||
versionMap = map;
|
|
||||||
|
|
||||||
return sb.Length > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<string> GetHwaccelTypes()
|
private IEnumerable<string> GetHwaccelTypes()
|
||||||
|
|
|
@ -18,12 +18,14 @@ namespace Jellyfin.MediaEncoding.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
[InlineData(EncoderValidatorTestsData.FFmpegV431Output, true)]
|
||||||
[InlineData(EncoderValidatorTestsData.FFmpegV43Output, true)]
|
[InlineData(EncoderValidatorTestsData.FFmpegV43Output, true)]
|
||||||
[InlineData(EncoderValidatorTestsData.FFmpegV421Output, true)]
|
[InlineData(EncoderValidatorTestsData.FFmpegV421Output, true)]
|
||||||
[InlineData(EncoderValidatorTestsData.FFmpegV42Output, true)]
|
[InlineData(EncoderValidatorTestsData.FFmpegV42Output, true)]
|
||||||
[InlineData(EncoderValidatorTestsData.FFmpegV414Output, true)]
|
[InlineData(EncoderValidatorTestsData.FFmpegV414Output, true)]
|
||||||
[InlineData(EncoderValidatorTestsData.FFmpegV404Output, true)]
|
[InlineData(EncoderValidatorTestsData.FFmpegV404Output, true)]
|
||||||
[InlineData(EncoderValidatorTestsData.FFmpegGitUnknownOutput, true)]
|
[InlineData(EncoderValidatorTestsData.FFmpegGitUnknownOutput2, true)]
|
||||||
|
[InlineData(EncoderValidatorTestsData.FFmpegGitUnknownOutput, false)]
|
||||||
public void ValidateVersionInternalTest(string versionOutput, bool valid)
|
public void ValidateVersionInternalTest(string versionOutput, bool valid)
|
||||||
{
|
{
|
||||||
var val = new EncoderValidator(new NullLogger<EncoderValidatorTests>());
|
var val = new EncoderValidator(new NullLogger<EncoderValidatorTests>());
|
||||||
|
@ -34,12 +36,14 @@ namespace Jellyfin.MediaEncoding.Tests
|
||||||
{
|
{
|
||||||
public IEnumerator<object?[]> GetEnumerator()
|
public IEnumerator<object?[]> GetEnumerator()
|
||||||
{
|
{
|
||||||
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegV431Output, new Version(4, 3, 1) };
|
||||||
yield return new object?[] { EncoderValidatorTestsData.FFmpegV43Output, new Version(4, 3) };
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegV43Output, new Version(4, 3) };
|
||||||
yield return new object?[] { EncoderValidatorTestsData.FFmpegV421Output, new Version(4, 2, 1) };
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegV421Output, new Version(4, 2, 1) };
|
||||||
yield return new object?[] { EncoderValidatorTestsData.FFmpegV42Output, new Version(4, 2) };
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegV42Output, new Version(4, 2) };
|
||||||
yield return new object?[] { EncoderValidatorTestsData.FFmpegV414Output, new Version(4, 1, 4) };
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegV414Output, new Version(4, 1, 4) };
|
||||||
yield return new object?[] { EncoderValidatorTestsData.FFmpegV404Output, new Version(4, 0, 4) };
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegV404Output, new Version(4, 0, 4) };
|
||||||
yield return new object?[] { EncoderValidatorTestsData.FFmpegGitUnknownOutput, new Version(4, 0) };
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegGitUnknownOutput2, new Version(4, 0) };
|
||||||
|
yield return new object?[] { EncoderValidatorTestsData.FFmpegGitUnknownOutput, null };
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
|
|
|
@ -2,6 +2,18 @@ namespace Jellyfin.MediaEncoding.Tests
|
||||||
{
|
{
|
||||||
internal static class EncoderValidatorTestsData
|
internal static class EncoderValidatorTestsData
|
||||||
{
|
{
|
||||||
|
public const string FFmpegV431Output = @"ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
|
||||||
|
built with gcc 10.1.0 (GCC)
|
||||||
|
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
|
||||||
|
libavutil 56. 51.100 / 56. 51.100
|
||||||
|
libavcodec 58. 91.100 / 58. 91.100
|
||||||
|
libavformat 58. 45.100 / 58. 45.100
|
||||||
|
libavdevice 58. 10.100 / 58. 10.100
|
||||||
|
libavfilter 7. 85.100 / 7. 85.100
|
||||||
|
libswscale 5. 7.100 / 5. 7.100
|
||||||
|
libswresample 3. 7.100 / 3. 7.100
|
||||||
|
libpostproc 55. 7.100 / 55. 7.100";
|
||||||
|
|
||||||
public const string FFmpegV43Output = @"ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
|
public const string FFmpegV43Output = @"ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
|
||||||
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
|
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
|
||||||
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-vdpau --disable-sdl2 --disable-xlib --enable-gpl --enable-version3 --enable-static --enable-libfontconfig --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzvbi --arch=amd64 --enable-amf --enable-nvenc --enable-nvdec --enable-vaapi --enable-opencl
|
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-vdpau --disable-sdl2 --disable-xlib --enable-gpl --enable-version3 --enable-static --enable-libfontconfig --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzvbi --arch=amd64 --enable-amf --enable-nvenc --enable-nvdec --enable-vaapi --enable-opencl
|
||||||
|
@ -63,7 +75,7 @@ libswscale 5. 1.100 / 5. 1.100
|
||||||
libswresample 3. 1.100 / 3. 1.100
|
libswresample 3. 1.100 / 3. 1.100
|
||||||
libpostproc 55. 1.100 / 55. 1.100";
|
libpostproc 55. 1.100 / 55. 1.100";
|
||||||
|
|
||||||
public const string FFmpegGitUnknownOutput = @"ffmpeg version N-94303-g7cb4f8c962 Copyright (c) 2000-2019 the FFmpeg developers
|
public const string FFmpegGitUnknownOutput2 = @"ffmpeg version N-94303-g7cb4f8c962 Copyright (c) 2000-2019 the FFmpeg developers
|
||||||
built with gcc 9.1.1 (GCC) 20190716
|
built with gcc 9.1.1 (GCC) 20190716
|
||||||
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
|
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
|
||||||
libavutil 56. 30.100 / 56. 30.100
|
libavutil 56. 30.100 / 56. 30.100
|
||||||
|
@ -74,5 +86,17 @@ libavfilter 7. 56.101 / 7. 56.101
|
||||||
libswscale 5. 4.101 / 5. 4.101
|
libswscale 5. 4.101 / 5. 4.101
|
||||||
libswresample 3. 4.100 / 3. 4.100
|
libswresample 3. 4.100 / 3. 4.100
|
||||||
libpostproc 55. 4.100 / 55. 4.100";
|
libpostproc 55. 4.100 / 55. 4.100";
|
||||||
|
|
||||||
|
public const string FFmpegGitUnknownOutput = @"ffmpeg version N-45325-gb173e0353-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers
|
||||||
|
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
|
||||||
|
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
|
||||||
|
libavutil 56. 9.100 / 56. 9.100
|
||||||
|
libavcodec 58. 14.100 / 58. 14.100
|
||||||
|
libavformat 58. 10.100 / 58. 10.100
|
||||||
|
libavdevice 58. 2.100 / 58. 2.100
|
||||||
|
libavfilter 7. 13.100 / 7. 13.100
|
||||||
|
libswscale 5. 0.102 / 5. 0.102
|
||||||
|
libswresample 3. 0.101 / 3. 0.101
|
||||||
|
libpostproc 55. 0.100 / 55. 0.100";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library
|
||||||
[InlineData("/media/movies/.@__thumb/foo-bar-thumbnail.png", true)]
|
[InlineData("/media/movies/.@__thumb/foo-bar-thumbnail.png", true)]
|
||||||
[InlineData("/media/music/Foo B.A.R./epic.flac", false)]
|
[InlineData("/media/music/Foo B.A.R./epic.flac", false)]
|
||||||
[InlineData("/media/music/Foo B.A.R", false)]
|
[InlineData("/media/music/Foo B.A.R", false)]
|
||||||
// This test is pending an upstream fix: https://github.com/dazinator/DotNet.Glob/issues/78
|
[InlineData("/media/music/Foo B.A.R.", false)]
|
||||||
// [InlineData("/media/music/Foo B.A.R.", false)]
|
|
||||||
public void PathIgnored(string path, bool expected)
|
public void PathIgnored(string path, bool expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, IgnorePatterns.ShouldIgnore(path));
|
Assert.Equal(expected, IgnorePatterns.ShouldIgnore(path));
|
||||||
|
|
Loading…
Reference in a new issue