blob: b067e135820dbbaaaf8c200753a998e64c47a9a9 [file] [log] [blame]
Constantin Kaplinsky71a32f02007-07-24 12:10:16 +00001#ifndef __IRIXDMIC_RAWTOJPEG_H__
2#define __IRIXDMIC_RAWTOJPEG_H__
3
4#include <dmedia/dmedia.h>
5#include <dmedia/dm_imageconvert.h>
6
7namespace rfb {
8
9 //
10 // A C++ wrapper for IRIX-specific Digital Media Image Conversion
11 // library used for JPEG compression.
12 //
13
14 class IrixDMIC_RawToJpeg
15 {
16 public:
17 IrixDMIC_RawToJpeg(bool needRealtime = true);
18 virtual ~IrixDMIC_RawToJpeg();
19
20 bool isValid() const { return m_valid_ic; }
21
22 bool setImageParams(int w, int h);
23 bool setImageQuality(int quality);
24
25 bool createSrcBufferPool(DMbufferpool *pool, int bufCount, int bufSize);
26 bool registerDstBufferPool(DMbufferpool *pool, int bufCount, int bufSize);
27 static void destroyBufferPool(DMbufferpool pool);
28
29 static bool allocBuffer(DMbuffer *pbuf, DMbufferpool pool);
30 static bool copyToBuffer(DMbuffer buf, const void *data, int dataSize);
Constantin Kaplinsky52eaa8c2007-09-04 09:12:59 +000031 static bool copyToBuffer(DMbuffer buf, const void *data,
32 int rowSize, int nRows, int stride);
Constantin Kaplinsky71a32f02007-07-24 12:10:16 +000033 static int getBufferSize(DMbuffer buf);
34 static void * mapBufferData(DMbuffer buf);
35 static void freeBuffer(DMbuffer buf);
36
37 bool sendData(DMbuffer buf);
38 bool waitConversion();
39 bool receiveData(DMbuffer *pbuf);
40
41 static void reportError(const char *funcName);
42 static void reportErrorNotInited();
43
44 protected:
45 DMimageconverter m_ic;
46 bool m_valid_ic;
47
48 DMparams *m_srcParams;
49 DMparams *m_dstParams;
50 DMparams *m_convParams;
51 };
52
53}
54
55#endif // __IRIXDMIC_RAWTOJPEG_H__
56