track.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Copyright (c) 2020 Paul-Louis Ageneau
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library 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 GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef RTC_TRACK_H
  19. #define RTC_TRACK_H
  20. #include "channel.hpp"
  21. #include "common.hpp"
  22. #include "description.hpp"
  23. #include "mediahandler.hpp"
  24. #include "message.hpp"
  25. namespace rtc {
  26. namespace impl {
  27. class Track;
  28. } // namespace impl
  29. class RTC_CPP_EXPORT Track final : private CheshireCat<impl::Track>, public Channel {
  30. public:
  31. Track(impl_ptr<impl::Track> impl);
  32. ~Track() = default;
  33. string mid() const;
  34. Description::Direction direction() const;
  35. Description::Media description() const;
  36. void setDescription(Description::Media description);
  37. void close(void) override;
  38. bool send(message_variant data) override;
  39. bool send(const byte *data, size_t size) override;
  40. bool isOpen(void) const override;
  41. bool isClosed(void) const override;
  42. size_t maxMessageSize() const override;
  43. bool requestKeyframe();
  44. void setMediaHandler(shared_ptr<MediaHandler> handler);
  45. shared_ptr<MediaHandler> getMediaHandler();
  46. // Deprecated, use setMediaHandler() and getMediaHandler()
  47. inline void setRtcpHandler(shared_ptr<MediaHandler> handler) { setMediaHandler(handler); }
  48. inline shared_ptr<MediaHandler> getRtcpHandler() { return getMediaHandler(); }
  49. private:
  50. using CheshireCat<impl::Track>::impl;
  51. };
  52. } // namespace rtc
  53. #endif