mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
sdp: Implement Borrow/BorrowMut/ToOwned for SDPMedia
This commit is contained in:
parent
b6f569d049
commit
7b66325f22
1 changed files with 25 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
// // option. This file may not be copied, modified, or distributed
|
||||
// // except according to those terms.
|
||||
|
||||
use std::borrow::{Borrow, BorrowMut, ToOwned};
|
||||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
|
@ -632,6 +633,30 @@ impl SDPMediaRef {
|
|||
}
|
||||
}
|
||||
|
||||
impl Borrow<SDPMediaRef> for SDPMedia {
|
||||
fn borrow(&self) -> &SDPMediaRef {
|
||||
&*self
|
||||
}
|
||||
}
|
||||
|
||||
impl BorrowMut<SDPMediaRef> for SDPMedia {
|
||||
fn borrow_mut(&mut self) -> &mut SDPMediaRef {
|
||||
&mut *self
|
||||
}
|
||||
}
|
||||
|
||||
impl ToOwned for SDPMediaRef {
|
||||
type Owned = SDPMedia;
|
||||
|
||||
fn to_owned(&self) -> SDPMedia {
|
||||
unsafe {
|
||||
let mut ptr = ptr::null_mut();
|
||||
ffi::gst_sdp_media_copy(&self.0, &mut ptr);
|
||||
from_glib_full(ptr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! define_iter(
|
||||
($name:ident, $typ:ty, $get_item:expr, $get_len:expr) => {
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Reference in a new issue