2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TIIO_MOV_H
|
|
|
|
#define TIIO_MOV_H
|
|
|
|
|
|
|
|
#ifdef __LP64__
|
|
|
|
#include "tiio_mov_proxy.h"
|
|
|
|
#else
|
|
|
|
|
|
|
|
//#include <Carbon/Carbon.h>
|
|
|
|
//#include <Movies.h>
|
|
|
|
//#include <ImageCompression.h>
|
|
|
|
//#include "QuickTimeComponents.h"
|
|
|
|
|
|
|
|
#include <QuickTime/QuickTime.h>
|
|
|
|
|
|
|
|
#include "tquicktime.h"
|
|
|
|
#include "tlevel_io.h"
|
|
|
|
#include "tthread.h"
|
|
|
|
#include "tthreadmessage.h"
|
|
|
|
|
|
|
|
bool IsQuickTimeInstalled();
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class TLevelWriterMov : public TLevelWriter {
|
|
|
|
std::vector<std::pair<int, TimeValue>> m_savedFrames;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TLevelWriterMov(const TFilePath &path, TPropertyGroup *winfo);
|
|
|
|
~TLevelWriterMov();
|
|
|
|
TImageWriterP getFrameWriter(TFrameId fid);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int m_IOError;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void save(const TImageP &img, int frameIndex);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
Movie m_movie;
|
|
|
|
Track m_videoTrack;
|
|
|
|
Media m_videoMedia;
|
|
|
|
Track m_soundTrack;
|
|
|
|
Media m_soundMedia;
|
|
|
|
|
|
|
|
GWorldPtr m_gworld;
|
|
|
|
PixMapHandle m_pixmap;
|
|
|
|
// Handle m_compressedData;
|
|
|
|
short m_refNum;
|
|
|
|
|
|
|
|
PixelXRGB *buf;
|
|
|
|
int buf_lx;
|
|
|
|
int buf_ly;
|
|
|
|
int m_firstFrame;
|
|
|
|
TThread::Mutex m_mutex;
|
|
|
|
ComponentInstance m_ci;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
static TLevelWriter *create(const TFilePath &f, TPropertyGroup *winfo) {
|
|
|
|
return new TLevelWriterMov(f, winfo);
|
|
|
|
};
|
|
|
|
void saveSoundTrack(TSoundTrack *st);
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class TLevelReaderMov : public TLevelReader {
|
|
|
|
bool m_readAsToonzOutput;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TLevelReaderMov(const TFilePath &path);
|
|
|
|
~TLevelReaderMov();
|
|
|
|
TImageReaderP getFrameReader(TFrameId fid);
|
|
|
|
// friend class TImageReaderMov;
|
|
|
|
TLevelP loadInfo();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void enableRandomAccessRead(bool enable) { m_readAsToonzOutput = enable; }
|
|
|
|
void load(const TRasterP &rasP, int frameIndex, const TPoint &pos,
|
|
|
|
int shrinkX = 1, int shrinkY = 1);
|
|
|
|
TDimension getSize() const { return TDimension(m_lx, m_ly); }
|
|
|
|
TRect getBBox() const { return TRect(0, 0, m_lx - 1, m_ly - 1); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int m_IOError;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
short m_refNum;
|
|
|
|
Movie m_movie;
|
|
|
|
short m_resId;
|
|
|
|
Track m_track;
|
|
|
|
long m_depth;
|
|
|
|
map<int, TimeValue> currentTimes;
|
|
|
|
int m_lx, m_ly;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
static TLevelReader *create(const TFilePath &f) {
|
|
|
|
return new TLevelReaderMov(f);
|
|
|
|
};
|
|
|
|
TThread::Mutex m_mutex;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TLevelP loadToonzOutputFormatInfo();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
class TWriterInfoMov : public TWriterInfo {
|
|
|
|
friend class TLevelWriterMov;
|
|
|
|
public:
|
|
|
|
static TWriterInfo *create(const string &ext);
|
|
|
|
~TWriterInfoMov();
|
|
|
|
TWriterInfo *clone() const;
|
|
|
|
private:
|
|
|
|
TWriterInfoMov();
|
2016-06-15 18:43:10 +12:00
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
TWriterInfoMov(const TWriterInfoMov&);
|
|
|
|
|
|
|
|
TWriterInfoMov&operator=(const TWriterInfoMov&); // not implemented
|
|
|
|
|
|
|
|
typedef map<int, CodecQ> CodecTable;
|
|
|
|
typedef map<int, CodecType> QualityTable;
|
|
|
|
CodecTable m_codecTable;
|
|
|
|
QualityTable m_qualityTable;
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace Tiio {
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class MovWriterProperties : public TPropertyGroup {
|
|
|
|
// std::map<wstring, CodecType> m_codecMap;
|
|
|
|
// std::map<wstring, CodecQ> m_qualityMap;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
MovWriterProperties();
|
|
|
|
// TPropertyGroup* clone() const;
|
|
|
|
// TEnumProperty m_codec;
|
|
|
|
// TEnumProperty m_quality;
|
|
|
|
// CodecType getCurrentCodec()const;
|
|
|
|
// wstring getCurrentNameFromCodec(CodecType &cCodec)const;
|
|
|
|
// wstring getCurrentQualityFromCodeQ(CodecQ &cCodeQ)const;
|
|
|
|
// CodecQ getCurrentQuality()const;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif //__LP64__
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // TIIO_MOV_H
|