blob: f2f077dd70202f42f9f53fd81dc4ed10b429f1f2 [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);
Constantin Kaplinsky651606d2007-10-17 17:40:23 +000041 virtual bool isPixelFormatSupported(PixelBuffer* pb) const;
42 virtual void writeRect(PixelBuffer* pb, const Rect& r);
Constantin Kaplinsky0b263232007-08-02 13:51:09 +000043
Constantin Kaplinsky48039462007-10-10 04:44:54 +000044 static BoolParameter useHardwareJPEG;
45
Constantin Kaplinsky0b263232007-08-02 13:51:09 +000046 private:
47 SMsgWriter* writer;
48 JpegCompressor* jcomp;
49
50 static const int qualityMap[10];
51 };
52
53}
54
55#endif