// Video.h: interface for the CVideo class.
//
//////////////////////////////////////////////////////////////////////
#include "fwxDCam.h"
#include "fwxVideo.h"
#include "fwx1394API.h"

#if !defined(AFX_VIDEO_H__DEA9A138_8CB8_11D3_80A0_00C04F60EB8B__INCLUDED_)
#define AFX_VIDEO_H__DEA9A138_8CB8_11D3_80A0_00C04F60EB8B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define _PROFILE 1

#define ISO_VIDEO_FRAMES 3

#define FRAMESIZE_MODE0 57600
#define FRAMESIZE_MODE1 153600
#define FRAMESIZE_MODE2 460800
#define FRAMESIZE_MODE3 614400
#define FRAMESIZE_MODE4 921600
#define FRAMESIZE_MODE5 307200

class CVideoProcess;
class CVideo;

typedef struct 
{
	LPVOID pFrameData;
	BYTE *pVideoFrame;
	ULONG nFrameSize;
	UINT nFrames;
	UINT nVideoMode;
	HANDLE hStopVideoEvent;
	HANDLE hFrameCompleteEvent[ISO_VIDEO_FRAMES];
	CVideoProcess* pVideoProcess;
} SVideoThreadArg;


class CVideo : public CObject  
{
public:
	
	BOOL ChangeVMode(int nMode);
	void OnStart();
    SVideoThreadArg VideoThreadArg;
	void OnStop();
	BOOL StopVideo();
    BOOL StartVideo();
	BOOL RunCamera();
	CVideo();
	virtual ~CVideo();

protected:
    UINT ProcessVideoThread(LPVOID pParam);
	CfwxDCam *pDCam;

	/*int nZoom;
	int nBrightness;
	int nFocus;
	int nGain;
	int nGamma;
	int nLensControl;
	int nShutterSpeed;
	int nWhiteBalance;*/

	int nShutDown;
	CVideoProcess * pVideoProcess;

	UINT nVideoMode;
	BYTE *pVideoFrame;
	ULONG nFrameSize[6];
	LPVOID pFrameData;
	CfwxDCam DCam;
	fwxGUID_t GUID;
	HANDLE hDeviceRemovedEvent;
	BOOL bInitialized;
	BOOL bPaused;
	BOOL bReallocateIsoResources;
	int nRemovedTimerID;

#ifdef _PROFILE
	DWORD StartTick;
	DWORD StopTick;
#endif

	CWinThread *pVideoThread;
	HANDLE hStopVideoThreadEvent;
	HANDLE hFrameCompleteEvent[ISO_VIDEO_FRAMES];

	/*int nZoomMax;
	int nZoomMin;
	int nBrightnessMax;
	int nBrightnessMin;
	int nFocusMax;
	int nFocusMin;
	int nGainMax;
	int nGainMin;
	int nGammaMax;
	int nGammaMin;
	int nLensControlMax;
	int nLensControlMin;
	int nShutterSpeedMax;
	int nShutterSpeedMin;
	int nWhiteBalanceMax;
	int nWhiteBalanceMin;*/

};

#endif // !defined(AFX_VIDEO_H__DEA9A138_8CB8_11D3_80A0_00C04F60EB8B__INCLUDED_)
