forked from sdcb/Sdcb.FFmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using Sdcb.FFmpeg.Common; | ||
using Sdcb.FFmpeg.Formats; | ||
using Sdcb.FFmpeg.Raw; | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Sdcb.FFmpeg.Tests.Formats; | ||
|
||
public class FormatTest | ||
{ | ||
private readonly ITestOutputHelper _console; | ||
|
||
public FormatTest(ITestOutputHelper console) | ||
{ | ||
_console = console; | ||
} | ||
|
||
[Fact] | ||
public void InputFormatTest() | ||
{ | ||
foreach (InputFormat fmt in InputFormat.All) | ||
{ | ||
_console.WriteLine(fmt.Name); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void OutputFormatTest() | ||
{ | ||
foreach (OutputFormat fmt in OutputFormat.All) | ||
{ | ||
_console.WriteLine(fmt.Name); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Sdcb.FFmpeg.Common; | ||
using Sdcb.FFmpeg.Raw; | ||
using System; | ||
using System.Collections.Generic; | ||
using static Sdcb.FFmpeg.Raw.ffmpeg; | ||
using System.Linq; | ||
|
||
namespace Sdcb.FFmpeg.Formats; | ||
|
||
public unsafe partial struct OutputFormat | ||
{ | ||
/// <summary> | ||
/// Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match. | ||
/// <param name="shortName">if non-NULL checks if short_name matches with the names of the registered formats</param> | ||
/// <param name="fileName">if non-NULL checks if filename terminates with the extensions of the registered formats</param> | ||
/// <param name="mimeType">if non-NULL checks if mime_type matches with the MIME type of the registered formats</param> | ||
/// <see cref="av_guess_format(string, string, string)"/> | ||
/// </summary> | ||
public static OutputFormat? Guess(string? shortName = null, string? fileName = null, string? mimeType = null) | ||
=> FromNativeOrNull(av_guess_format(shortName, fileName, mimeType)); | ||
|
||
/// <summary> | ||
/// Iterate over all registered muxers. | ||
/// <see cref="av_muxer_iterate(void**)"/> | ||
/// </summary> | ||
public static IEnumerable<OutputFormat> All => NativeUtils | ||
.EnumeratePtrIterator(ptr => (IntPtr)av_muxer_iterate((void**)ptr)) | ||
.Select(x => FromNative((AVOutputFormat*)x)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters