|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
07f3e8 |
#if (!(defined(x64) || defined(__LP64__) || defined(LINUX)))
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Toonz stuff
|
|
Toshihiro Shimizu |
890ddd |
#include "tiio.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "timage_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tlevel_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "traster.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "movsettings.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tproperty.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsound.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
#include "../image/3gp/tiio_3gp.h"
|
|
Toshihiro Shimizu |
890ddd |
#elif MACOSX
|
|
Toshihiro Shimizu |
890ddd |
#include "../image/3gp/tiio_3gpM.h"
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Qt stuff
|
|
Toshihiro Shimizu |
890ddd |
#include <qstring></qstring>
|
|
Toshihiro Shimizu |
890ddd |
#include <qhash></qhash>
|
|
Toshihiro Shimizu |
890ddd |
#include <qsharedmemory></qsharedmemory>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdebug></qdebug>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qlocalsocket></qlocalsocket>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdatastream></qdatastream>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//tipc includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tipc.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tipcmsg.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tipcsrv.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "t32bitsrv_wrap.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "t323gpmsg.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Local namespace stuff
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QHash<unsigned int,="" tlevelreaderp=""> readers;</unsigned>
|
|
Toshihiro Shimizu |
890ddd |
QHash<unsigned int,="" tlevelwriterp=""> writers;</unsigned>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace tipc;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace _3gp_io
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addParsers(tipc::Server *srv)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new InitLW3gpParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new LWSetFrameRateParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new LWImageWriteParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new LWSaveSoundTrackParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new CloseLW3gpParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new InitLR3gpParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new LRLoadInfoParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new LREnableRandomAccessReadParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new LRImageReadParser);
|
|
Toshihiro Shimizu |
890ddd |
srv->addParser(new CloseLR3gpParser);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// InitLWMov Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InitLW3gpParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
QString fp, propsFp;
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> fp >> propsFp >> clr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath tfp(fp.toStdWString()), propsTFp(propsFp.toStdWString());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *props = 0;
|
|
Toshihiro Shimizu |
890ddd |
if (!propsTFp.isEmpty()) {
|
|
Toshihiro Shimizu |
890ddd |
props = new TPropertyGroup;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TIStream is(propsTFp);
|
|
Toshihiro Shimizu |
890ddd |
props->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
writers.insert(id, TLevelWriterP(tfp, props));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok");
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LWsetFrameRate Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void LWSetFrameRateParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
double fps;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> fps >> clr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
writers.find(id).value()->setFrameRate(fps);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LWImageWrite Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void LWImageWriteParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
int frameIdx, lx, ly;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> frameIdx >> lx >> ly;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Read the data through a shared memory segment
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P ras(lx, ly);
|
|
Toshihiro Shimizu |
890ddd |
t32bitsrv::RasterExchanger<tpixel32> exch(ras);</tpixel32>
|
|
Toshihiro Shimizu |
890ddd |
tipc::readShMemBuffer(*stream(), msg, &exch);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Save the image
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
TImageWriterP iw(writers.find(id).value()->getFrameWriter(frameIdx + 1));
|
|
Toshihiro Shimizu |
890ddd |
iw->save(TRasterImageP(ras));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok");
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LWSaveSoundTrack Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void LWSaveSoundTrackParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
QString shMemId;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TUINT32 sampleRate;
|
|
Toshihiro Shimizu |
890ddd |
TINT32 sCount;
|
|
Toshihiro Shimizu |
890ddd |
int bps, chanCount;
|
|
Toshihiro Shimizu |
890ddd |
bool signedSample;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> sampleRate >> bps >> chanCount >> sCount >> signedSample;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Retrieve the soundtrack buffer
|
|
Toshihiro Shimizu |
890ddd |
TSoundTrackP st = TSoundTrack::create(sampleRate, bps, chanCount, sCount, signedSample);
|
|
Toshihiro Shimizu |
890ddd |
t32bitsrv::BufferExchanger exch((UCHAR *)st->getRawData());
|
|
Toshihiro Shimizu |
890ddd |
tipc::readShMemBuffer(*stream(), msg, &exch);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Write the soundtrack
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
writers.find(id).value()->saveSoundTrack(st.getPointer());
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok");
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// CloseLW3gp Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CloseLW3gpParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> clr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
writers.take(id);
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok");
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// InitLR3gp Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InitLR3gpParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
QString fp, propsFp;
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> fp >> clr;
|
|
Toshihiro Shimizu |
890ddd |
assert(!fp.isEmpty());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath tfp(fp.toStdWString());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderP lrm(tfp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Extract some info to be returned
|
|
Toshihiro Shimizu |
890ddd |
const TImageInfo *info = lrm->getImageInfo();
|
|
Toshihiro Shimizu |
890ddd |
if (!info)
|
|
Toshihiro Shimizu |
890ddd |
throw TImageException(tfp, "Couldn't retrieve image properties");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int lx = info->m_lx, ly = info->m_ly;
|
|
Toshihiro Shimizu |
890ddd |
double frameRate = info->m_frameRate;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
readers.insert(id, lrm);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok") << lx << ly << frameRate;
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LRLoadInfo Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void LRLoadInfoParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Read command data
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
QString shMemId;
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> shMemId >> clr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHash<unsigned int,="" tlevelreaderp="">::iterator it = readers.find(id);</unsigned>
|
|
Toshihiro Shimizu |
890ddd |
if (it == readers.end())
|
|
Toshihiro Shimizu |
890ddd |
goto err;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Read level infos
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TLevelP level;
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
level = it.value()->loadInfo();
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
goto err;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int frameCount = level->getFrameCount();
|
|
Toshihiro Shimizu |
890ddd |
if (!shMemId.isEmpty()) {
|
|
Toshihiro Shimizu |
890ddd |
//Create a shared memory segment to transfer the infos to
|
|
Toshihiro Shimizu |
890ddd |
tipc::DefaultMessageParser<shmem_request> msgParser;</shmem_request>
|
|
Toshihiro Shimizu |
890ddd |
Message shMsg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
shMsg << shMemId << frameCount * (int)sizeof(int) << reset;
|
|
Toshihiro Shimizu |
890ddd |
msgParser(shMsg);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString str;
|
|
Toshihiro Shimizu |
890ddd |
shMsg >> reset >> str;
|
|
Toshihiro Shimizu |
890ddd |
if (str != QString("ok"))
|
|
Toshihiro Shimizu |
890ddd |
goto err;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Copy level data to the shared memory segment
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QSharedMemory shmem(shMemId);
|
|
Toshihiro Shimizu |
890ddd |
shmem.attach();
|
|
Toshihiro Shimizu |
890ddd |
shmem.lock();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevel::Table *table = level->getTable();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevel::Table::const_iterator jt;
|
|
Toshihiro Shimizu |
890ddd |
int *f = (int *)shmem.data();
|
|
Toshihiro Shimizu |
890ddd |
for (jt = table->begin(); jt != table->end(); ++jt, ++f)
|
|
Toshihiro Shimizu |
890ddd |
*f = jt->first.getNumber();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
shmem.unlock();
|
|
Toshihiro Shimizu |
890ddd |
shmem.detach();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok") << frameCount;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
err:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LREnableRandomAccessRead Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void LREnableRandomAccessReadParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
QString str;
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> str >> clr;
|
|
Toshihiro Shimizu |
890ddd |
bool enable = (str == "true");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHash<unsigned int,="" tlevelreaderp="">::iterator it = readers.find(id);</unsigned>
|
|
Toshihiro Shimizu |
890ddd |
if (it == readers.end()) {
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
it.value()->enableRandomAccessRead(enable);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LRImageRead Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void LRImageReadParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
int lx, ly, pixSize, frameIdx, x, y, shrinkX, shrinkY;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> lx >> ly >> pixSize >> frameIdx >> x >> y >> shrinkX >> shrinkY >> clr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (pixSize != 4)
|
|
Toshihiro Shimizu |
890ddd |
goto err;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHash<unsigned int,="" tlevelreaderp="">::iterator it = readers.find(id);</unsigned>
|
|
Toshihiro Shimizu |
890ddd |
if (it == readers.end())
|
|
Toshihiro Shimizu |
890ddd |
goto err;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Load the raster
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P ras(lx, ly);
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
TImageReaderP ir(it.value()->getFrameReader(frameIdx + 1));
|
|
Toshihiro Shimizu |
890ddd |
ir->load(ras, TPoint(x, y), shrinkX, shrinkY);
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
goto err;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
t32bitsrv::RasterExchanger<tpixel32> exch(ras);</tpixel32>
|
|
Toshihiro Shimizu |
890ddd |
if (!tipc::writeShMemBuffer(*stream(), msg << clr, lx * ly * sizeof(TPixel32), &exch))
|
|
Toshihiro Shimizu |
890ddd |
goto err;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
err:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("err");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// CloseLRMov Parser
|
|
Toshihiro Shimizu |
890ddd |
//************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CloseLR3gpParser::operator()(Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
unsigned int id;
|
|
Toshihiro Shimizu |
890ddd |
msg >> id >> clr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
readers.take(id);
|
|
Toshihiro Shimizu |
890ddd |
msg << QString("ok");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} //namespace mov_io
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif // !x64 && !__LP64__
|