2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef T32BITSRV_WRAP
|
|
|
|
#define T32BITSRV_WRAP
|
|
|
|
|
|
|
|
// TnzBase includes
|
|
|
|
#include "tenv.h"
|
|
|
|
|
|
|
|
// TnzCore includes
|
|
|
|
#include "tcommon.h"
|
|
|
|
#include "traster.h"
|
|
|
|
#include "tipc.h"
|
|
|
|
|
|
|
|
// Qt includes
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QDir>
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TNZCORE_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
This file contains the platform-specific command lines and server names to
|
|
|
|
address 64-bit Toonz's background 32-bit process (used to deal with QuickTime,
|
|
|
|
to say one).
|
|
|
|
*/
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace t32bitsrv {
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//*************************************************************************************
|
|
|
|
// Platform-specific Server Command Lines
|
|
|
|
//*************************************************************************************
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
static QString srvName() {
|
|
|
|
static QString name(tipc::applicationSpecificServerName("t32bitsrv"));
|
|
|
|
return name;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-04-15 17:11:23 +12:00
|
|
|
#ifdef _WIN32
|
2016-06-15 18:43:10 +12:00
|
|
|
static QString srvCmdline() {
|
|
|
|
static QString cmd("srv/t32bitsrv.exe " + srvName());
|
|
|
|
return cmd;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
#else
|
2016-06-15 18:43:10 +12:00
|
|
|
static QString srvCmdline() {
|
|
|
|
return "\"" + QCoreApplication::applicationDirPath() + "/t32bitsrv\" " +
|
|
|
|
srvName();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//*************************************************************************************
|
|
|
|
// Buffer data exchanger
|
|
|
|
//*************************************************************************************
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI BufferExchanger final : public tipc::ShMemReader,
|
|
|
|
public tipc::ShMemWriter {
|
2016-06-15 18:43:10 +12:00
|
|
|
UCHAR *m_buf;
|
|
|
|
UCHAR *m_data;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
BufferExchanger(UCHAR *buf) : m_buf(buf), m_data(buf) {}
|
|
|
|
~BufferExchanger() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
UCHAR *buffer() const { return m_buf; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int read(const char *srcBuf, int len) override;
|
|
|
|
int write(char *dstBuf, int len) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//*************************************************************************************
|
|
|
|
// Raster data exchanger
|
|
|
|
//*************************************************************************************
|
|
|
|
|
|
|
|
template <typename PIXEL>
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI RasterExchanger final : public tipc::ShMemReader,
|
|
|
|
public tipc::ShMemWriter {
|
2016-06-15 18:43:10 +12:00
|
|
|
typedef PIXEL pix_type;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterPT<PIXEL> m_ras;
|
|
|
|
PIXEL *m_pix;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
RasterExchanger(TRasterP ras) : m_ras(ras) {
|
|
|
|
m_ras->lock();
|
|
|
|
m_pix = m_ras->pixels(0);
|
|
|
|
}
|
|
|
|
~RasterExchanger() { m_ras->unlock(); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterP raster() const { return m_ras; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
int read(const char *srcBuf, int len) override;
|
|
|
|
int write(char *dstBuf, int len) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
} // namespace t32bitsrv
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // T32BITSRV_WRAP
|