mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-14 02:04:14 +01:00
Merge pull request #477 from rosenbjerg/bugfix/fix-null-ref-exception-with-tags-container
Bugfix/fix null ref exception with tags container
This commit is contained in:
commit
3085fa4209
7 changed files with 18 additions and 18 deletions
|
@ -12,8 +12,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SkiaSharp" Version="2.88.3" />
|
<PackageReference Include="SkiaSharp" Version="2.88.6" />
|
||||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" />
|
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
<PackageReference Include="coverlet.collector" Version="6.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.10.0" />
|
<PackageReference Include="FluentAssertions" Version="6.12.0" />
|
||||||
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
|
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
|
||||||
<PackageReference Include="SkiaSharp" Version="2.88.3" />
|
<PackageReference Include="SkiaSharp" Version="2.88.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -46,7 +46,7 @@ public async Task PacketAnalysis_Async()
|
||||||
var packets = packetAnalysis.Packets;
|
var packets = packetAnalysis.Packets;
|
||||||
Assert.AreEqual(96, packets.Count);
|
Assert.AreEqual(96, packets.Count);
|
||||||
Assert.IsTrue(packets.All(f => f.CodecType == "video"));
|
Assert.IsTrue(packets.All(f => f.CodecType == "video"));
|
||||||
Assert.AreEqual("K_", packets[0].Flags);
|
Assert.IsTrue(packets[0].Flags.StartsWith("K_"));
|
||||||
Assert.AreEqual(1362, packets.Last().Size);
|
Assert.AreEqual(1362, packets.Last().Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public void PacketAnalysis_Sync()
|
||||||
|
|
||||||
Assert.AreEqual(96, packets.Count);
|
Assert.AreEqual(96, packets.Count);
|
||||||
Assert.IsTrue(packets.All(f => f.CodecType == "video"));
|
Assert.IsTrue(packets.All(f => f.CodecType == "video"));
|
||||||
Assert.AreEqual("K_", packets[0].Flags);
|
Assert.IsTrue(packets[0].Flags.StartsWith("K_"));
|
||||||
Assert.AreEqual(1362, packets.Last().Size);
|
Assert.AreEqual(1362, packets.Last().Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public void PacketAnalysisAudioVideo_Sync()
|
||||||
var actual = packets.Select(f => f.CodecType).Distinct().ToList();
|
var actual = packets.Select(f => f.CodecType).Distinct().ToList();
|
||||||
var expected = new List<string> { "audio", "video" };
|
var expected = new List<string> { "audio", "video" };
|
||||||
CollectionAssert.AreEquivalent(expected, actual);
|
CollectionAssert.AreEquivalent(expected, actual);
|
||||||
Assert.IsTrue(packets.Where(t => t.CodecType == "audio").All(f => f.Flags == "K_"));
|
Assert.IsTrue(packets.Where(t => t.CodecType == "audio").All(f => f.Flags.StartsWith("K_")));
|
||||||
Assert.AreEqual(75, packets.Count(t => t.CodecType == "video"));
|
Assert.AreEqual(75, packets.Count(t => t.CodecType == "video"));
|
||||||
Assert.AreEqual(141, packets.Count(t => t.CodecType == "audio"));
|
Assert.AreEqual(141, packets.Count(t => t.CodecType == "audio"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Instances" Version="3.0.0" />
|
<PackageReference Include="Instances" Version="3.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="7.0.2" />
|
<PackageReference Include="System.Text.Json" Version="7.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer
|
||||||
public Dictionary<string, int> Disposition { get; set; } = null!;
|
public Dictionary<string, int> Disposition { get; set; } = null!;
|
||||||
|
|
||||||
[JsonPropertyName("tags")]
|
[JsonPropertyName("tags")]
|
||||||
public Dictionary<string, string> Tags { get; set; } = null!;
|
public Dictionary<string, string>? Tags { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("side_data_list")]
|
[JsonPropertyName("side_data_list")]
|
||||||
public List<Dictionary<string, JsonValue>> SideData { get; set; } = null!;
|
public List<Dictionary<string, JsonValue>> SideData { get; set; } = null!;
|
||||||
|
@ -126,7 +126,7 @@ public class Format : ITagsContainer
|
||||||
public int ProbeScore { get; set; }
|
public int ProbeScore { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("tags")]
|
[JsonPropertyName("tags")]
|
||||||
public Dictionary<string, string> Tags { get; set; } = null!;
|
public Dictionary<string, string>? Tags { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IDispositionContainer
|
public interface IDispositionContainer
|
||||||
|
@ -136,7 +136,7 @@ public interface IDispositionContainer
|
||||||
|
|
||||||
public interface ITagsContainer
|
public interface ITagsContainer
|
||||||
{
|
{
|
||||||
Dictionary<string, string> Tags { get; set; }
|
Dictionary<string, string>? Tags { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TagExtensions
|
public static class TagExtensions
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace FFMpegCore
|
namespace FFMpegCore
|
||||||
{
|
{
|
||||||
public class MediaFormat
|
public class MediaFormat : ITagsContainer
|
||||||
{
|
{
|
||||||
public TimeSpan Duration { get; set; }
|
public TimeSpan Duration { get; set; }
|
||||||
public TimeSpan StartTime { get; set; }
|
public TimeSpan StartTime { get; set; }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace FFMpegCore
|
namespace FFMpegCore
|
||||||
{
|
{
|
||||||
public abstract class MediaStream
|
public abstract class MediaStream : ITagsContainer
|
||||||
{
|
{
|
||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
public string CodecName { get; set; } = null!;
|
public string CodecName { get; set; } = null!;
|
||||||
|
|
Loading…
Reference in a new issue