
// VideoPlayerDlg.h : header file
//

#pragma once
#include "afxcmn.h"
#include "afxwin.h"


// CVideoPlayerDlg dialog
class CVideoPlayerDlg : public CDialog
{
// Construction
public:
	CVideoPlayerDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_VIDEOPLAYERSDK_5_7_0_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;
	CComboBox m_ListOfPlayers;
	CProgressCtrl m_Progress1;
	CProgressCtrl m_Progress2;

	// VideoPlayerSDK
	//
	// enumerator of players
	CComPtr<ISLTMEnumVideoPlayer4TE> m_pIEnumPlayers;
	// video player
	CComPtr<ISLTMVideoPlayer4> m_pIPlayer;
	// status of the player
	enum { eNotInited=0, eStopped, eRunning, ePreparing } m_nState;
	// play list
	CArray<CString> m_FileNames;
	// index of playing file into the playlist
	int m_nCurFileIndex;
	// preparing file info
	int nPrepareIndex;
	double m_fPrepareDuration;
	// playing file info
	int nPlayIndex;
	double m_fPlayDuration;
	//
	// VideoPlayerSDK

	// VideoPlayerSDK
	//
	// external methods
	bool InitListOfPlayers();
	bool InitPlayer(int nVPIndex);
	bool StartPlayback();
	bool StopPlayback();
	void TickTimer();
	//
	// internal methods
	//
	// select first available player
	HRESULT CreatePlayer(int nVPIndex);
	HRESULT PrepareMovie(int nFileIndex, bool wait);
	HRESULT StartPreparedMovie(double start_time);
	HRESULT ForcePlayback();
	void DrawStatus(CString text);
	//
	// VideoPlayerSDK

public:
	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
	afx_msg void OnCbnSelchangePlayer();
	afx_msg void OnBnClickedStart();
	afx_msg void OnBnClickedStop();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
};
