#pragma once

#include "kpi_player.h"
#include "kpi_impl.h"

extern "C" {
#include "PsxPub.h"
}
class KbCstrModule;
class KbCstrPlayer : public KbKpiUnknownImpl<IKpiPlayer>
{
private:
    static wchar_t  s_szClassName[128];
    KPI_MEDIAINFO   m_MediaInfo;
    HWND            m_hWnd;         // 表示ウインドウのハンドル
    HPLAYER         m_hPlayer;      // PsxMCのプレイヤー
    PSRSTREAMINFO   m_strInfo;      // 再生メディアの情報
    IKpiFile       *m_pFile;
    void __fastcall SetMovieSize(int nVideoWidth, int nVideoHeight);
    static LRESULT CALLBACK CstrWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
    LRESULT CALLBACK CstrWindowProcInternal(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
public:
    KbCstrPlayer(void);
    ~KbCstrPlayer(void);
    BOOL __fastcall Open(IKpiFile *pFile, IKpiFolder *pFolder);
    DWORD WINAPI Select(DWORD dwNumber,
                        const KPI_MEDIAINFO **ppInfo,
                        IKpiTagInfo *pTagInfo,
                        DWORD dwTagGetFlags);
    BOOL  WINAPI Play(DWORD dwStartpos, BOOL bVisible);
    BOOL  WINAPI Pause(void);
    BOOL  WINAPI Restart(void);
    void  WINAPI Stop(void);
    DWORD WINAPI GetPosition(void);
    DWORD WINAPI GetStatus(void);
    void  WINAPI SetTempo(int Tempo);
    void  WINAPI SetVolume(int Volume);
    void  WINAPI SetVisible(BOOL bVisible);
    void  WINAPI GetWindowPosition(int *pLeft, int *pTop,
                                   int *pVideoWidth, int *pVideoHeight);
    void  WINAPI SetWindowPosition(int nLeft, int nTop,
                                   int nVideoWidth, int nVideoHeight);
    void  WINAPI SetTopMost(BOOL bParent);
    void  WINAPI SetRepeat(BOOL bRepeat){};
    DWORD WINAPI UpdateConfig(void *pvReserved){return 0;}//設定が変更されたら呼ばれる
    static void __fastcall Init(void);
    static void __fastcall Deinit(void);
};

