|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tiio_movX.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "traster.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsound.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef NOTE
|
|
Shinya Kitaoka |
120a6e |
Supportato solo RGBM32, sotto NT sarebbe possibile supportare anche 1bpp,
|
|
Shinya Kitaoka |
120a6e |
ma mancano i TRaster opportuni...
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
viene supportata
|
|
Shinya Kitaoka |
120a6e |
solo(LA PRIMA) traccia video !!!!
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// namespace {
|
|
Shinya Kitaoka |
120a6e |
enum QTLibError {
|
|
Shinya Kitaoka |
120a6e |
QTNoError = 0x0000,
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QTCantCreateParams = 0x0101,
|
|
Shinya Kitaoka |
120a6e |
QTCantSetParams = 0x0102,
|
|
Shinya Kitaoka |
120a6e |
QTPixelTypeError = 0x0103,
|
|
Shinya Kitaoka |
120a6e |
QTCheckLibError = 0x0104
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
string buildQTErrorString(int ec) {
|
|
Shinya Kitaoka |
120a6e |
switch (ec) {
|
|
Shinya Kitaoka |
120a6e |
case QTCantCreateParams:
|
|
Shinya Kitaoka |
120a6e |
return "Unable to create default params";
|
|
Shinya Kitaoka |
120a6e |
case QTCantSetParams:
|
|
Shinya Kitaoka |
120a6e |
return "Unable to set default params";
|
|
Shinya Kitaoka |
120a6e |
case QTPixelTypeError:
|
|
Shinya Kitaoka |
120a6e |
return "Unsupported pixel type";
|
|
Shinya Kitaoka |
120a6e |
case QTCheckLibError:
|
|
Shinya Kitaoka |
120a6e |
return mvGetErrorStr(mvGetErrno());
|
|
Shinya Kitaoka |
120a6e |
default:
|
|
Shinya Kitaoka |
120a6e |
return "Unknown error";
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//}
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// TImageWriterMov
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class TImageWriterMov : public TImageWriter {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
TImageWriterMov(const TFilePath &, int frameIndex, TLevelWriterMov *);
|
|
Shinya Kitaoka |
120a6e |
~TImageWriterMov() {}
|
|
Shinya Kitaoka |
120a6e |
bool is64bitOutputSupported() { return false; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// not implemented
|
|
Shinya Kitaoka |
120a6e |
TImageWriterMov(const TImageWriterMov &);
|
|
Shinya Kitaoka |
120a6e |
TImageWriterMov &operator=(const TImageWriterMov &src);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
void save(const TImageP &);
|
|
Shinya Kitaoka |
120a6e |
int m_frameIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
TLevelWriterMov *m_lwm;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// TImageReaderMov
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
class TImageReaderMov : public TImageReader {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
TImageReaderMov(const TFilePath &, int frameIndex, TLevelReaderMov *);
|
|
Shinya Kitaoka |
120a6e |
~TImageReaderMov() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// not implemented
|
|
Shinya Kitaoka |
120a6e |
TImageReaderMov(const TImageReaderMov &);
|
|
Shinya Kitaoka |
120a6e |
TImageReaderMov &operator=(const TImageReaderMov &src);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
TImageP load();
|
|
Shinya Kitaoka |
120a6e |
int m_frameIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDimension getSize() const { return TDimension(m_lrm->m_lx, m_lrm->m_ly); }
|
|
Shinya Kitaoka |
120a6e |
TRect getBBox() const {
|
|
Shinya Kitaoka |
120a6e |
return TRect(0, 0, m_lrm->m_lx - 1, m_lrm->m_ly - 1);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
TLevelReaderMov *m_lrm;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// TImageWriterMov
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageWriterMov::TImageWriterMov(const TFilePath &path, int frameIndex,
|
|
Shinya Kitaoka |
120a6e |
TLevelWriterMov *lwm)
|
|
Shinya Kitaoka |
120a6e |
: TImageWriter(path), m_lwm(lwm), m_frameIndex(frameIndex) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TImageWriterMov::save(const TImageP &img) {
|
|
Shinya Kitaoka |
120a6e |
TRasterImageP image(img);
|
|
Shinya Kitaoka |
120a6e |
int lx = image->getRaster()->getLx();
|
|
Shinya Kitaoka |
120a6e |
int ly = image->getRaster()->getLy();
|
|
Shinya Kitaoka |
120a6e |
void *buffer = image->getRaster()->getRawData();
|
|
Shinya Kitaoka |
120a6e |
int pixSize = image->getRaster()->getPixelSize();
|
|
Shinya Kitaoka |
120a6e |
if (pixSize != 4)
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(), "Unsupported pixel type");
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!m_lwm->m_initDone) {
|
|
Shinya Kitaoka |
120a6e |
DMparams *imageTrackParams;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (dmParamsCreate(&imageTrackParams) != DM_SUCCESS)
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(),
|
|
Shinya Kitaoka |
120a6e |
"Unable to create image track params");
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (dmSetImageDefaults(imageTrackParams, lx, ly, DM_IMAGE_PACKING_XRGB) !=
|
|
Shinya Kitaoka |
120a6e |
DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(imageTrackParams);
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(),
|
|
Shinya Kitaoka |
120a6e |
"Unable to set image defaults");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (dmParamsSetFloat(imageTrackParams, DM_IMAGE_RATE,
|
|
Shinya Kitaoka |
120a6e |
(double)m_lwm->m_rate) != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(imageTrackParams);
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(), "Unable to set frame rate");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (dmParamsSetEnum(imageTrackParams, DM_IMAGE_ORIENTATION,
|
|
Shinya Kitaoka |
120a6e |
DM_TOP_TO_BOTTOM) != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(imageTrackParams);
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(), "Unable to set frame rate");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (dmParamsSetFloat(imageTrackParams, DM_IMAGE_QUALITY_SPATIAL,
|
|
Shinya Kitaoka |
120a6e |
m_lwm->quality) != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(imageTrackParams);
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(), "Unable to set quality");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (dmParamsSetString(imageTrackParams, DM_IMAGE_COMPRESSION,
|
|
Shinya Kitaoka |
120a6e |
m_lwm->compression) != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(imageTrackParams);
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(), "Unable to set compression");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (mvAddTrack(m_lwm->id, DM_IMAGE, imageTrackParams, NULL,
|
|
Shinya Kitaoka |
120a6e |
&(m_lwm->imageTrack)) == DM_FAILURE) {
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(imageTrackParams);
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(),
|
|
Shinya Kitaoka |
120a6e |
"Unable to add image track to movie");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(imageTrackParams);
|
|
Shinya Kitaoka |
120a6e |
m_lwm->m_initDone = true;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (mvInsertFrames(m_lwm->imageTrack, m_frameIndex, 1, lx * ly * pixSize,
|
|
Shinya Kitaoka |
120a6e |
buffer) != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_lwm->getFilePath(),
|
|
Shinya Kitaoka |
120a6e |
"Unable to write image to movie");
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// TLevelWriterMov
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class TWriterInfoMov : public TWriterInfo {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
TWriterInfoMov() : TWriterInfo() { assert(!"Not implemented"); }
|
|
Shinya Kitaoka |
120a6e |
~TWriterInfoMov() {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevelWriterMov::TLevelWriterMov(const TFilePath &path)
|
|
Shinya Kitaoka |
120a6e |
: TLevelWriter(path)
|
|
Shinya Kitaoka |
120a6e |
, m_initDone(false)
|
|
Shinya Kitaoka |
120a6e |
, m_rate(25)
|
|
Shinya Kitaoka |
120a6e |
, m_IOError(QTNoError)
|
|
Shinya Kitaoka |
120a6e |
, quality(DM_IMAGE_QUALITY_NORMAL)
|
|
Shinya Kitaoka |
120a6e |
, compression(DM_IMAGE_QT_ANIM)
|
|
Shinya Kitaoka |
120a6e |
, m_writerInfo(new TWriterInfoMov()) {
|
|
Shinya Kitaoka |
120a6e |
DMparams *movieParams;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (dmParamsCreate(&movieParams) != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
m_IOError = QTCantCreateParams;
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (mvSetMovieDefaults(movieParams, MV_FORMAT_QT) != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(movieParams);
|
|
Shinya Kitaoka |
120a6e |
m_IOError = QTCantCreateParams;
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
if (mvCreateFile(path.getFullPath().c_str(), movieParams, NULL, &id) ==
|
|
Shinya Kitaoka |
120a6e |
DM_FAILURE) {
|
|
Shinya Kitaoka |
120a6e |
static char m[1024];
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(movieParams);
|
|
Shinya Kitaoka |
120a6e |
m_IOError = QTCheckLibError;
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
dmParamsDestroy(movieParams);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void TLevelWriterMov::saveSoundTrack(TSoundTrack *) {
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_path,
|
|
Shinya Kitaoka |
120a6e |
"TLevelWriterMov::saveSoundTrack not Implemented");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TWriterInfo *TLevelWriterMov::getWriterInfo() const { return m_writerInfo; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TLevelWriterMov::~TLevelWriterMov() {
|
|
Shinya Kitaoka |
120a6e |
bool rc = (mvClose(id) == DM_SUCCESS);
|
|
Shinya Kitaoka |
120a6e |
// if (!rc)
|
|
Shinya Kitaoka |
120a6e |
// throw TImageException(getFilePath(), "Error closing mov file");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageWriterP TLevelWriterMov::getFrameWriter(TFrameId fid) {
|
|
Shinya Kitaoka |
120a6e |
if (m_IOError) throw TImageException(m_path, buildQTErrorString(m_IOError));
|
|
Shinya Kitaoka |
120a6e |
if (fid.getLetter() != 0) return TImageWriterP(0);
|
|
Shinya Kitaoka |
120a6e |
int index = fid.getNumber() - 1;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TImageWriterMov *iwm = new TImageWriterMov(m_path, index, this);
|
|
Shinya Kitaoka |
120a6e |
return TImageWriterP(iwm);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderMov::TLevelReaderMov(const TFilePath &path)
|
|
Shinya Kitaoka |
120a6e |
: TLevelReader(path)
|
|
Shinya Kitaoka |
120a6e |
, IOError(QTNoError)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
120a6e |
m_status = mvOpenFile(path.getFullPath().c_str(), O_RDONLY, &movie);
|
|
Shinya Kitaoka |
120a6e |
if (m_status != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
IOError = QTCheckLibError;
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
track = 0;
|
|
Shinya Kitaoka |
120a6e |
m_status = mvFindTrackByMedium(movie, DM_IMAGE, &track);
|
|
Shinya Kitaoka |
120a6e |
if (m_status != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
IOError = QTCheckLibError;
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
m_lx = mvGetImageWidth(track);
|
|
Shinya Kitaoka |
120a6e |
m_ly = mvGetImageHeight(track);
|
|
Shinya Kitaoka |
120a6e |
DMpacking packing = mvGetImagePacking(track);
|
|
Shinya Kitaoka |
120a6e |
if (packing != DM_IMAGE_PACKING_XRGB) {
|
|
Shinya Kitaoka |
120a6e |
IOError = QTPixelTypeError;
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// TImageReaderMov
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageReaderMov::TImageReaderMov(const TFilePath &path, int frameIndex,
|
|
Shinya Kitaoka |
120a6e |
TLevelReaderMov *lrm)
|
|
Shinya Kitaoka |
120a6e |
: TImageReader(path), m_lrm(lrm), m_frameIndex(frameIndex) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TLevelReaderMov::~TLevelReaderMov() { mvClose(movie); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TLevelP TLevelReaderMov::loadInfo() {
|
|
Shinya Kitaoka |
120a6e |
TLevelP level;
|
|
Shinya Kitaoka |
120a6e |
if (IOError != QTNoError)
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_path, buildQTErrorString(IOError));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!track)
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(getFilePath().getFullPath().c_str(),
|
|
Shinya Kitaoka |
120a6e |
" error reading info");
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
MVframe nFrames = mvGetTrackLength(track);
|
|
Shinya Kitaoka |
120a6e |
if (nFrames == -1) return level;
|
|
Shinya Kitaoka |
120a6e |
for (int i = 1; i <= nFrames; i++) level->setFrame(TFrameId(i), TImageP());
|
|
Shinya Kitaoka |
120a6e |
return level;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageP TImageReaderMov::load() {
|
|
Shinya Kitaoka |
120a6e |
TRaster32P ret(m_lrm->m_lx, m_lrm->m_ly);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DMstatus status =
|
|
Shinya Kitaoka |
120a6e |
mvReadFrames(m_lrm->track, m_frameIndex, 1, m_lrm->m_lx * m_lrm->m_ly * 4,
|
|
Shinya Kitaoka |
120a6e |
ret->getRawData());
|
|
Shinya Kitaoka |
120a6e |
if (status != DM_SUCCESS) {
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(getFilePath().getFullPath().c_str(),
|
|
Shinya Kitaoka |
120a6e |
mvGetErrorStr(mvGetErrno()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// getImage()->setRaster(ret);
|
|
Shinya Kitaoka |
120a6e |
return TRasterImageP(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageReaderP TLevelReaderMov::getFrameReader(TFrameId fid) {
|
|
Shinya Kitaoka |
120a6e |
if (IOError != QTNoError)
|
|
Shinya Kitaoka |
120a6e |
throw TImageException(m_path, buildQTErrorString(IOError));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (fid.getLetter() != 0) return TImageReaderP(0);
|
|
Shinya Kitaoka |
120a6e |
int index = fid.getNumber() - 1;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TImageReaderMov *irm = new TImageReaderMov(m_path, index, this);
|
|
Shinya Kitaoka |
120a6e |
return TImageReaderP(irm);
|
|
Toshihiro Shimizu |
890ddd |
}
|