/******************************************************************************************************

	UQuickTimeMovie.h
	
 ******************************************************************************************************

	Author:			Peter Baumgartner		peter@baumgartner.com
	
	Copyright:		© 2005-2006 by IMAGINE GbR - All Rights Reserved

 ******************************************************************************************************/

#if !__LP64__

 /******************************************************************************************************
	READ ME
 ******************************************************************************************************/

	#pragma mark READ ME

	// This class provides convenience methods for working with QuickTime movies...


	
/******************************************************************************************************
	INCLUDES
 ******************************************************************************************************/

	#pragma mark INCLUDES	
	
	#import <Carbon/Carbon.h>
	#import <Cocoa/Cocoa.h>
	#import <QuickTime/QuickTime.h>
	
	
	
/******************************************************************************************************
	TYPES
 ******************************************************************************************************/

	#pragma mark TYPES

	// Callbacks...
	
	typedef pascal OSErr (*VideoPropertyCallbackType)(void* inRefcon,long inTrackID,OSType inPropertyType,void* outPropertyValue);
	typedef pascal OSErr (*VideoRenderCallbackType)(void* inRefcon,MovieExportGetDataParams* outParams);



	#pragma mark

/******************************************************************************************************
	UQuickTimeMovie
 ******************************************************************************************************/

	class UQuickTimeMovie
	{
		#pragma mark

		// Movie Functions...
		
		public:
		
			static OSStatus GetDuration(NSString* inPath,double& outDuration);
			
			static OSStatus RenderMovie( NSString* inPath,
										 TimeScale inTimeScale,
										 MovieExportComponent inExporter,
										 VideoPropertyCallbackType inPropertyCallback,
										 VideoRenderCallbackType inRenderCallback,
										 void* inCallbackData);
										 
			static OSStatus FlattenMovieToFile(Movie inMovie,NSString* inPath,OSType inCreator);

			
		#pragma mark

		// General Track Accessors...
		
		public:
		
			static int GetTrackCount(Movie inMovie);
			static int GetTrackCountForMediaType(Movie inMovie,OSType inMediaType);
			static Track GetTrackForMediaTypeAtIndex(Movie inMovie,OSType inMediaType,int inIndex);
			static OSStatus CreateNewTrack(Movie inMovie,OSType inMediaType,int inWidth,int inHeight,int inLayer,TimeScale inTimeScale,Track* outTrack=NULL,Media* outMedia=NULL);


		#pragma mark

		// Audio Tracks...
		
		public:
			
			static int GetAudioTrackCount(Movie inMovie);
			static Track GetAudioTrackAtIndex(Movie inMovie,int inIndex);
			static OSStatus CreateNewAudioTrack(Movie inMovie,TimeScale inTimeScale,Track* outTrack=NULL,Media* outMedia=NULL);


		#pragma mark

		// Video Tracks...
		
		public:
			
			static int GetVideoTrackCount(Movie inMovie);
			static Track GetVideoTrackAtIndex(Movie inMovie,int inIndex);
			static OSStatus CreateNewVideoTrack(Movie inMovie,int inWidth,int inHeight,int inLayer,TimeScale inTimeScale,Track* outTrack=NULL,Media* outMedia=NULL);


		#pragma mark

		// Tween Tracks...
		
		public:
			
			static int GetTweenTrackCount(Movie inMovie);
			static Track GetTweenTrackAtIndex(Movie inMovie,int inIndex);
			static OSStatus CreateNewTweenTrackForAudioTrack(Movie inMovie,Track inAudioTrack,double inTime[4],double inVolume);
	};



/******************************************************************************************************/

#endif // !_LP64
