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