Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TIIO_MOV_H
Toshihiro Shimizu 890ddd
#define TIIO_MOV_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __LP64__
Toshihiro Shimizu 890ddd
#include "tiio_mov_proxy.h"
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//#include <carbon carbon.h=""></carbon>
Toshihiro Shimizu 890ddd
//#include <movies.h></movies.h>
Toshihiro Shimizu 890ddd
//#include <imagecompression.h></imagecompression.h>
Toshihiro Shimizu 890ddd
//#include "QuickTimeComponents.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <quicktime quicktime.h=""></quicktime>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tquicktime.h"
Toshihiro Shimizu 890ddd
#include "tlevel_io.h"
Toshihiro Shimizu 890ddd
#include "tthread.h"
Toshihiro Shimizu 890ddd
#include "tthreadmessage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
bool IsQuickTimeInstalled();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TLevelWriterMov : public TLevelWriter {
Shinya Kitaoka 120a6e
  std::vector<std::pair<int, timevalue="">> m_savedFrames;</std::pair<int,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TLevelWriterMov(const TFilePath &path, TPropertyGroup *winfo);
Shinya Kitaoka 120a6e
  ~TLevelWriterMov();
Shinya Kitaoka 120a6e
  TImageWriterP getFrameWriter(TFrameId fid);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_IOError;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void save(const TImageP &img, int frameIndex);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  Movie m_movie;
Shinya Kitaoka 120a6e
  Track m_videoTrack;
Shinya Kitaoka 120a6e
  Media m_videoMedia;
Shinya Kitaoka 120a6e
  Track m_soundTrack;
Shinya Kitaoka 120a6e
  Media m_soundMedia;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  GWorldPtr m_gworld;
Shinya Kitaoka 120a6e
  PixMapHandle m_pixmap;
Shinya Kitaoka 120a6e
  // Handle       m_compressedData;
Shinya Kitaoka 120a6e
  short m_refNum;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  PixelXRGB *buf;
Shinya Kitaoka 120a6e
  int buf_lx;
Shinya Kitaoka 120a6e
  int buf_ly;
Shinya Kitaoka 120a6e
  int m_firstFrame;
Shinya Kitaoka 120a6e
  TThread::Mutex m_mutex;
Shinya Kitaoka 120a6e
  ComponentInstance m_ci;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  static TLevelWriter *create(const TFilePath &f, TPropertyGroup *winfo) {
Shinya Kitaoka 120a6e
    return new TLevelWriterMov(f, winfo);
Shinya Kitaoka 120a6e
  };
Shinya Kitaoka 120a6e
  void saveSoundTrack(TSoundTrack *st);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TLevelReaderMov : public TLevelReader {
Shinya Kitaoka 120a6e
  bool m_readAsToonzOutput;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TLevelReaderMov(const TFilePath &path);
Shinya Kitaoka 120a6e
  ~TLevelReaderMov();
Shinya Kitaoka 120a6e
  TImageReaderP getFrameReader(TFrameId fid);
Shinya Kitaoka 120a6e
  // friend class TImageReaderMov;
Shinya Kitaoka 120a6e
  TLevelP loadInfo();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void enableRandomAccessRead(bool enable) { m_readAsToonzOutput = enable; }
Shinya Kitaoka 120a6e
  void load(const TRasterP &rasP, int frameIndex, const TPoint &pos,
Shinya Kitaoka 120a6e
            int shrinkX = 1, int shrinkY = 1);
Shinya Kitaoka 120a6e
  TDimension getSize() const { return TDimension(m_lx, m_ly); }
Shinya Kitaoka 120a6e
  TRect getBBox() const { return TRect(0, 0, m_lx - 1, m_ly - 1); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_IOError;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  short m_refNum;
Shinya Kitaoka 120a6e
  Movie m_movie;
Shinya Kitaoka 120a6e
  short m_resId;
Shinya Kitaoka 120a6e
  Track m_track;
Shinya Kitaoka 120a6e
  long m_depth;
Shinya Kitaoka 120a6e
  map<int, timevalue=""> currentTimes;</int,>
Shinya Kitaoka 120a6e
  int m_lx, m_ly;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  static TLevelReader *create(const TFilePath &f) {
Shinya Kitaoka 120a6e
    return new TLevelReaderMov(f);
Shinya Kitaoka 120a6e
  };
Shinya Kitaoka 120a6e
  TThread::Mutex m_mutex;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TLevelP loadToonzOutputFormatInfo();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
class TWriterInfoMov : public TWriterInfo {
Toshihiro Shimizu 890ddd
friend class TLevelWriterMov;
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
  static TWriterInfo *create(const string &ext);
Toshihiro Shimizu 890ddd
  ~TWriterInfoMov();
Toshihiro Shimizu 890ddd
  TWriterInfo *clone() const;
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
  TWriterInfoMov();
Shinya Kitaoka 120a6e
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  TWriterInfoMov(const TWriterInfoMov&);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  TWriterInfoMov&operator=(const TWriterInfoMov&);   // not implemented
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  typedef map<int, codecq=""> CodecTable;</int,>
Toshihiro Shimizu 890ddd
  typedef map<int, codectype=""> QualityTable;</int,>
Toshihiro Shimizu 890ddd
  CodecTable m_codecTable;
Toshihiro Shimizu 890ddd
  QualityTable m_qualityTable;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace Tiio {
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class MovWriterProperties : public TPropertyGroup {
Shinya Kitaoka 120a6e
  //  std::map<wstring, codectype=""> m_codecMap;</wstring,>
Shinya Kitaoka 120a6e
  //  std::map<wstring, codecq=""> m_qualityMap;</wstring,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  MovWriterProperties();
Shinya Kitaoka 120a6e
  //	TPropertyGroup* clone() const;
Shinya Kitaoka 120a6e
  //  TEnumProperty m_codec;
Shinya Kitaoka 120a6e
  //  TEnumProperty m_quality;
Shinya Kitaoka 120a6e
  //	CodecType getCurrentCodec()const;
Shinya Kitaoka 120a6e
  //  wstring getCurrentNameFromCodec(CodecType &cCodec)const;
Shinya Kitaoka 120a6e
  //  wstring getCurrentQualityFromCodeQ(CodecQ &cCodeQ)const;
Shinya Kitaoka 120a6e
  //	CodecQ getCurrentQuality()const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  //__LP64__
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // TIIO_MOV_H