Bump nuget version and cleanup

This commit is contained in:
Malte Rosenbjerg 2023-02-21 18:27:26 +01:00
parent 3ca1e983a6
commit 54e216d3e0
8 changed files with 37 additions and 77 deletions

View file

@ -4,6 +4,7 @@
<IsPackable>true</IsPackable>
<Description>Image extension for FFMpegCore using SkiaSharp</Description>
<PackageVersion>5.0.0</PackageVersion>
<PackageOutputPath>../nupkg</PackageOutputPath>
<PackageReleaseNotes>
</PackageReleaseNotes>
<PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze muxing skiasharp</PackageTags>

View file

@ -12,12 +12,12 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.9.0"/>
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="SkiaSharp" Version="2.88.3" />

View file

@ -0,0 +1,15 @@
namespace FFMpegCore.Extend;
public static class TimeSpanExtensions
{
public static string ToLongString(this TimeSpan timeSpan)
{
var hours = timeSpan.Hours;
if (timeSpan.Days > 0)
{
hours += timeSpan.Days * 24;
}
return $"-ss {hours:00}:{timeSpan.Minutes:00}:{timeSpan.Seconds:00}.{timeSpan.Milliseconds:000}";
}
}

View file

@ -1,4 +1,6 @@
namespace FFMpegCore.Arguments
using FFMpegCore.Extend;
namespace FFMpegCore.Arguments
{
/// <summary>
/// Represents seek parameter
@ -12,25 +14,6 @@ public EndSeekArgument(TimeSpan? seekTo)
SeekTo = seekTo;
}
public string Text
{
get
{
if (SeekTo.HasValue)
{
var hours = SeekTo.Value.Hours;
if (SeekTo.Value.Days > 0)
{
hours += SeekTo.Value.Days * 24;
}
return $"-to {hours.ToString("00")}:{SeekTo.Value.Minutes.ToString("00")}:{SeekTo.Value.Seconds.ToString("00")}.{SeekTo.Value.Milliseconds.ToString("000")}";
}
else
{
return string.Empty;
}
}
}
public string Text => SeekTo.HasValue ? $"-to {SeekTo.Value.ToLongString()}" : string.Empty;
}
}

View file

@ -1,4 +1,6 @@
namespace FFMpegCore.Arguments
using FFMpegCore.Extend;
namespace FFMpegCore.Arguments
{
/// <summary>
/// Represents seek parameter
@ -12,25 +14,6 @@ public SeekArgument(TimeSpan? seekTo)
SeekTo = seekTo;
}
public string Text
{
get
{
if (SeekTo.HasValue)
{
var hours = SeekTo.Value.Hours;
if (SeekTo.Value.Days > 0)
{
hours += SeekTo.Value.Days * 24;
}
return $"-ss {hours.ToString("00")}:{SeekTo.Value.Minutes.ToString("00")}:{SeekTo.Value.Seconds.ToString("00")}.{SeekTo.Value.Milliseconds.ToString("000")}";
}
else
{
return string.Empty;
}
}
}
public string Text => SeekTo.HasValue ? $"-ss {SeekTo.Value.ToLongString()}" : string.Empty;
}
}

View file

@ -3,7 +3,7 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<Description>A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your .NET applications</Description>
<PackageVersion>5.0.1</PackageVersion>
<PackageVersion>5.0.2</PackageVersion>
<PackageOutputPath>../nupkg</PackageOutputPath>
<PackageReleaseNotes>
</PackageReleaseNotes>
@ -18,7 +18,7 @@
<ItemGroup>
<PackageReference Include="Instances" Version="3.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.1"/>
<PackageReference Include="System.Text.Json" Version="7.0.2" />
</ItemGroup>
</Project>

View file

@ -50,7 +50,7 @@ private MediaFormat ParseFormat(Format analysisFormat)
{
var bitDepth = int.TryParse(stream.BitsPerRawSample, out var bprs) ? bprs :
stream.BitsPerSample;
return bitDepth == 0 ? null : (int?)bitDepth;
return bitDepth == 0 ? null : bitDepth;
}
private VideoStream ParseVideoStream(FFProbeStream stream)
@ -126,7 +126,7 @@ public static class MediaAnalysisUtils
{
private static readonly Regex DurationRegex = new(@"^(\d+):(\d{1,2}):(\d{1,2})\.(\d{1,3})", RegexOptions.Compiled);
internal static Dictionary<string, string>? ToCaseInsensitive(this Dictionary<string, string>? dictionary)
internal static Dictionary<string, string> ToCaseInsensitive(this Dictionary<string, string>? dictionary)
{
return dictionary?.ToDictionary(tag => tag.Key, tag => tag.Value, StringComparer.OrdinalIgnoreCase) ?? new Dictionary<string, string>();
}
@ -195,11 +195,6 @@ public static TimeSpan ParseDuration(string duration)
}
}
public static TimeSpan ParseDuration(FFProbeStream ffProbeStream)
{
return ParseDuration(ffProbeStream.Duration);
}
public static int ParseRotation(FFProbeStream fFProbeStream)
{
var displayMatrixSideData = fFProbeStream.SideData?.Find(item => item.TryGetValue("side_data_type", out var rawSideDataType) && rawSideDataType.ToString() == "Display Matrix");

View file

@ -3,27 +3,10 @@
namespace FFMpegCore.Helpers
{
public class FFProbeHelper
public static class FFProbeHelper
{
private static bool _ffprobeVerified;
public static int Gcd(int first, int second)
{
while (first != 0 && second != 0)
{
if (first > second)
{
first -= second;
}
else
{
second -= first;
}
}
return first == 0 ? second : first;
}
public static void RootExceptionCheck()
{
if (GlobalFFOptions.Current.BinaryFolder == null)