#pragma once

//tak_deco_lib.lib が SDK に同梱されていないので LoadLibarary/GetProcAddress して使う
//tak_deco_lib.dll の各 API は takapi.tak_xxx のようにして使う
//tak_deco_lib.h の API をそのまま使うとリンカエラーになる

BOOL LoadTakLib(HINSTANCE hKpi);
void UnloadTakLib(void);

struct TAKAPI
{
    TtakResult (*tak_GetLibraryVersion)(TtakInt32* AVersion, TtakInt32* ACompatibility);

    //TtakBool   (*tak_GetWaveExtensibleSpeakerMask)(TtakAudioFormatEx* AFormat, TtakUInt32* AMask);

    TtakResult (*tak_GetCodecName)(TtakInt32 ACodec, TtakAnsiChar* AName, TtakInt32 ANameSize);

    /*--- Create & Destroy -----------------------------------------------*/

    TtakSeekableStreamDecoder (*tak_SSD_Create_FromStream)(const TtakStreamIoInterface* ASourceStream,
        void* ASourceStreamUser,
        const TtakSSDOptions* AOptions,
        TSSDDamageCallback    ADamageCallback,
        void* ACallbackUser);

    void (*tak_SSD_Destroy)(TtakSeekableStreamDecoder ADecoder);

    /*--- Info -----------------------------------------------------------*/

    //TtakBool (*tak_SSD_Valid)(TtakSeekableStreamDecoder ADecoder);

    //TtakResult (*tak_SSD_State)(TtakSeekableStreamDecoder ADecoder);

    //TtakResult (*tak_SSD_GetStateInfo)(TtakSeekableStreamDecoder ADecoder,
    //    TtakSSDResult* AInfo);

    //TtakResult (*tak_SSD_GetErrorString)(TtakResult     AError,
    //    TtakAnsiChar* AString,
    //    TtakInt32      AStringSize);

    TtakResult (*tak_SSD_GetStreamInfo)(TtakSeekableStreamDecoder ADecoder,
        Ttak_str_StreamInfo* AInfo);

    //TtakResult (*tak_SSD_GetStreamInfo_V22)(TtakSeekableStreamDecoder ADecoder,
    //    Ttak_str_StreamInfo_V22* AInfo);

    //TtakInt32 (*tak_SSD_GetFrameSize)(TtakSeekableStreamDecoder ADecoder);

    //TtakResult (*tak_SSD_GetMD5)(TtakSeekableStreamDecoder ADecoder,
    //    Ttak_str_MD5              AMD5);

    /*--- IO -------------------------------------------------------------*/

    TtakResult (*tak_SSD_Seek)(TtakSeekableStreamDecoder ADecoder,
        TtakInt64                 ASamplePos);

    TtakResult (*tak_SSD_ReadAudio)(TtakSeekableStreamDecoder ADecoder,
        void* ASamples,
        TtakInt32                 ASampleNum,
        TtakInt32* AReadNum);

    //TtakInt64 (*tak_SSD_GetReadPos)(TtakSeekableStreamDecoder ADecoder);

    //TtakInt32 (*tak_SSD_GetCurFrameBitRate)(TtakSeekableStreamDecoder ADecoder);

    TtakResult (*tak_SSD_GetSimpleWaveDataDesc)(TtakSeekableStreamDecoder       ADecoder,
        Ttak_str_SimpleWaveDataHeader* ADesc);

    TtakResult (*tak_SSD_ReadSimpleWaveData)(TtakSeekableStreamDecoder ADecoder,
        void* ABuf,
        TtakInt32                 ABufSize);

    TtakResult (*tak_SSD_GetEncoderInfo)(TtakSeekableStreamDecoder   ADecoder,
        Ttak_str_MetaEncoderInfo* AInfo);

    //TtakAPEv2Tag (*tak_SSD_GetAPEv2Tag)(TtakSeekableStreamDecoder ADecoder);

};
extern TAKAPI takapi;
