#ifndef _OF_MEMVID_PLAYER
#define _OF_MEMVID_PLAYER

#include "ofConstants.h"
#include "ofQtUtils.h"
#include "ofTexture.h"

#define OF_QT_LOOP_NONE					0x01
#define OF_QT_LOOP_PALINDROME			0x02
#define OF_QT_LOOP_NORMAL				0x03

//---------------------------------------------
// this struct has all the info we need to play 1 movie
// kept in a struct, because the callback will 
// need to reference it... 
typedef struct {
	MovieController  	thePlayer;
	GWorldPtr 			offscreenGWorld;
	Movie 			 	moviePtr;
	Rect 				movieRect;
	unsigned char * 	offscreenGWorldPixels;	// 32 bit: argb (qt k32ARGBPixelFormat)	
	unsigned char * 	pixels;					// 24 bit: rgb
	int					w;
	int 				h;
	bool 				bHavePixelsChanged;
	ofTexture 			* tex;					// a ptr to the texture we are utilizing
	bool 				bUseTexture;			// are we using a texture
} videoPlayerData2;
//---------------------------------------------

class memoryMoviePlayer{
	
	public:
	
	
		memoryMoviePlayer ();
				
		void 	closeMovie();
		bool 	loadMovie(Movie * myMovie);
		void 	idleMovie();				// rename to updateMovie?
		
		int 				width, height;
		float  				speed;
		bool 				bLoadedMovie;	
		
		bool 				isFrameNew();
		unsigned char * 	getPixels();
		float 				getPosition();
		float 				getSpeed();
		float 				getDuration();	
		
		void 				setPosition(float pct);
		void 				setVolume(int volume);
		void 				setLoopState(int state);
		void   				setSpeed(float speed);
		
		void 				setUseTexture(bool bUse);
		void 				draw(float x, float y, float w, float h);	
		void 				draw(float x, float y);	
		
		void 				setPaused(bool bPause);
		
	private:
	
		//---------------------------
		videoPlayerData2			* vpd;
		ofTexture 					tex;
		bool						bUseTexture;	
					
}; 
#endif

