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> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 24 | |
| 25 | namespace rfb { |
Pierre Ossman | 668468b | 2014-01-31 12:37:32 +0100 | [diff] [blame] | 26 | class SConnection; |
Pierre Ossman | 0c9bd4b | 2014-07-09 16:44:11 +0200 | [diff] [blame] | 27 | class PixelBuffer; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 28 | |
| 29 | class Encoder { |
| 30 | public: |
Pierre Ossman | 668468b | 2014-01-31 12:37:32 +0100 | [diff] [blame] | 31 | Encoder(SConnection* conn); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 32 | virtual ~Encoder(); |
| 33 | |
| 34 | virtual void setCompressLevel(int level) {}; |
| 35 | virtual void setQualityLevel(int level) {}; |
Pierre Ossman | b948a91 | 2014-01-15 13:23:43 +0100 | [diff] [blame] | 36 | virtual void setFineQualityLevel(int quality, int subsampling) {}; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 37 | virtual int getNumRects(const Rect &r) { return 1; } |
| 38 | |
Pierre Ossman | 717c07b | 2014-01-21 14:45:10 +0100 | [diff] [blame] | 39 | // writeRect() is the main interface that encodes the given rectangle |
Pierre Ossman | 0c9bd4b | 2014-07-09 16:44:11 +0200 | [diff] [blame] | 40 | // with data from the PixelBuffer onto the SConnection given at |
| 41 | // encoder creation. The PixelFormat of the PixelBuffer might not |
| 42 | // match the ConnParams and it is up ot the encoder to do |
| 43 | // any necessary conversion. |
| 44 | virtual void writeRect(const Rect& r, PixelBuffer* pb)=0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 45 | |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame] | 46 | static bool supported(int encoding); |
Pierre Ossman | 668468b | 2014-01-31 12:37:32 +0100 | [diff] [blame] | 47 | static Encoder* createEncoder(int encoding, SConnection* conn); |
Pierre Ossman | 4aba19e | 2014-01-29 16:42:48 +0100 | [diff] [blame] | 48 | |
| 49 | protected: |
Pierre Ossman | 668468b | 2014-01-31 12:37:32 +0100 | [diff] [blame] | 50 | SConnection* conn; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 51 | }; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | #endif |