///////////////////////////////////////////////////////////////////////////////
//
// File      : Asura_PS3_FMV_Control.h
// Author    : Philip Hall
// Created   : 19/10/2007
//
// Copyright (C) 2007 Rebellion. All Rights Reserved
//
///////////////////////////////////////////////////////////////////////////////

#if !defined __ASURA_PS3_FMV_CONTROL_H__
#define __ASURA_PS3_FMV_CONTROL_H__


// Asura PS3 headers
#include "Core/Asura_PS3_Mutex.h"

#include <cell/codec.h>

#define FMV_ERROR_FACILITY      0x800
#define RET_CODE_ERR_ARG        CELL_ERROR_MAKE_ERROR(FMV_ERROR_FACILITY, 1)
#define RET_CODE_ERR_FATAL      CELL_ERROR_MAKE_ERROR(FMV_ERROR_FACILITY, 2)
#define RET_CODE_ERR_UNKNOWN    CELL_ERROR_MAKE_ERROR(FMV_ERROR_FACILITY, 4)
//#define RET_CODE_ERR_INVALID  CELL_ERROR_MAKE_ERROR(FMV_ERROR_FACILITY, 5)

////PGH/////////////////////////////////////////
// Control arbitration for the FMV classes
////////////////////////////////////////////////
class Asura_PS3_FMV_Control
{
	enum { 
		STATUS_NONE	 = 0x00,
		STATUS_READY = 0x01,
		STATUS_END	 = 0x02
	};
public:
	Asura_PS3_FMV_Control();
	~Asura_PS3_FMV_Control();
	
	void Begin();
	void Abort(int iError);

	void Complete();
	void EndStream();
	void EndAudioData();
	void EndVideoData();
	void EndDMux();

	bool IsComplete()        { return m_bComplete; }
	bool IsAborted()         { return m_bAborted; } 
	bool IsEndOfAudioData()  { return m_bEndOfAudioData; }
	bool IsEndOfVideoData()  { return m_bEndOfVideoData; }
	bool IsEndOfStream()     { return m_bEndOfStream; }
	bool IsEndOfDMux()       { return m_bEndOfDMux; }

	void SetATime(CellAdecTimeStamp &xAudioTime) { m_xATime = xAudioTime; }
	CellAdecTimeStamp GetATime() const { return m_xATime; }

private:
	bool  m_bAborted;
	bool  m_bComplete;
	bool  m_bEndOfAudioData;
	bool  m_bEndOfVideoData;
	bool  m_bEndOfStream;
	bool  m_bEndOfDMux;

	int   m_iErrorCode;
	CellAdecTimeStamp m_xATime;

	Asura_PS3_Mutex m_xControlLock;
};





#endif













