You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Encoder.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
  3. * Copyright 2014 Pierre Ossman for Cendio AB
  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. #include <rfb/Rect.h>
  23. namespace rfb {
  24. class SConnection;
  25. class PixelBuffer;
  26. class Encoder {
  27. public:
  28. Encoder(SConnection* conn);
  29. virtual ~Encoder();
  30. virtual void setCompressLevel(int level) {};
  31. virtual void setQualityLevel(int level) {};
  32. virtual void setFineQualityLevel(int quality, int subsampling) {};
  33. virtual int getNumRects(const Rect &r) { return 1; }
  34. // writeRect() is the main interface that encodes the given rectangle
  35. // with data from the PixelBuffer onto the SConnection given at
  36. // encoder creation. The PixelFormat of the PixelBuffer might not
  37. // match the ConnParams and it is up ot the encoder to do
  38. // any necessary conversion.
  39. virtual void writeRect(const Rect& r, PixelBuffer* pb)=0;
  40. static bool supported(int encoding);
  41. static Encoder* createEncoder(int encoding, SConnection* conn);
  42. protected:
  43. SConnection* conn;
  44. };
  45. }
  46. #endif