// Copyright 2025 LiveKit, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #[cxx::bridge(namespace = "livekit_ffi")] pub mod ffi { // Wrapper to opaque C++ objects // https://github.com/dtolnay/cxx/issues/741 // Used to allow SharedPtr/UniquePtr type inside a rust::Vec pub struct MediaStreamPtr { pub ptr: SharedPtr, } pub struct CandidatePtr { pub ptr: SharedPtr, } pub struct AudioTrackPtr { pub ptr: SharedPtr, } pub struct VideoTrackPtr { pub ptr: SharedPtr, } pub struct RtpSenderPtr { pub ptr: SharedPtr, } pub struct RtpReceiverPtr { pub ptr: SharedPtr, } pub struct RtpTransceiverPtr { pub ptr: SharedPtr, } unsafe extern "C++" { include!("livekit/helper.h"); type MediaStream = crate::media_stream::ffi::MediaStream; type AudioTrack = crate::media_stream::ffi::AudioTrack; type VideoTrack = crate::media_stream::ffi::VideoTrack; type Candidate = crate::candidate::ffi::Candidate; type RtpSender = crate::rtp_sender::ffi::RtpSender; type RtpReceiver = crate::rtp_receiver::ffi::RtpReceiver; type RtpTransceiver = crate::rtp_transceiver::ffi::RtpTransceiver; fn _vec_media_stream_ptr() -> Vec; fn _vec_candidate_ptr() -> Vec; fn _vec_audio_track_ptr() -> Vec; fn _vec_video_track_ptr() -> Vec; fn _vec_rtp_sender_ptr() -> Vec; fn _vec_rtp_receiver_ptr() -> Vec; fn _vec_rtp_transceiver_ptr() -> Vec; } }