#pragma once

#include "kpi_decoder.h"
#include "kpi_impl.h"

namespace dsa{
    class CSMFPlay;
}

class KbEMidiDecoder : public KbKpiUnknownImpl<IKpiDecoder>
{
private:
    dsa::CSMFPlay *m_smfplay;
    KPI_MEDIAINFO m_MediaInfo;
    IKpiConfig    *m_pConfig;
    UINT64         m_qwCurSample;
public:
    KbEMidiDecoder(IKpiConfig *pConfig);
    ~KbEMidiDecoder(void);
    DWORD __fastcall Open(const KPI_MEDIAINFO *cpRequest,
                          IKpiFile *pFile,
                          IKpiFolder *pFolder);
    DWORD  WINAPI Select(DWORD dwNumber,
                         const KPI_MEDIAINFO **ppMediaInfo,
                         IKpiTagInfo *pTagInfo,
                         DWORD dwTagGetFlags);
    UINT64 WINAPI Seek(UINT64 qwPosSample, DWORD dwFlag);
    DWORD  WINAPI Render(BYTE *pBuffer, DWORD dwSizeSample);
    DWORD  WINAPI UpdateConfig(void *pvReserved){return 0;}
};
