mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Updated the build system, now using .NET Framework v4.0 for most things
This commit is contained in:
@@ -8,10 +8,16 @@ namespace CUETools.Codecs.libFLAC
|
||||
internal const string libFLACDll = "libFLAC_dynamic";
|
||||
internal const CallingConvention libFLACCallingConvention = CallingConvention.Cdecl;
|
||||
internal const int FLAC__MAX_CHANNELS = 8;
|
||||
private static string version;
|
||||
|
||||
internal static string GetVersion => version;
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr LoadLibrary(string dllToLoad);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate FLAC__StreamDecoderReadStatus FLAC__StreamDecoderReadCallback(IntPtr decoder, byte* buffer, ref long bytes, void* client_data);
|
||||
|
||||
@@ -36,6 +42,7 @@ namespace CUETools.Codecs.libFLAC
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate void FLAC__StreamDecoderErrorCallback(IntPtr decoder, FLAC__StreamDecoderErrorStatus status, void* client_data);
|
||||
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern IntPtr FLAC__stream_decoder_new();
|
||||
|
||||
@@ -157,10 +164,17 @@ namespace CUETools.Codecs.libFLAC
|
||||
var is64 = IntPtr.Size == 8;
|
||||
var subfolder = is64 ? "plugins (x64)" : "plugins (win32)";
|
||||
#if NET40
|
||||
LoadLibrary(System.IO.Path.Combine(myFolder, "..", subfolder, libFLACDll + ".dll"));
|
||||
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(myFolder, "..", subfolder, libFLACDll + ".dll"));
|
||||
#else
|
||||
LoadLibrary(System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.Combine(myFolder, ".."), subfolder), libFLACDll + ".dll"));
|
||||
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.Combine(myFolder, ".."), subfolder), libFLACDll + ".dll"));
|
||||
#endif
|
||||
if (Dll == IntPtr.Zero)
|
||||
Dll = LoadLibrary(libFLACDll + ".dll");
|
||||
if (Dll == IntPtr.Zero)
|
||||
throw new DllNotFoundException();
|
||||
IntPtr addr = GetProcAddress(Dll, "FLAC__VERSION_STRING");
|
||||
IntPtr ptr = Marshal.ReadIntPtr(addr);
|
||||
version = Marshal.PtrToStringAnsi(ptr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using CUETools.Codecs;
|
||||
|
||||
namespace CUETools.Codecs.libFLAC.Reader
|
||||
namespace CUETools.Codecs.libFLAC
|
||||
{
|
||||
[AudioDecoderClass("libFLAC", "flac", 1)]
|
||||
public unsafe class Reader : IAudioSource
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using CUETools.Codecs;
|
||||
|
||||
namespace CUETools.Codecs.libFLAC.Writer
|
||||
namespace CUETools.Codecs.libFLAC
|
||||
{
|
||||
public class WriterSettings : AudioEncoderSettings
|
||||
{
|
||||
@@ -24,6 +24,10 @@ namespace CUETools.Codecs.libFLAC.Writer
|
||||
[DisplayName("MD5")]
|
||||
[Description("Calculate MD5 hash for audio stream")]
|
||||
public bool MD5Sum { get; set; }
|
||||
|
||||
[DisplayName("Version")]
|
||||
[Description("Library version")]
|
||||
public string Version => FLACDLL.GetVersion;
|
||||
};
|
||||
|
||||
[AudioEncoderClass("libFLAC", "flac", true, 2, typeof(WriterSettings))]
|
||||
|
||||
Reference in New Issue
Block a user