blob: 485b850c502316895d2f6af92c261909a6c6c526 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
DRCb4a83232011-08-19 04:57:18 +00002 * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
Pierre Ossman316a3242014-01-15 12:40:20 +01003 * Copyright 2014 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00004 *
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 Ossman316a3242014-01-15 12:40:20 +010024#include <rfb/TransImageGetter.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000025
26namespace rfb {
27 class SMsgWriter;
Pierre Ossman456b2c22014-01-15 13:22:03 +010028 class TransImageGetter;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000029
30 class Encoder {
31 public:
Pierre Ossman4aba19e2014-01-29 16:42:48 +010032 Encoder(SMsgWriter* writer);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000033 virtual ~Encoder();
34
35 virtual void setCompressLevel(int level) {};
36 virtual void setQualityLevel(int level) {};
Pierre Ossmanb948a912014-01-15 13:23:43 +010037 virtual void setFineQualityLevel(int quality, int subsampling) {};
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000038 virtual int getNumRects(const Rect &r) { return 1; }
39
Pierre Ossman717c07b2014-01-21 14:45:10 +010040 // 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 Kaplinskya2adc8d2006-05-25 05:01:55 +000044
Peter Åstrand98fe98c2010-02-10 07:43:02 +000045 static bool supported(int encoding);
46 static Encoder* createEncoder(int encoding, SMsgWriter* writer);
Pierre Ossman4aba19e2014-01-29 16:42:48 +010047
48 protected:
49 SMsgWriter* writer;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000050 };
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000051}
52
53#endif