Files
tysdk-intergration/sdk-intergration/LocalPackages/LeviathanVideo/Plugins/Core/Leviathan.cs
2026-03-24 11:43:22 +08:00

56 lines
2.0 KiB
C#

/*----------------------------------------------------------------
// Copyright (C) 2025 Beijing All rights reserved.
//
// Author: huachangmiao
// Create Date: 2025/04/11
// Module Describe:
//----------------------------------------------------------------*/
using System;
using Unity.Collections.LowLevel.Unsafe;
namespace LeviathanVideo.Abstractions
{
public static partial class leviathan
{
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IOS
public static readonly int EAGAIN = 35;
public static readonly int ENOMEM = 12;
public static readonly int EINVAL = 22;
#elif UNITY_WEBGL && !UNITY_EDITOR
public static readonly int EAGAIN = 6;
public static readonly int ENOMEM = 48;
public static readonly int EINVAL = 28;
#else
public static readonly int EAGAIN = 11;
public static readonly int ENOMEM = 12;
public static readonly int EINVAL = 22;
#endif
// public static readonly int EPIPE = 32;
public static ulong UINT64_C<T>(T a)
=> Convert.ToUInt64(a);
public static int AVERROR_Enum<T1>(T1 a) where T1 : struct, IConvertible => -UnsafeUtility.EnumToInt(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);
}
}