blob: 78e08facd73e30436dc1becd3463ee921b5881fc [file] [log] [blame]
Constantin Kaplinsky0b263232007-08-02 13:51:09 +00001/* Copyright (C) 2007 Constantin Kaplinsky. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18#ifndef __RFB_JPEGENCODER_H__
19#define __RFB_JPEGENCODER_H__
20
21#include <rfb/SMsgWriter.h>
22#include <rfb/PixelBuffer.h>
23#include <rfb/JpegCompressor.h>
Constantin Kaplinsky48039462007-10-10 04:44:54 +000024#include <rfb/Configuration.h>
Constantin Kaplinsky0b263232007-08-02 13:51:09 +000025
26//
27// JPEG Encoder.
28// NOTE: JpegEncoder class is NOT derived from Encoder, because we need
29// access to the original server's framebuffer, without extra pixel
30// copying and with no pixel format translation.
31//
32
33namespace rfb {
34
35 class JpegEncoder {
36 public:
37 JpegEncoder(SMsgWriter* writer);
38 virtual ~JpegEncoder();
39
40 virtual void setQualityLevel(int level);
41 virtual bool writeRect(PixelBuffer* pb, const Rect& r);
42
Constantin Kaplinsky48039462007-10-10 04:44:54 +000043 static BoolParameter useHardwareJPEG;
44
Constantin Kaplinsky0b263232007-08-02 13:51:09 +000045 private:
46 SMsgWriter* writer;
47 JpegCompressor* jcomp;
48
49 static const int qualityMap[10];
50 };
51
52}
53
54#endif