aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/IrixDMIC_RawToJpeg.h
blob: 704682b9bcae8855ae73baf9c9264788d84ef133 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#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();

    void debugListConverters();

    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 bool copyToBuffer(DMbuffer buf, const void *data,
                             int rowSize, int nRows, int stride);
    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__