Skip to content

Commit

Permalink
Merge pull request #407 from rosenbjerg/chore/cleanup
Browse files Browse the repository at this point in the history
Bump nuget version and cleanup
  • Loading branch information
rosenbjerg authored Feb 21, 2023
2 parents 3ca1e98 + 7ebf948 commit dc88862
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
12 changes: 6 additions & 6 deletions FFMpegCore.Test/FFMpegCore.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
<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="MSTest.TestAdapter" Version="3.0.2"/>
<PackageReference Include="MSTest.TestFramework" Version="3.0.2"/>
<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" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FFMpegCore.Extensions.SkiaSharp\FFMpegCore.Extensions.SkiaSharp.csproj" />
<ProjectReference Include="..\FFMpegCore.Extensions.System.Drawing.Common\FFMpegCore.Extensions.System.Drawing.Common.csproj"/>
<ProjectReference Include="..\FFMpegCore\FFMpegCore.csproj"/>
<ProjectReference Include="..\FFMpegCore.Extensions.System.Drawing.Common\FFMpegCore.Extensions.System.Drawing.Common.csproj" />
<ProjectReference Include="..\FFMpegCore\FFMpegCore.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions FFMpegCore/Extend/TimeSpanExtensions.cs
Original file line number Diff line number Diff line change
@@ -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 $"{hours:00}:{timeSpan.Minutes:00}:{timeSpan.Seconds:00}.{timeSpan.Milliseconds:000}";
}
}
25 changes: 4 additions & 21 deletions FFMpegCore/FFMpeg/Arguments/EndSeekArgument.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace FFMpegCore.Arguments
using FFMpegCore.Extend;

namespace FFMpegCore.Arguments
{
/// <summary>
/// Represents seek parameter
Expand All @@ -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;
}
}
25 changes: 4 additions & 21 deletions FFMpegCore/FFMpeg/Arguments/SeekArgument.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace FFMpegCore.Arguments
using FFMpegCore.Extend;

namespace FFMpegCore.Arguments
{
/// <summary>
/// Represents seek parameter
Expand All @@ -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;
}
}
8 changes: 4 additions & 4 deletions FFMpegCore/FFMpegCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -13,12 +13,12 @@
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md" Pack="true" PackagePath="\"/>
<None Include="..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Instances" Version="3.0.0"/>
<PackageReference Include="System.Text.Json" Version="7.0.1"/>
<PackageReference Include="Instances" Version="3.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
</ItemGroup>

</Project>
9 changes: 2 additions & 7 deletions FFMpegCore/FFProbe/MediaAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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>();
}
Expand Down Expand Up @@ -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");
Expand Down
19 changes: 1 addition & 18 deletions FFMpegCore/Helpers/FFProbeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dc88862

Please sign in to comment.