track.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. namespace rtc {
  25. namespace impl {
  26. class Track;
  27. } // namespace impl
  28. class RTC_CPP_EXPORT Track final : private CheshireCat<impl::Track>, public Channel {
  29. public:
  30. Track(impl_ptr<impl::Track> impl);
  31. ~Track() = default;
  32. string mid() const;
  33. Description::Direction direction() const;
  34. Description::Media description() const;
  35. void setDescription(Description::Media description);
  36. void close(void) override;
  37. bool send(message_variant data) override;
  38. bool send(const byte *data, size_t size) override;
  39. bool isOpen(void) const override;
  40. bool isClosed(void) const override;
  41. size_t maxMessageSize() const override;
  42. bool requestKeyframe();
  43. void setMediaHandler(shared_ptr<MediaHandler> handler);
  44. shared_ptr<MediaHandler> getMediaHandler();
  45. // Deprecated, use setMediaHandler() and getMediaHandler()
  46. inline void setRtcpHandler(shared_ptr<MediaHandler> handler) { setMediaHandler(handler); }
  47. inline shared_ptr<MediaHandler> getRtcpHandler() { return getMediaHandler(); }
  48. private:
  49. using CheshireCat<impl::Track>::impl;
  50. };
  51. } // namespace rtc
  52. #endif