Added JpegCompressor abstract class and two implementations -- one cross-platform and another IRIX-specific.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2320 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/IrixDMIC_RawToJpeg.h b/common/rfb/IrixDMIC_RawToJpeg.h
new file mode 100644
index 0000000..33674bd
--- /dev/null
+++ b/common/rfb/IrixDMIC_RawToJpeg.h
@@ -0,0 +1,54 @@
+#ifndef __IRIXDMIC_RAWTOJPEG_H__
+#define __IRIXDMIC_RAWTOJPEG_H__
+
+#include <dmedia/dmedia.h>
+#include <dmedia/dm_imageconvert.h>
+
+namespace rfb {
+
+ //
+ // A C++ wrapper for IRIX-specific Digital Media Image Conversion
+ // library used for JPEG compression.
+ //
+
+ class IrixDMIC_RawToJpeg
+ {
+ public:
+ IrixDMIC_RawToJpeg(bool needRealtime = true);
+ virtual ~IrixDMIC_RawToJpeg();
+
+ bool isValid() const { return m_valid_ic; }
+
+ bool setImageParams(int w, int h);
+ bool setImageQuality(int quality);
+
+ bool createSrcBufferPool(DMbufferpool *pool, int bufCount, int bufSize);
+ bool registerDstBufferPool(DMbufferpool *pool, int bufCount, int bufSize);
+ static void destroyBufferPool(DMbufferpool pool);
+
+ static bool allocBuffer(DMbuffer *pbuf, DMbufferpool pool);
+ static bool copyToBuffer(DMbuffer buf, const void *data, int dataSize);
+ static int getBufferSize(DMbuffer buf);
+ static void * mapBufferData(DMbuffer buf);
+ static void freeBuffer(DMbuffer buf);
+
+ bool sendData(DMbuffer buf);
+ bool waitConversion();
+ bool receiveData(DMbuffer *pbuf);
+
+ static void reportError(const char *funcName);
+ static void reportErrorNotInited();
+
+ protected:
+ DMimageconverter m_ic;
+ bool m_valid_ic;
+
+ DMparams *m_srcParams;
+ DMparams *m_dstParams;
+ DMparams *m_convParams;
+ };
+
+}
+
+#endif // __IRIXDMIC_RAWTOJPEG_H__
+