Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
DRC | b4a8323 | 2011-08-19 04:57:18 +0000 | [diff] [blame] | 2 | * Copyright (C) 2011 D. R. Commander. All Rights Reserved. |
Pierre Ossman | 316a324 | 2014-01-15 12:40:20 +0100 | [diff] [blame] | 3 | * Copyright 2014 Pierre Ossman for Cendio AB |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 4 | * |
| 5 | * This is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This software is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this software; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 18 | * USA. |
| 19 | */ |
| 20 | #ifndef __RFB_ENCODER_H__ |
| 21 | #define __RFB_ENCODER_H__ |
| 22 | |
| 23 | #include <rfb/Rect.h> |
Pierre Ossman | 316a324 | 2014-01-15 12:40:20 +0100 | [diff] [blame] | 24 | #include <rfb/TransImageGetter.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 25 | |
| 26 | namespace rfb { |
| 27 | class SMsgWriter; |
Pierre Ossman | 456b2c2 | 2014-01-15 13:22:03 +0100 | [diff] [blame] | 28 | class TransImageGetter; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 29 | |
| 30 | class Encoder { |
| 31 | public: |
Pierre Ossman | 4aba19e | 2014-01-29 16:42:48 +0100 | [diff] [blame] | 32 | Encoder(SMsgWriter* writer); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 33 | virtual ~Encoder(); |
| 34 | |
| 35 | virtual void setCompressLevel(int level) {}; |
| 36 | virtual void setQualityLevel(int level) {}; |
Pierre Ossman | b948a91 | 2014-01-15 13:23:43 +0100 | [diff] [blame] | 37 | virtual void setFineQualityLevel(int quality, int subsampling) {}; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 38 | virtual int getNumRects(const Rect &r) { return 1; } |
| 39 | |
Pierre Ossman | 717c07b | 2014-01-21 14:45:10 +0100 | [diff] [blame] | 40 | // writeRect() is the main interface that encodes the given rectangle |
| 41 | // with data from the ImageGetter onto the SMsgWriter given at |
| 42 | // encoder creation. |
| 43 | virtual void writeRect(const Rect& r, TransImageGetter* ig)=0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 44 | |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame] | 45 | static bool supported(int encoding); |
| 46 | static Encoder* createEncoder(int encoding, SMsgWriter* writer); |
Pierre Ossman | 4aba19e | 2014-01-29 16:42:48 +0100 | [diff] [blame] | 47 | |
| 48 | protected: |
| 49 | SMsgWriter* writer; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 50 | }; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | #endif |