Files
SuperVPN/output/VideoReader/libfaad.cs
2025-10-09 09:57:24 +09:00

82 lines
2.3 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace VideoReader;
public class libfaad
{
public struct NeAACDecConfiguration
{
public char defObjectType;
public int defSampleRate;
public char outputFormat;
public char downMatrix;
public char useOldADTSFormat;
}
public struct NeAACDecFrameInfo
{
public int bytesconsumed;
public int samples;
public char channels;
public char error;
public int samplerate;
public char sbr;
public char object_type;
public char header_type;
public char num_front_channels;
public char num_side_channels;
public char num_back_channels;
public char num_lfe_channels;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public char[] channel_position;
public char ps;
}
private const string libPath = "libfaad2.dll";
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NeAACDecOpen();
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NeAACDecGetCurrentConfiguration(IntPtr hpDecoder);
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern char NeAACDecSetConfiguration(IntPtr hpDecoder, IntPtr config);
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern int NeAACDecInit(IntPtr hpDecoder, byte[] buffer, int buffer_size, ulong* samplerate, char* channels);
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern char NeAACDecInit2(IntPtr hpDecoder, byte[] buffer, int SizeOfDecoderSpecificInfo, ulong* samplerate, char* channels);
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr NeAACDecDecode(IntPtr hpDecoder, out NeAACDecFrameInfo hInfo, byte[] buffer, int buffer_size);
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void NeAACDecClose(IntPtr hpDecoder);
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern char* NeAACDecGetErrorMessage(char errcode);
[DllImport("libfaad2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern char NeAACDecAudioSpecificConfig(IntPtr pBuffer, int buffer_size, IntPtr mp4ASC);
}