track.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright (c) 2020 Paul-Louis Ageneau
  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_TRACK_H
  9. #define RTC_TRACK_H
  10. #include "channel.hpp"
  11. #include "common.hpp"
  12. #include "description.hpp"
  13. #include "mediahandler.hpp"
  14. namespace rtc {
  15. namespace impl {
  16. class Track;
  17. } // namespace impl
  18. class RTC_CPP_EXPORT Track final : private CheshireCat<impl::Track>, public Channel {
  19. public:
  20. Track(impl_ptr<impl::Track> impl);
  21. ~Track() = default;
  22. string mid() const;
  23. Description::Direction direction() const;
  24. Description::Media description() const;
  25. void setDescription(Description::Media description);
  26. void close(void) override;
  27. bool send(message_variant data) override;
  28. bool send(const byte *data, size_t size) override;
  29. bool isOpen(void) const override;
  30. bool isClosed(void) const override;
  31. size_t maxMessageSize() const override;
  32. bool requestKeyframe();
  33. void setMediaHandler(shared_ptr<MediaHandler> handler);
  34. shared_ptr<MediaHandler> getMediaHandler();
  35. // Deprecated, use setMediaHandler() and getMediaHandler()
  36. inline void setRtcpHandler(shared_ptr<MediaHandler> handler) { setMediaHandler(handler); }
  37. inline shared_ptr<MediaHandler> getRtcpHandler() { return getMediaHandler(); }
  38. private:
  39. using CheshireCat<impl::Track>::impl;
  40. };
  41. } // namespace rtc
  42. #endif