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.

Decoder.cxx 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2014 Pierre Ossman for Cendio AB
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  17. * USA.
  18. */
  19. #ifdef HAVE_CONFIG_H
  20. #include <config.h>
  21. #endif
  22. #include <stdio.h>
  23. #include <rfb/encodings.h>
  24. #include <rfb/Region.h>
  25. #include <rfb/Decoder.h>
  26. #include <rfb/RawDecoder.h>
  27. #include <rfb/CopyRectDecoder.h>
  28. #include <rfb/RREDecoder.h>
  29. #include <rfb/HextileDecoder.h>
  30. #include <rfb/ZRLEDecoder.h>
  31. #include <rfb/TightDecoder.h>
  32. #ifdef HAVE_H264
  33. #include <rfb/H264Decoder.h>
  34. #endif
  35. using namespace rfb;
  36. Decoder::Decoder(enum DecoderFlags flags) : flags(flags)
  37. {
  38. }
  39. Decoder::~Decoder()
  40. {
  41. }
  42. void Decoder::getAffectedRegion(const Rect& rect, const void* buffer,
  43. size_t buflen, const ServerParams& server,
  44. Region* region)
  45. {
  46. region->reset(rect);
  47. }
  48. bool Decoder::doRectsConflict(const Rect& rectA, const void* bufferA,
  49. size_t buflenA, const Rect& rectB,
  50. const void* bufferB, size_t buflenB,
  51. const ServerParams& server)
  52. {
  53. return false;
  54. }
  55. bool Decoder::supported(int encoding)
  56. {
  57. switch (encoding) {
  58. case encodingRaw:
  59. case encodingCopyRect:
  60. case encodingRRE:
  61. case encodingHextile:
  62. case encodingZRLE:
  63. case encodingTight:
  64. #ifdef HAVE_H264
  65. case encodingH264:
  66. #endif
  67. return true;
  68. default:
  69. return false;
  70. }
  71. }
  72. Decoder* Decoder::createDecoder(int encoding)
  73. {
  74. switch (encoding) {
  75. case encodingRaw:
  76. return new RawDecoder();
  77. case encodingCopyRect:
  78. return new CopyRectDecoder();
  79. case encodingRRE:
  80. return new RREDecoder();
  81. case encodingHextile:
  82. return new HextileDecoder();
  83. case encodingZRLE:
  84. return new ZRLEDecoder();
  85. case encodingTight:
  86. return new TightDecoder();
  87. #ifdef HAVE_H264
  88. case encodingH264:
  89. return new H264Decoder();
  90. #endif
  91. default:
  92. return NULL;
  93. }
  94. }