track.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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() override;
  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. bool requestBitrate(unsigned int bitrate);
  34. void setMediaHandler(shared_ptr<MediaHandler> handler);
  35. void chainMediaHandler(shared_ptr<MediaHandler> handler);
  36. shared_ptr<MediaHandler> getMediaHandler();
  37. // Deprecated, use setMediaHandler() and getMediaHandler()
  38. inline void setRtcpHandler(shared_ptr<MediaHandler> handler) { setMediaHandler(handler); }
  39. inline shared_ptr<MediaHandler> getRtcpHandler() { return getMediaHandler(); }
  40. private:
  41. using CheshireCat<impl::Track>::impl;
  42. };
  43. } // namespace rtc
  44. #endif