Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Runtime.InteropServices;
- namespace AACtoPCM
- {
- public class libfaad
- {
- #region Structures
- [StructLayout(LayoutKind.Sequential)]
- public struct NeAACDecConfiguration
- {
- public char defObjectType;
- public int defSampleRate;
- public char outputFormat;
- public char downMatrix;
- public char useOldADTSFormat;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct NeAACDecFrameInfo
- {
- public Int32 bytesconsumed;
- public Int32 samples;
- public char channels;
- public char error;
- public Int32 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;
- }
- #endregion
- const string libPath = "libfaad2.dll";
- #region Methods
- [DllImport(libPath)]public static extern IntPtr NeAACDecOpen();
- [DllImport(libPath)]public static extern IntPtr NeAACDecGetCurrentConfiguration(IntPtr hpDecoder);
- [DllImport(libPath)]public static extern char NeAACDecSetConfiguration(IntPtr hpDecoder, IntPtr config);
- [DllImport(libPath)]public static extern int NeAACDecInit(IntPtr hpDecoder, byte[] buffer, int buffer_size, IntPtr samplerate, IntPtr channels);
- [DllImport(libPath)]public static extern char NeAACDecInit2 (IntPtr hpDecoder, IntPtr pBuffer, int SizeOfDecoderSpecificInfo, IntPtr samplerate, IntPtr channels);
- [DllImport(libPath)]public static extern IntPtr NeAACDecDecode(IntPtr hpDecoder, out NeAACDecFrameInfo hInfo, byte[] buffer, int buffer_size);
- [DllImport(libPath)]public static extern void NeAACDecClose(IntPtr hpDecoder);
- [DllImport(libPath, CharSet=CharSet.Ansi)]public static extern string NeAACDecGetErrorMessage(char errcode);
- [DllImport(libPath)]public static extern char NeAACDecAudioSpecificConfig(IntPtr pBuffer, int buffer_size, IntPtr mp4ASC);
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment