mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 04:51:09 +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
042c1b5fd0
commit
1a4487c245
4 changed files with 36 additions and 11 deletions
|
@ -261,6 +261,10 @@ status = "generate"
|
||||||
[object.function.return]
|
[object.function.return]
|
||||||
bool_return_is_error = "Failed to unsuspend media"
|
bool_return_is_error = "Failed to unsuspend media"
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "take_pipeline"
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "GstRtspServer.RTSPMediaFactory"
|
name = "GstRtspServer.RTSPMediaFactory"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -183,8 +183,6 @@ pub trait RTSPMediaExt: 'static {
|
||||||
|
|
||||||
fn suspend(&self) -> Result<(), glib::error::BoolError>;
|
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 unprepare(&self) -> Result<(), glib::error::BoolError>;
|
||||||
|
|
||||||
fn unsuspend(&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> {
|
fn unprepare(&self) -> Result<(), glib::error::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib_result_from_gboolean!(
|
glib_result_from_gboolean!(
|
||||||
|
|
|
@ -51,6 +51,7 @@ mod rtsp_address_pool;
|
||||||
mod rtsp_auth;
|
mod rtsp_auth;
|
||||||
mod rtsp_client;
|
mod rtsp_client;
|
||||||
mod rtsp_context;
|
mod rtsp_context;
|
||||||
|
mod rtsp_media;
|
||||||
mod rtsp_media_factory;
|
mod rtsp_media_factory;
|
||||||
mod rtsp_server;
|
mod rtsp_server;
|
||||||
mod rtsp_session_pool;
|
mod rtsp_session_pool;
|
||||||
|
@ -59,9 +60,12 @@ mod rtsp_stream_transport;
|
||||||
mod rtsp_thread;
|
mod rtsp_thread;
|
||||||
mod rtsp_token;
|
mod rtsp_token;
|
||||||
|
|
||||||
|
pub mod subclass;
|
||||||
|
|
||||||
pub use rtsp_address_pool::RTSPAddressPoolExtManual;
|
pub use rtsp_address_pool::RTSPAddressPoolExtManual;
|
||||||
pub use rtsp_auth::RTSPAuthExtManual;
|
pub use rtsp_auth::RTSPAuthExtManual;
|
||||||
pub use rtsp_client::RTSPClientExtManual;
|
pub use rtsp_client::RTSPClientExtManual;
|
||||||
|
pub use rtsp_media::RTSPMediaExtManual;
|
||||||
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
||||||
pub use rtsp_server::RTSPServerExtManual;
|
pub use rtsp_server::RTSPServerExtManual;
|
||||||
pub use rtsp_session_pool::RTSPSessionPoolExtManual;
|
pub use rtsp_session_pool::RTSPSessionPoolExtManual;
|
||||||
|
@ -141,6 +145,7 @@ pub mod prelude {
|
||||||
pub use rtsp_address_pool::RTSPAddressPoolExtManual;
|
pub use rtsp_address_pool::RTSPAddressPoolExtManual;
|
||||||
pub use rtsp_auth::RTSPAuthExtManual;
|
pub use rtsp_auth::RTSPAuthExtManual;
|
||||||
pub use rtsp_client::RTSPClientExtManual;
|
pub use rtsp_client::RTSPClientExtManual;
|
||||||
|
pub use rtsp_media::RTSPMediaExtManual;
|
||||||
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
||||||
pub use rtsp_server::RTSPServerExtManual;
|
pub use rtsp_server::RTSPServerExtManual;
|
||||||
pub use rtsp_session_pool::RTSPSessionPoolExtManual;
|
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