Skip to content

Commit

Permalink
Add unit tests for new properies LanguageMediaStream.StreamSize and M…
Browse files Browse the repository at this point in the history
…ediaInfoWrapper.Text
  • Loading branch information
yartat committed Sep 19, 2021
1 parent c5c354d commit 97dc513
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 223 deletions.
292 changes: 155 additions & 137 deletions MediaInfo.Wrapper.Tests/AudioTests.cs

Large diffs are not rendered by default.

156 changes: 92 additions & 64 deletions MediaInfo.Wrapper.Tests/VideoTests.cs

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions MediaInfo.Wrapper/Builder/VideoStreamBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ public override VideoStream Build()
{
// Support Matroska stereo
if (multiViewCount >= 2)
{
{
result.Stereoscopic = StereoMode.Stereo;
}
else
{
{
// Support BD3D
var idValues = Get((int)NativeMethods.Video.Video_ID, InfoKind.Text);
if (idValues.Split('/').Where(x => !string.IsNullOrWhiteSpace(x)).Count() > 1)
if (idValues.Split('/').Count(x => !string.IsNullOrWhiteSpace(x)) > 1)
{
result.Stereoscopic = StereoMode.Stereo;
}
Expand All @@ -351,18 +351,18 @@ public override VideoStream Build()
}

switch (result.Codec)
{
{
case VideoCodec.Mpeg4:
var additionalCodec = Get<VideoCodec>((int)NativeMethods.Video.Video_CodecID, InfoKind.Text, TryGetCodec);
if (additionalCodec != VideoCodec.Undefined)
{
result.Codec = additionalCodec;
break;
}

additionalCodec = Get<VideoCodec>((int)NativeMethods.Video.Video_Format_Settings_Matrix, InfoKind.Text, TryGetCodec);
if (additionalCodec != VideoCodec.Undefined)
{
{
result.Codec = additionalCodec;
}
break;
Expand Down
28 changes: 14 additions & 14 deletions MediaInfo.Wrapper/LogExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public static void LogError(this ILogger logger, Exception exception, string mes
var errorMessage = string.Format(message, parameters);
if (exception != null)
{
var msg = new StringBuilder();
msg.AppendFormat(message, parameters);
msg.AppendLine();

msg.AppendLine($"Exception: {exception.Message}");
msg.AppendLine("Callstack:");
msg.Append(exception.StackTrace);
var msg = new StringBuilder()
.AppendFormat(message, parameters)
.AppendLine()
.Append("Exception: ")
.AppendLine(exception.Message)
.AppendLine("Callstack:")
.Append(exception.StackTrace);

errorMessage = msg.ToString();
}
Expand Down Expand Up @@ -95,13 +95,13 @@ public static void LogCritical(this ILogger logger, Exception exception, string
var errorMessage = string.Format(message, parameters);
if (exception != null)
{
var msg = new StringBuilder();
msg.AppendFormat(message, parameters);
msg.AppendLine();

msg.AppendLine($"Exception: {exception.Message}");
msg.AppendLine("Callstack:");
msg.Append(exception.StackTrace);
var msg = new StringBuilder()
.AppendFormat(message, parameters)
.AppendLine()
.Append("Exception: ")
.AppendLine(exception.Message)
.AppendLine("Callstack:")
.Append(exception.StackTrace);

errorMessage = msg.ToString();
}
Expand Down
1 change: 1 addition & 0 deletions MediaInfo.Wrapper/MediaInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace MediaInfo
{
[Flags]
public enum InfoFileOptions
{
Nothing = 0x00,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ MP-MediaInfo is .NET wrapper for [MediaArea MediaInfo](https://github.com/MediaA
There are 2 packages for .NET Core and full .NET. If your project is designed to run only on Windows and you are not using .NET Core, use the full .NET package. .NET Core package is designed for ASP.NET Core services only.
### .NET Core
```sh
dotnet add package MediaInfo.Wrapper.Core --version 21.3.5
dotnet add package MediaInfo.Wrapper.Core --version 21.3.6
```
### Full .NET
```ps
Install-Package MediaInfo.Wrapper -Version 21.3.5
Install-Package MediaInfo.Wrapper -Version 21.3.6
```
## Dependencies
Make sure that the following dependencies are installed in the operating system before starting the project
Expand Down

0 comments on commit 97dc513

Please sign in to comment.