mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-15 02:25:44 +00:00
47 lines
No EOL
1.4 KiB
C#
47 lines
No EOL
1.4 KiB
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace FFMpegCore.Enums
|
|
{
|
|
public class ContainerFormat
|
|
{
|
|
private static readonly Regex FormatRegex = new Regex(@"([D ])([E ])\s+([a-z0-9_]+)\s+(.+)");
|
|
|
|
public string Name { get; private set; }
|
|
public bool DemuxingSupported { get; private set; }
|
|
public bool MuxingSupported { get; private set; }
|
|
public string Description { get; private set; } = null!;
|
|
|
|
public string Extension
|
|
{
|
|
get
|
|
{
|
|
if (GlobalFFOptions.Current.ExtensionOverrides.ContainsKey(Name))
|
|
return GlobalFFOptions.Current.ExtensionOverrides[Name];
|
|
return "." + Name;
|
|
}
|
|
}
|
|
|
|
internal ContainerFormat(string name)
|
|
{
|
|
Name = name;
|
|
}
|
|
|
|
internal static bool TryParse(string line, out ContainerFormat fmt)
|
|
{
|
|
var match = FormatRegex.Match(line);
|
|
if (!match.Success)
|
|
{
|
|
fmt = null!;
|
|
return false;
|
|
}
|
|
|
|
fmt = new ContainerFormat(match.Groups[3].Value)
|
|
{
|
|
DemuxingSupported = match.Groups[1].Value != " ",
|
|
MuxingSupported = match.Groups[2].Value != " ",
|
|
Description = match.Groups[4].Value
|
|
};
|
|
return true;
|
|
}
|
|
}
|
|
} |