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:
Malte Rosenbjerg 2023-10-05 09:20:51 +02:00 committed by GitHub
commit 3085fa4209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 18 deletions

View file

@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="2.88.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.6" />
</ItemGroup>
<ItemGroup>

View file

@ -8,19 +8,19 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<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" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
</ItemGroup>
<ItemGroup>

View file

@ -46,7 +46,7 @@ public async Task PacketAnalysis_Async()
var packets = packetAnalysis.Packets;
Assert.AreEqual(96, packets.Count);
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);
}
@ -57,7 +57,7 @@ public void PacketAnalysis_Sync()
Assert.AreEqual(96, packets.Count);
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);
}
@ -70,7 +70,7 @@ public void PacketAnalysisAudioVideo_Sync()
var actual = packets.Select(f => f.CodecType).Distinct().ToList();
var expected = new List<string> { "audio", "video" };
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(141, packets.Count(t => t.CodecType == "audio"));
}

View file

@ -18,7 +18,7 @@
<ItemGroup>
<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>
</Project>

View file

@ -87,7 +87,7 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer
public Dictionary<string, int> Disposition { get; set; } = null!;
[JsonPropertyName("tags")]
public Dictionary<string, string> Tags { get; set; } = null!;
public Dictionary<string, string>? Tags { get; set; }
[JsonPropertyName("side_data_list")]
public List<Dictionary<string, JsonValue>> SideData { get; set; } = null!;
@ -126,7 +126,7 @@ public class Format : ITagsContainer
public int ProbeScore { get; set; }
[JsonPropertyName("tags")]
public Dictionary<string, string> Tags { get; set; } = null!;
public Dictionary<string, string>? Tags { get; set; }
}
public interface IDispositionContainer
@ -136,7 +136,7 @@ public interface IDispositionContainer
public interface ITagsContainer
{
Dictionary<string, string> Tags { get; set; }
Dictionary<string, string>? Tags { get; set; }
}
public static class TagExtensions

View file

@ -1,6 +1,6 @@
namespace FFMpegCore
{
public class MediaFormat
public class MediaFormat : ITagsContainer
{
public TimeSpan Duration { get; set; }
public TimeSpan StartTime { get; set; }

View file

@ -2,7 +2,7 @@
namespace FFMpegCore
{
public abstract class MediaStream
public abstract class MediaStream : ITagsContainer
{
public int Index { get; set; }
public string CodecName { get; set; } = null!;