mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-14 05:21:29 +00:00
rtsp_server/media: Implement take_pipeline() manually
Because of floating reference problems in the API that have to be worked around.
This commit is contained in:
parent
38071f1897
commit
aa86c804bd
4 changed files with 36 additions and 11 deletions
|
@ -261,6 +261,10 @@ status = "generate"
|
|||
[object.function.return]
|
||||
bool_return_is_error = "Failed to unsuspend media"
|
||||
|
||||
[[object.function]]
|
||||
name = "take_pipeline"
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "GstRtspServer.RTSPMediaFactory"
|
||||
status = "generate"
|
||||
|
|
|
@ -183,8 +183,6 @@ pub trait RTSPMediaExt: 'static {
|
|||
|
||||
fn suspend(&self) -> Result<(), glib::error::BoolError>;
|
||||
|
||||
fn take_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: &P);
|
||||
|
||||
fn unprepare(&self) -> Result<(), glib::error::BoolError>;
|
||||
|
||||
fn unsuspend(&self) -> Result<(), glib::error::BoolError>;
|
||||
|
@ -764,15 +762,6 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn take_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: &P) {
|
||||
unsafe {
|
||||
gst_rtsp_server_sys::gst_rtsp_media_take_pipeline(
|
||||
self.as_ref().to_glib_none().0,
|
||||
pipeline.as_ref().to_glib_full(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn unprepare(&self) -> Result<(), glib::error::BoolError> {
|
||||
unsafe {
|
||||
glib_result_from_gboolean!(
|
||||
|
|
|
@ -52,6 +52,7 @@ mod rtsp_address_pool;
|
|||
mod rtsp_auth;
|
||||
mod rtsp_client;
|
||||
mod rtsp_context;
|
||||
mod rtsp_media;
|
||||
mod rtsp_media_factory;
|
||||
mod rtsp_server;
|
||||
mod rtsp_session_pool;
|
||||
|
@ -60,9 +61,12 @@ mod rtsp_stream_transport;
|
|||
mod rtsp_thread;
|
||||
mod rtsp_token;
|
||||
|
||||
pub mod subclass;
|
||||
|
||||
pub use rtsp_address_pool::RTSPAddressPoolExtManual;
|
||||
pub use rtsp_auth::RTSPAuthExtManual;
|
||||
pub use rtsp_client::RTSPClientExtManual;
|
||||
pub use rtsp_media::RTSPMediaExtManual;
|
||||
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
||||
pub use rtsp_server::RTSPServerExtManual;
|
||||
pub use rtsp_session_pool::RTSPSessionPoolExtManual;
|
||||
|
@ -142,6 +146,7 @@ pub mod prelude {
|
|||
pub use rtsp_address_pool::RTSPAddressPoolExtManual;
|
||||
pub use rtsp_auth::RTSPAuthExtManual;
|
||||
pub use rtsp_client::RTSPClientExtManual;
|
||||
pub use rtsp_media::RTSPMediaExtManual;
|
||||
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
||||
pub use rtsp_server::RTSPServerExtManual;
|
||||
pub use rtsp_session_pool::RTSPSessionPoolExtManual;
|
||||
|
|
27
gstreamer-rtsp-server/src/rtsp_media.rs
Normal file
27
gstreamer-rtsp-server/src/rtsp_media.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use glib::object::IsA;
|
||||
use glib::translate::*;
|
||||
use gst;
|
||||
use gst_rtsp_server_sys;
|
||||
|
||||
use RTSPMedia;
|
||||
|
||||
pub trait RTSPMediaExtManual: 'static {
|
||||
fn take_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: &P);
|
||||
}
|
||||
|
||||
impl<O: IsA<RTSPMedia>> RTSPMediaExtManual for O {
|
||||
fn take_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: &P) {
|
||||
unsafe {
|
||||
let pipeline = pipeline.as_ref().to_glib_full();
|
||||
// See https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/merge_requests/109
|
||||
gobject_sys::g_object_force_floating(pipeline as *mut _);
|
||||
gst_rtsp_server_sys::gst_rtsp_media_take_pipeline(
|
||||
self.as_ref().to_glib_none().0,
|
||||
pipeline,
|
||||
);
|
||||
if gobject_sys::g_object_is_floating(pipeline as *mut _) != glib_sys::GFALSE {
|
||||
gobject_sys::g_object_ref_sink(pipeline as *mut _);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue