mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
rtsp-server: media: Take pipeline by reference instead of value
And remove <1.18 workaround if building for 1.18 or newer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1548>
This commit is contained in:
parent
7b51a7c77b
commit
192844c173
1 changed files with 18 additions and 7 deletions
|
@ -11,17 +11,28 @@ mod sealed {
|
||||||
|
|
||||||
pub trait RTSPMediaExtManual: sealed::Sealed + IsA<RTSPMedia> + 'static {
|
pub trait RTSPMediaExtManual: sealed::Sealed + IsA<RTSPMedia> + 'static {
|
||||||
#[doc(alias = "gst_rtsp_media_take_pipeline")]
|
#[doc(alias = "gst_rtsp_media_take_pipeline")]
|
||||||
fn take_pipeline(&self, pipeline: impl IsA<gst::Pipeline>) {
|
fn take_pipeline(&self, pipeline: &impl IsA<gst::Pipeline>) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let pipeline = pipeline.upcast().into_glib_ptr();
|
#[cfg(feature = "v1_18")]
|
||||||
|
{
|
||||||
|
ffi::gst_rtsp_media_take_pipeline(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
pipeline.upcast_ref().to_glib_none().0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "v1_18"))]
|
||||||
|
{
|
||||||
|
let pipeline = pipeline.upcast_ref().to_glib_full();
|
||||||
// See https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/merge_requests/109
|
// See https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/merge_requests/109
|
||||||
glib::gobject_ffi::g_object_force_floating(pipeline as *mut _);
|
glib::gobject_ffi::g_object_force_floating(pipeline as *mut _);
|
||||||
ffi::gst_rtsp_media_take_pipeline(self.as_ref().to_glib_none().0, pipeline);
|
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 {
|
if glib::gobject_ffi::g_object_is_floating(pipeline as *mut _) != glib::ffi::GFALSE
|
||||||
|
{
|
||||||
glib::gobject_ffi::g_object_ref_sink(pipeline as *mut _);
|
glib::gobject_ffi::g_object_ref_sink(pipeline as *mut _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O: IsA<RTSPMedia>> RTSPMediaExtManual for O {}
|
impl<O: IsA<RTSPMedia>> RTSPMediaExtManual for O {}
|
||||||
|
|
Loading…
Reference in a new issue