#pragma once

#include <wmsdk.h>
#include "kpi_decoder.h"
#include "kpi_impl.h"
#include "kpifile_stream.h"

class KbWmaDecoder : public KbKpiUnknownImpl<IKpiDecoder>
{
protected:
    KPI_MEDIAINFO   m_MediaInfo;
    IWMSyncReader*  m_pReader;
    KbKpiFileStream*       m_pStream;
    INSSBuffer*     m_pSample;
    BYTE           *m_pBuffer;
    DWORD           m_dwRemainSample;
    DWORD           m_dwBitrate;
    DWORD           m_dwIsVbr;
public:
    KbWmaDecoder(void);
    ~KbWmaDecoder(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);
    DWORD  WINAPI Render(BYTE *pBuffer, DWORD dwSizeSample);
    UINT64 WINAPI Seek(UINT64 qwPosSample, DWORD dwFlag);
    DWORD  WINAPI UpdateConfig(void *pvReserved){return 0;}
};
