#pragma once

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

class pxtnService;
class KbPxtoneDecoder : public KbKpiUnknownImpl<IKpiDecoder>
{
private:
    KPI_MEDIAINFO  m_MediaInfo;
    pxtnService *m_pPxtn;
    IKpiFile    *m_pFile;
//    IKpiConfig  *m_pConfig;
    UINT64 m_qwCurSample;
    UINT64 m_qwEndSample;
    BOOL   m_bReady;
    kbpxtone_Settings m_Settings;
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);
    void __fastcall GetTagInfo(IKpiTagInfo *pTagInfo, DWORD dwTagGetFlags);
    KbPxtoneDecoder(IKpiConfig *pConfig);
    ~KbPxtoneDecoder(void);
};
