gstreamer-rs/gstreamer-rtsp-server/src/rtsp_media.rs
Bilal Elmoussaoui 4ebec84f5e Adapt to no longer renamed ffi crates
Allows us to set all the crates in the main workspace file, so changing
their versions or branch is much simpler and reduce the amount of noise
in the diff

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1450>
2024-06-02 11:20:55 +02:00

28 lines
1 KiB
Rust

// Take a look at the license at the top of the repository in the LICENSE file.
use glib::{prelude::*, translate::*};
use crate::{ffi, RTSPMedia};
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::RTSPMedia>> Sealed for T {}
}
pub trait RTSPMediaExtManual: sealed::Sealed + IsA<RTSPMedia> + 'static {
#[doc(alias = "gst_rtsp_media_take_pipeline")]
fn take_pipeline(&self, pipeline: impl IsA<gst::Pipeline>) {
unsafe {
let pipeline = pipeline.upcast().into_glib_ptr();
// See https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/merge_requests/109
glib::gobject_ffi::g_object_force_floating(pipeline as *mut _);
ffi::gst_rtsp_media_take_pipeline(self.as_ref().to_glib_none().0, pipeline);
if glib::gobject_ffi::g_object_is_floating(pipeline as *mut _) != glib::ffi::GFALSE {
glib::gobject_ffi::g_object_ref_sink(pipeline as *mut _);
}
}
}
}
impl<O: IsA<RTSPMedia>> RTSPMediaExtManual for O {}