From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Plugins/Input/in_flac/FLACFileCallbacks.h | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Src/Plugins/Input/in_flac/FLACFileCallbacks.h (limited to 'Src/Plugins/Input/in_flac/FLACFileCallbacks.h') diff --git a/Src/Plugins/Input/in_flac/FLACFileCallbacks.h b/Src/Plugins/Input/in_flac/FLACFileCallbacks.h new file mode 100644 index 00000000..7bd2538c --- /dev/null +++ b/Src/Plugins/Input/in_flac/FLACFileCallbacks.h @@ -0,0 +1,35 @@ +#pragma once +#include +#include "nx/nxfile.h" + + +FLAC__StreamDecoderReadStatus FLAC_NXFile_Read(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); +FLAC__StreamDecoderSeekStatus FLAC_NXFile_Seek(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); +FLAC__StreamDecoderTellStatus FLAC_NXFile_Tell(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); +FLAC__StreamDecoderLengthStatus FLAC_NXFile_Length(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); +FLAC__bool FLAC_NXFile_EOF(const FLAC__StreamDecoder *decoder, void *client_data); + + +class FLACClientData +{ +public: + FLACClientData() : object(0) {} + void SetFile(nx_file_t file) { this->file = file; } + void SetObject(void *object) { this->object = object; } + nx_file_t GetFile() { return file; } + void *GetObject() { return object; } +private: + nx_file_t file; + void *object; +}; + +template +static _t *FLAC_GetObject(void *client_data) +{ + return (_t *)((FLACClientData *)client_data)->GetObject(); +} + +static nx_file_t FLAC_GetFile(void *client_data) +{ + return ((FLACClientData *)client_data)->GetFile(); +} \ No newline at end of file -- cgit