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.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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,
  43. const uint8_t* /*buffer*/,
  44. size_t /*buflen*/,
  45. const ServerParams& /*server*/,
  46. Region* region)
  47. {
  48. region->reset(rect);
  49. }
  50. bool Decoder::doRectsConflict(const Rect& /*rectA*/,
  51. const uint8_t* /*bufferA*/,
  52. size_t /*buflenA*/,
  53. const Rect& /*rectB*/,
  54. const uint8_t* /*bufferB*/,
  55. size_t /*buflenB*/,
  56. const ServerParams& /*server*/)
  57. {
  58. return false;
  59. }
  60. bool Decoder::supported(int encoding)
  61. {
  62. switch (encoding) {
  63. case encodingRaw:
  64. case encodingCopyRect:
  65. case encodingRRE:
  66. case encodingHextile:
  67. case encodingZRLE:
  68. case encodingTight:
  69. #ifdef HAVE_H264
  70. case encodingH264:
  71. #endif
  72. return true;
  73. default:
  74. return false;
  75. }
  76. }
  77. Decoder* Decoder::createDecoder(int encoding)
  78. {
  79. switch (encoding) {
  80. case encodingRaw:
  81. return new RawDecoder();
  82. case encodingCopyRect:
  83. return new CopyRectDecoder();
  84. case encodingRRE:
  85. return new RREDecoder();
  86. case encodingHextile:
  87. return new HextileDecoder();
  88. case encodingZRLE:
  89. return new ZRLEDecoder();
  90. case encodingTight:
  91. return new TightDecoder();
  92. #ifdef HAVE_H264
  93. case encodingH264:
  94. return new H264Decoder();
  95. #endif
  96. default:
  97. return NULL;
  98. }
  99. }