mediachainablehandler.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Copyright (c) 2020 Filip Klembara (in2core)
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  7. */
  8. #ifndef RTC_MEDIA_CHAINABLE_HANDLER_H
  9. #define RTC_MEDIA_CHAINABLE_HANDLER_H
  10. #if RTC_ENABLE_MEDIA
  11. #include "mediahandler.hpp"
  12. #include "mediahandlerrootelement.hpp"
  13. namespace rtc {
  14. class RTC_CPP_EXPORT MediaChainableHandler : public MediaHandler {
  15. const shared_ptr<MediaHandlerRootElement> root;
  16. shared_ptr<MediaHandlerElement> leaf;
  17. mutable std::mutex mutex;
  18. message_ptr handleIncomingBinary(message_ptr);
  19. message_ptr handleIncomingControl(message_ptr);
  20. message_ptr handleOutgoingBinary(message_ptr);
  21. message_ptr handleOutgoingControl(message_ptr);
  22. bool sendProduct(ChainedOutgoingProduct product);
  23. shared_ptr<MediaHandlerElement> getLeaf() const;
  24. public:
  25. MediaChainableHandler(shared_ptr<MediaHandlerRootElement> root);
  26. ~MediaChainableHandler();
  27. message_ptr incoming(message_ptr ptr) override;
  28. message_ptr outgoing(message_ptr ptr) override;
  29. bool send(message_ptr msg);
  30. /// Adds element to chain
  31. /// @param chainable Chainable element
  32. void addToChain(shared_ptr<MediaHandlerElement> chainable);
  33. };
  34. } // namespace rtc
  35. #endif // RTC_ENABLE_MEDIA
  36. #endif // RTC_MEDIA_CHAINABLE_HANDLER_H