| 1 | /* |
| 2 | * Copyright 2025 LiveKit, Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <memory> |
| 20 | |
| 21 | #include "api/media_stream_interface.h" |
| 22 | #include "livekit/helper.h" |
| 23 | #include "livekit/webrtc.h" |
| 24 | #include "rust/cxx.h" |
| 25 | |
| 26 | namespace livekit_ffi { |
| 27 | class MediaStreamTrack; |
| 28 | } // namespace livekit_ffi |
| 29 | #include "webrtc-sys/src/media_stream_track.rs.h" |
| 30 | |
| 31 | namespace livekit_ffi { |
| 32 | |
| 33 | class MediaStreamTrack { |
| 34 | protected: |
| 35 | MediaStreamTrack(std::shared_ptr<RtcRuntime>, |
| 36 | webrtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track); |
| 37 | |
| 38 | public: |
| 39 | rust::String kind() const; |
| 40 | rust::String id() const; |
| 41 | |
| 42 | bool enabled() const; |
| 43 | bool set_enabled(bool enable) const; |
| 44 | |
| 45 | TrackState state() const; |
| 46 | |
| 47 | webrtc::scoped_refptr<webrtc::MediaStreamTrackInterface> rtc_track() const { |
| 48 | return track_; |
| 49 | } |
| 50 | |
| 51 | protected: |
| 52 | std::shared_ptr<RtcRuntime> rtc_runtime_; |
| 53 | webrtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track_; |
| 54 | }; |
| 55 | |
| 56 | static std::shared_ptr<MediaStreamTrack> _shared_media_stream_track() { |
| 57 | return nullptr; // Ignore |
| 58 | } |
| 59 | |
| 60 | } // namespace livekit_ffi |