Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TIIO_MOV_H
Toshihiro Shimizu 890ddd
#define TIIO_MOV_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef x64
Toshihiro Shimizu 890ddd
#include "tiio_mov_proxy.h"
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Windows include
Toshihiro Shimizu 890ddd
#include <windows.h></windows.h>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//QuickTime includes
Toshihiro Shimizu 890ddd
namespace QuickTime
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
#define list List
Toshihiro Shimizu 890ddd
#define map Map
Toshihiro Shimizu 890ddd
#define iterator Iterator
Toshihiro Shimizu 890ddd
#define float_t Float_t
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "QTML.h"
Toshihiro Shimizu 890ddd
#include "Movies.h"
Toshihiro Shimizu 890ddd
#include "Script.h"
Toshihiro Shimizu 890ddd
#include "FixMath.h"
Toshihiro Shimizu 890ddd
#include "Sound.h"
Toshihiro Shimizu 890ddd
#include "QuickTimeComponents.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tquicktime.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef list
Toshihiro Shimizu 890ddd
#undef map
Toshihiro Shimizu 890ddd
#undef iterator
Toshihiro Shimizu 890ddd
#undef float_t
Toshihiro Shimizu 890ddd
} //namespace QuickTime
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Toonz includes
Toshihiro Shimizu 890ddd
#include "tlevel_io.h"
Toshihiro Shimizu 890ddd
#include "tthreadmessage.h"
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef IMAGE_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
using namespace QuickTime;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//  Forward declarations
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TImageWriterMov;
Toshihiro Shimizu 890ddd
class TImageReaderMov;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//  Global functions
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
bool IsQuickTimeInstalled();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
//    Mov TLevelWriter class
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TLevelWriterMov : public TLevelWriter
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	std::vector<std::pair<int, timevalue="">> m_savedFrames;</std::pair<int,>
Toshihiro Shimizu 890ddd
	int m_IOError;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Movie m_movie;
Toshihiro Shimizu 890ddd
	Track m_videoTrack;
Toshihiro Shimizu 890ddd
	Track m_soundTrack;
Toshihiro Shimizu 890ddd
	Media m_videoMedia;
Toshihiro Shimizu 890ddd
	Media m_soundMedia;
Toshihiro Shimizu 890ddd
	GWorldPtr m_gworld;
Toshihiro Shimizu 890ddd
	PixMapHandle m_pixmap;
Toshihiro Shimizu 890ddd
	short m_refNum;
Toshihiro Shimizu 890ddd
	PixelXRGB *m_buf;
Toshihiro Shimizu 890ddd
	int buf_lx;
Toshihiro Shimizu 890ddd
	int buf_ly;
Toshihiro Shimizu 890ddd
	int m_firstFrame;
Toshihiro Shimizu 890ddd
	TThread::Mutex m_mutex;
Toshihiro Shimizu 890ddd
	ComponentInstance m_ci;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TLevelWriterMov(const TFilePath &path, TPropertyGroup *winfo);
Toshihiro Shimizu 890ddd
	~TLevelWriterMov();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TImageWriterP getFrameWriter(TFrameId fid);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void save(const TImageP &img, int frameIndex);
Toshihiro Shimizu 890ddd
	void saveSoundTrack(TSoundTrack *st);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	static TLevelWriter *create(const TFilePath &f, TPropertyGroup *winfo)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return new TLevelWriterMov(f, winfo);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
//    Mov TLevelReader class
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TLevelReaderMov : public TLevelReader
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	bool m_readAsToonzOutput; //default: false
Toshihiro Shimizu 890ddd
	bool m_yMirror;			  //default: true
Toshihiro Shimizu 890ddd
	bool m_loadTimecode;	  //default: false
Toshihiro Shimizu 890ddd
	int m_IOError;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	short m_refNum;
Toshihiro Shimizu 890ddd
	Movie m_movie;
Toshihiro Shimizu 890ddd
	Track m_track;
Toshihiro Shimizu 890ddd
	MediaHandler m_timecodeHandler;
Toshihiro Shimizu 890ddd
	long m_depth;
Toshihiro Shimizu 890ddd
	map<int, timevalue=""> currentTimes;</int,>
Toshihiro Shimizu 890ddd
	int m_lx, m_ly;
Toshihiro Shimizu 890ddd
	int m_hh, m_mm, m_ss, m_ff;
Toshihiro Shimizu 890ddd
	TThread::Mutex m_mutex;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TLevelReaderMov(const TFilePath &path);
Toshihiro Shimizu 890ddd
	~TLevelReaderMov();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TImageReaderP getFrameReader(TFrameId fid);
Toshihiro Shimizu 890ddd
	TLevelP loadInfo();
Toshihiro Shimizu 890ddd
	void load(const TRasterP &rasP, int frameIndex, const TPoint &pos, int shrinkX = 1, int shrinkY = 1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void timecode(int frame, UCHAR &hh, UCHAR &mm, UCHAR &ss, UCHAR &ff);
Toshihiro Shimizu 890ddd
	void loadedTimecode(UCHAR &hh, UCHAR &mm, UCHAR &ss, UCHAR &ff);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	const TImageInfo *getImageInfo(TFrameId fid) { return m_info; }
Toshihiro Shimizu 890ddd
	const TImageInfo *getImageInfo() { return m_info; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setYMirror(bool enabled);
Toshihiro Shimizu 890ddd
	void setLoadTimecode(bool enabled);
Toshihiro Shimizu 890ddd
	void enableRandomAccessRead(bool enable);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDimension getSize() const { return TDimension(m_lx, m_ly); }
Toshihiro Shimizu 890ddd
	TRect getBBox() const { return TRect(0, 0, m_lx - 1, m_ly - 1); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	static TLevelReader *create(const TFilePath &f);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	TLevelP loadToonzOutputFormatInfo();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===========================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//  Mov Properties
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace Tiio
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class MovWriterProperties : public TPropertyGroup
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	MovWriterProperties();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} //namespace Tiio
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//===========================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif //!x64
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif //TIIO_MOV_H