/*
 *	osgART/Video/ARToolKit/ARToolKitVideo
 *	osgART: AR ToolKit for OpenSceneGraph
 *
 *	Copyright (c) 2005-2007 ARToolworks, Inc. All rights reserved.
 *	
 *	Rev		Date		Who		Changes
 *  1.0   	2006-12-08  ---     Version 1.0 release.
 *
 */
/*
 * This file is part of osgART - AR Toolkit for OpenSceneGraph
 *
 * Copyright (c) 2005-2007 ARToolworks, Inc. All rights reserved.
 *
 * (See the AUTHORS file in the root of this distribution.)
 *
 *
 * OSGART is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * OSGART is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OSGART; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *
 */


/**
 *  \file  Video
 *  \brief A video class for video input stream.
 *
 * 
 * A multiplatform video class mainly based on the ARToolKit Video Class
 * wrapped to be used with OpenScenegraph.
 *	
 *   \remark 
 *
 *   History :
 *
 *  \author Julian Looser Julian.Looser@hitlabnz.org
 *  \author Raphael Grasset Raphael.Grasset@hitlabnz.org
 *  \version 3.1
 *  \date 01/12/07
 **/

#ifndef OSGART_ARTOOLKITVIDEO
#define OSGART_ARTOOLKITVIDEO

/* --------------------------------------------------------------------------
 * include file
 *----------------------------------------------------------------------------*/

//standard include

#include <iostream>
#include <string>

//graphics include
#include <AR/video.h>
#include "osgART/Export"

//personnal include
#include "osgART/GenericVideo"
#include "osgART/VideoConfig"


class ARToolKitVideo : public osgART::GenericVideo
{
public:        
// Standard Services
	
	/** 
		* Default constructor. It creates a video source from a configuration string
		* as it is been used in the original AR Toolkit 2.71
		* \param videoName a string definition of the video background. See documentation
		* of ARToolKit for further details.
		*/
	ARToolKitVideo();
	
	/** 
		* Copy constructor.
		*
		*/
	ARToolKitVideo(const ARToolKitVideo &);
	
	/** 
		* Destructor.
		*
		*/
	~ARToolKitVideo();   
	
	/** 
		* Affectation operator.
		*
		*/
	ARToolKitVideo& operator = (const ARToolKitVideo &);
	
	/**
		* Open the video stream. Access the video stream (hardware or file) and get an handle on it.
		*/
	void open();
	
	/**
		* Close the video stream. Terminates the connection with the video stream and clean handle.
		*/
	void close();
	
	/**
		* Start the video stream grabbing. Start to get image from the video stream. In function of the 
		* implementation on different platform, this function can run a thread, signal or 
		* real-time function.
		*/
	void start();
	
	/**
		* Stop the video stream grabbing. Stop to get image from the video stream. In function 
		* of the implementation on different platform, this function can stop a thread, signal or 
		* real-time function. 
		*/
	void stop();
	
	/**
		* Update the video stream grabbing. Try to get an image of the video instance, usable 
		* by your application.
		*/
	void update();
	

	/** 
	* Deallocate image memory. Deallocates any internal memory allocated by the instance of this
	* class.
	*/		 
	void releaseImage();
	
	virtual osgART::VideoConfiguration* getVideoConfiguration();
	
	
	
private:

	AR2VideoParamT *video;
	
	osgART::VideoConfiguration m_config;
	
};


#endif
