#ifndef _MEMORY_MM
#define _MEMORY_MM

#include "ofMain.h"
#include <QTML.h>
#include <FixMath.h>
#include <QuickTimeComponents.h>
#include <TextUtils.h>	
#include <Resources.h>

#include <direct.h>

class memoryMovieMaker {

	public:
		
		memoryMovieMaker();
		Movie * returnMyMovie();
		
		
		
		
		void 			startMakingMovieInRam(int width, int height);
		void 			finishMakingMovieInRam();
		
		void 			addFrame(unsigned char * pixels);
		void 			addFrame(unsigned char * pixels, float frameDuration);
		
		void 			saveViaFileDialog();
		void 			save(char * fileName);
		
		void 			listCodecs();
		void			setCodecType(int codec);	
		
		Rect            myRect;
		GWorldPtr       myGWorld;
		PixMapHandle    myPixMap;
	
		
		int 			width, height;
		bool 			bOkToMakeMovie;
		 
		
		Movie          	myMovie;
		Track          	myTrack;
		Media          	myMedia;
		short          	myResRefNum;
		short          	myResID;
		Handle          myDataRef;
		Handle          myHandle;
		OSErr          	myErr;
		
		
		
		CodecType          			myCodecType;
		long            			myNumSample;
		long            			myMaxComprSize;
		Handle            			myComprDataHdl;
		Ptr              			myComprDataPtr;
		ImageDescriptionHandle    	myImageDesc;



};

#endif	







/*
useful info:

void function( GWorldPtr gwPtr, RGBColor rgb, short x, short y )
{ 
    Ptr    gwAddress, gwAddressBase;
    long   gwWidth;
    char   red, blue, green,

    gwAddressBase = GetPixBaseAddr( GetGWorldPixMap( gwPtr ) );   // Get head address of offscreen      
    gwWidth = ( **GetGWorldPixMap( gwPtr ) ).rowBytes & 0x3fff;   // Get with of offscreen              
    gwAddress = gwAddressBase + ( x * 4 ) + ( y * gwWidth ) + 1;  // Get adress for current pixel       
    *gwAddress++ = (unsigned char)rgb.red;                        // Put red and move address forward   
    *gwAddress++ = (unsigned char)rgb.green;                      // Put green and move address forward 
    *gwAddress   = (unsigned char)rgb.blue;                       // Put blue                           
   
	//RGBForeColor( &rgb );
	//PenSize( 1, 1 );
	//MoveTo( x, y );
	//LineTo( x, y );
}
*/