blob: 704682b9bcae8855ae73baf9c9264788d84ef133 [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
Constantin Kaplinsky9964c782007-10-10 06:22:34 +000020 void debugListConverters();
21
Constantin Kaplinsky71a32f02007-07-24 12:10:16 +000022 bool isValid() const { return m_valid_ic; }
23
24 bool setImageParams(int w, int h);
25 bool setImageQuality(int quality);
26
27 bool createSrcBufferPool(DMbufferpool *pool, int bufCount, int bufSize);
28 bool registerDstBufferPool(DMbufferpool *pool, int bufCount, int bufSize);
29 static void destroyBufferPool(DMbufferpool pool);
30
31 static bool allocBuffer(DMbuffer *pbuf, DMbufferpool pool);
32 static bool copyToBuffer(DMbuffer buf, const void *data, int dataSize);
Constantin Kaplinsky52eaa8c2007-09-04 09:12:59 +000033 static bool copyToBuffer(DMbuffer buf, const void *data,
34 int rowSize, int nRows, int stride);
Constantin Kaplinsky71a32f02007-07-24 12:10:16 +000035 static int getBufferSize(DMbuffer buf);
36 static void * mapBufferData(DMbuffer buf);
37 static void freeBuffer(DMbuffer buf);
38
39 bool sendData(DMbuffer buf);
40 bool waitConversion();
41 bool receiveData(DMbuffer *pbuf);
42
43 static void reportError(const char *funcName);
44 static void reportErrorNotInited();
45
46 protected:
47 DMimageconverter m_ic;
48 bool m_valid_ic;
49
50 DMparams *m_srcParams;
51 DMparams *m_dstParams;
52 DMparams *m_convParams;
53 };
54
55}
56
57#endif // __IRIXDMIC_RAWTOJPEG_H__
58