Constantin Kaplinsky | 0b26323 | 2007-08-02 13:51:09 +0000 | [diff] [blame] | 1 | /* 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 Kaplinsky | 4803946 | 2007-10-10 04:44:54 +0000 | [diff] [blame] | 24 | #include <rfb/Configuration.h> |
Constantin Kaplinsky | 0b26323 | 2007-08-02 13:51:09 +0000 | [diff] [blame] | 25 | |
| 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 | |
| 33 | namespace rfb { |
| 34 | |
| 35 | class JpegEncoder { |
| 36 | public: |
| 37 | JpegEncoder(SMsgWriter* writer); |
| 38 | virtual ~JpegEncoder(); |
| 39 | |
| 40 | virtual void setQualityLevel(int level); |
Constantin Kaplinsky | 651606d | 2007-10-17 17:40:23 +0000 | [diff] [blame] | 41 | virtual bool isPixelFormatSupported(PixelBuffer* pb) const; |
| 42 | virtual void writeRect(PixelBuffer* pb, const Rect& r); |
Constantin Kaplinsky | 0b26323 | 2007-08-02 13:51:09 +0000 | [diff] [blame] | 43 | |
Constantin Kaplinsky | 4803946 | 2007-10-10 04:44:54 +0000 | [diff] [blame] | 44 | static BoolParameter useHardwareJPEG; |
| 45 | |
Constantin Kaplinsky | 0b26323 | 2007-08-02 13:51:09 +0000 | [diff] [blame] | 46 | private: |
| 47 | SMsgWriter* writer; |
| 48 | JpegCompressor* jcomp; |
| 49 | |
| 50 | static const int qualityMap[10]; |
| 51 | }; |
| 52 | |
| 53 | } |
| 54 | |
| 55 | #endif |