2
0

mediachainablehandler.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Copyright (c) 2020 Filip Klembara (in2core)
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program 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 program; If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef RTC_MEDIA_CHAINABLE_HANDLER_H
  18. #define RTC_MEDIA_CHAINABLE_HANDLER_H
  19. #if RTC_ENABLE_MEDIA
  20. #include "mediahandler.hpp"
  21. #include "mediahandlerrootelement.hpp"
  22. namespace rtc {
  23. class RTC_CPP_EXPORT MediaChainableHandler : public MediaHandler {
  24. const shared_ptr<MediaHandlerRootElement> root;
  25. shared_ptr<MediaHandlerElement> leaf;
  26. std::mutex inoutMutex;
  27. message_ptr handleIncomingBinary(message_ptr);
  28. message_ptr handleIncomingControl(message_ptr);
  29. message_ptr handleOutgoingBinary(message_ptr);
  30. message_ptr handleOutgoingControl(message_ptr);
  31. bool sendProduct(ChainedOutgoingProduct product);
  32. public:
  33. MediaChainableHandler(shared_ptr<MediaHandlerRootElement> root);
  34. ~MediaChainableHandler();
  35. message_ptr incoming(message_ptr ptr) override;
  36. message_ptr outgoing(message_ptr ptr) override;
  37. bool send(message_ptr msg);
  38. /// Adds element to chain
  39. /// @param chainable Chainable element
  40. void addToChain(shared_ptr<MediaHandlerElement> chainable);
  41. };
  42. } // namespace rtc
  43. #endif // RTC_ENABLE_MEDIA
  44. #endif // RTC_MEDIA_CHAINABLE_HANDLER_H