Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef T32BITSRV_WRAP
Toshihiro Shimizu 890ddd
#define T32BITSRV_WRAP
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzBase includes
Toshihiro Shimizu 890ddd
#include "tenv.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
#include "tipc.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// Qt includes
Toshihiro Shimizu 890ddd
#include <qcoreapplication></qcoreapplication>
Toshihiro Shimizu 890ddd
#include <qdir></qdir>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TNZCORE_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
  This file contains the platform-specific command lines and server names to
Toshihiro Shimizu 890ddd
  address 64-bit Toonz's background 32-bit process (used to deal with QuickTime,
Toshihiro Shimizu 890ddd
  to say one).
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace t32bitsrv
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//*************************************************************************************
Toshihiro Shimizu 890ddd
//  Platform-specific Server Command Lines
Toshihiro Shimizu 890ddd
//*************************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
static QString srvName()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	static QString name(tipc::applicationSpecificServerName("t32bitsrv"));
Toshihiro Shimizu 890ddd
	return name;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
static QString srvCmdline()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	static QString cmd("srv/t32bitsrv.exe " + srvName());
Toshihiro Shimizu 890ddd
	return cmd;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
static QString srvCmdline()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return "\"" + QCoreApplication::applicationDirPath() +
Toshihiro Shimizu 890ddd
		   "/t32bitsrv\" " + srvName();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//*************************************************************************************
Toshihiro Shimizu 890ddd
//  Buffer data exchanger
Toshihiro Shimizu 890ddd
//*************************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI BufferExchanger : public tipc::ShMemReader, public tipc::ShMemWriter
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	UCHAR *m_buf;
Toshihiro Shimizu 890ddd
	UCHAR *m_data;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	BufferExchanger(UCHAR *buf) : m_buf(buf), m_data(buf) {}
Toshihiro Shimizu 890ddd
	~BufferExchanger() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	UCHAR *buffer() const { return m_buf; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int read(const char *srcBuf, int len);
Toshihiro Shimizu 890ddd
	int write(char *dstBuf, int len);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//*************************************************************************************
Toshihiro Shimizu 890ddd
//  Raster data exchanger
Toshihiro Shimizu 890ddd
//*************************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <typename pixel=""></typename>
Toshihiro Shimizu 890ddd
class DVAPI RasterExchanger : public tipc::ShMemReader, public tipc::ShMemWriter
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	typedef PIXEL pix_type;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterPT<pixel> m_ras;</pixel>
Toshihiro Shimizu 890ddd
	PIXEL *m_pix;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	RasterExchanger(TRasterP ras) : m_ras(ras)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_ras->lock();
Toshihiro Shimizu 890ddd
		m_pix = m_ras->pixels(0);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	~RasterExchanger() { m_ras->unlock(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterP raster() const { return m_ras; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int read(const char *srcBuf, int len);
Toshihiro Shimizu 890ddd
	int write(char *dstBuf, int len);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} //namespace t32bitsrv
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif //T32BITSRV_WRAP