net: Add new PtpClock::init_full() function

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1348>
This commit is contained in:
Sebastian Dröge 2023-11-16 17:21:30 +02:00
parent 9ab8dee59c
commit db2028c4c5
2 changed files with 23 additions and 0 deletions

View file

@ -28,6 +28,26 @@ impl PtpClock {
} }
} }
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
// rustdoc-stripper-ignore-next
/// Initialize GStreamer PTP clock support
///
/// This is automatically called once the first PTP clock instance is created.
#[doc(alias = "gst_ptp_init_full")]
pub fn init_full(s: &gst::StructureRef) -> Result<(), glib::BoolError> {
skip_assert_initialized!();
unsafe {
let res: bool = from_glib(ffi::gst_ptp_init_full(s.as_ptr()));
if res {
Ok(())
} else {
Err(glib::bool_error!("Failed to initialize PTP subsystem"))
}
}
}
// rustdoc-stripper-ignore-next // rustdoc-stripper-ignore-next
/// Deinitialize GStreamer PTP clock support /// Deinitialize GStreamer PTP clock support
/// ///

View file

@ -323,6 +323,9 @@ extern "C" {
pub fn gst_net_utils_set_socket_tos(socket: *mut gio::GSocket, qos_dscp: c_int) -> gboolean; pub fn gst_net_utils_set_socket_tos(socket: *mut gio::GSocket, qos_dscp: c_int) -> gboolean;
pub fn gst_ptp_deinit(); pub fn gst_ptp_deinit();
pub fn gst_ptp_init(clock_id: u64, interfaces: *mut *mut c_char) -> gboolean; pub fn gst_ptp_init(clock_id: u64, interfaces: *mut *mut c_char) -> gboolean;
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub fn gst_ptp_init_full(config: *const gst::GstStructure) -> gboolean;
pub fn gst_ptp_is_initialized() -> gboolean; pub fn gst_ptp_is_initialized() -> gboolean;
pub fn gst_ptp_is_supported() -> gboolean; pub fn gst_ptp_is_supported() -> gboolean;
pub fn gst_ptp_statistics_callback_add( pub fn gst_ptp_statistics_callback_add(