#pragma once

#include "kpi_decoder.h"
#include "kpi_impl.h"
#include <mmsystem.h>

class KbWavDecoder :  public KbKpiUnknownImpl<IKpiDecoder>
{
private:
    KPI_MEDIAINFO m_MediaInfo;
    IKpiFile     *m_pFile;
    HMMIO         m_hmmio;
    DWORD         m_dwBlockAlign;
    DWORD         m_dwStartFileOffset;
    DWORD         m_dwCurSample;
    DWORD         m_dwEndSample;
public:
    BOOL __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;}
    KbWavDecoder(void);
    ~KbWavDecoder(void);
};
