blob: 33674bd30d0f5931130254bd015d5c7f01bc35a5 [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);
31 static int getBufferSize(DMbuffer buf);
32 static void * mapBufferData(DMbuffer buf);
33 static void freeBuffer(DMbuffer buf);
34
35 bool sendData(DMbuffer buf);
36 bool waitConversion();
37 bool receiveData(DMbuffer *pbuf);
38
39 static void reportError(const char *funcName);
40 static void reportErrorNotInited();
41
42 protected:
43 DMimageconverter m_ic;
44 bool m_valid_ic;
45
46 DMparams *m_srcParams;
47 DMparams *m_dstParams;
48 DMparams *m_convParams;
49 };
50
51}
52
53#endif // __IRIXDMIC_RAWTOJPEG_H__
54