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

		IShMovie.h

		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Emil (from RD code)
		Date:	1/21/99

		Revision History

		when		who			what & why
		==========	==========	======================================================

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

#ifndef __IShMovie__
#define __IShMovie__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "COMTypes.h"

//************************ Globally Unique Ids *******************************

MCDEFINE_GUID(IID_IShMovie, 0xa085d928, 0xb16d, 0x11d2, 0x8b, 0x6e, 0x0, 0x60, 0x97, 0xb, 0xc5, 0x21);

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


struct IShRasterLayer;
struct IExMovieCompressionOptions;
struct IMFPart;
struct IExSound;
struct TSequencedMovieInfos;
struct ImageExportCapabilities;
class  TMCString;
class  TMovieCaps;
struct TGBuffer32List;
struct IShLayerList;

/// \addtogroup MCImage
/// \{


/*****************************************************************************\
*                                                                             *
*  IShMovie                                                                   *
*                                                                             *
\*****************************************************************************/
#ifndef qDemoVersion //regular interface

struct IShMovie: public IMCUnknown
{   
	//methods common to reading and writing
	virtual MCCOMErr MCCOMAPI GetCaps				(TMovieCaps& caps) = 0;
	virtual IDType	 MCCOMAPI GetFileTypeID			() = 0;

	//movie playing
	virtual MCCOMErr MCCOMAPI CreateMovieController	(IMFPart** movieController) = 0;

	//methods for reading
	virtual MCCOMErr MCCOMAPI Initialize			(const TMCString& fullPathName, const TSequencedMovieInfos* infos= NULL) = 0;
	virtual MCCOMErr MCCOMAPI BeginRead				() = 0;
	virtual MCCOMErr MCCOMAPI GetFrameRate			(real32& frameRate) = 0;
	virtual MCCOMErr MCCOMAPI GetFrameCount			(uint32& frameCount) = 0;
	virtual MCCOMErr MCCOMAPI GetFrame				(IShRasterLayer** rasterLayer, uint32 frameIndex) = 0;
	virtual MCCOMErr MCCOMAPI GetFrame				(IShLayerList** layerList, uint32 frameIndex, boolean forceLoad) = 0;
	virtual MCCOMErr MCCOMAPI EndRead				() = 0;

	//methods for writing
	virtual boolean	 MCCOMAPI HasOptionsDialog		() = 0;
	virtual MCCOMErr MCCOMAPI ShowOptionsDialog		(uint32 depth, real32& frameRate) = 0;
	virtual boolean	 MCCOMAPI HasOptions			() = 0;
	virtual MCCOMErr MCCOMAPI BeginWrite			(const TMCString& fullPathName, uint32 sizeH, uint32 sizeV, uint32 depth, real32 frameRate, boolean append) = 0;
	virtual MCCOMErr MCCOMAPI PutFrame				(IShRasterLayer* rasterLayer,const TGBuffer32List* gBuffers, uint32 frameIndex) = 0;
	virtual MCCOMErr MCCOMAPI PutFrame				(IShLayerList* layerList,const TGBuffer32List* gBuffers, uint32 frameIndex) = 0;

	// ****************************************************************************
	//								PutSound
	// 
	/// Adds a sound to the movie. Don't forget to call FinishAddingSound once you
	/// are done adding all the sounds.
	/// 
	/// \param inSound			The sound that should be added to the movie.
	/// \param startTime		Start time of the sound in the animation
	/// \param offsetInSound    Offset into the sound where it actually starts
	/// 
	virtual MCCOMErr MCCOMAPI PutSound				(IExSound* inSound, uint32 startTime, int32 offsetInSound) = 0;

	//calling flush ensures that the movie file is valid up to the last PutFrame.
	virtual MCCOMErr MCCOMAPI Flush					() = 0;

	//sometimes the file name can change between open and save.
	//more specifically, wen using numbered files. You save "Movie.jpg"
	//but you reopen "Movie001.jpg" because this is the actual file.
	virtual MCCOMErr MCCOMAPI GetMovieFullPathName	(TMCString& fullPathName) = 0;

	virtual MCCOMErr MCCOMAPI EndWrite				() = 0;

	virtual MCCOMErr MCCOMAPI PostWrite				() = 0;

	//Makes an exact copy of the movie to the location given by fullPathName.
	//Returns the name of the first written file (equals fullPathName if non sequenced).	
	virtual void	 MCCOMAPI MakeCopy(const TMCString& fullPathName, TMCString& outFirstFileName) = 0;

	virtual void	 MCCOMAPI DeleteMovie() = 0;

	// ****************************************************************************
	//								GetCompressionOptions
	// 
	// -Description:
	//
	// Returns a pointer to the compression options used for this movie
	//
	virtual void	 MCCOMAPI GetCompressionOptions(IExMovieCompressionOptions** movieOptions) = 0;

	// ****************************************************************************
	//								SetCompressionOptions
	// 
	// -Description:
	//
	// Sets the compression options used for this movie
	//
	virtual void	 MCCOMAPI SetCompressionOptions(IExMovieCompressionOptions* movieOptions) = 0;

	// ****************************************************************************
	//								CanHaveSounds					
	// 
	// -Description: Returns true if the file format of this movie writer supports sounds
	//
	virtual boolean	MCCOMAPI CanHaveSounds() = 0;

	// ****************************************************************************
	//								FinishAddingSound
	// 
	/// Should be called after all the called to PutSound to get the changes written
	/// to disk.
	/// 
	virtual MCCOMErr FinishAddingSound() = 0;

};
/// \}
#else 	//(qDemoVersion) begin scrambled interface

struct IShMovie: public IMCUnknown
{   
	virtual void	 MCCOMAPI GetCompressionOptions(IExMovieCompressionOptions** movieOptions) = 0;
	virtual void	 MCCOMAPI SetCompressionOptions(IExMovieCompressionOptions* movieOptions) = 0;
	virtual MCCOMErr MCCOMAPI ShowOptionsDialog		(uint32 depth, real32& frameRate) = 0;
	virtual MCCOMErr MCCOMAPI PostWrite				() = 0;
	virtual boolean	 MCCOMAPI HasOptions			() = 0;
	virtual MCCOMErr MCCOMAPI BeginWrite			(const TMCString& fullPathName, uint32 sizeH, uint32 sizeV, uint32 depth, real32 frameRate, boolean append) = 0;
	virtual MCCOMErr MCCOMAPI PutFrame				(IShRasterLayer* rasterLayer,const TGBuffer32List* gBuffers, uint32 frameIndex) = 0;
	virtual MCCOMErr MCCOMAPI Flush					() = 0;
	virtual boolean	 MCCOMAPI CanHaveSounds() = 0;
	virtual MCCOMErr MCCOMAPI GetMovieFullPathName	(TMCString& fullPathName) = 0;
	virtual MCCOMErr MCCOMAPI EndWrite				() = 0;		
	virtual MCCOMErr MCCOMAPI GetFrameCount			(uint32& frameCount) = 0;
	virtual MCCOMErr MCCOMAPI GetFrame				(IShRasterLayer** rasterLayer, uint32 frameIndex) = 0;
	virtual MCCOMErr MCCOMAPI EndRead				() = 0;	
	virtual boolean	 MCCOMAPI HasOptionsDialog		() = 0;
	virtual MCCOMErr MCCOMAPI GetCaps				(TMovieCaps& caps) = 0;
	virtual IDType	 MCCOMAPI GetFileTypeID			() = 0;	
	virtual MCCOMErr MCCOMAPI CreateMovieController	(IMFPart** movieController) = 0;	
	virtual MCCOMErr MCCOMAPI Initialize			(const TMCString& fullPathName, const TSequencedMovieInfos* infos= NULL) = 0;
	virtual MCCOMErr MCCOMAPI PutSound				(IExSound* inSound, uint32 startTime, int32 offsetInSound) = 0;
	virtual MCCOMErr MCCOMAPI BeginRead				() = 0;
	virtual MCCOMErr MCCOMAPI GetFrameRate			(real32& frameRate) = 0;
	virtual void	 MCCOMAPI DeleteMovie() = 0;
	virtual void	 MCCOMAPI MakeCopy(const TMCString& fullPathName, TMCString& outFirstFileName) = 0;
};
#endif	//(qDemoVersion) end scrambled


#endif