#pragma once

#include "kpi_decoder.h"
#include "kpi_impl.h"
#include "kbgme_config.h"
#include "libgme/gme/gme.h"

class KbGmeDecoder : public KbKpiUnknownImpl<IKpiDecoder>
{
private:
    static LONG     s_lInitialized;
    KPI_MEDIAINFO   m_MediaInfo;
    kbgme_Settings  m_Settings;
    IKpiFile       *m_pFile;
    Music_Emu      *m_pEmu;

public:
    DWORD  __fastcall Open(const KPI_MEDIAINFO *cpRequest,
                           IKpiFile   *pFile,
                           IKpiFolder *pFolder);
    DWORD  WINAPI Select(DWORD dwNumber,
                         const KPI_MEDIAINFO **ppMediaInfo,
                         IKpiTagInfo *pTagInfo,
                         DWORD dwTagGetFlags);
    DWORD  WINAPI Render(BYTE *pBuffer, DWORD dwSizeSample);
    UINT64 WINAPI Seek(UINT64 qwPosSample, DWORD dwFlag);
    DWORD  WINAPI UpdateConfig(void *pvReserved){return 0;}
    void __fastcall GetTagInfo(IKpiTagInfo *pTagInfo, DWORD dwTagGetFlags);
    static void __fastcall Initialize(IKpiConfig *pConfig);
    static void __fastcall Uninitialize(void);
    KbGmeDecoder(IKpiConfig *pConfig);
    ~KbGmeDecoder(void);
};
