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.

H264DecoderContext.h 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Copyright (C) 2021 Vladimir Sukhonosov <xornet@xornet.org>
  2. * Copyright (C) 2021 Martins Mozeiko <martins.mozeiko@gmail.com>
  3. * All Rights Reserved.
  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_H264DECODERCONTEXT_H__
  21. #define __RFB_H264DECODERCONTEXT_H__
  22. #include <os/Mutex.h>
  23. #include <rdr/types.h>
  24. #include <rfb/Rect.h>
  25. #include <rfb/Decoder.h>
  26. namespace rfb {
  27. class H264DecoderContext {
  28. public:
  29. static H264DecoderContext *createContext(const Rect &r);
  30. virtual ~H264DecoderContext() = 0;
  31. virtual void decode(const rdr::U8* /*h264_buffer*/,
  32. rdr::U32 /*len*/,
  33. ModifiablePixelBuffer* /*pb*/) {}
  34. void reset();
  35. inline bool isEqualRect(const Rect &r) const { return r.equals(rect); }
  36. bool isReady();
  37. protected:
  38. os::Mutex mutex;
  39. rfb::Rect rect;
  40. bool initialized;
  41. H264DecoderContext(const Rect &r) : rect(r) { initialized = false; }
  42. virtual bool initCodec() { return false; }
  43. virtual void freeCodec() {}
  44. };
  45. }
  46. #endif