mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Build system cleanup. Platform dependent plugins moved to "plugins" subdirectories.
This commit is contained in:
@@ -5,7 +5,7 @@ namespace CUETools.Codecs.libFLAC
|
||||
{
|
||||
internal unsafe static class FLACDLL
|
||||
{
|
||||
internal const string libFLACDll = "libFLAC_dynamic";
|
||||
internal const string DllName = "libFLAC_dynamic";
|
||||
internal const CallingConvention libFLACCallingConvention = CallingConvention.Cdecl;
|
||||
internal const int FLAC__MAX_CHANNELS = 8;
|
||||
private static string version;
|
||||
@@ -43,16 +43,16 @@ namespace CUETools.Codecs.libFLAC
|
||||
internal delegate void FLAC__StreamDecoderErrorCallback(IntPtr decoder, FLAC__StreamDecoderErrorStatus status, void* client_data);
|
||||
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern IntPtr FLAC__stream_decoder_new();
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_decoder_set_metadata_respond(IntPtr decoder, FLAC__MetadataType type);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_decoder_process_until_end_of_metadata(IntPtr decoder);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
|
||||
IntPtr decoder,
|
||||
FLAC__StreamDecoderReadCallback read_callback,
|
||||
@@ -66,75 +66,75 @@ namespace CUETools.Codecs.libFLAC
|
||||
void* client_data
|
||||
);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_decoder_finish(IntPtr decoder);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_decoder_delete(IntPtr decoder);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_decoder_seek_absolute(IntPtr decoder, long sample);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern FLAC__StreamDecoderState FLAC__stream_decoder_get_state(IntPtr decoder);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_decoder_process_single(IntPtr decoder);
|
||||
|
||||
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern IntPtr FLAC__stream_encoder_new();
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_bits_per_sample(IntPtr encoder, uint value);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_sample_rate(IntPtr encoder, uint value);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_channels(IntPtr encoder, uint value);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_finish(IntPtr encoder);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_delete(IntPtr encoder);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_process_interleaved(IntPtr encoder, int* buffer, int samples);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern FLAC__StreamEncoderState FLAC__stream_encoder_get_state(IntPtr encoder);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern void FLAC__stream_encoder_get_verify_decoder_error_stats(IntPtr encoder, out ulong absolute_sample, out uint frame_number, out uint channel, out uint sample, out int expected, out int got);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern FLAC__StreamMetadata* FLAC__metadata_object_new(FLAC__MetadataType type);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata* metadata, int samples, long total_samples);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata* metadata, int compact);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_metadata(IntPtr encoder, FLAC__StreamMetadata** metadata, int num_blocks);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_verify(IntPtr encoder, int value);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_do_md5(IntPtr encoder, int value);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_total_samples_estimate(IntPtr encoder, long value);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_compression_level(IntPtr encoder, int value);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern int FLAC__stream_encoder_set_blocksize(IntPtr encoder, int value);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
@@ -149,7 +149,7 @@ namespace CUETools.Codecs.libFLAC
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate void FLAC__StreamEncoderMetadataCallback(IntPtr encoder, FLAC__StreamMetadata* metadata, void* client_data);
|
||||
|
||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
||||
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||
internal static extern FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(IntPtr encoder,
|
||||
FLAC__StreamEncoderWriteCallback write_callback,
|
||||
FLAC__StreamEncoderSeekCallback seek_callback,
|
||||
@@ -162,14 +162,14 @@ namespace CUETools.Codecs.libFLAC
|
||||
var myPath = new Uri(typeof(FLACDLL).Assembly.CodeBase).LocalPath;
|
||||
var myFolder = System.IO.Path.GetDirectoryName(myPath);
|
||||
var is64 = IntPtr.Size == 8;
|
||||
var subfolder = is64 ? "plugins (x64)" : "plugins (win32)";
|
||||
var subfolder = is64 ? "x64" : "win32";
|
||||
#if NET40
|
||||
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(myFolder, "..", subfolder, libFLACDll + ".dll"));
|
||||
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(myFolder, subfolder, DllName + ".dll"));
|
||||
#else
|
||||
IntPtr Dll = 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(myFolder, subfolder), DllName + ".dll"));
|
||||
#endif
|
||||
if (Dll == IntPtr.Zero)
|
||||
Dll = LoadLibrary(libFLACDll + ".dll");
|
||||
Dll = LoadLibrary(DllName + ".dll");
|
||||
if (Dll == IntPtr.Zero)
|
||||
throw new DllNotFoundException();
|
||||
IntPtr addr = GetProcAddress(Dll, "FLAC__VERSION_STRING");
|
||||
|
||||
Reference in New Issue
Block a user