-
-
Notifications
You must be signed in to change notification settings - Fork 315
/
FFmpeg.cs
55 lines (39 loc) · 1.61 KB
/
FFmpeg.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
namespace FFmpeg.AutoGen;
public static partial class ffmpeg
{
public static readonly int EAGAIN;
public static readonly int ENOMEM = 12;
public static readonly int EINVAL = 22;
public static readonly int EPIPE = 32;
static ffmpeg()
{
EAGAIN = FunctionResolverFactory.GetPlatformId() switch
{
PlatformID.MacOSX => 35,
_ => 11
};
DynamicallyLoadedBindings.Initialize();
}
/// <summary>
/// Gets or sets the root path for loading libraries.
/// Work out of box with companion ffmpeg distribution package like FFmpeg.AutoGen.Redist.windows.x64
/// </summary>
/// <value>The root path.</value>
public static string RootPath { get; set; } = AppDomain.CurrentDomain.BaseDirectory;
public static ulong UINT64_C<T>(T a)
=> Convert.ToUInt64(a);
public static int AVERROR<T1>(T1 a)
=> -Convert.ToInt32(a);
public static int MKTAG<T1, T2, T3, T4>(T1 a, T2 b, T3 c, T4 d)
=> (int)(Convert.ToUInt32(a) | (Convert.ToUInt32(b) << 8) | (Convert.ToUInt32(c) << 16) |
(Convert.ToUInt32(d) << 24));
public static int FFERRTAG<T1, T2, T3, T4>(T1 a, T2 b, T3 c, T4 d)
=> -MKTAG(a, b, c, d);
public static int AV_VERSION_INT<T1, T2, T3>(T1 a, T2 b, T3 c) =>
(Convert.ToInt32(a) << 16) | (Convert.ToInt32(b) << 8) | Convert.ToInt32(c);
public static string AV_VERSION_DOT<T1, T2, T3>(T1 a, T2 b, T3 c)
=> $"{a}.{b}.{c}";
public static string AV_VERSION<T1, T2, T3>(T1 a, T2 b, T3 c)
=> AV_VERSION_DOT(a, b, c);
}