From e7898c1b2436ea4f0e2f04419988bb4536c3f9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 19 Mar 2019 09:58:20 +0200 Subject: [PATCH] Update manual code --- examples/src/bin/rtsp-server-record.rs | 4 +- gstreamer-app/src/app_sink.rs | 34 +- gstreamer-app/src/app_src.rs | 40 ++- gstreamer-app/src/auto/flags.rs | 2 +- gstreamer-app/src/lib.rs | 10 +- gstreamer-audio/src/audio_channel_position.rs | 82 ++--- gstreamer-audio/src/audio_format.rs | 12 +- gstreamer-audio/src/audio_format_info.rs | 55 +-- gstreamer-audio/src/audio_info.rs | 77 +++-- gstreamer-audio/src/audio_stream_align.rs | 4 +- gstreamer-audio/src/lib.rs | 12 +- gstreamer-base/src/adapter.rs | 10 +- gstreamer-base/src/aggregator.rs | 4 +- gstreamer-base/src/aggregator_pad.rs | 8 +- gstreamer-base/src/auto/enums.rs | 2 +- gstreamer-base/src/auto/flags.rs | 2 +- gstreamer-base/src/base_sink.rs | 8 +- gstreamer-base/src/base_src.rs | 18 +- gstreamer-base/src/base_transform.rs | 4 +- gstreamer-base/src/flow_combiner.rs | 32 +- gstreamer-base/src/functions.rs | 4 +- gstreamer-base/src/lib.rs | 10 +- gstreamer-base/src/subclass/aggregator.rs | 156 +++++---- gstreamer-base/src/subclass/aggregator_pad.rs | 28 +- gstreamer-base/src/subclass/base_sink.rs | 117 ++++--- gstreamer-base/src/subclass/base_src.rs | 135 ++++---- gstreamer-base/src/subclass/base_transform.rs | 150 +++++---- gstreamer-base/src/utils.rs | 10 +- gstreamer-check/src/harness.rs | 248 ++++++++------ gstreamer-check/src/lib.rs | 10 +- gstreamer-check/src/test_clock.rs | 14 +- gstreamer-editing-services/src/lib.rs | 22 +- .../src/timeline_element.rs | 10 +- gstreamer-gl/src/caps_features.rs | 4 +- gstreamer-gl/src/context.rs | 9 +- gstreamer-gl/src/gl_context.rs | 16 +- gstreamer-gl/src/gl_display.rs | 4 +- gstreamer-gl/src/gl_display_egl.rs | 8 +- gstreamer-gl/src/gl_display_wayland.rs | 6 +- gstreamer-gl/src/gl_display_x11.rs | 6 +- gstreamer-gl/src/gl_sync_meta.rs | 16 +- gstreamer-gl/src/gl_video_frame.rs | 30 +- gstreamer-gl/src/lib.rs | 12 +- gstreamer-net/src/auto/enums.rs | 2 +- gstreamer-net/src/auto/flags.rs | 2 +- gstreamer-net/src/lib.rs | 10 +- gstreamer-net/src/net_address_meta.rs | 12 +- gstreamer-net/src/net_client_clock.rs | 6 +- gstreamer-net/src/net_time_provider.rs | 6 +- gstreamer-net/src/ntp_clock.rs | 6 +- gstreamer-net/src/ptp_clock.rs | 8 +- gstreamer-pbutils/src/discoverer.rs | 16 +- .../src/discoverer_video_info.rs | 15 +- gstreamer-pbutils/src/encoding_profile.rs | 45 ++- gstreamer-pbutils/src/functions.rs | 24 +- gstreamer-pbutils/src/lib.rs | 12 +- gstreamer-player/src/auto/flags.rs | 2 +- gstreamer-player/src/config.rs | 22 +- gstreamer-player/src/lib.rs | 8 +- gstreamer-player/src/player.rs | 34 +- ...player_g_main_context_signal_dispatcher.rs | 9 +- gstreamer-player/src/player_video_info.rs | 10 +- .../player_video_overlay_video_renderer.rs | 35 +- gstreamer-rtsp-server/src/lib.rs | 38 +-- .../src/rtsp_address_pool.rs | 4 +- gstreamer-rtsp-server/src/rtsp_auth.rs | 16 +- gstreamer-rtsp-server/src/rtsp_client.rs | 4 +- gstreamer-rtsp-server/src/rtsp_context.rs | 10 +- .../src/rtsp_media_factory.rs | 6 +- gstreamer-rtsp-server/src/rtsp_server.rs | 4 +- .../src/rtsp_session_pool.rs | 18 +- gstreamer-rtsp-server/src/rtsp_stream.rs | 6 +- .../src/rtsp_stream_transport.rs | 4 +- gstreamer-rtsp-server/src/rtsp_token.rs | 27 +- gstreamer-rtsp/src/lib.rs | 12 +- gstreamer-sdp/src/lib.rs | 10 +- gstreamer-sdp/src/sdp_attribute.rs | 12 +- gstreamer-sdp/src/sdp_bandwidth.rs | 8 +- gstreamer-sdp/src/sdp_connection.rs | 8 +- gstreamer-sdp/src/sdp_key.rs | 4 +- gstreamer-sdp/src/sdp_media.rs | 149 +++++---- gstreamer-sdp/src/sdp_message.rs | 226 +++++++------ gstreamer-sdp/src/sdp_origin.rs | 4 +- gstreamer-sdp/src/sdp_time.rs | 8 +- gstreamer-sdp/src/sdp_zone.rs | 8 +- gstreamer-video/src/functions.rs | 20 +- gstreamer-video/src/lib.rs | 12 +- gstreamer-video/src/video_event.rs | 68 ++-- gstreamer-video/src/video_format.rs | 14 +- gstreamer-video/src/video_format_info.rs | 38 ++- gstreamer-video/src/video_frame.rs | 90 ++--- gstreamer-video/src/video_info.rs | 120 ++++--- gstreamer-video/src/video_meta.rs | 26 +- gstreamer-video/src/video_overlay.rs | 12 +- .../src/video_overlay_composition.rs | 80 +++-- gstreamer-video/src/video_rectangle.rs | 10 +- gstreamer-video/src/video_time_code.rs | 130 ++++---- .../src/video_time_code_interval.rs | 66 ++-- gstreamer-webrtc/src/auto/flags.rs | 2 +- gstreamer-webrtc/src/lib.rs | 10 +- .../src/web_rtc_session_description.rs | 4 +- gstreamer/src/bin.rs | 49 ++- gstreamer/src/buffer.rs | 102 +++--- gstreamer/src/buffer_pool.rs | 41 +-- gstreamer/src/bufferlist.rs | 24 +- gstreamer/src/bus.rs | 44 +-- gstreamer/src/bus_unix.rs | 8 +- gstreamer/src/bus_windows.rs | 8 +- gstreamer/src/caps.rs | 123 ++++--- gstreamer/src/caps_features.rs | 116 +++---- gstreamer/src/child_proxy.rs | 10 +- gstreamer/src/clock.rs | 41 +-- gstreamer/src/clock_time.rs | 14 +- gstreamer/src/context.rs | 20 +- gstreamer/src/device_monitor.rs | 10 +- gstreamer/src/device_provider.rs | 10 +- gstreamer/src/element.rs | 111 ++++--- gstreamer/src/error.rs | 8 +- gstreamer/src/event.rs | 235 +++++++------ gstreamer/src/functions.rs | 16 +- gstreamer/src/ghost_pad.rs | 14 +- gstreamer/src/gobject.rs | 4 +- gstreamer/src/iterator.rs | 171 +++++----- gstreamer/src/lib.rs | 18 +- gstreamer/src/log.rs | 30 +- gstreamer/src/message.rs | 314 ++++++++++-------- gstreamer/src/meta.rs | 34 +- gstreamer/src/miniobject.rs | 186 +++++------ gstreamer/src/object.rs | 8 +- gstreamer/src/pad.rs | 236 ++++++------- gstreamer/src/pad_template.rs | 6 +- gstreamer/src/param_spec.rs | 6 +- gstreamer/src/parse_context.rs | 16 +- gstreamer/src/plugin.rs | 6 +- gstreamer/src/promise.rs | 32 +- gstreamer/src/proxy_pad.rs | 18 +- gstreamer/src/query.rs | 276 ++++++++------- gstreamer/src/sample.rs | 23 +- gstreamer/src/segment.rs | 88 ++--- gstreamer/src/static_caps.rs | 50 +-- gstreamer/src/static_pad_template.rs | 56 ++-- gstreamer/src/stream.rs | 6 +- gstreamer/src/stream_collection.rs | 8 +- gstreamer/src/structure.rs | 134 ++++---- gstreamer/src/subclass/bin.rs | 28 +- gstreamer/src/subclass/child_proxy.rs | 38 +-- gstreamer/src/subclass/element.rs | 66 ++-- gstreamer/src/subclass/ghost_pad.rs | 4 +- gstreamer/src/subclass/pad.rs | 20 +- gstreamer/src/subclass/pipeline.rs | 4 +- gstreamer/src/subclass/plugin.rs | 16 +- gstreamer/src/subclass/uri_handler.rs | 26 +- gstreamer/src/tag_setter.rs | 4 +- gstreamer/src/tags.rs | 68 ++-- gstreamer/src/tags_serde.rs | 4 +- gstreamer/src/toc.rs | 81 +++-- gstreamer/src/typefind.rs | 32 +- gstreamer/src/utils.rs | 10 +- gstreamer/src/value.rs | 98 +++--- 159 files changed, 3387 insertions(+), 2859 deletions(-) diff --git a/examples/src/bin/rtsp-server-record.rs b/examples/src/bin/rtsp-server-record.rs index 250920491..92f2d575d 100644 --- a/examples/src/bin/rtsp-server-record.rs +++ b/examples/src/bin/rtsp-server-record.rs @@ -14,7 +14,7 @@ extern crate failure_derive; extern crate gstreamer as gst; extern crate gstreamer_rtsp as gst_rtsp; extern crate gstreamer_rtsp_server as gst_rtsp_server; -extern crate gstreamer_rtsp_server_sys as ffi; +extern crate gstreamer_rtsp_server_sys as gst_rtsp_server_sys; use failure::Error; use std::env; @@ -93,7 +93,7 @@ fn main_loop() -> Result<(), Error> { // This declares that the user "user" (once authenticated) has a role that // allows them to access and construct media factories. unsafe { - ffi::gst_rtsp_media_factory_add_role( + gst_rtsp_server_sys::gst_rtsp_media_factory_add_role( factory.to_glib_none().0, "user".to_glib_none().0, RTSP_PERM_MEDIA_FACTORY_ACCESS.to_glib_none().0, diff --git a/gstreamer-app/src/app_sink.rs b/gstreamer-app/src/app_sink.rs index c90393d7d..151dcab33 100644 --- a/gstreamer-app/src/app_sink.rs +++ b/gstreamer-app/src/app_sink.rs @@ -6,14 +6,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::ObjectType; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; -use glib_ffi::gpointer; +use glib_sys::gpointer; use gst; -use gst_ffi; +use gst_app_sys; +use gst_sys; use std::boxed::Box as Box_; use std::cell::RefCell; use std::mem::transmute; @@ -29,7 +29,7 @@ pub struct AppSinkCallbacks { new_sample: Option< RefCell Result + Send + 'static>>, >, - callbacks: ffi::GstAppSinkCallbacks, + callbacks: gst_app_sys::GstAppSinkCallbacks, } unsafe impl Send for AppSinkCallbacks {} @@ -99,7 +99,7 @@ impl AppSinkCallbacksBuilder { eos: self.eos, new_preroll: self.new_preroll, new_sample: self.new_sample, - callbacks: ffi::GstAppSinkCallbacks { + callbacks: gst_app_sys::GstAppSinkCallbacks { eos: if have_eos { Some(trampoline_eos) } else { None }, new_preroll: if have_new_preroll { Some(trampoline_new_preroll) @@ -122,7 +122,7 @@ impl AppSinkCallbacksBuilder { } } -unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gpointer) { +unsafe extern "C" fn trampoline_eos(appsink: *mut gst_app_sys::GstAppSink, callbacks: gpointer) { let callbacks = &*(callbacks as *const AppSinkCallbacks); if let Some(ref eos) = callbacks.eos { @@ -131,9 +131,9 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp } unsafe extern "C" fn trampoline_new_preroll( - appsink: *mut ffi::GstAppSink, + appsink: *mut gst_app_sys::GstAppSink, callbacks: gpointer, -) -> gst_ffi::GstFlowReturn { +) -> gst_sys::GstFlowReturn { let callbacks = &*(callbacks as *const AppSinkCallbacks); let ret = if let Some(ref new_preroll) = callbacks.new_preroll { @@ -146,9 +146,9 @@ unsafe extern "C" fn trampoline_new_preroll( } unsafe extern "C" fn trampoline_new_sample( - appsink: *mut ffi::GstAppSink, + appsink: *mut gst_app_sys::GstAppSink, callbacks: gpointer, -) -> gst_ffi::GstFlowReturn { +) -> gst_sys::GstFlowReturn { let callbacks = &*(callbacks as *const AppSinkCallbacks); let ret = if let Some(ref new_sample) = callbacks.new_sample { @@ -167,7 +167,7 @@ unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { impl AppSink { pub fn set_callbacks(&self, callbacks: AppSinkCallbacks) { unsafe { - ffi::gst_app_sink_set_callbacks( + gst_app_sys::gst_app_sink_set_callbacks( self.to_glib_none().0, mut_override(&callbacks.callbacks), Box::into_raw(Box::new(callbacks)) as *mut _, @@ -214,9 +214,9 @@ impl AppSink { unsafe extern "C" fn new_sample_trampoline< F: Fn(&AppSink) -> Result + Send + Sync + 'static, >( - this: *mut ffi::GstAppSink, - f: glib_ffi::gpointer, -) -> gst_ffi::GstFlowReturn { + this: *mut gst_app_sys::GstAppSink, + f: glib_sys::gpointer, +) -> gst_sys::GstFlowReturn { let f: &F = &*(f as *const F); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); ret.to_glib() @@ -225,9 +225,9 @@ unsafe extern "C" fn new_sample_trampoline< unsafe extern "C" fn new_preroll_trampoline< F: Fn(&AppSink) -> Result + Send + Sync + 'static, >( - this: *mut ffi::GstAppSink, - f: glib_ffi::gpointer, -) -> gst_ffi::GstFlowReturn { + this: *mut gst_app_sys::GstAppSink, + f: glib_sys::gpointer, +) -> gst_sys::GstFlowReturn { let f: &F = &*(f as *const F); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); ret.to_glib() diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 3abc11e24..6f0ee0bb0 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; -use glib_ffi::{gboolean, gpointer}; +use glib_sys::{gboolean, gpointer}; use gst; +use gst_app_sys; use std::cell::RefCell; use std::mem; use std::ptr; @@ -20,7 +20,7 @@ pub struct AppSrcCallbacks { need_data: Option>>, enough_data: Option>, seek_data: Option bool + Send + Sync + 'static>>, - callbacks: ffi::GstAppSrcCallbacks, + callbacks: gst_app_sys::GstAppSrcCallbacks, } unsafe impl Send for AppSrcCallbacks {} @@ -80,7 +80,7 @@ impl AppSrcCallbacksBuilder { need_data: self.need_data, enough_data: self.enough_data, seek_data: self.seek_data, - callbacks: ffi::GstAppSrcCallbacks { + callbacks: gst_app_sys::GstAppSrcCallbacks { need_data: if have_need_data { Some(trampoline_need_data) } else { @@ -108,7 +108,7 @@ impl AppSrcCallbacksBuilder { } unsafe extern "C" fn trampoline_need_data( - appsrc: *mut ffi::GstAppSrc, + appsrc: *mut gst_app_sys::GstAppSrc, length: u32, callbacks: gpointer, ) { @@ -119,7 +119,10 @@ unsafe extern "C" fn trampoline_need_data( } } -unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) { +unsafe extern "C" fn trampoline_enough_data( + appsrc: *mut gst_app_sys::GstAppSrc, + callbacks: gpointer, +) { let callbacks = &*(callbacks as *const AppSrcCallbacks); if let Some(ref enough_data) = callbacks.enough_data { @@ -128,7 +131,7 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac } unsafe extern "C" fn trampoline_seek_data( - appsrc: *mut ffi::GstAppSrc, + appsrc: *mut gst_app_sys::GstAppSrc, offset: u64, callbacks: gpointer, ) -> gboolean { @@ -149,14 +152,17 @@ unsafe extern "C" fn destroy_callbacks(ptr: gpointer) { impl AppSrc { pub fn end_of_stream(&self) -> Result { - let ret: gst::FlowReturn = - unsafe { from_glib(ffi::gst_app_src_end_of_stream(self.to_glib_none().0)) }; + let ret: gst::FlowReturn = unsafe { + from_glib(gst_app_sys::gst_app_src_end_of_stream( + self.to_glib_none().0, + )) + }; ret.into_result() } pub fn push_buffer(&self, buffer: gst::Buffer) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_app_src_push_buffer( + from_glib(gst_app_sys::gst_app_src_push_buffer( self.to_glib_none().0, buffer.into_ptr(), )) @@ -170,7 +176,7 @@ impl AppSrc { list: gst::BufferList, ) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_app_src_push_buffer_list( + from_glib(gst_app_sys::gst_app_src_push_buffer_list( self.to_glib_none().0, list.into_ptr(), )) @@ -180,7 +186,7 @@ impl AppSrc { pub fn push_sample(&self, sample: &gst::Sample) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_app_src_push_sample( + from_glib(gst_app_sys::gst_app_src_push_sample( self.to_glib_none().0, sample.to_glib_none().0, )) @@ -190,7 +196,7 @@ impl AppSrc { pub fn set_callbacks(&self, callbacks: AppSrcCallbacks) { unsafe { - ffi::gst_app_src_set_callbacks( + gst_app_sys::gst_app_src_set_callbacks( self.to_glib_none().0, mut_override(&callbacks.callbacks), Box::into_raw(Box::new(callbacks)) as *mut _, @@ -201,7 +207,11 @@ impl AppSrc { pub fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { unsafe { - ffi::gst_app_src_set_latency(self.to_glib_none().0, min.to_glib(), max.to_glib()); + gst_app_sys::gst_app_src_set_latency( + self.to_glib_none().0, + min.to_glib(), + max.to_glib(), + ); } } @@ -209,7 +219,7 @@ impl AppSrc { unsafe { let mut min = mem::uninitialized(); let mut max = mem::uninitialized(); - ffi::gst_app_src_get_latency(self.to_glib_none().0, &mut min, &mut max); + gst_app_sys::gst_app_src_get_latency(self.to_glib_none().0, &mut min, &mut max); (from_glib(min), from_glib(max)) } } diff --git a/gstreamer-app/src/auto/flags.rs b/gstreamer-app/src/auto/flags.rs index fc9f2848b..b32248217 100644 --- a/gstreamer-app/src/auto/flags.rs +++ b/gstreamer-app/src/auto/flags.rs @@ -2,6 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ffi; +use gst_app_sys; use glib::translate::*; diff --git a/gstreamer-app/src/lib.rs b/gstreamer-app/src/lib.rs index 101982cdb..f46d3a75e 100644 --- a/gstreamer-app/src/lib.rs +++ b/gstreamer-app/src/lib.rs @@ -8,13 +8,13 @@ extern crate libc; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_app_sys as ffi; +extern crate gstreamer_app_sys as gst_app_sys; extern crate gstreamer_base as gst_base; -extern crate gstreamer_base_sys as gst_base_ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_base_sys as gst_base_sys; +extern crate gstreamer_sys as gst_sys; #[macro_use] extern crate glib; diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index 8fdd0d36d..52f1ea281 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_audio_sys; use AudioChannelPosition; use std::mem; @@ -25,7 +25,7 @@ impl AudioChannelPosition { return 0; } unsafe { - let val = mem::transmute::(pos); + let val = mem::transmute::(pos); 1 << val } } @@ -38,17 +38,18 @@ impl AudioChannelPosition { return None; } - let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { - if i >= len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID - } else { - positions[i].to_glib() - } - }); + let positions_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = + array_init::array_init_copy(|i| { + if i >= len as usize { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID + } else { + positions[i].to_glib() + } + }); unsafe { let mut mask = mem::uninitialized(); - let valid: bool = from_glib(ffi::gst_audio_channel_positions_to_mask( + let valid: bool = from_glib(gst_audio_sys::gst_audio_channel_positions_to_mask( positions_raw.as_ptr() as *mut _, len as i32, force_order.to_glib(), @@ -73,10 +74,10 @@ impl AudioChannelPosition { } let len = positions.len(); - let mut positions_raw: [ffi::GstAudioChannelPosition; 64] = - [ffi::GST_AUDIO_CHANNEL_POSITION_INVALID; 64]; + let mut positions_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = + [gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID; 64]; let valid: bool = unsafe { - from_glib(ffi::gst_audio_channel_positions_from_mask( + from_glib(gst_audio_sys::gst_audio_channel_positions_from_mask( len as i32, mask, positions_raw.as_mut_ptr(), @@ -105,17 +106,17 @@ impl AudioChannelPosition { } let len = positions.len(); - let mut positions_raw: [ffi::GstAudioChannelPosition; 64] = + let mut positions_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { positions[i].to_glib() } }); let valid: bool = unsafe { - from_glib(ffi::gst_audio_channel_positions_to_valid_order( + from_glib(gst_audio_sys::gst_audio_channel_positions_to_valid_order( positions_raw.as_mut_ptr(), len as i32, )) @@ -136,7 +137,7 @@ impl AudioChannelPosition { pub fn get_fallback_mask(channels: u32) -> u64 { assert_initialized_main_thread!(); - unsafe { ffi::gst_audio_channel_get_fallback_mask(channels as i32) } + unsafe { gst_audio_sys::gst_audio_channel_get_fallback_mask(channels as i32) } } pub fn check_valid_channel_positions( @@ -150,16 +151,17 @@ impl AudioChannelPosition { } let len = positions.len(); - let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { - if i >= len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID - } else { - positions[i].to_glib() - } - }); + let positions_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = + array_init::array_init_copy(|i| { + if i >= len as usize { + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID + } else { + positions[i].to_glib() + } + }); unsafe { - from_glib(ffi::gst_audio_check_valid_channel_positions( + from_glib(gst_audio_sys::gst_audio_check_valid_channel_positions( positions_raw.as_ptr() as *mut _, len as i32, force_order.to_glib(), @@ -184,24 +186,24 @@ pub fn buffer_reorder_channels( let from_len = from.len(); let to_len = to.len(); - let from_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { + let from_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= from_len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { from[i].to_glib() } }); - let to_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { + let to_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= to_len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { to[i].to_glib() } }); let valid: bool = unsafe { - from_glib(ffi::gst_audio_buffer_reorder_channels( + from_glib(gst_audio_sys::gst_audio_buffer_reorder_channels( buffer.as_mut_ptr(), format.to_glib(), channels as i32, @@ -233,24 +235,24 @@ pub fn reorder_channels( let from_len = from.len(); let to_len = to.len(); - let from_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { + let from_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= from_len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { from[i].to_glib() } }); - let to_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { + let to_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= to_len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { to[i].to_glib() } }); let valid: bool = unsafe { - from_glib(ffi::gst_audio_reorder_channels( + from_glib(gst_audio_sys::gst_audio_reorder_channels( data.as_mut_ptr() as *mut _, data.len(), format.to_glib(), @@ -281,17 +283,17 @@ pub fn get_channel_reorder_map( let from_len = from.len(); let to_len = to.len(); - let from_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { + let from_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= from_len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { from[i].to_glib() } }); - let to_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { + let to_raw: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= to_len as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { to[i].to_glib() } @@ -299,7 +301,7 @@ pub fn get_channel_reorder_map( let mut reorder_map_raw = [0i32, 64]; let valid: bool = unsafe { - from_glib(ffi::gst_audio_get_channel_reorder_map( + from_glib(gst_audio_sys::gst_audio_get_channel_reorder_map( from_len as i32, from_raw.as_ptr() as *mut _, to_raw.as_ptr() as *mut _, diff --git a/gstreamer-audio/src/audio_format.rs b/gstreamer-audio/src/audio_format.rs index 16df3ae43..90c62dc13 100644 --- a/gstreamer-audio/src/audio_format.rs +++ b/gstreamer-audio/src/audio_format.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_audio_sys; use std::ffi::CStr; use std::fmt; @@ -24,7 +24,7 @@ impl ::AudioFormat { assert_initialized_main_thread!(); unsafe { - from_glib(ffi::gst_audio_format_build_integer( + from_glib(gst_audio_sys::gst_audio_format_build_integer( sign.to_glib(), endianness.to_glib(), width, @@ -36,7 +36,11 @@ impl ::AudioFormat { pub fn from_string(s: &str) -> ::AudioFormat { assert_initialized_main_thread!(); - unsafe { from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)) } + unsafe { + from_glib(gst_audio_sys::gst_audio_format_from_string( + s.to_glib_none().0, + )) + } } pub fn to_string<'a>(self) -> &'a str { @@ -45,7 +49,7 @@ impl ::AudioFormat { } unsafe { - CStr::from_ptr(ffi::gst_audio_format_to_string(self.to_glib())) + CStr::from_ptr(gst_audio_sys::gst_audio_format_to_string(self.to_glib())) .to_str() .unwrap() } diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index bad1c1f5e..673fa265e 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_audio_sys; use std::ffi::CStr; use std::fmt; @@ -48,14 +48,14 @@ impl ToGlib for AudioEndianness { } } -pub struct AudioFormatInfo(&'static ffi::GstAudioFormatInfo); +pub struct AudioFormatInfo(&'static gst_audio_sys::GstAudioFormatInfo); impl AudioFormatInfo { pub fn from_format(format: ::AudioFormat) -> AudioFormatInfo { assert_initialized_main_thread!(); unsafe { - let info = ffi::gst_audio_format_get_info(format.to_glib()); + let info = gst_audio_sys::gst_audio_format_get_info(format.to_glib()); assert!(!info.is_null()); AudioFormatInfo(&*info) @@ -178,7 +178,11 @@ impl AudioFormatInfo { } unsafe { - ffi::gst_audio_format_fill_silence(self.0, dest.as_mut_ptr() as *mut _, dest.len()) + gst_audio_sys::gst_audio_format_fill_silence( + self.0, + dest.as_mut_ptr() as *mut _, + dest.len(), + ) } } @@ -245,26 +249,29 @@ impl From<::AudioFormat> for AudioFormatInfo { impl glib::types::StaticType for AudioFormatInfo { fn static_type() -> glib::types::Type { - unsafe { glib::translate::from_glib(ffi::gst_audio_format_info_get_type()) } + unsafe { glib::translate::from_glib(gst_audio_sys::gst_audio_format_info_get_type()) } } } #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for AudioFormatInfo { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none(gobject_ffi::g_value_get_boxed( + Option::::from_glib_none(gobject_sys::g_value_get_boxed( value.to_glib_none().0, - ) as *mut ffi::GstAudioFormatInfo) + ) + as *mut gst_audio_sys::GstAudioFormatInfo) } } #[doc(hidden)] impl glib::value::SetValue for AudioFormatInfo { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioFormatInfo>::to_glib_none( + this, + ) + .0 as glib_sys::gpointer, ) } } @@ -272,36 +279,42 @@ impl glib::value::SetValue for AudioFormatInfo { #[doc(hidden)] impl glib::value::SetValueOptional for AudioFormatInfo { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(&this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioFormatInfo>::to_glib_none( + &this, + ) + .0 as glib_sys::gpointer, ) } } #[doc(hidden)] impl glib::translate::GlibPtrDefault for AudioFormatInfo { - type GlibType = *mut ffi::GstAudioFormatInfo; + type GlibType = *mut gst_audio_sys::GstAudioFormatInfo; } #[doc(hidden)] -impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstAudioFormatInfo> for AudioFormatInfo { +impl<'a> glib::translate::ToGlibPtr<'a, *const gst_audio_sys::GstAudioFormatInfo> + for AudioFormatInfo +{ type Storage = &'a AudioFormatInfo; - fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstAudioFormatInfo, Self> { + fn to_glib_none( + &'a self, + ) -> glib::translate::Stash<'a, *const gst_audio_sys::GstAudioFormatInfo, Self> { glib::translate::Stash(self.0, self) } - fn to_glib_full(&self) -> *const ffi::GstAudioFormatInfo { + fn to_glib_full(&self) -> *const gst_audio_sys::GstAudioFormatInfo { unimplemented!() } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstAudioFormatInfo> for AudioFormatInfo { +impl glib::translate::FromGlibPtrNone<*mut gst_audio_sys::GstAudioFormatInfo> for AudioFormatInfo { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstAudioFormatInfo) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_audio_sys::GstAudioFormatInfo) -> Self { AudioFormatInfo(&*ptr) } } diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index 56db27663..edf6fd846 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_audio_sys; use glib; use glib::translate::{ @@ -23,7 +23,7 @@ use std::ptr; use array_init; -pub struct AudioInfo(ffi::GstAudioInfo, [::AudioChannelPosition; 64]); +pub struct AudioInfo(gst_audio_sys::GstAudioInfo, [::AudioChannelPosition; 64]); impl fmt::Debug for AudioInfo { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { @@ -57,20 +57,21 @@ impl<'a> AudioInfoBuilder<'a> { return None; } - let positions: [ffi::GstAudioChannelPosition; 64] = + let positions: [gst_audio_sys::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { if i >= self.channels as usize { - ffi::GST_AUDIO_CHANNEL_POSITION_INVALID + gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID } else { p[i].to_glib() } }); - let valid: bool = from_glib(ffi::gst_audio_check_valid_channel_positions( - positions.as_ptr() as *mut _, - self.channels as i32, - true.to_glib(), - )); + let valid: bool = + from_glib(gst_audio_sys::gst_audio_check_valid_channel_positions( + positions.as_ptr() as *mut _, + self.channels as i32, + true.to_glib(), + )); if !valid { return None; } @@ -85,7 +86,7 @@ impl<'a> AudioInfoBuilder<'a> { .map(|p| p.as_ptr()) .unwrap_or(ptr::null()); - ffi::gst_audio_info_set_format( + gst_audio_sys::gst_audio_info_set_format( &mut info, self.format.to_glib(), self.rate as i32, @@ -152,7 +153,10 @@ impl AudioInfo { unsafe { let mut info = mem::uninitialized(); - if from_glib(ffi::gst_audio_info_from_caps(&mut info, caps.as_ptr())) { + if from_glib(gst_audio_sys::gst_audio_info_from_caps( + &mut info, + caps.as_ptr(), + )) { let positions = array_init::array_init_copy(|i| from_glib(info.position[i])); Some(AudioInfo(info, positions)) } else { @@ -162,7 +166,7 @@ impl AudioInfo { } pub fn to_caps(&self) -> Option { - unsafe { from_glib_full(ffi::gst_audio_info_to_caps(&self.0)) } + unsafe { from_glib_full(gst_audio_sys::gst_audio_info_to_caps(&self.0)) } } pub fn convert, U: gst::SpecificFormattedValue>( @@ -174,7 +178,7 @@ impl AudioInfo { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - if from_glib(ffi::gst_audio_info_convert( + if from_glib(gst_audio_sys::gst_audio_info_convert( &self.0, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -198,7 +202,7 @@ impl AudioInfo { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - if from_glib(ffi::gst_audio_info_convert( + if from_glib(gst_audio_sys::gst_audio_info_convert( &self.0, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -297,7 +301,7 @@ impl Clone for AudioInfo { impl PartialEq for AudioInfo { fn eq(&self, other: &Self) -> bool { - unsafe { from_glib(ffi::gst_audio_info_is_equal(&self.0, &other.0)) } + unsafe { from_glib(gst_audio_sys::gst_audio_info_is_equal(&self.0, &other.0)) } } } @@ -308,26 +312,25 @@ unsafe impl Sync for AudioInfo {} impl glib::types::StaticType for AudioInfo { fn static_type() -> glib::types::Type { - unsafe { glib::translate::from_glib(ffi::gst_audio_info_get_type()) } + unsafe { glib::translate::from_glib(gst_audio_sys::gst_audio_info_get_type()) } } } #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for AudioInfo { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstAudioInfo - ) + Option::::from_glib_none(gobject_sys::g_value_get_boxed(value.to_glib_none().0) + as *mut gst_audio_sys::GstAudioInfo) } } #[doc(hidden)] impl glib::value::SetValue for AudioInfo { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioInfo>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -335,10 +338,10 @@ impl glib::value::SetValue for AudioInfo { #[doc(hidden)] impl glib::value::SetValueOptional for AudioInfo { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(&this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioInfo>::to_glib_none(&this).0 + as glib_sys::gpointer, ) } } @@ -352,26 +355,28 @@ impl glib::translate::Uninitialized for AudioInfo { #[doc(hidden)] impl glib::translate::GlibPtrDefault for AudioInfo { - type GlibType = *mut ffi::GstAudioInfo; + type GlibType = *mut gst_audio_sys::GstAudioInfo; } #[doc(hidden)] -impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstAudioInfo> for AudioInfo { +impl<'a> glib::translate::ToGlibPtr<'a, *const gst_audio_sys::GstAudioInfo> for AudioInfo { type Storage = &'a AudioInfo; - fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstAudioInfo, Self> { + fn to_glib_none( + &'a self, + ) -> glib::translate::Stash<'a, *const gst_audio_sys::GstAudioInfo, Self> { glib::translate::Stash(&self.0, self) } - fn to_glib_full(&self) -> *const ffi::GstAudioInfo { + fn to_glib_full(&self) -> *const gst_audio_sys::GstAudioInfo { unimplemented!() } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstAudioInfo> for AudioInfo { +impl glib::translate::FromGlibPtrNone<*mut gst_audio_sys::GstAudioInfo> for AudioInfo { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstAudioInfo) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_audio_sys::GstAudioInfo) -> Self { AudioInfo( ptr::read(ptr), array_init::array_init_copy(|i| from_glib((*ptr).position[i])), @@ -380,11 +385,11 @@ impl glib::translate::FromGlibPtrNone<*mut ffi::GstAudioInfo> for AudioInfo { } #[doc(hidden)] -impl glib::translate::FromGlibPtrFull<*mut ffi::GstAudioInfo> for AudioInfo { +impl glib::translate::FromGlibPtrFull<*mut gst_audio_sys::GstAudioInfo> for AudioInfo { #[inline] - unsafe fn from_glib_full(ptr: *mut ffi::GstAudioInfo) -> Self { + unsafe fn from_glib_full(ptr: *mut gst_audio_sys::GstAudioInfo) -> Self { let info = from_glib_none(ptr); - glib_ffi::g_free(ptr as *mut _); + glib_sys::g_free(ptr as *mut _); info } } diff --git a/gstreamer-audio/src/audio_stream_align.rs b/gstreamer-audio/src/audio_stream_align.rs index fed017acc..4276e2592 100644 --- a/gstreamer-audio/src/audio_stream_align.rs +++ b/gstreamer-audio/src/audio_stream_align.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_audio_sys; use AudioStreamAlign; use glib::translate::*; @@ -25,7 +25,7 @@ impl AudioStreamAlign { let mut out_timestamp = mem::uninitialized(); let mut out_duration = mem::uninitialized(); let mut out_sample_position = mem::uninitialized(); - let ret = from_glib(ffi::gst_audio_stream_align_process( + let ret = from_glib(gst_audio_sys::gst_audio_stream_align_process( self.to_glib_none_mut().0, discont.to_glib(), timestamp.to_glib(), diff --git a/gstreamer-audio/src/lib.rs b/gstreamer-audio/src/lib.rs index 43de2dab5..a5c9029b6 100644 --- a/gstreamer-audio/src/lib.rs +++ b/gstreamer-audio/src/lib.rs @@ -12,15 +12,15 @@ extern crate bitflags; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_audio_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_audio_sys as gst_audio_sys; +extern crate gstreamer_sys as gst_sys; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; @@ -60,7 +60,7 @@ pub fn audio_buffer_clip( skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_audio_buffer_clip( + from_glib_full(gst_audio_sys::gst_audio_buffer_clip( buffer.into_ptr(), segment.to_glib_none().0, rate as i32, diff --git a/gstreamer-base/src/adapter.rs b/gstreamer-base/src/adapter.rs index 26961b7b4..0fdfaa394 100644 --- a/gstreamer-base/src/adapter.rs +++ b/gstreamer-base/src/adapter.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use gst; +use gst_base_sys; use std::io; use std::ops; use Adapter; @@ -17,7 +17,7 @@ impl Adapter { pub fn copy(&self, offset: usize, dest: &mut [u8]) { unsafe { let size = dest.len(); - ffi::gst_adapter_copy( + gst_base_sys::gst_adapter_copy( self.to_glib_none().0, dest.as_mut_ptr() as *mut _, offset, @@ -28,7 +28,7 @@ impl Adapter { pub fn push(&self, buf: gst::Buffer) { unsafe { - ffi::gst_adapter_push(self.to_glib_none().0, buf.into_ptr()); + gst_base_sys::gst_adapter_push(self.to_glib_none().0, buf.into_ptr()); } } } @@ -187,7 +187,7 @@ impl UniqueAdapter { use std::slice; unsafe { - let ptr = ffi::gst_adapter_map(self.0.to_glib_none().0, nbytes); + let ptr = gst_base_sys::gst_adapter_map(self.0.to_glib_none().0, nbytes); if ptr.is_null() { None } else { @@ -206,7 +206,7 @@ pub struct UniqueAdapterMap<'a>(&'a UniqueAdapter, &'a [u8]); impl<'a> Drop for UniqueAdapterMap<'a> { fn drop(&mut self) { unsafe { - ffi::gst_adapter_unmap((self.0).0.to_glib_none().0); + gst_base_sys::gst_adapter_unmap((self.0).0.to_glib_none().0); } } } diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index c107e4d91..af16555d8 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use glib::IsA; use gst; +use gst_base_sys; use Aggregator; pub trait AggregatorExtManual: 'static { @@ -19,7 +19,7 @@ pub trait AggregatorExtManual: 'static { impl> AggregatorExtManual for O { fn finish_buffer(&self, buffer: gst::Buffer) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_aggregator_finish_buffer( + from_glib(gst_base_sys::gst_aggregator_finish_buffer( self.as_ref().to_glib_none().0, buffer.into_ptr(), )) diff --git a/gstreamer-base/src/aggregator_pad.rs b/gstreamer-base/src/aggregator_pad.rs index 9448be2f1..915d13e41 100644 --- a/gstreamer-base/src/aggregator_pad.rs +++ b/gstreamer-base/src/aggregator_pad.rs @@ -6,11 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; use gst; -use gst_ffi; +use gst_base_sys; +use gst_sys; use AggregatorPad; pub trait AggregatorPadExtManual: 'static { @@ -20,9 +20,9 @@ pub trait AggregatorPadExtManual: 'static { impl> AggregatorPadExtManual for O { fn get_segment(&self) -> gst::Segment { unsafe { - let ptr: &ffi::GstAggregatorPad = &*(self.as_ptr() as *const _); + let ptr: &gst_base_sys::GstAggregatorPad = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&ptr.parent.object.lock); - from_glib_none(&ptr.segment as *const gst_ffi::GstSegment) + from_glib_none(&ptr.segment as *const gst_sys::GstSegment) } } } diff --git a/gstreamer-base/src/auto/enums.rs b/gstreamer-base/src/auto/enums.rs index fc9f2848b..db4949d05 100644 --- a/gstreamer-base/src/auto/enums.rs +++ b/gstreamer-base/src/auto/enums.rs @@ -2,6 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ffi; +use gst_base_sys; use glib::translate::*; diff --git a/gstreamer-base/src/auto/flags.rs b/gstreamer-base/src/auto/flags.rs index fc9f2848b..db4949d05 100644 --- a/gstreamer-base/src/auto/flags.rs +++ b/gstreamer-base/src/auto/flags.rs @@ -2,6 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ffi; +use gst_base_sys; use glib::translate::*; diff --git a/gstreamer-base/src/base_sink.rs b/gstreamer-base/src/base_sink.rs index 75d705972..d45388641 100644 --- a/gstreamer-base/src/base_sink.rs +++ b/gstreamer-base/src/base_sink.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; use gst; +use gst_base_sys; use std::mem; use BaseSink; @@ -27,7 +27,7 @@ pub trait BaseSinkExtManual: 'static { impl> BaseSinkExtManual for O { fn get_segment(&self) -> gst::Segment { unsafe { - let sink: &ffi::GstBaseSink = &*(self.as_ptr() as *const _); + let sink: &gst_base_sys::GstBaseSink = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&sink.element.object.lock); from_glib_none(&sink.segment as *const _) } @@ -39,7 +39,7 @@ impl> BaseSinkExtManual for O { ) -> (Result, gst::ClockTimeDiff) { unsafe { let mut jitter = mem::uninitialized(); - let ret: gst::FlowReturn = from_glib(ffi::gst_base_sink_wait( + let ret: gst::FlowReturn = from_glib(gst_base_sys::gst_base_sink_wait( self.as_ref().to_glib_none().0, time.to_glib(), &mut jitter, @@ -50,7 +50,7 @@ impl> BaseSinkExtManual for O { fn wait_preroll(&self) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_base_sink_wait_preroll( + from_glib(gst_base_sys::gst_base_sink_wait_preroll( self.as_ref().to_glib_none().0, )) }; diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index 6ce97fcb8..b39a0fd0b 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; use gst; +use gst_base_sys; use BaseSrc; pub trait BaseSrcExtManual: 'static { @@ -25,7 +25,7 @@ pub trait BaseSrcExtManual: 'static { impl> BaseSrcExtManual for O { fn get_segment(&self) -> gst::Segment { unsafe { - let src: &ffi::GstBaseSrc = &*(self.as_ptr() as *const _); + let src: &gst_base_sys::GstBaseSrc = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&src.element.object.lock); from_glib_none(&src.segment as *const _) } @@ -34,19 +34,25 @@ impl> BaseSrcExtManual for O { fn start_complete(&self, ret: Result) { let ret: gst::FlowReturn = ret.into(); unsafe { - ffi::gst_base_src_start_complete(self.as_ref().to_glib_none().0, ret.to_glib()); + gst_base_sys::gst_base_src_start_complete( + self.as_ref().to_glib_none().0, + ret.to_glib(), + ); } } fn start_wait(&self) -> Result { - let ret: gst::FlowReturn = - unsafe { from_glib(ffi::gst_base_src_start_wait(self.as_ref().to_glib_none().0)) }; + let ret: gst::FlowReturn = unsafe { + from_glib(gst_base_sys::gst_base_src_start_wait( + self.as_ref().to_glib_none().0, + )) + }; ret.into_result() } fn wait_playing(&self) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_base_src_wait_playing( + from_glib(gst_base_sys::gst_base_src_wait_playing( self.as_ref().to_glib_none().0, )) }; diff --git a/gstreamer-base/src/base_transform.rs b/gstreamer-base/src/base_transform.rs index 03a0b8eb0..557325061 100644 --- a/gstreamer-base/src/base_transform.rs +++ b/gstreamer-base/src/base_transform.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; use gst; +use gst_base_sys; use BaseTransform; pub trait BaseTransformExtManual: 'static { @@ -19,7 +19,7 @@ pub trait BaseTransformExtManual: 'static { impl> BaseTransformExtManual for O { fn get_segment(&self) -> gst::Segment { unsafe { - let trans: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _); + let trans: &gst_base_sys::GstBaseTransform = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&trans.element.object.lock); from_glib_none(&trans.segment as *const _) } diff --git a/gstreamer-base/src/flow_combiner.rs b/gstreamer-base/src/flow_combiner.rs index 2b63686d5..8b34ebde2 100644 --- a/gstreamer-base/src/flow_combiner.rs +++ b/gstreamer-base/src/flow_combiner.rs @@ -6,50 +6,56 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; -use gobject_ffi; +use gobject_sys; use gst; +use gst_base_sys; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] - pub struct FlowCombiner(Shared); + pub struct FlowCombiner(Shared); match fn { - ref => |ptr| gobject_ffi::g_boxed_copy(ffi::gst_flow_combiner_get_type(), ptr as *mut _), - unref => |ptr| gobject_ffi::g_boxed_free(ffi::gst_flow_combiner_get_type(), ptr as *mut _), - get_type => || ffi::gst_flow_combiner_get_type(), + ref => |ptr| gobject_sys::g_boxed_copy(gst_base_sys::gst_flow_combiner_get_type(), ptr as *mut _), + unref => |ptr| gobject_sys::g_boxed_free(gst_base_sys::gst_flow_combiner_get_type(), ptr as *mut _), + get_type => || gst_base_sys::gst_flow_combiner_get_type(), } } impl FlowCombiner { pub fn new() -> FlowCombiner { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_flow_combiner_new()) } + unsafe { from_glib_full(gst_base_sys::gst_flow_combiner_new()) } } pub fn add_pad>(&self, pad: &P) { unsafe { - ffi::gst_flow_combiner_add_pad(self.to_glib_none().0, pad.as_ref().to_glib_none().0); + gst_base_sys::gst_flow_combiner_add_pad( + self.to_glib_none().0, + pad.as_ref().to_glib_none().0, + ); } } pub fn clear(&self) { unsafe { - ffi::gst_flow_combiner_clear(self.to_glib_none().0); + gst_base_sys::gst_flow_combiner_clear(self.to_glib_none().0); } } pub fn remove_pad>(&self, pad: &P) { unsafe { - ffi::gst_flow_combiner_remove_pad(self.to_glib_none().0, pad.as_ref().to_glib_none().0); + gst_base_sys::gst_flow_combiner_remove_pad( + self.to_glib_none().0, + pad.as_ref().to_glib_none().0, + ); } } pub fn reset(&self) { unsafe { - ffi::gst_flow_combiner_reset(self.to_glib_none().0); + gst_base_sys::gst_flow_combiner_reset(self.to_glib_none().0); } } @@ -59,7 +65,7 @@ impl FlowCombiner { ) -> Result { let fret: gst::FlowReturn = fret.into(); let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_flow_combiner_update_flow( + from_glib(gst_base_sys::gst_flow_combiner_update_flow( self.to_glib_none().0, fret.to_glib(), )) @@ -74,7 +80,7 @@ impl FlowCombiner { ) -> Result { let fret: gst::FlowReturn = fret.into(); let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_flow_combiner_update_pad_flow( + from_glib(gst_base_sys::gst_flow_combiner_update_pad_flow( self.to_glib_none().0, pad.as_ref().to_glib_none().0, fret.to_glib(), diff --git a/gstreamer-base/src/functions.rs b/gstreamer-base/src/functions.rs index 974aeb41c..61449df20 100644 --- a/gstreamer-base/src/functions.rs +++ b/gstreamer-base/src/functions.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; use gst; +use gst_base_sys; use std::mem; pub fn type_find_helper_for_data< @@ -27,7 +27,7 @@ pub fn type_find_helper_for_data< let mut prob = mem::uninitialized(); let data = data.as_ref(); let (ptr, len) = (data.as_ptr(), data.len()); - let ret = from_glib_full(ffi::gst_type_find_helper_for_data( + let ret = from_glib_full(gst_base_sys::gst_type_find_helper_for_data( obj.map(|p| p.as_ref()).to_glib_none().0, mut_override(ptr), len, diff --git a/gstreamer-base/src/lib.rs b/gstreamer-base/src/lib.rs index 4c6c6176a..08d2258c6 100644 --- a/gstreamer-base/src/lib.rs +++ b/gstreamer-base/src/lib.rs @@ -6,12 +6,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; #[cfg_attr(feature = "subclassing", macro_use)] extern crate gstreamer as gst; -extern crate gstreamer_base_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_base_sys as gst_base_sys; +extern crate gstreamer_sys as gst_sys; extern crate libc; @@ -20,7 +20,7 @@ extern crate glib; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index aa0340539..758cebe8e 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -8,9 +8,9 @@ use libc; -use ffi; -use glib_ffi; -use gst_ffi; +use glib_sys; +use gst_base_sys; +use gst_sys; use glib::translate::*; use prelude::*; @@ -211,7 +211,8 @@ impl AggregatorImplExt for T { fn parent_flush(&self, aggregator: &Aggregator) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) .flush .map(|f| from_glib(f(aggregator.to_glib_none().0))) @@ -228,7 +229,8 @@ impl AggregatorImplExt for T { ) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; match (*parent_class).clip { None => Some(buffer), Some(ref func) => from_glib_full(func( @@ -247,7 +249,8 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .finish_buffer .expect("Missing parent function `finish_buffer`"); @@ -264,7 +267,8 @@ impl AggregatorImplExt for T { ) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .sink_event .expect("Missing parent function `sink_event`"); @@ -284,7 +288,8 @@ impl AggregatorImplExt for T { ) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .sink_query .expect("Missing parent function `sink_query`"); @@ -299,7 +304,8 @@ impl AggregatorImplExt for T { fn parent_src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .src_event .expect("Missing parent function `src_event`"); @@ -310,7 +316,8 @@ impl AggregatorImplExt for T { fn parent_src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .src_query .expect("Missing parent function `src_query`"); @@ -326,7 +333,8 @@ impl AggregatorImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; match (*parent_class).src_activate { None => Ok(()), Some(f) => gst_result_from_gboolean!( @@ -349,7 +357,8 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .aggregate .expect("Missing parent function `aggregate`"); @@ -361,7 +370,8 @@ impl AggregatorImplExt for T { fn parent_start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) .start .map(|f| { @@ -381,7 +391,8 @@ impl AggregatorImplExt for T { fn parent_stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) .stop .map(|f| { @@ -401,7 +412,8 @@ impl AggregatorImplExt for T { fn parent_get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) .get_next_time .map(|f| from_glib(f(aggregator.to_glib_none().0))) @@ -418,7 +430,8 @@ impl AggregatorImplExt for T { ) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .create_new_pad .expect("Missing parent function `create_new_pad`"); @@ -438,7 +451,8 @@ impl AggregatorImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .update_src_caps .expect("Missing parent function `update_src_caps`"); @@ -456,7 +470,8 @@ impl AggregatorImplExt for T { fn parent_fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) .fixate_src_caps @@ -472,7 +487,8 @@ impl AggregatorImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) .negotiated_src_caps .map(|f| { @@ -494,7 +510,7 @@ where fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstAggregatorClass); + let klass = &mut *(self as *mut Self as *mut gst_base_sys::GstAggregatorClass); klass.flush = Some(aggregator_flush::); klass.clip = Some(aggregator_clip::); klass.finish_buffer = Some(aggregator_finish_buffer::); @@ -516,8 +532,8 @@ where } unsafe extern "C" fn aggregator_flush( - ptr: *mut ffi::GstAggregator, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstAggregator, +) -> gst_sys::GstFlowReturn where T: AggregatorImpl, T::Instance: PanicPoison, @@ -534,10 +550,10 @@ where } unsafe extern "C" fn aggregator_clip( - ptr: *mut ffi::GstAggregator, - aggregator_pad: *mut ffi::GstAggregatorPad, - buffer: *mut gst_ffi::GstBuffer, -) -> *mut gst_ffi::GstBuffer + ptr: *mut gst_base_sys::GstAggregator, + aggregator_pad: *mut gst_base_sys::GstAggregatorPad, + buffer: *mut gst_sys::GstBuffer, +) -> *mut gst_sys::GstBuffer where T: AggregatorImpl, T::Instance: PanicPoison, @@ -559,9 +575,9 @@ where } unsafe extern "C" fn aggregator_finish_buffer( - ptr: *mut ffi::GstAggregator, - buffer: *mut gst_ffi::GstBuffer, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstAggregator, + buffer: *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: AggregatorImpl, T::Instance: PanicPoison, @@ -578,10 +594,10 @@ where } unsafe extern "C" fn aggregator_sink_event( - ptr: *mut ffi::GstAggregator, - aggregator_pad: *mut ffi::GstAggregatorPad, - event: *mut gst_ffi::GstEvent, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, + aggregator_pad: *mut gst_base_sys::GstAggregatorPad, + event: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, @@ -602,10 +618,10 @@ where } unsafe extern "C" fn aggregator_sink_query( - ptr: *mut ffi::GstAggregator, - aggregator_pad: *mut ffi::GstAggregatorPad, - query: *mut gst_ffi::GstQuery, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, + aggregator_pad: *mut gst_base_sys::GstAggregatorPad, + query: *mut gst_sys::GstQuery, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, @@ -626,9 +642,9 @@ where } unsafe extern "C" fn aggregator_src_event( - ptr: *mut ffi::GstAggregator, - event: *mut gst_ffi::GstEvent, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, + event: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, @@ -645,9 +661,9 @@ where } unsafe extern "C" fn aggregator_src_query( - ptr: *mut ffi::GstAggregator, - query: *mut gst_ffi::GstQuery, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, + query: *mut gst_sys::GstQuery, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, @@ -664,10 +680,10 @@ where } unsafe extern "C" fn aggregator_src_activate( - ptr: *mut ffi::GstAggregator, - mode: gst_ffi::GstPadMode, - active: glib_ffi::gboolean, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, + mode: gst_sys::GstPadMode, + active: glib_sys::gboolean, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, @@ -690,9 +706,9 @@ where } unsafe extern "C" fn aggregator_aggregate( - ptr: *mut ffi::GstAggregator, - timeout: glib_ffi::gboolean, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstAggregator, + timeout: glib_sys::gboolean, +) -> gst_sys::GstFlowReturn where T: AggregatorImpl, T::Instance: PanicPoison, @@ -709,8 +725,8 @@ where } unsafe extern "C" fn aggregator_start( - ptr: *mut ffi::GstAggregator, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, @@ -733,8 +749,8 @@ where } unsafe extern "C" fn aggregator_stop( - ptr: *mut ffi::GstAggregator, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, @@ -757,8 +773,8 @@ where } unsafe extern "C" fn aggregator_get_next_time( - ptr: *mut ffi::GstAggregator, -) -> gst_ffi::GstClockTime + ptr: *mut gst_base_sys::GstAggregator, +) -> gst_sys::GstClockTime where T: AggregatorImpl, T::Instance: PanicPoison, @@ -775,11 +791,11 @@ where } unsafe extern "C" fn aggregator_create_new_pad( - ptr: *mut ffi::GstAggregator, - templ: *mut gst_ffi::GstPadTemplate, + ptr: *mut gst_base_sys::GstAggregator, + templ: *mut gst_sys::GstPadTemplate, req_name: *const libc::c_char, - caps: *const gst_ffi::GstCaps, -) -> *mut ffi::GstAggregatorPad + caps: *const gst_sys::GstCaps, +) -> *mut gst_base_sys::GstAggregatorPad where T: AggregatorImpl, T::Instance: PanicPoison, @@ -817,10 +833,10 @@ where } unsafe extern "C" fn aggregator_update_src_caps( - ptr: *mut ffi::GstAggregator, - caps: *mut gst_ffi::GstCaps, - res: *mut *mut gst_ffi::GstCaps, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstAggregator, + caps: *mut gst_sys::GstCaps, + res: *mut *mut gst_sys::GstCaps, +) -> gst_sys::GstFlowReturn where T: AggregatorImpl, T::Instance: PanicPoison, @@ -845,9 +861,9 @@ where } unsafe extern "C" fn aggregator_fixate_src_caps( - ptr: *mut ffi::GstAggregator, - caps: *mut gst_ffi::GstCaps, -) -> *mut gst_ffi::GstCaps + ptr: *mut gst_base_sys::GstAggregator, + caps: *mut gst_sys::GstCaps, +) -> *mut gst_sys::GstCaps where T: AggregatorImpl, T::Instance: PanicPoison, @@ -864,9 +880,9 @@ where } unsafe extern "C" fn aggregator_negotiated_src_caps( - ptr: *mut ffi::GstAggregator, - caps: *mut gst_ffi::GstCaps, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregator, + caps: *mut gst_sys::GstCaps, +) -> glib_sys::gboolean where T: AggregatorImpl, T::Instance: PanicPoison, diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index 4623a5972..813ed4f9e 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gst_ffi; +use glib_sys; +use gst_base_sys; +use gst_sys; use glib::translate::*; use gst; @@ -63,7 +63,8 @@ impl AggregatorPadImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorPadClass; (*parent_class) .flush .map(|f| { @@ -85,7 +86,8 @@ impl AggregatorPadImplExt for T { ) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorPadClass; (*parent_class) .skip_buffer .map(|f| { @@ -103,7 +105,7 @@ unsafe impl IsSubclassable for Aggrega fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstAggregatorPadClass); + let klass = &mut *(self as *mut Self as *mut gst_base_sys::GstAggregatorPadClass); klass.flush = Some(aggregator_pad_flush::); klass.skip_buffer = Some(aggregator_pad_skip_buffer::); } @@ -111,9 +113,9 @@ unsafe impl IsSubclassable for Aggrega } unsafe extern "C" fn aggregator_pad_flush( - ptr: *mut ffi::GstAggregatorPad, - aggregator: *mut ffi::GstAggregator, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstAggregatorPad, + aggregator: *mut gst_base_sys::GstAggregator, +) -> gst_sys::GstFlowReturn where T: AggregatorPadImpl, { @@ -127,10 +129,10 @@ where } unsafe extern "C" fn aggregator_pad_skip_buffer( - ptr: *mut ffi::GstAggregatorPad, - aggregator: *mut ffi::GstAggregator, - buffer: *mut gst_ffi::GstBuffer, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstAggregatorPad, + aggregator: *mut gst_base_sys::GstAggregator, + buffer: *mut gst_sys::GstBuffer, +) -> glib_sys::gboolean where T: AggregatorPadImpl, { diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index 2a0cfe296..d09c632bd 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gst_ffi; +use glib_sys; +use gst_base_sys; +use gst_sys; use glib::translate::*; use prelude::*; @@ -146,7 +146,8 @@ impl BaseSinkImplExt for T { fn parent_start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .start .map(|f| { @@ -166,7 +167,8 @@ impl BaseSinkImplExt for T { fn parent_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .stop .map(|f| { @@ -190,7 +192,8 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .render .map(|f| { @@ -208,7 +211,8 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .prepare .map(|f| from_glib(f(element.to_glib_none().0, buffer.as_mut_ptr()))) @@ -224,7 +228,8 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .render_list .map(|f| { @@ -247,7 +252,8 @@ impl BaseSinkImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .prepare_list .map(|f| { @@ -266,7 +272,8 @@ impl BaseSinkImplExt for T { fn parent_query(&self, element: &BaseSink, query: &mut gst::QueryRef) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .query .map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr()))) @@ -277,7 +284,8 @@ impl BaseSinkImplExt for T { fn parent_event(&self, element: &BaseSink, event: gst::Event) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .event .map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr()))) @@ -292,7 +300,8 @@ impl BaseSinkImplExt for T { ) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; let filter_ptr = if let Some(filter) = filter { filter.as_mut_ptr() } else { @@ -313,7 +322,8 @@ impl BaseSinkImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .set_caps .map(|f| { @@ -330,7 +340,8 @@ impl BaseSinkImplExt for T { fn parent_fixate(&self, element: &BaseSink, caps: gst::Caps) -> gst::Caps { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; match (*parent_class).fixate { Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())), @@ -342,7 +353,8 @@ impl BaseSinkImplExt for T { fn parent_unlock(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .unlock .map(|f| { @@ -362,7 +374,8 @@ impl BaseSinkImplExt for T { fn parent_unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSinkClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) .unlock_stop .map(|f| { @@ -387,7 +400,7 @@ where fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstBaseSinkClass); + let klass = &mut *(self as *mut Self as *mut gst_base_sys::GstBaseSinkClass); klass.start = Some(base_sink_start::); klass.stop = Some(base_sink_stop::); klass.render = Some(base_sink_render::); @@ -406,8 +419,8 @@ where } unsafe extern "C" fn base_sink_start( - ptr: *mut ffi::GstBaseSink, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSink, +) -> glib_sys::gboolean where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -430,8 +443,8 @@ where } unsafe extern "C" fn base_sink_stop( - ptr: *mut ffi::GstBaseSink, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSink, +) -> glib_sys::gboolean where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -454,9 +467,9 @@ where } unsafe extern "C" fn base_sink_render( - ptr: *mut ffi::GstBaseSink, - buffer: *mut gst_ffi::GstBuffer, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstBaseSink, + buffer: *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -474,9 +487,9 @@ where } unsafe extern "C" fn base_sink_prepare( - ptr: *mut ffi::GstBaseSink, - buffer: *mut gst_ffi::GstBuffer, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstBaseSink, + buffer: *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -494,9 +507,9 @@ where } unsafe extern "C" fn base_sink_render_list( - ptr: *mut ffi::GstBaseSink, - list: *mut gst_ffi::GstBufferList, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstBaseSink, + list: *mut gst_sys::GstBufferList, +) -> gst_sys::GstFlowReturn where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -514,9 +527,9 @@ where } unsafe extern "C" fn base_sink_prepare_list( - ptr: *mut ffi::GstBaseSink, - list: *mut gst_ffi::GstBufferList, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstBaseSink, + list: *mut gst_sys::GstBufferList, +) -> gst_sys::GstFlowReturn where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -534,9 +547,9 @@ where } unsafe extern "C" fn base_sink_query( - ptr: *mut ffi::GstBaseSink, - query_ptr: *mut gst_ffi::GstQuery, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSink, + query_ptr: *mut gst_sys::GstQuery, +) -> glib_sys::gboolean where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -554,9 +567,9 @@ where } unsafe extern "C" fn base_sink_event( - ptr: *mut ffi::GstBaseSink, - event_ptr: *mut gst_ffi::GstEvent, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSink, + event_ptr: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -573,9 +586,9 @@ where } unsafe extern "C" fn base_sink_get_caps( - ptr: *mut ffi::GstBaseSink, - filter: *mut gst_ffi::GstCaps, -) -> *mut gst_ffi::GstCaps + ptr: *mut gst_base_sys::GstBaseSink, + filter: *mut gst_sys::GstCaps, +) -> *mut gst_sys::GstCaps where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -598,9 +611,9 @@ where } unsafe extern "C" fn base_sink_set_caps( - ptr: *mut ffi::GstBaseSink, - caps: *mut gst_ffi::GstCaps, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSink, + caps: *mut gst_sys::GstCaps, +) -> glib_sys::gboolean where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -624,9 +637,9 @@ where } unsafe extern "C" fn base_sink_fixate( - ptr: *mut ffi::GstBaseSink, - caps: *mut gst_ffi::GstCaps, -) -> *mut gst_ffi::GstCaps + ptr: *mut gst_base_sys::GstBaseSink, + caps: *mut gst_sys::GstCaps, +) -> *mut gst_sys::GstCaps where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -644,8 +657,8 @@ where } unsafe extern "C" fn base_sink_unlock( - ptr: *mut ffi::GstBaseSink, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSink, +) -> glib_sys::gboolean where T: BaseSinkImpl, T::Instance: PanicPoison, @@ -668,8 +681,8 @@ where } unsafe extern "C" fn base_sink_unlock_stop( - ptr: *mut ffi::GstBaseSink, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSink, +) -> glib_sys::gboolean where T: BaseSinkImpl, T::Instance: PanicPoison, diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index c52cd1b3c..8ba9a717e 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gst_ffi; +use glib_sys; +use gst_base_sys; +use gst_sys; use glib::translate::*; use prelude::*; @@ -150,7 +150,8 @@ impl BaseSrcImplExt for T { fn parent_start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .start .map(|f| { @@ -170,7 +171,8 @@ impl BaseSrcImplExt for T { fn parent_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .stop .map(|f| { @@ -190,7 +192,8 @@ impl BaseSrcImplExt for T { fn parent_is_seekable(&self, element: &BaseSrc) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .is_seekable .map(|f| from_glib(f(element.to_glib_none().0))) @@ -201,7 +204,8 @@ impl BaseSrcImplExt for T { fn parent_get_size(&self, element: &BaseSrc) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .get_size .map(|f| { @@ -225,7 +229,8 @@ impl BaseSrcImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .fill .map(|f| { @@ -249,14 +254,15 @@ impl BaseSrcImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .create .map(|f| { - let mut buffer: *mut gst_ffi::GstBuffer = ptr::null_mut(); + let mut buffer: *mut gst_sys::GstBuffer = ptr::null_mut(); // FIXME: Wrong signature in -sys bindings // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 - let buffer_ref = &mut buffer as *mut _ as *mut gst_ffi::GstBuffer; + let buffer_ref = &mut buffer as *mut _ as *mut gst_sys::GstBuffer; let ret: gst::FlowReturn = from_glib(f(element.to_glib_none().0, offset, length, buffer_ref)); @@ -269,7 +275,8 @@ impl BaseSrcImplExt for T { fn parent_do_seek(&self, element: &BaseSrc, segment: &mut gst::Segment) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .do_seek .map(|f| from_glib(f(element.to_glib_none().0, segment.to_glib_none_mut().0))) @@ -280,7 +287,8 @@ impl BaseSrcImplExt for T { fn parent_query(&self, element: &BaseSrc, query: &mut gst::QueryRef) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .query .map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr()))) @@ -291,7 +299,8 @@ impl BaseSrcImplExt for T { fn parent_event(&self, element: &BaseSrc, event: &gst::Event) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .event .map(|f| from_glib(f(element.to_glib_none().0, event.to_glib_none().0))) @@ -306,7 +315,8 @@ impl BaseSrcImplExt for T { ) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; let filter_ptr = if let Some(filter) = filter { filter.as_mut_ptr() } else { @@ -323,7 +333,8 @@ impl BaseSrcImplExt for T { fn parent_negotiate(&self, element: &BaseSrc) -> Result<(), gst::LoggableError> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .negotiate .map(|f| { @@ -344,7 +355,8 @@ impl BaseSrcImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .set_caps .map(|f| { @@ -361,7 +373,8 @@ impl BaseSrcImplExt for T { fn parent_fixate(&self, element: &BaseSrc, caps: gst::Caps) -> gst::Caps { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; match (*parent_class).fixate { Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())), @@ -373,7 +386,8 @@ impl BaseSrcImplExt for T { fn parent_unlock(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .unlock .map(|f| { @@ -393,7 +407,8 @@ impl BaseSrcImplExt for T { fn parent_unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseSrcClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) .unlock_stop .map(|f| { @@ -418,7 +433,7 @@ where fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstBaseSrcClass); + let klass = &mut *(self as *mut Self as *mut gst_base_sys::GstBaseSrcClass); klass.start = Some(base_src_start::); klass.stop = Some(base_src_stop::); klass.is_seekable = Some(base_src_is_seekable::); @@ -439,8 +454,8 @@ where } unsafe extern "C" fn base_src_start( - ptr: *mut ffi::GstBaseSrc, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -463,8 +478,8 @@ where } unsafe extern "C" fn base_src_stop( - ptr: *mut ffi::GstBaseSrc, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -487,8 +502,8 @@ where } unsafe extern "C" fn base_src_is_seekable( - ptr: *mut ffi::GstBaseSrc, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -505,9 +520,9 @@ where } unsafe extern "C" fn base_src_get_size( - ptr: *mut ffi::GstBaseSrc, + ptr: *mut gst_base_sys::GstBaseSrc, size: *mut u64, -) -> glib_ffi::gboolean +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -530,11 +545,11 @@ where } unsafe extern "C" fn base_src_fill( - ptr: *mut ffi::GstBaseSrc, + ptr: *mut gst_base_sys::GstBaseSrc, offset: u64, length: u32, - buffer: *mut gst_ffi::GstBuffer, -) -> gst_ffi::GstFlowReturn + buffer: *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -552,11 +567,11 @@ where } unsafe extern "C" fn base_src_create( - ptr: *mut ffi::GstBaseSrc, + ptr: *mut gst_base_sys::GstBaseSrc, offset: u64, length: u32, - buffer_ptr: *mut gst_ffi::GstBuffer, -) -> gst_ffi::GstFlowReturn + buffer_ptr: *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -567,7 +582,7 @@ where let wrap: BaseSrc = from_glib_borrow(ptr); // FIXME: Wrong signature in -sys bindings // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 - let buffer_ptr = buffer_ptr as *mut *mut gst_ffi::GstBuffer; + let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer; gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { match imp.create(&wrap, offset, length) { @@ -582,9 +597,9 @@ where } unsafe extern "C" fn base_src_do_seek( - ptr: *mut ffi::GstBaseSrc, - segment: *mut gst_ffi::GstSegment, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, + segment: *mut gst_sys::GstSegment, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -601,9 +616,9 @@ where } unsafe extern "C" fn base_src_query( - ptr: *mut ffi::GstBaseSrc, - query_ptr: *mut gst_ffi::GstQuery, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, + query_ptr: *mut gst_sys::GstQuery, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -621,9 +636,9 @@ where } unsafe extern "C" fn base_src_event( - ptr: *mut ffi::GstBaseSrc, - event_ptr: *mut gst_ffi::GstEvent, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, + event_ptr: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -640,9 +655,9 @@ where } unsafe extern "C" fn base_src_get_caps( - ptr: *mut ffi::GstBaseSrc, - filter: *mut gst_ffi::GstCaps, -) -> *mut gst_ffi::GstCaps + ptr: *mut gst_base_sys::GstBaseSrc, + filter: *mut gst_sys::GstCaps, +) -> *mut gst_sys::GstCaps where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -665,8 +680,8 @@ where } unsafe extern "C" fn base_src_negotiate( - ptr: *mut ffi::GstBaseSrc, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -689,9 +704,9 @@ where } unsafe extern "C" fn base_src_set_caps( - ptr: *mut ffi::GstBaseSrc, - caps: *mut gst_ffi::GstCaps, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, + caps: *mut gst_sys::GstCaps, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -715,9 +730,9 @@ where } unsafe extern "C" fn base_src_fixate( - ptr: *mut ffi::GstBaseSrc, - caps: *mut gst_ffi::GstCaps, -) -> *mut gst_ffi::GstCaps + ptr: *mut gst_base_sys::GstBaseSrc, + caps: *mut gst_sys::GstCaps, +) -> *mut gst_sys::GstCaps where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -735,8 +750,8 @@ where } unsafe extern "C" fn base_src_unlock( - ptr: *mut ffi::GstBaseSrc, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, @@ -759,8 +774,8 @@ where } unsafe extern "C" fn base_src_unlock_stop( - ptr: *mut ffi::GstBaseSrc, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseSrc, +) -> glib_sys::gboolean where T: BaseSrcImpl, T::Instance: PanicPoison, diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 19b3986a8..7d83cead0 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gst_ffi; +use glib_sys; +use gst_base_sys; +use gst_sys; use glib::translate::*; use prelude::*; @@ -201,7 +201,8 @@ impl BaseTransformImplExt for T { fn parent_start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .start .map(|f| { @@ -221,7 +222,8 @@ impl BaseTransformImplExt for T { fn parent_stop(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .stop .map(|f| { @@ -247,7 +249,8 @@ impl BaseTransformImplExt for T { ) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .transform_caps .map(|f| { @@ -271,7 +274,8 @@ impl BaseTransformImplExt for T { ) -> gst::Caps { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; match (*parent_class).fixate_caps { Some(f) => from_glib_full(f( element.to_glib_none().0, @@ -292,7 +296,8 @@ impl BaseTransformImplExt for T { ) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .set_caps .map(|f| { @@ -314,7 +319,8 @@ impl BaseTransformImplExt for T { ) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .accept_caps .map(|f| { @@ -336,7 +342,8 @@ impl BaseTransformImplExt for T { ) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .query .map(|f| { @@ -360,7 +367,8 @@ impl BaseTransformImplExt for T { ) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .transform_size .map(|f| { @@ -386,7 +394,8 @@ impl BaseTransformImplExt for T { fn parent_get_unit_size(&self, element: &BaseTransform, caps: &gst::Caps) -> Option { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class).get_unit_size.unwrap_or_else(|| { if !element.is_in_place() { unimplemented!(concat!( @@ -417,7 +426,8 @@ impl BaseTransformImplExt for T { fn parent_sink_event(&self, element: &BaseTransform, event: gst::Event) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .sink_event .map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr()))) @@ -428,7 +438,8 @@ impl BaseTransformImplExt for T { fn parent_src_event(&self, element: &BaseTransform, event: gst::Event) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .src_event .map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr()))) @@ -444,7 +455,8 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) .transform .map(|f| { @@ -475,7 +487,8 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { if element.is_in_place() { panic!(concat!( @@ -502,7 +515,8 @@ impl BaseTransformImplExt for T { ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBaseTransformClass; + let parent_class = + data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { if element.is_in_place() { panic!(concat!( @@ -537,7 +551,7 @@ where fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstBaseTransformClass); + let klass = &mut *(self as *mut Self as *mut gst_base_sys::GstBaseTransformClass); klass.start = Some(base_transform_start::); klass.stop = Some(base_transform_stop::); klass.transform_caps = Some(base_transform_transform_caps::); @@ -564,7 +578,7 @@ pub unsafe trait BaseTransformClassSubclassExt: Sized + 'static { ::Instance: PanicPoison, { unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstBaseTransformClass); + let klass = &mut *(self as *mut Self as *mut gst_base_sys::GstBaseTransformClass); klass.passthrough_on_same_caps = passthrough_on_same_caps.to_glib(); klass.transform_ip_on_passthrough = transform_ip_on_passthrough.to_glib(); @@ -593,8 +607,8 @@ where } unsafe extern "C" fn base_transform_start( - ptr: *mut ffi::GstBaseTransform, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseTransform, +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -617,8 +631,8 @@ where } unsafe extern "C" fn base_transform_stop( - ptr: *mut ffi::GstBaseTransform, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseTransform, +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -641,11 +655,11 @@ where } unsafe extern "C" fn base_transform_transform_caps( - ptr: *mut ffi::GstBaseTransform, - direction: gst_ffi::GstPadDirection, - caps: *mut gst_ffi::GstCaps, - filter: *mut gst_ffi::GstCaps, -) -> *mut gst_ffi::GstCaps + ptr: *mut gst_base_sys::GstBaseTransform, + direction: gst_sys::GstPadDirection, + caps: *mut gst_sys::GstCaps, + filter: *mut gst_sys::GstCaps, +) -> *mut gst_sys::GstCaps where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -674,11 +688,11 @@ where } unsafe extern "C" fn base_transform_fixate_caps( - ptr: *mut ffi::GstBaseTransform, - direction: gst_ffi::GstPadDirection, - caps: *mut gst_ffi::GstCaps, - othercaps: *mut gst_ffi::GstCaps, -) -> *mut gst_ffi::GstCaps + ptr: *mut gst_base_sys::GstBaseTransform, + direction: gst_sys::GstPadDirection, + caps: *mut gst_sys::GstCaps, + othercaps: *mut gst_sys::GstCaps, +) -> *mut gst_sys::GstCaps where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -700,10 +714,10 @@ where } unsafe extern "C" fn base_transform_set_caps( - ptr: *mut ffi::GstBaseTransform, - incaps: *mut gst_ffi::GstCaps, - outcaps: *mut gst_ffi::GstCaps, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseTransform, + incaps: *mut gst_sys::GstCaps, + outcaps: *mut gst_sys::GstCaps, +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -720,10 +734,10 @@ where } unsafe extern "C" fn base_transform_accept_caps( - ptr: *mut ffi::GstBaseTransform, - direction: gst_ffi::GstPadDirection, - caps: *mut gst_ffi::GstCaps, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseTransform, + direction: gst_sys::GstPadDirection, + caps: *mut gst_sys::GstCaps, +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -740,10 +754,10 @@ where } unsafe extern "C" fn base_transform_query( - ptr: *mut ffi::GstBaseTransform, - direction: gst_ffi::GstPadDirection, - query: *mut gst_ffi::GstQuery, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseTransform, + direction: gst_sys::GstPadDirection, + query: *mut gst_sys::GstQuery, +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -765,13 +779,13 @@ where } unsafe extern "C" fn base_transform_transform_size( - ptr: *mut ffi::GstBaseTransform, - direction: gst_ffi::GstPadDirection, - caps: *mut gst_ffi::GstCaps, + ptr: *mut gst_base_sys::GstBaseTransform, + direction: gst_sys::GstPadDirection, + caps: *mut gst_sys::GstCaps, size: usize, - othercaps: *mut gst_ffi::GstCaps, + othercaps: *mut gst_sys::GstCaps, othersize: *mut usize, -) -> glib_ffi::gboolean +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -800,10 +814,10 @@ where } unsafe extern "C" fn base_transform_get_unit_size( - ptr: *mut ffi::GstBaseTransform, - caps: *mut gst_ffi::GstCaps, + ptr: *mut gst_base_sys::GstBaseTransform, + caps: *mut gst_sys::GstCaps, size: *mut usize, -) -> glib_ffi::gboolean +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -826,9 +840,9 @@ where } unsafe extern "C" fn base_transform_sink_event( - ptr: *mut ffi::GstBaseTransform, - event: *mut gst_ffi::GstEvent, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseTransform, + event: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -845,9 +859,9 @@ where } unsafe extern "C" fn base_transform_src_event( - ptr: *mut ffi::GstBaseTransform, - event: *mut gst_ffi::GstEvent, -) -> glib_ffi::gboolean + ptr: *mut gst_base_sys::GstBaseTransform, + event: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -864,10 +878,10 @@ where } unsafe extern "C" fn base_transform_transform( - ptr: *mut ffi::GstBaseTransform, - inbuf: *mut gst_ffi::GstBuffer, - outbuf: *mut gst_ffi::GstBuffer, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstBaseTransform, + inbuf: *mut gst_sys::GstBuffer, + outbuf: *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -889,9 +903,9 @@ where } unsafe extern "C" fn base_transform_transform_ip( - ptr: *mut ffi::GstBaseTransform, - buf: *mut *mut gst_ffi::GstBuffer, -) -> gst_ffi::GstFlowReturn + ptr: *mut gst_base_sys::GstBaseTransform, + buf: *mut *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: BaseTransformImpl, T::Instance: PanicPoison, @@ -902,10 +916,10 @@ where let wrap: BaseTransform = from_glib_borrow(ptr); // FIXME: Wrong signature in FFI - let buf = buf as *mut gst_ffi::GstBuffer; + let buf = buf as *mut gst_sys::GstBuffer; gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { - if from_glib(ffi::gst_base_transform_is_passthrough(ptr)) { + if from_glib(gst_base_sys::gst_base_transform_is_passthrough(ptr)) { imp.transform_ip_passthrough(&wrap, gst::BufferRef::from_ptr(buf)) .into() } else { diff --git a/gstreamer-base/src/utils.rs b/gstreamer-base/src/utils.rs index 6ee68c29a..dca8cf691 100644 --- a/gstreamer-base/src/utils.rs +++ b/gstreamer-base/src/utils.rs @@ -7,15 +7,15 @@ // except according to those terms. use glib::translate::mut_override; -use glib_ffi; +use glib_sys; -pub struct MutexGuard<'a>(&'a glib_ffi::GMutex); +pub struct MutexGuard<'a>(&'a glib_sys::GMutex); impl<'a> MutexGuard<'a> { #[allow(clippy::trivially_copy_pass_by_ref)] - pub fn lock(mutex: &'a glib_ffi::GMutex) -> Self { + pub fn lock(mutex: &'a glib_sys::GMutex) -> Self { unsafe { - glib_ffi::g_mutex_lock(mut_override(mutex)); + glib_sys::g_mutex_lock(mut_override(mutex)); } MutexGuard(mutex) } @@ -24,7 +24,7 @@ impl<'a> MutexGuard<'a> { impl<'a> Drop for MutexGuard<'a> { fn drop(&mut self) { unsafe { - glib_ffi::g_mutex_unlock(mut_override(self.0)); + glib_sys::g_mutex_unlock(mut_override(self.0)); } } } diff --git a/gstreamer-check/src/harness.rs b/gstreamer-check/src/harness.rs index aa9549444..195dc39c8 100644 --- a/gstreamer-check/src/harness.rs +++ b/gstreamer-check/src/harness.rs @@ -6,14 +6,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::object::IsA; use glib::translate::*; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; use gst; use gst::prelude::*; +use gst_check_sys; use std::marker::PhantomData; use std::mem; use std::ops; @@ -22,12 +22,15 @@ use std::ptr; use TestClock; #[derive(Debug)] -pub struct Harness(ptr::NonNull, PhantomData); +pub struct Harness( + ptr::NonNull, + PhantomData, +); impl Drop for Harness { fn drop(&mut self) { unsafe { - ffi::gst_harness_teardown(self.0.as_ptr()); + gst_check_sys::gst_harness_teardown(self.0.as_ptr()); } } } @@ -60,7 +63,7 @@ impl Harness { let element_srcpad_name = element_srcpad_name.into(); let element_srcpad_name = element_srcpad_name.to_glib_none(); unsafe { - ffi::gst_harness_add_element_full( + gst_check_sys::gst_harness_add_element_full( self.0.as_ptr(), element.as_ref().to_glib_none().0, hsrc.to_glib_none().0 as *mut _, @@ -73,7 +76,7 @@ impl Harness { pub fn add_element_sink_pad>(&mut self, sinkpad: &P) { unsafe { - ffi::gst_harness_add_element_sink_pad( + gst_check_sys::gst_harness_add_element_sink_pad( self.0.as_ptr(), sinkpad.as_ref().to_glib_none().0, ); @@ -82,13 +85,16 @@ impl Harness { pub fn add_element_src_pad>(&mut self, srcpad: &P) { unsafe { - ffi::gst_harness_add_element_src_pad(self.0.as_ptr(), srcpad.as_ref().to_glib_none().0); + gst_check_sys::gst_harness_add_element_src_pad( + self.0.as_ptr(), + srcpad.as_ref().to_glib_none().0, + ); } } pub fn add_parse(&mut self, launchline: &str) { unsafe { - ffi::gst_harness_add_parse(self.0.as_ptr(), launchline.to_glib_none().0); + gst_check_sys::gst_harness_add_parse(self.0.as_ptr(), launchline.to_glib_none().0); } } @@ -117,19 +123,26 @@ impl Harness { let params = params.into(); unsafe { let params = params.map(|p| p.as_ptr()).unwrap_or(ptr::null_mut()); - ffi::gst_harness_add_propose_allocation_meta(self.0.as_ptr(), api.to_glib(), params); + gst_check_sys::gst_harness_add_propose_allocation_meta( + self.0.as_ptr(), + api.to_glib(), + params, + ); } } pub fn add_sink(&mut self, sink_element_name: &str) { unsafe { - ffi::gst_harness_add_sink(self.0.as_ptr(), sink_element_name.to_glib_none().0); + gst_check_sys::gst_harness_add_sink( + self.0.as_ptr(), + sink_element_name.to_glib_none().0, + ); } } pub fn add_sink_harness(&mut self, sink_harness: Harness) { unsafe { - ffi::gst_harness_add_sink_harness(self.0.as_ptr(), sink_harness.0.as_ptr()); + gst_check_sys::gst_harness_add_sink_harness(self.0.as_ptr(), sink_harness.0.as_ptr()); mem::forget(sink_harness); } @@ -137,13 +150,13 @@ impl Harness { pub fn add_sink_parse(&mut self, launchline: &str) { unsafe { - ffi::gst_harness_add_sink_parse(self.0.as_ptr(), launchline.to_glib_none().0); + gst_check_sys::gst_harness_add_sink_parse(self.0.as_ptr(), launchline.to_glib_none().0); } } pub fn add_src(&mut self, src_element_name: &str, has_clock_wait: bool) { unsafe { - ffi::gst_harness_add_src( + gst_check_sys::gst_harness_add_src( self.0.as_ptr(), src_element_name.to_glib_none().0, has_clock_wait.to_glib(), @@ -153,7 +166,7 @@ impl Harness { pub fn add_src_harness(&mut self, src_harness: Harness, has_clock_wait: bool) { unsafe { - ffi::gst_harness_add_src_harness( + gst_check_sys::gst_harness_add_src_harness( self.0.as_ptr(), src_harness.0.as_ptr(), has_clock_wait.to_glib(), @@ -165,7 +178,7 @@ impl Harness { pub fn add_src_parse(&mut self, launchline: &str, has_clock_wait: bool) { unsafe { - ffi::gst_harness_add_src_parse( + gst_check_sys::gst_harness_add_src_parse( self.0.as_ptr(), launchline.to_glib_none().0, has_clock_wait.to_glib(), @@ -174,17 +187,17 @@ impl Harness { } pub fn buffers_in_queue(&self) -> u32 { - unsafe { ffi::gst_harness_buffers_in_queue(self.0.as_ptr()) } + unsafe { gst_check_sys::gst_harness_buffers_in_queue(self.0.as_ptr()) } } pub fn buffers_received(&self) -> u32 { - unsafe { ffi::gst_harness_buffers_received(self.0.as_ptr()) } + unsafe { gst_check_sys::gst_harness_buffers_received(self.0.as_ptr()) } } pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits), + gst_check_sys::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits), "Failed to crank multiple clock waits", ) } @@ -193,43 +206,51 @@ impl Harness { pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_harness_crank_single_clock_wait(self.0.as_ptr()), + gst_check_sys::gst_harness_crank_single_clock_wait(self.0.as_ptr()), "Failed to crank single clock wait", ) } } pub fn create_buffer(&mut self, size: usize) -> Option { - unsafe { from_glib_full(ffi::gst_harness_create_buffer(self.0.as_ptr(), size)) } + unsafe { + from_glib_full(gst_check_sys::gst_harness_create_buffer( + self.0.as_ptr(), + size, + )) + } } pub fn dump_to_file>(&mut self, filename: P) { let filename = filename.as_ref(); unsafe { - ffi::gst_harness_dump_to_file(self.0.as_ptr(), filename.to_glib_none().0); + gst_check_sys::gst_harness_dump_to_file(self.0.as_ptr(), filename.to_glib_none().0); } } pub fn events_in_queue(&self) -> u32 { - unsafe { ffi::gst_harness_events_in_queue(self.0.as_ptr()) } + unsafe { gst_check_sys::gst_harness_events_in_queue(self.0.as_ptr()) } } pub fn events_received(&self) -> u32 { - unsafe { ffi::gst_harness_events_received(self.0.as_ptr()) } + unsafe { gst_check_sys::gst_harness_events_received(self.0.as_ptr()) } } pub fn find_element(&mut self, element_name: &str) -> Option { unsafe { // Work around https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/31 - let ptr = ffi::gst_harness_find_element(self.0.as_ptr(), element_name.to_glib_none().0); + let ptr = gst_check_sys::gst_harness_find_element( + self.0.as_ptr(), + element_name.to_glib_none().0, + ); if ptr.is_null() { return None; } // Clear floating flag if it is set - if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { - gobject_ffi::g_object_ref_sink(ptr as *mut _); + if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE { + gobject_sys::g_object_ref_sink(ptr as *mut _); } from_glib_full(ptr) @@ -237,48 +258,60 @@ impl Harness { } //pub fn get(&mut self, element_name: &str, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { - // unsafe { TODO: call ffi::gst_harness_get() } + // unsafe { TODO: call gst_check_sys::gst_harness_get() } //} //pub fn get_allocator(&mut self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) { - // unsafe { TODO: call ffi::gst_harness_get_allocator() } + // unsafe { TODO: call gst_check_sys::gst_harness_get_allocator() } //} pub fn get_last_pushed_timestamp(&self) -> gst::ClockTime { - unsafe { from_glib(ffi::gst_harness_get_last_pushed_timestamp(self.0.as_ptr())) } + unsafe { + from_glib(gst_check_sys::gst_harness_get_last_pushed_timestamp( + self.0.as_ptr(), + )) + } } pub fn get_testclock(&self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_get_testclock(self.0.as_ptr())) } + unsafe { from_glib_full(gst_check_sys::gst_harness_get_testclock(self.0.as_ptr())) } } pub fn play(&mut self) { unsafe { - ffi::gst_harness_play(self.0.as_ptr()); + gst_check_sys::gst_harness_play(self.0.as_ptr()); } } pub fn pull(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_pull(self.0.as_ptr())) } + unsafe { from_glib_full(gst_check_sys::gst_harness_pull(self.0.as_ptr())) } } pub fn pull_event(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_pull_event(self.0.as_ptr())) } + unsafe { from_glib_full(gst_check_sys::gst_harness_pull_event(self.0.as_ptr())) } } pub fn pull_upstream_event(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_pull_upstream_event(self.0.as_ptr())) } + unsafe { + from_glib_full(gst_check_sys::gst_harness_pull_upstream_event( + self.0.as_ptr(), + )) + } } pub fn push(&mut self, buffer: gst::Buffer) -> Result { - let ret: gst::FlowReturn = - unsafe { from_glib(ffi::gst_harness_push(self.0.as_ptr(), buffer.into_ptr())) }; + let ret: gst::FlowReturn = unsafe { + from_glib(gst_check_sys::gst_harness_push( + self.0.as_ptr(), + buffer.into_ptr(), + )) + }; ret.into_result() } pub fn push_and_pull(&mut self, buffer: gst::Buffer) -> Option { unsafe { - from_glib_full(ffi::gst_harness_push_and_pull( + from_glib_full(gst_check_sys::gst_harness_push_and_pull( self.0.as_ptr(), buffer.into_ptr(), )) @@ -287,7 +320,7 @@ impl Harness { pub fn push_event(&mut self, event: gst::Event) -> bool { unsafe { - from_glib(ffi::gst_harness_push_event( + from_glib(gst_check_sys::gst_harness_push_event( self.0.as_ptr(), event.into_ptr(), )) @@ -296,19 +329,19 @@ impl Harness { pub fn push_from_src(&mut self) -> Result { let ret: gst::FlowReturn = - unsafe { from_glib(ffi::gst_harness_push_from_src(self.0.as_ptr())) }; + unsafe { from_glib(gst_check_sys::gst_harness_push_from_src(self.0.as_ptr())) }; ret.into_result() } pub fn push_to_sink(&mut self) -> Result { let ret: gst::FlowReturn = - unsafe { from_glib(ffi::gst_harness_push_to_sink(self.0.as_ptr())) }; + unsafe { from_glib(gst_check_sys::gst_harness_push_to_sink(self.0.as_ptr())) }; ret.into_result() } pub fn push_upstream_event(&mut self, event: gst::Event) -> bool { unsafe { - from_glib(ffi::gst_harness_push_upstream_event( + from_glib(gst_check_sys::gst_harness_push_upstream_event( self.0.as_ptr(), event.into_ptr(), )) @@ -316,28 +349,28 @@ impl Harness { } pub fn query_latency(&self) -> gst::ClockTime { - unsafe { from_glib(ffi::gst_harness_query_latency(self.0.as_ptr())) } + unsafe { from_glib(gst_check_sys::gst_harness_query_latency(self.0.as_ptr())) } } //pub fn set(&mut self, element_name: &str, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { - // unsafe { TODO: call ffi::gst_harness_set() } + // unsafe { TODO: call gst_check_sys::gst_harness_set() } //} pub fn set_blocking_push_mode(&mut self) { unsafe { - ffi::gst_harness_set_blocking_push_mode(self.0.as_ptr()); + gst_check_sys::gst_harness_set_blocking_push_mode(self.0.as_ptr()); } } pub fn set_caps(&mut self, in_: gst::Caps, out: gst::Caps) { unsafe { - ffi::gst_harness_set_caps(self.0.as_ptr(), in_.into_ptr(), out.into_ptr()); + gst_check_sys::gst_harness_set_caps(self.0.as_ptr(), in_.into_ptr(), out.into_ptr()); } } pub fn set_caps_str(&mut self, in_: &str, out: &str) { unsafe { - ffi::gst_harness_set_caps_str( + gst_check_sys::gst_harness_set_caps_str( self.0.as_ptr(), in_.to_glib_none().0, out.to_glib_none().0, @@ -347,48 +380,48 @@ impl Harness { pub fn set_drop_buffers(&mut self, drop_buffers: bool) { unsafe { - ffi::gst_harness_set_drop_buffers(self.0.as_ptr(), drop_buffers.to_glib()); + gst_check_sys::gst_harness_set_drop_buffers(self.0.as_ptr(), drop_buffers.to_glib()); } } pub fn set_forwarding(&mut self, forwarding: bool) { unsafe { - ffi::gst_harness_set_forwarding(self.0.as_ptr(), forwarding.to_glib()); + gst_check_sys::gst_harness_set_forwarding(self.0.as_ptr(), forwarding.to_glib()); } } //pub fn set_propose_allocator<'a, 'b, P: Into>, Q: Into>>(&mut self, allocator: P, params: Q) { - // unsafe { TODO: call ffi::gst_harness_set_propose_allocator() } + // unsafe { TODO: call gst_check_sys::gst_harness_set_propose_allocator() } //} pub fn set_sink_caps(&mut self, caps: gst::Caps) { unsafe { - ffi::gst_harness_set_sink_caps(self.0.as_ptr(), caps.into_ptr()); + gst_check_sys::gst_harness_set_sink_caps(self.0.as_ptr(), caps.into_ptr()); } } pub fn set_sink_caps_str(&mut self, str: &str) { unsafe { - ffi::gst_harness_set_sink_caps_str(self.0.as_ptr(), str.to_glib_none().0); + gst_check_sys::gst_harness_set_sink_caps_str(self.0.as_ptr(), str.to_glib_none().0); } } pub fn set_src_caps(&mut self, caps: gst::Caps) { unsafe { - ffi::gst_harness_set_src_caps(self.0.as_ptr(), caps.into_ptr()); + gst_check_sys::gst_harness_set_src_caps(self.0.as_ptr(), caps.into_ptr()); } } pub fn set_src_caps_str(&mut self, str: &str) { unsafe { - ffi::gst_harness_set_src_caps_str(self.0.as_ptr(), str.to_glib_none().0); + gst_check_sys::gst_harness_set_src_caps_str(self.0.as_ptr(), str.to_glib_none().0); } } pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()), + gst_check_sys::gst_harness_set_time(self.0.as_ptr(), time.to_glib()), "Failed to set time", ) } @@ -396,13 +429,13 @@ impl Harness { pub fn set_upstream_latency(&mut self, latency: gst::ClockTime) { unsafe { - ffi::gst_harness_set_upstream_latency(self.0.as_ptr(), latency.to_glib()); + gst_check_sys::gst_harness_set_upstream_latency(self.0.as_ptr(), latency.to_glib()); } } pub fn sink_push_many(&mut self, pushes: u32) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_harness_sink_push_many( + from_glib(gst_check_sys::gst_harness_sink_push_many( self.0.as_ptr(), pushes as i32, )) @@ -416,7 +449,7 @@ impl Harness { pushes: u32, ) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_harness_src_crank_and_push_many( + from_glib(gst_check_sys::gst_harness_src_crank_and_push_many( self.0.as_ptr(), cranks as i32, pushes as i32, @@ -426,88 +459,100 @@ impl Harness { } pub fn src_push_event(&mut self) -> bool { - unsafe { from_glib(ffi::gst_harness_src_push_event(self.0.as_ptr())) } + unsafe { from_glib(gst_check_sys::gst_harness_src_push_event(self.0.as_ptr())) } } //pub fn stress_custom_start<'a, P: Into>, Q: Into>>(&mut self, init: P, callback: /*Unknown conversion*//*Unimplemented*/Func, data: Q, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_custom_start() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_custom_start() } //} //pub fn stress_property_start_full(&mut self, name: &str, value: /*Ignored*/&glib::Value, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_property_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_property_start_full() } //} //pub fn stress_push_buffer_start_full(&mut self, caps: &mut gst::Caps, segment: /*Ignored*/&gst::Segment, buf: &mut gst::Buffer, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_push_buffer_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_push_buffer_start_full() } //} //pub fn stress_push_buffer_with_cb_start_full>>(&mut self, caps: &mut gst::Caps, segment: /*Ignored*/&gst::Segment, func: /*Unknown conversion*//*Unimplemented*/HarnessPrepareBufferFunc, data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_push_buffer_with_cb_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_push_buffer_with_cb_start_full() } //} //pub fn stress_push_event_start_full(&mut self, event: &mut gst::Event, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_push_event_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_push_event_start_full() } //} //pub fn stress_push_event_with_cb_start_full>>(&mut self, func: /*Unknown conversion*//*Unimplemented*/HarnessPrepareEventFunc, data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_push_event_with_cb_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_push_event_with_cb_start_full() } //} //pub fn stress_push_upstream_event_start_full(&mut self, event: &mut gst::Event, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_push_upstream_event_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_push_upstream_event_start_full() } //} //pub fn stress_push_upstream_event_with_cb_start_full>>(&mut self, func: /*Unknown conversion*//*Unimplemented*/HarnessPrepareEventFunc, data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_push_upstream_event_with_cb_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_push_upstream_event_with_cb_start_full() } //} //pub fn stress_requestpad_start_full(&mut self, templ: /*Ignored*/&gst::PadTemplate, name: &str, caps: &mut gst::Caps, release: bool, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_requestpad_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_requestpad_start_full() } //} //pub fn stress_statechange_start_full(&mut self, sleep: libc::c_ulong) -> /*Ignored*/Option { - // unsafe { TODO: call ffi::gst_harness_stress_statechange_start_full() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_statechange_start_full() } //} #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn take_all_data_as_buffer(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_take_all_data_as_buffer(self.0.as_ptr())) } + unsafe { + from_glib_full(gst_check_sys::gst_harness_take_all_data_as_buffer( + self.0.as_ptr(), + )) + } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn take_all_data_as_bytes(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_take_all_data_as_bytes(self.0.as_ptr())) } + unsafe { + from_glib_full(gst_check_sys::gst_harness_take_all_data_as_bytes( + self.0.as_ptr(), + )) + } } pub fn try_pull(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_try_pull(self.0.as_ptr())) } + unsafe { from_glib_full(gst_check_sys::gst_harness_try_pull(self.0.as_ptr())) } } pub fn try_pull_event(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_try_pull_event(self.0.as_ptr())) } + unsafe { from_glib_full(gst_check_sys::gst_harness_try_pull_event(self.0.as_ptr())) } } pub fn try_pull_upstream_event(&mut self) -> Option { - unsafe { from_glib_full(ffi::gst_harness_try_pull_upstream_event(self.0.as_ptr())) } + unsafe { + from_glib_full(gst_check_sys::gst_harness_try_pull_upstream_event( + self.0.as_ptr(), + )) + } } pub fn upstream_events_in_queue(&self) -> u32 { - unsafe { ffi::gst_harness_upstream_events_in_queue(self.0.as_ptr()) } + unsafe { gst_check_sys::gst_harness_upstream_events_in_queue(self.0.as_ptr()) } } pub fn upstream_events_received(&self) -> u32 { - unsafe { ffi::gst_harness_upstream_events_received(self.0.as_ptr()) } + unsafe { gst_check_sys::gst_harness_upstream_events_received(self.0.as_ptr()) } } pub fn use_systemclock(&mut self) { unsafe { - ffi::gst_harness_use_systemclock(self.0.as_ptr()); + gst_check_sys::gst_harness_use_systemclock(self.0.as_ptr()); } } pub fn use_testclock(&mut self) { unsafe { - ffi::gst_harness_use_testclock(self.0.as_ptr()); + gst_check_sys::gst_harness_use_testclock(self.0.as_ptr()); } } @@ -518,13 +563,13 @@ impl Harness { ) -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_harness_wait_for_clock_id_waits(self.0.as_ptr(), waits, timeout), + gst_check_sys::gst_harness_wait_for_clock_id_waits(self.0.as_ptr(), waits, timeout), "Failed to wait for clock id waits", ) } } - unsafe fn from_glib_full(ptr: *mut ffi::GstHarness) -> Harness { + unsafe fn from_glib_full(ptr: *mut gst_check_sys::GstHarness) -> Harness { assert!(!ptr.is_null()); Harness(ptr::NonNull::new_unchecked(ptr), PhantomData) @@ -532,12 +577,16 @@ impl Harness { pub fn new(element_name: &str) -> Harness { assert_initialized_main_thread!(); - unsafe { Self::from_glib_full(ffi::gst_harness_new(element_name.to_glib_none().0)) } + unsafe { + Self::from_glib_full(gst_check_sys::gst_harness_new( + element_name.to_glib_none().0, + )) + } } pub fn new_empty() -> Harness { assert_initialized_main_thread!(); - unsafe { Self::from_glib_full(ffi::gst_harness_new_empty()) } + unsafe { Self::from_glib_full(gst_check_sys::gst_harness_new_empty()) } } pub fn new_full< @@ -565,7 +614,7 @@ impl Harness { let element_srcpad_name = element_srcpad_name.into(); let element_srcpad_name = element_srcpad_name.to_glib_none(); unsafe { - Self::from_glib_full(ffi::gst_harness_new_full( + Self::from_glib_full(gst_check_sys::gst_harness_new_full( element.as_ref().to_glib_none().0, hsrc.to_glib_none().0 as *mut _, element_sinkpad_name.0, @@ -577,7 +626,11 @@ impl Harness { pub fn new_parse(launchline: &str) -> Harness { assert_initialized_main_thread!(); - unsafe { Self::from_glib_full(ffi::gst_harness_new_parse(launchline.to_glib_none().0)) } + unsafe { + Self::from_glib_full(gst_check_sys::gst_harness_new_parse( + launchline.to_glib_none().0, + )) + } } pub fn new_with_element< @@ -597,7 +650,7 @@ impl Harness { let element_srcpad_name = element_srcpad_name.into(); let element_srcpad_name = element_srcpad_name.to_glib_none(); unsafe { - Self::from_glib_full(ffi::gst_harness_new_with_element( + Self::from_glib_full(gst_check_sys::gst_harness_new_with_element( element.as_ref().to_glib_none().0, element_sinkpad_name.0, element_srcpad_name.0, @@ -616,7 +669,7 @@ impl Harness { let element_srcpad_name = element_srcpad_name.into(); let element_srcpad_name = element_srcpad_name.to_glib_none(); unsafe { - Self::from_glib_full(ffi::gst_harness_new_with_padnames( + Self::from_glib_full(gst_check_sys::gst_harness_new_with_padnames( element_name.to_glib_none().0, element_sinkpad_name.0, element_srcpad_name.0, @@ -638,7 +691,7 @@ impl Harness { let hsrc = hsrc.into(); let hsink = hsink.into(); unsafe { - Self::from_glib_full(ffi::gst_harness_new_with_templates( + Self::from_glib_full(gst_check_sys::gst_harness_new_with_templates( element_name.to_glib_none().0, hsrc.to_glib_none().0 as *mut _, hsink.to_glib_none().0 as *mut _, @@ -647,7 +700,7 @@ impl Harness { } //pub fn stress_thread_stop(t: /*Ignored*/&mut HarnessThread) -> u32 { - // unsafe { TODO: call ffi::gst_harness_stress_thread_stop() } + // unsafe { TODO: call gst_check_sys::gst_harness_stress_thread_stop() } //} pub fn get_element(&self) -> Option { @@ -660,8 +713,8 @@ impl Harness { } // Clear floating flag if it is set - if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { - gobject_ffi::g_object_ref_sink(ptr as *mut _); + if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE { + gobject_sys::g_object_ref_sink(ptr as *mut _); } from_glib_none(ptr) @@ -678,8 +731,8 @@ impl Harness { } // Clear floating flag if it is set - if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { - gobject_ffi::g_object_ref_sink(ptr as *mut _); + if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE { + gobject_sys::g_object_ref_sink(ptr as *mut _); } from_glib_none(ptr) @@ -696,8 +749,8 @@ impl Harness { } // Clear floating flag if it is set - if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { - gobject_ffi::g_object_ref_sink(ptr as *mut _); + if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE { + gobject_sys::g_object_ref_sink(ptr as *mut _); } from_glib_none(ptr) @@ -774,7 +827,7 @@ impl Harness { } #[derive(Debug)] -pub struct Ref<'a>(Option, PhantomData<&'a ffi::GstHarness>); +pub struct Ref<'a>(Option, PhantomData<&'a gst_check_sys::GstHarness>); impl<'a> ops::Deref for Ref<'a> { type Target = Harness; @@ -792,7 +845,10 @@ impl<'a> Drop for Ref<'a> { } #[derive(Debug)] -pub struct RefMut<'a>(Option, PhantomData<&'a mut ffi::GstHarness>); +pub struct RefMut<'a>( + Option, + PhantomData<&'a mut gst_check_sys::GstHarness>, +); impl<'a> ops::Deref for RefMut<'a> { type Target = Harness; diff --git a/gstreamer-check/src/lib.rs b/gstreamer-check/src/lib.rs index 7bdd83d02..ddaa4099c 100644 --- a/gstreamer-check/src/lib.rs +++ b/gstreamer-check/src/lib.rs @@ -6,18 +6,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_check_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_check_sys as gst_check_sys; +extern crate gstreamer_sys as gst_sys; #[macro_use] extern crate glib; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-check/src/test_clock.rs b/gstreamer-check/src/test_clock.rs index d9f75bbc4..97c5620e6 100644 --- a/gstreamer-check/src/test_clock.rs +++ b/gstreamer-check/src/test_clock.rs @@ -6,16 +6,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use gst; +use gst_check_sys; use std::ptr; use TestClock; impl TestClock { pub fn has_id(&self, id: &gst::ClockId) -> bool { unsafe { - from_glib(ffi::gst_test_clock_has_id( + from_glib(gst_check_sys::gst_test_clock_has_id( self.to_glib_none().0, id.to_glib_none().0, )) @@ -25,7 +25,7 @@ impl TestClock { pub fn peek_next_pending_id(&self) -> Option { unsafe { let mut id = ptr::null_mut(); - let ret: bool = from_glib(ffi::gst_test_clock_peek_next_pending_id( + let ret: bool = from_glib(gst_check_sys::gst_test_clock_peek_next_pending_id( self.to_glib_none().0, &mut id, )); @@ -39,7 +39,7 @@ impl TestClock { pub fn process_id_list(&self, pending_list: &[&gst::ClockId]) -> u32 { unsafe { - ffi::gst_test_clock_process_id_list( + gst_check_sys::gst_test_clock_process_id_list( self.to_glib_none().0, pending_list.to_glib_none().0, ) @@ -48,7 +48,7 @@ impl TestClock { pub fn process_next_clock_id(&self) -> Option { unsafe { - from_glib_full(ffi::gst_test_clock_process_next_clock_id( + from_glib_full(gst_check_sys::gst_test_clock_process_next_clock_id( self.to_glib_none().0, )) } @@ -57,7 +57,7 @@ impl TestClock { pub fn wait_for_multiple_pending_ids(&self, count: u32) -> Vec { unsafe { let mut pending_list = ptr::null_mut(); - ffi::gst_test_clock_wait_for_multiple_pending_ids( + gst_check_sys::gst_test_clock_wait_for_multiple_pending_ids( self.to_glib_none().0, count, &mut pending_list, @@ -69,7 +69,7 @@ impl TestClock { pub fn wait_for_next_pending_id(&self) -> gst::ClockId { unsafe { let mut id = ptr::null_mut(); - ffi::gst_test_clock_wait_for_next_pending_id(self.to_glib_none().0, &mut id); + gst_check_sys::gst_test_clock_wait_for_next_pending_id(self.to_glib_none().0, &mut id); from_glib_full(id) } } diff --git a/gstreamer-editing-services/src/lib.rs b/gstreamer-editing-services/src/lib.rs index c657234dd..226bfcc0c 100644 --- a/gstreamer-editing-services/src/lib.rs +++ b/gstreamer-editing-services/src/lib.rs @@ -10,16 +10,16 @@ extern crate libc; use std::sync::{Once, ONCE_INIT}; -extern crate gio_sys as gio_ffi; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate gio_sys; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; extern crate gstreamer_base as gst_base; -extern crate gstreamer_base_sys as gst_base_ffi; -extern crate gstreamer_editing_services_sys as ffi; +extern crate gstreamer_base_sys as gst_base_sys; +extern crate gstreamer_editing_services_sys as ges_sys; extern crate gstreamer_pbutils as gst_pbutils; -extern crate gstreamer_pbutils_sys as gst_pbutils_ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_pbutils_sys as gst_pbutils_sys; +extern crate gstreamer_sys as gst_sys; use glib::translate::from_glib; @@ -39,7 +39,7 @@ pub fn init() -> Result<(), BoolError> { } unsafe { - if from_glib(ffi::ges_init()) { + if from_glib(ges_sys::ges_init()) { Ok(()) } else { Err(glib_bool_error!("Could not initialize GES.")) @@ -48,16 +48,16 @@ pub fn init() -> Result<(), BoolError> { } pub unsafe fn deinit() { - ffi::ges_deinit(); + ges_sys::ges_deinit(); } macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } ::GES_INIT.call_once(|| { - unsafe { ::ffi::ges_init() }; + unsafe { ::ges_sys::ges_init() }; }); }; } diff --git a/gstreamer-editing-services/src/timeline_element.rs b/gstreamer-editing-services/src/timeline_element.rs index bbce67c58..3c5778984 100644 --- a/gstreamer-editing-services/src/timeline_element.rs +++ b/gstreamer-editing-services/src/timeline_element.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use ges_sys; use glib; use glib::object::IsA; use glib::translate::*; @@ -21,7 +21,7 @@ pub trait TimelineElementExtManual: 'static { impl> TimelineElementExtManual for O { fn get_child_property(&self, name: &str) -> Option { unsafe { - let found: bool = from_glib(ffi::ges_timeline_element_lookup_child( + let found: bool = from_glib(ges_sys::ges_timeline_element_lookup_child( self.as_ref().to_glib_none().0, name.to_glib_none().0, ptr::null_mut(), @@ -32,7 +32,7 @@ impl> TimelineElementExtManual for O { } let mut value = glib::Value::uninitialized(); - ffi::ges_timeline_element_get_child_property( + ges_sys::ges_timeline_element_get_child_property( self.as_ref().to_glib_none().0, name.to_glib_none().0, value.to_glib_none_mut().0, @@ -43,7 +43,7 @@ impl> TimelineElementExtManual for O { fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError> { unsafe { - let found: bool = from_glib(ffi::ges_timeline_element_lookup_child( + let found: bool = from_glib(ges_sys::ges_timeline_element_lookup_child( self.as_ref().to_glib_none().0, name.to_glib_none().0, ptr::null_mut(), @@ -54,7 +54,7 @@ impl> TimelineElementExtManual for O { } let value = value.to_value(); - ffi::ges_timeline_element_set_child_property( + ges_sys::ges_timeline_element_set_child_property( self.as_ref().to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, diff --git a/gstreamer-gl/src/caps_features.rs b/gstreamer-gl/src/caps_features.rs index 1c2d5c8bd..de0d5b427 100644 --- a/gstreamer-gl/src/caps_features.rs +++ b/gstreamer-gl/src/caps_features.rs @@ -6,13 +6,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use gst::CapsFeatures; +use gst_gl_sys; use std::ffi::CStr; lazy_static! { pub static ref CAPS_FEATURE_MEMORY_GL_MEMORY: &'static str = unsafe { - CStr::from_ptr(ffi::GST_CAPS_FEATURE_MEMORY_GL_MEMORY) + CStr::from_ptr(gst_gl_sys::GST_CAPS_FEATURE_MEMORY_GL_MEMORY) .to_str() .unwrap() }; diff --git a/gstreamer-gl/src/context.rs b/gstreamer-gl/src/context.rs index 620503901..167aebbcd 100644 --- a/gstreamer-gl/src/context.rs +++ b/gstreamer-gl/src/context.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use glib::IsA; use gst::{ContextRef, MiniObject}; +use gst_gl_sys; use std::ptr; use GLDisplay; @@ -22,7 +22,7 @@ impl ContextGLExt for ContextRef { fn get_gl_display(&self) -> Option { unsafe { let mut display = ptr::null_mut(); - if from_glib(ffi::gst_context_get_gl_display( + if from_glib(gst_gl_sys::gst_context_get_gl_display( self.as_mut_ptr(), &mut display, )) { @@ -35,7 +35,10 @@ impl ContextGLExt for ContextRef { fn set_gl_display>(&self, display: &T) { unsafe { - ffi::gst_context_set_gl_display(self.as_mut_ptr(), display.as_ref().to_glib_none().0); + gst_gl_sys::gst_context_set_gl_display( + self.as_mut_ptr(), + display.as_ref().to_glib_none().0, + ); } } } diff --git a/gstreamer-gl/src/gl_context.rs b/gstreamer-gl/src/gl_context.rs index 8287a00bf..791285310 100644 --- a/gstreamer-gl/src/gl_context.rs +++ b/gstreamer-gl/src/gl_context.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use glib::IsA; +use gst_gl_sys; use libc::uintptr_t; use GLContext; use GLDisplay; @@ -22,7 +22,7 @@ impl GLContext { context_type: GLPlatform, available_apis: GLAPI, ) -> Option { - from_glib_full(ffi::gst_gl_context_new_wrapped( + from_glib_full(gst_gl_sys::gst_gl_context_new_wrapped( display.as_ref().to_glib_none().0, handle, context_type.to_glib(), @@ -31,7 +31,9 @@ impl GLContext { } pub fn get_current_gl_context(context_type: GLPlatform) -> uintptr_t { - unsafe { ffi::gst_gl_context_get_current_gl_context(context_type.to_glib()) as uintptr_t } + unsafe { + gst_gl_sys::gst_gl_context_get_current_gl_context(context_type.to_glib()) as uintptr_t + } } pub fn get_proc_address_with_platform( @@ -40,7 +42,7 @@ impl GLContext { name: &str, ) -> uintptr_t { unsafe { - ffi::gst_gl_context_get_proc_address_with_platform( + gst_gl_sys::gst_gl_context_get_proc_address_with_platform( context_type.to_glib(), gl_api.to_glib(), name.to_glib_none().0, @@ -57,12 +59,14 @@ pub trait GLContextExtManual: 'static { impl> GLContextExtManual for O { fn get_gl_context(&self) -> uintptr_t { - unsafe { ffi::gst_gl_context_get_gl_context(self.as_ref().to_glib_none().0) as uintptr_t } + unsafe { + gst_gl_sys::gst_gl_context_get_gl_context(self.as_ref().to_glib_none().0) as uintptr_t + } } fn get_proc_address(&self, name: &str) -> uintptr_t { unsafe { - ffi::gst_gl_context_get_proc_address( + gst_gl_sys::gst_gl_context_get_proc_address( self.as_ref().to_glib_none().0, name.to_glib_none().0, ) as uintptr_t diff --git a/gstreamer-gl/src/gl_display.rs b/gstreamer-gl/src/gl_display.rs index 7dcbd2365..c9d4f5fac 100644 --- a/gstreamer-gl/src/gl_display.rs +++ b/gstreamer-gl/src/gl_display.rs @@ -6,12 +6,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_gl_sys; use std::ffi::CStr; lazy_static! { pub static ref GL_DISPLAY_CONTEXT_TYPE: &'static str = unsafe { - CStr::from_ptr(ffi::GST_GL_DISPLAY_CONTEXT_TYPE) + CStr::from_ptr(gst_gl_sys::GST_GL_DISPLAY_CONTEXT_TYPE) .to_str() .unwrap() }; diff --git a/gstreamer-gl/src/gl_display_egl.rs b/gstreamer-gl/src/gl_display_egl.rs index 1b2908746..9e2e4543a 100644 --- a/gstreamer-gl/src/gl_display_egl.rs +++ b/gstreamer-gl/src/gl_display_egl.rs @@ -6,21 +6,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; -use glib_ffi::gpointer; +use glib_sys::gpointer; +use gst_gl_sys; use libc::uintptr_t; use GLDisplayEGL; use GLDisplayType; impl GLDisplayEGL { pub unsafe fn new_with_egl_display(display: uintptr_t) -> Option { - from_glib_full(ffi::gst_gl_display_egl_new_with_egl_display( + from_glib_full(gst_gl_sys::gst_gl_display_egl_new_with_egl_display( display as gpointer, )) } pub unsafe fn get_from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer { - ffi::gst_gl_display_egl_get_from_native(display_type.to_glib(), display) + gst_gl_sys::gst_gl_display_egl_get_from_native(display_type.to_glib(), display) } } diff --git a/gstreamer-gl/src/gl_display_wayland.rs b/gstreamer-gl/src/gl_display_wayland.rs index e1b7967cb..67c1a91fd 100644 --- a/gstreamer-gl/src/gl_display_wayland.rs +++ b/gstreamer-gl/src/gl_display_wayland.rs @@ -6,15 +6,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; -use glib_ffi::gpointer; +use glib_sys::gpointer; +use gst_gl_sys; use libc::uintptr_t; use GLDisplayWayland; impl GLDisplayWayland { pub unsafe fn new_with_display(display: uintptr_t) -> Option { - from_glib_full(ffi::gst_gl_display_wayland_new_with_display( + from_glib_full(gst_gl_sys::gst_gl_display_wayland_new_with_display( display as gpointer, )) } diff --git a/gstreamer-gl/src/gl_display_x11.rs b/gstreamer-gl/src/gl_display_x11.rs index 00e77039d..46cf41aa1 100644 --- a/gstreamer-gl/src/gl_display_x11.rs +++ b/gstreamer-gl/src/gl_display_x11.rs @@ -6,15 +6,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; -use glib_ffi::gpointer; +use glib_sys::gpointer; +use gst_gl_sys; use libc::uintptr_t; use GLDisplayX11; impl GLDisplayX11 { pub unsafe fn new_with_display(display: uintptr_t) -> Option { - from_glib_full(ffi::gst_gl_display_x11_new_with_display( + from_glib_full(gst_gl_sys::gst_gl_display_x11_new_with_display( display as gpointer, )) } diff --git a/gstreamer-gl/src/gl_sync_meta.rs b/gstreamer-gl/src/gl_sync_meta.rs index fd58cddbc..fb48a4062 100644 --- a/gstreamer-gl/src/gl_sync_meta.rs +++ b/gstreamer-gl/src/gl_sync_meta.rs @@ -1,15 +1,15 @@ use std::fmt; -use ffi; use glib; use glib::translate::*; use gst; use gst::prelude::*; +use gst_gl_sys; use GLContext; #[repr(C)] -pub struct GLSyncMeta(ffi::GstGLSyncMeta); +pub struct GLSyncMeta(gst_gl_sys::GstGLSyncMeta); impl GLSyncMeta { pub fn add<'a, C: IsA>( @@ -17,7 +17,7 @@ impl GLSyncMeta { context: &C, ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { unsafe { - let meta = ffi::gst_buffer_add_gl_sync_meta( + let meta = gst_gl_sys::gst_buffer_add_gl_sync_meta( context.as_ref().to_glib_none().0, buffer.as_mut_ptr(), ); @@ -31,7 +31,7 @@ impl GLSyncMeta { pub fn set_sync_point>(&self, context: &C) { unsafe { - ffi::gst_gl_sync_meta_set_sync_point( + gst_gl_sys::gst_gl_sync_meta_set_sync_point( &self.0 as *const _ as *mut _, context.as_ref().to_glib_none().0, ); @@ -40,7 +40,7 @@ impl GLSyncMeta { pub fn wait>(&self, context: &C) { unsafe { - ffi::gst_gl_sync_meta_wait( + gst_gl_sys::gst_gl_sync_meta_wait( &self.0 as *const _ as *mut _, context.as_ref().to_glib_none().0, ); @@ -49,7 +49,7 @@ impl GLSyncMeta { pub fn wait_cpu>(&self, context: &C) { unsafe { - ffi::gst_gl_sync_meta_wait_cpu( + gst_gl_sys::gst_gl_sync_meta_wait_cpu( &self.0 as *const _ as *mut _, context.as_ref().to_glib_none().0, ); @@ -58,10 +58,10 @@ impl GLSyncMeta { } unsafe impl MetaAPI for GLSyncMeta { - type GstType = ffi::GstGLSyncMeta; + type GstType = gst_gl_sys::GstGLSyncMeta; fn get_meta_api() -> glib::Type { - unsafe { from_glib(ffi::gst_gl_sync_meta_api_get_type()) } + unsafe { from_glib(gst_gl_sys::gst_gl_sync_meta_api_get_type()) } } } diff --git a/gstreamer-gl/src/gl_video_frame.rs b/gstreamer-gl/src/gl_video_frame.rs index 62ec01883..7f051363e 100644 --- a/gstreamer-gl/src/gl_video_frame.rs +++ b/gstreamer-gl/src/gl_video_frame.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gst_ffi; -use gst_video_ffi; +use glib_sys; +use gst_gl_sys; +use gst_sys; +use gst_video_sys; use glib::translate::{from_glib, ToGlibPtr}; use gst; @@ -75,13 +75,13 @@ impl<'a> VideoFrameGLExt for VideoFrameRef<&'a gst::BufferRef> { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(gst_video_ffi::gst_video_frame_map( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map( &mut frame, info.to_glib_none().0 as *mut _, buffer.to_glib_none().0, - gst_video_ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF - | gst_ffi::GST_MAP_READ - | ffi::GST_MAP_GL as u32, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF + | gst_sys::GST_MAP_READ + | gst_gl_sys::GST_MAP_GL as u32, )); if !res { @@ -112,13 +112,13 @@ impl<'a> VideoFrameGLExt for VideoFrameRef<&'a gst::BufferRef> { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(gst_video_ffi::gst_video_frame_map( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map( &mut frame, info.to_glib_none().0 as *mut _, buffer.as_mut_ptr(), - gst_video_ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF - | gst_ffi::GST_MAP_READ - | ffi::GST_MAP_GL as u32, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF + | gst_sys::GST_MAP_READ + | gst_gl_sys::GST_MAP_GL as u32, )); if !res { @@ -151,10 +151,10 @@ impl<'a> VideoFrameGLExt for VideoFrameRef<&'a gst::BufferRef> { fn buffer_n_gl_memory(buffer: &gst::BufferRef) -> Option { unsafe { let buf = buffer.as_mut_ptr(); - let num = gst_ffi::gst_buffer_n_memory(buf); + let num = gst_sys::gst_buffer_n_memory(buf); for i in 0..num - 1 { - let mem = gst_ffi::gst_buffer_peek_memory(buf, i); - if ffi::gst_is_gl_memory(mem) != glib_ffi::GTRUE { + let mem = gst_sys::gst_buffer_peek_memory(buf, i); + if gst_gl_sys::gst_is_gl_memory(mem) != glib_sys::GTRUE { return None; } } diff --git a/gstreamer-gl/src/lib.rs b/gstreamer-gl/src/lib.rs index 67441e8f1..3a74c52e8 100644 --- a/gstreamer-gl/src/lib.rs +++ b/gstreamer-gl/src/lib.rs @@ -15,18 +15,18 @@ extern crate lazy_static; extern crate libc; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; extern crate gstreamer_base as gst_base; -extern crate gstreamer_gl_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_gl_sys as gst_gl_sys; +extern crate gstreamer_sys as gst_sys; extern crate gstreamer_video as gst_video; -extern crate gstreamer_video_sys as gst_video_ffi; +extern crate gstreamer_video_sys as gst_video_sys; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-net/src/auto/enums.rs b/gstreamer-net/src/auto/enums.rs index fc9f2848b..7bad4724d 100644 --- a/gstreamer-net/src/auto/enums.rs +++ b/gstreamer-net/src/auto/enums.rs @@ -2,6 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ffi; +use gst_net_sys; use glib::translate::*; diff --git a/gstreamer-net/src/auto/flags.rs b/gstreamer-net/src/auto/flags.rs index fc9f2848b..7bad4724d 100644 --- a/gstreamer-net/src/auto/flags.rs +++ b/gstreamer-net/src/auto/flags.rs @@ -2,6 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ffi; +use gst_net_sys; use glib::translate::*; diff --git a/gstreamer-net/src/lib.rs b/gstreamer-net/src/lib.rs index 23a4fc5cc..07e28f049 100644 --- a/gstreamer-net/src/lib.rs +++ b/gstreamer-net/src/lib.rs @@ -7,18 +7,18 @@ // except according to those terms. extern crate gio; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_net_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_net_sys as gst_net_sys; +extern crate gstreamer_sys as gst_sys; #[macro_use] extern crate glib; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-net/src/net_address_meta.rs b/gstreamer-net/src/net_address_meta.rs index 97b917411..4e157742f 100644 --- a/gstreamer-net/src/net_address_meta.rs +++ b/gstreamer-net/src/net_address_meta.rs @@ -1,14 +1,14 @@ use std::fmt; -use ffi; use gio; use glib; use glib::translate::*; use gst; use gst::prelude::*; +use gst_net_sys; #[repr(C)] -pub struct NetAddressMeta(ffi::GstNetAddressMeta); +pub struct NetAddressMeta(gst_net_sys::GstNetAddressMeta); impl NetAddressMeta { pub fn add<'a, A: IsA>( @@ -16,7 +16,7 @@ impl NetAddressMeta { addr: &A, ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { unsafe { - let meta = ffi::gst_buffer_add_net_address_meta( + let meta = gst_net_sys::gst_buffer_add_net_address_meta( buffer.as_mut_ptr(), addr.as_ref().to_glib_none().0, ); @@ -31,17 +31,17 @@ impl NetAddressMeta { pub fn set_addr>(&mut self, addr: &T) { #![allow(clippy::cast_ptr_alignment)] unsafe { - gobject_ffi::g_object_unref(self.0.addr as *mut _); + gobject_sys::g_object_unref(self.0.addr as *mut _); self.0.addr = addr.as_ref().to_glib_full(); } } } unsafe impl MetaAPI for NetAddressMeta { - type GstType = ffi::GstNetAddressMeta; + type GstType = gst_net_sys::GstNetAddressMeta; fn get_meta_api() -> glib::Type { - unsafe { from_glib(ffi::gst_net_address_meta_api_get_type()) } + unsafe { from_glib(gst_net_sys::gst_net_address_meta_api_get_type()) } } } diff --git a/gstreamer-net/src/net_client_clock.rs b/gstreamer-net/src/net_client_clock.rs index 82b585faa..c15b8191b 100644 --- a/gstreamer-net/src/net_client_clock.rs +++ b/gstreamer-net/src/net_client_clock.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_net_sys; use NetClientClock; use glib::object::Cast; @@ -26,7 +26,7 @@ impl NetClientClock { let (major, minor, _, _) = gst::version(); if (major, minor) > (1, 12) { unsafe { - gst::Clock::from_glib_full(ffi::gst_net_client_clock_new( + gst::Clock::from_glib_full(gst_net_sys::gst_net_client_clock_new( name.0, remote_address.to_glib_none().0, remote_port, @@ -37,7 +37,7 @@ impl NetClientClock { } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 unsafe { - gst::Clock::from_glib_none(ffi::gst_net_client_clock_new( + gst::Clock::from_glib_none(gst_net_sys::gst_net_client_clock_new( name.0, remote_address.to_glib_none().0, remote_port, diff --git a/gstreamer-net/src/net_time_provider.rs b/gstreamer-net/src/net_time_provider.rs index 28d8e90ad..a216bf573 100644 --- a/gstreamer-net/src/net_time_provider.rs +++ b/gstreamer-net/src/net_time_provider.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_net_sys; use NetTimeProvider; use glib::translate::*; @@ -26,7 +26,7 @@ impl NetTimeProvider { let (major, minor, _, _) = gst::version(); if (major, minor) > (1, 12) { unsafe { - from_glib_full(ffi::gst_net_time_provider_new( + from_glib_full(gst_net_sys::gst_net_time_provider_new( clock.as_ref().to_glib_none().0, address.0, port, @@ -35,7 +35,7 @@ impl NetTimeProvider { } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 unsafe { - from_glib_none(ffi::gst_net_time_provider_new( + from_glib_none(gst_net_sys::gst_net_time_provider_new( clock.as_ref().to_glib_none().0, address.0, port, diff --git a/gstreamer-net/src/ntp_clock.rs b/gstreamer-net/src/ntp_clock.rs index f99828db4..b60d340f3 100644 --- a/gstreamer-net/src/ntp_clock.rs +++ b/gstreamer-net/src/ntp_clock.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_net_sys; use NtpClock; use glib::object::Cast; @@ -26,7 +26,7 @@ impl NtpClock { let (major, minor, _, _) = gst::version(); if (major, minor) > (1, 12) { unsafe { - gst::Clock::from_glib_full(ffi::gst_ntp_clock_new( + gst::Clock::from_glib_full(gst_net_sys::gst_ntp_clock_new( name.0, remote_address.to_glib_none().0, remote_port, @@ -37,7 +37,7 @@ impl NtpClock { } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 unsafe { - gst::Clock::from_glib_none(ffi::gst_ntp_clock_new( + gst::Clock::from_glib_none(gst_net_sys::gst_ntp_clock_new( name.0, remote_address.to_glib_none().0, remote_port, diff --git a/gstreamer-net/src/ptp_clock.rs b/gstreamer-net/src/ptp_clock.rs index 3064ae906..82cb0e77a 100644 --- a/gstreamer-net/src/ptp_clock.rs +++ b/gstreamer-net/src/ptp_clock.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_net_sys; use PtpClock; use glib::object::Cast; @@ -21,12 +21,14 @@ impl PtpClock { let (major, minor, _, _) = gst::version(); if (major, minor) > (1, 12) { unsafe { - gst::Clock::from_glib_full(ffi::gst_ptp_clock_new(name.0, domain)).unsafe_cast() + gst::Clock::from_glib_full(gst_net_sys::gst_ptp_clock_new(name.0, domain)) + .unsafe_cast() } } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 unsafe { - gst::Clock::from_glib_none(ffi::gst_ptp_clock_new(name.0, domain)).unsafe_cast() + gst::Clock::from_glib_none(gst_net_sys::gst_ptp_clock_new(name.0, domain)) + .unsafe_cast() } } } diff --git a/gstreamer-pbutils/src/discoverer.rs b/gstreamer-pbutils/src/discoverer.rs index 6a5288c97..ea5efa9eb 100644 --- a/gstreamer-pbutils/src/discoverer.rs +++ b/gstreamer-pbutils/src/discoverer.rs @@ -18,9 +18,9 @@ use glib::translate::*; use glib::IsA; use glib::Value; -use ffi; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_pbutils_sys; use std::boxed::Box as Box_; use std::mem::transmute; @@ -28,7 +28,7 @@ use std::mem::transmute; impl Discoverer { pub fn set_property_timeout(&self, timeout: gst::ClockTime) { unsafe { - gobject_ffi::g_object_set_property( + gobject_sys::g_object_set_property( self.as_ptr() as *mut _, "timeout".to_glib_none().0, Value::from(&timeout).to_glib_none().0, @@ -39,7 +39,7 @@ impl Discoverer { pub fn get_property_timeout(&self) -> gst::ClockTime { let mut value = Value::from(&0u64); unsafe { - gobject_ffi::g_object_get_property( + gobject_sys::g_object_get_property( self.as_ptr() as *mut _, "timeout".to_glib_none().0, value.to_glib_none_mut().0, @@ -65,9 +65,9 @@ impl Discoverer { } unsafe extern "C" fn notify_timeout_trampoline( - this: *mut ffi::GstDiscoverer, - _param_spec: glib_ffi::gpointer, - f: glib_ffi::gpointer, + this: *mut gst_pbutils_sys::GstDiscoverer, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, ) where P: IsA, { diff --git a/gstreamer-pbutils/src/discoverer_video_info.rs b/gstreamer-pbutils/src/discoverer_video_info.rs index 27b54fe8d..18df83706 100644 --- a/gstreamer-pbutils/src/discoverer_video_info.rs +++ b/gstreamer-pbutils/src/discoverer_video_info.rs @@ -9,16 +9,19 @@ use DiscovererVideoInfo; -use ffi; use glib::translate::*; use gst; +use gst_pbutils_sys; impl DiscovererVideoInfo { pub fn get_framerate(&self) -> gst::Fraction { unsafe { gst::Fraction::new( - ffi::gst_discoverer_video_info_get_framerate_num(self.to_glib_none().0) as i32, - ffi::gst_discoverer_video_info_get_framerate_denom(self.to_glib_none().0) as i32, + gst_pbutils_sys::gst_discoverer_video_info_get_framerate_num(self.to_glib_none().0) + as i32, + gst_pbutils_sys::gst_discoverer_video_info_get_framerate_denom( + self.to_glib_none().0, + ) as i32, ) } } @@ -26,8 +29,10 @@ impl DiscovererVideoInfo { pub fn get_par(&self) -> gst::Fraction { unsafe { gst::Fraction::new( - ffi::gst_discoverer_video_info_get_par_num(self.to_glib_none().0) as i32, - ffi::gst_discoverer_video_info_get_par_denom(self.to_glib_none().0) as i32, + gst_pbutils_sys::gst_discoverer_video_info_get_par_num(self.to_glib_none().0) + as i32, + gst_pbutils_sys::gst_discoverer_video_info_get_par_denom(self.to_glib_none().0) + as i32, ) } } diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index f587deadd..a105de4be 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -7,10 +7,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use gst; -use gst_ffi; +use gst_pbutils_sys; +use gst_sys; use std::error; use std::fmt; @@ -46,7 +46,7 @@ trait EncodingProfileBuilderCommon { impl> EncodingProfileBuilderCommon for O { fn set_allow_dynamic_output(&self, allow_dynamic_output: bool) { unsafe { - ffi::gst_encoding_profile_set_allow_dynamic_output( + gst_pbutils_sys::gst_encoding_profile_set_allow_dynamic_output( self.as_ref().to_glib_none().0, allow_dynamic_output.to_glib(), ); @@ -57,7 +57,7 @@ impl> EncodingProfileBuilderCommon for O { let description = description.into(); let description = description.to_glib_none(); unsafe { - ffi::gst_encoding_profile_set_description( + gst_pbutils_sys::gst_encoding_profile_set_description( self.as_ref().to_glib_none().0, description.0, ); @@ -66,7 +66,7 @@ impl> EncodingProfileBuilderCommon for O { fn set_enabled(&self, enabled: bool) { unsafe { - ffi::gst_encoding_profile_set_enabled( + gst_pbutils_sys::gst_encoding_profile_set_enabled( self.as_ref().to_glib_none().0, enabled.to_glib(), ); @@ -75,7 +75,7 @@ impl> EncodingProfileBuilderCommon for O { fn set_format(&self, format: &gst::Caps) { unsafe { - ffi::gst_encoding_profile_set_format( + gst_pbutils_sys::gst_encoding_profile_set_format( self.as_ref().to_glib_none().0, format.to_glib_none().0, ); @@ -86,13 +86,16 @@ impl> EncodingProfileBuilderCommon for O { let name = name.into(); let name = name.to_glib_none(); unsafe { - ffi::gst_encoding_profile_set_name(self.as_ref().to_glib_none().0, name.0); + gst_pbutils_sys::gst_encoding_profile_set_name(self.as_ref().to_glib_none().0, name.0); } } fn set_presence(&self, presence: u32) { unsafe { - ffi::gst_encoding_profile_set_presence(self.as_ref().to_glib_none().0, presence); + gst_pbutils_sys::gst_encoding_profile_set_presence( + self.as_ref().to_glib_none().0, + presence, + ); } } @@ -100,7 +103,10 @@ impl> EncodingProfileBuilderCommon for O { let preset = preset.into(); let preset = preset.to_glib_none(); unsafe { - ffi::gst_encoding_profile_set_preset(self.as_ref().to_glib_none().0, preset.0); + gst_pbutils_sys::gst_encoding_profile_set_preset( + self.as_ref().to_glib_none().0, + preset.0, + ); } } @@ -108,7 +114,7 @@ impl> EncodingProfileBuilderCommon for O { let preset_name = preset_name.into(); let preset_name = preset_name.to_glib_none(); unsafe { - ffi::gst_encoding_profile_set_preset_name( + gst_pbutils_sys::gst_encoding_profile_set_preset_name( self.as_ref().to_glib_none().0, preset_name.0, ); @@ -120,10 +126,13 @@ impl> EncodingProfileBuilderCommon for O { unsafe { let restriction = match restriction { Some(restriction) => restriction.to_glib_full(), - None => gst_ffi::gst_caps_new_any(), + None => gst_sys::gst_caps_new_any(), }; - ffi::gst_encoding_profile_set_restriction(self.as_ref().to_glib_none().0, restriction); + gst_pbutils_sys::gst_encoding_profile_set_restriction( + self.as_ref().to_glib_none().0, + restriction, + ); } } } @@ -141,7 +150,7 @@ impl EncodingAudioProfile { let restriction = restriction.into(); let restriction = restriction.to_glib_none(); unsafe { - from_glib_full(ffi::gst_encoding_audio_profile_new( + from_glib_full(gst_pbutils_sys::gst_encoding_audio_profile_new( format.to_glib_none().0, preset.0, restriction.0, @@ -164,7 +173,7 @@ impl EncodingVideoProfile { let restriction = restriction.into(); let restriction = restriction.to_glib_none(); unsafe { - from_glib_full(ffi::gst_encoding_video_profile_new( + from_glib_full(gst_pbutils_sys::gst_encoding_video_profile_new( format.to_glib_none().0, preset.0, restriction.0, @@ -175,13 +184,13 @@ impl EncodingVideoProfile { fn set_pass(&self, pass: u32) { unsafe { - ffi::gst_encoding_video_profile_set_pass(self.to_glib_none().0, pass); + gst_pbutils_sys::gst_encoding_video_profile_set_pass(self.to_glib_none().0, pass); } } fn set_variableframerate(&self, variableframerate: bool) { unsafe { - ffi::gst_encoding_video_profile_set_variableframerate( + gst_pbutils_sys::gst_encoding_video_profile_set_variableframerate( self.to_glib_none().0, variableframerate.to_glib(), ); @@ -211,7 +220,7 @@ impl EncodingContainerProfile { let preset = preset.into(); let preset = preset.to_glib_none(); unsafe { - from_glib_full(ffi::gst_encoding_container_profile_new( + from_glib_full(gst_pbutils_sys::gst_encoding_container_profile_new( name.0, description.0, format.to_glib_none().0, @@ -226,7 +235,7 @@ impl EncodingContainerProfile { ) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_encoding_container_profile_add_profile( + gst_pbutils_sys::gst_encoding_container_profile_add_profile( self.to_glib_none().0, profile.as_ref().to_glib_full(), ), diff --git a/gstreamer-pbutils/src/functions.rs b/gstreamer-pbutils/src/functions.rs index 156668709..303801060 100644 --- a/gstreamer-pbutils/src/functions.rs +++ b/gstreamer-pbutils/src/functions.rs @@ -6,11 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::*; use gst; use gst::MiniObject; +use gst_pbutils_sys; use std::ptr; pub unsafe trait CodecTag<'a>: gst::Tag<'a, TagType = &'a str> {} @@ -29,7 +29,7 @@ pub fn pb_utils_add_codec_description_to_tag_list_for_tag<'a, T: CodecTag<'a>>( let codec_tag = T::tag_name(); unsafe { glib_result_from_gboolean!( - ffi::gst_pb_utils_add_codec_description_to_tag_list( + gst_pbutils_sys::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), codec_tag.to_glib_none().0, caps.as_ptr(), @@ -46,7 +46,7 @@ pub fn pb_utils_add_codec_description_to_tag_list( assert_initialized_main_thread!(); unsafe { glib_result_from_gboolean!( - ffi::gst_pb_utils_add_codec_description_to_tag_list( + gst_pbutils_sys::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), ptr::null_mut(), caps.as_ptr(), @@ -58,15 +58,27 @@ pub fn pb_utils_add_codec_description_to_tag_list( pub fn pb_utils_get_encoder_description(caps: &gst::CapsRef) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_pb_utils_get_encoder_description(caps.as_ptr())) } + unsafe { + from_glib_full(gst_pbutils_sys::gst_pb_utils_get_encoder_description( + caps.as_ptr(), + )) + } } pub fn pb_utils_get_decoder_description(caps: &gst::CapsRef) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_pb_utils_get_decoder_description(caps.as_ptr())) } + unsafe { + from_glib_full(gst_pbutils_sys::gst_pb_utils_get_decoder_description( + caps.as_ptr(), + )) + } } pub fn pb_utils_get_codec_description(caps: &gst::CapsRef) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_pb_utils_get_codec_description(caps.as_ptr())) } + unsafe { + from_glib_full(gst_pbutils_sys::gst_pb_utils_get_codec_description( + caps.as_ptr(), + )) + } } diff --git a/gstreamer-pbutils/src/lib.rs b/gstreamer-pbutils/src/lib.rs index 8ae88053d..1beea741d 100644 --- a/gstreamer-pbutils/src/lib.rs +++ b/gstreamer-pbutils/src/lib.rs @@ -14,21 +14,21 @@ use std::sync::{Once, ONCE_INIT}; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_pbutils_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_pbutils_sys as gst_pbutils_sys; +extern crate gstreamer_sys as gst_sys; static PBUTILS_INIT: Once = ONCE_INIT; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } ::PBUTILS_INIT.call_once(|| { - unsafe { ::ffi::gst_pb_utils_init() }; + unsafe { ::gst_pbutils_sys::gst_pb_utils_init() }; }); }; } diff --git a/gstreamer-player/src/auto/flags.rs b/gstreamer-player/src/auto/flags.rs index fc9f2848b..8690cac26 100644 --- a/gstreamer-player/src/auto/flags.rs +++ b/gstreamer-player/src/auto/flags.rs @@ -2,6 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ffi; +use gst_player_sys; use glib::translate::*; diff --git a/gstreamer-player/src/config.rs b/gstreamer-player/src/config.rs index 94e2e5e5f..261052e4f 100644 --- a/gstreamer-player/src/config.rs +++ b/gstreamer-player/src/config.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use gst; -use gst_ffi; +use gst_player_sys; +use gst_sys; use std::mem; use std::ops; @@ -46,13 +46,15 @@ impl AsMut for PlayerConfig { impl PlayerConfig { pub fn get_position_update_interval(&self) -> u32 { assert_initialized_main_thread!(); - unsafe { ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0) } + unsafe { + gst_player_sys::gst_player_config_get_position_update_interval(self.0.to_glib_none().0) + } } pub fn get_seek_accurate(&self) -> bool { assert_initialized_main_thread!(); unsafe { - from_glib(ffi::gst_player_config_get_seek_accurate( + from_glib(gst_player_sys::gst_player_config_get_seek_accurate( self.0.to_glib_none().0, )) } @@ -61,7 +63,7 @@ impl PlayerConfig { pub fn get_user_agent(&self) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_player_config_get_user_agent( + from_glib_full(gst_player_sys::gst_player_config_get_user_agent( self.0.to_glib_none().0, )) } @@ -70,7 +72,7 @@ impl PlayerConfig { pub fn set_position_update_interval(&mut self, interval: u32) { assert_initialized_main_thread!(); unsafe { - ffi::gst_player_config_set_position_update_interval( + gst_player_sys::gst_player_config_set_position_update_interval( self.0.to_glib_none_mut().0, interval, ); @@ -87,22 +89,22 @@ impl PlayerConfig { pub fn set_user_agent(&mut self, agent: &str) { assert_initialized_main_thread!(); unsafe { - ffi::gst_player_config_set_user_agent( + gst_player_sys::gst_player_config_set_user_agent( self.0.to_glib_none_mut().0, agent.to_glib_none().0, ); } } - pub unsafe fn into_ptr(mut self) -> *mut gst_ffi::GstStructure { + pub unsafe fn into_ptr(mut self) -> *mut gst_sys::GstStructure { let ptr = self.0.to_glib_none_mut().0; mem::forget(self); ptr } } -impl FromGlibPtrFull<*mut gst_ffi::GstStructure> for PlayerConfig { - unsafe fn from_glib_full(ptr: *mut gst_ffi::GstStructure) -> Self { +impl FromGlibPtrFull<*mut gst_sys::GstStructure> for PlayerConfig { + unsafe fn from_glib_full(ptr: *mut gst_sys::GstStructure) -> Self { PlayerConfig(from_glib_full(ptr)) } } diff --git a/gstreamer-player/src/lib.rs b/gstreamer-player/src/lib.rs index 70a90a47f..2a1f57185 100644 --- a/gstreamer-player/src/lib.rs +++ b/gstreamer-player/src/lib.rs @@ -8,11 +8,11 @@ extern crate libc; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_player_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_player_sys as gst_player_sys; +extern crate gstreamer_sys as gst_sys; extern crate gstreamer_video as gst_video; #[macro_use] diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index d01cd279e..ab009e993 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -6,14 +6,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::object::ObjectType; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; -use glib_ffi; +use glib_sys; use gst; +use gst_player_sys; use std::boxed::Box as Box_; use std::mem::transmute; use Player; @@ -31,22 +31,32 @@ impl Player { let (major, minor, _, _) = gst::version(); if (major, minor) > (1, 12) { - unsafe { from_glib_full(ffi::gst_player_new(video_renderer, signal_dispatcher)) } + unsafe { + from_glib_full(gst_player_sys::gst_player_new( + video_renderer, + signal_dispatcher, + )) + } } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 in // https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/gst-libs/gst/player/gstplayer.c?id=634cd87c76f58b5e1383715bafd5614db825c7d1 - unsafe { from_glib_none(ffi::gst_player_new(video_renderer, signal_dispatcher)) } + unsafe { + from_glib_none(gst_player_sys::gst_player_new( + video_renderer, + signal_dispatcher, + )) + } } } pub fn get_config(&self) -> ::PlayerConfig { - unsafe { from_glib_full(ffi::gst_player_get_config(self.to_glib_none().0)) } + unsafe { from_glib_full(gst_player_sys::gst_player_get_config(self.to_glib_none().0)) } } pub fn set_config(&self, config: ::PlayerConfig) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_player_set_config(self.to_glib_none().0, config.into_ptr()), + gst_player_sys::gst_player_set_config(self.to_glib_none().0, config.into_ptr()), "Failed to set config", ) } @@ -104,9 +114,9 @@ impl Player { unsafe extern "C" fn duration_changed_trampoline< F: Fn(&Player, gst::ClockTime) + Send + 'static, >( - this: *mut ffi::GstPlayer, + this: *mut gst_player_sys::GstPlayer, object: u64, - f: glib_ffi::gpointer, + f: glib_sys::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), gst::ClockTime(Some(object))) @@ -115,18 +125,18 @@ unsafe extern "C" fn duration_changed_trampoline< unsafe extern "C" fn position_updated_trampoline< F: Fn(&Player, gst::ClockTime) + Send + 'static, >( - this: *mut ffi::GstPlayer, + this: *mut gst_player_sys::GstPlayer, object: u64, - f: glib_ffi::gpointer, + f: glib_sys::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), gst::ClockTime(Some(object))) } unsafe extern "C" fn seek_done_trampoline( - this: *mut ffi::GstPlayer, + this: *mut gst_player_sys::GstPlayer, object: u64, - f: glib_ffi::gpointer, + f: glib_sys::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), gst::ClockTime(Some(object))) diff --git a/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs b/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs index 2ea9cd917..0de94c73e 100644 --- a/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs +++ b/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::*; +use gst_player_sys; use PlayerGMainContextSignalDispatcher; impl PlayerGMainContextSignalDispatcher { @@ -19,10 +19,11 @@ impl PlayerGMainContextSignalDispatcher { let application_context = application_context.into(); let application_context = application_context.to_glib_none(); unsafe { - from_glib_full(ffi::gst_player_g_main_context_signal_dispatcher_new( - application_context.0, + from_glib_full( + gst_player_sys::gst_player_g_main_context_signal_dispatcher_new( + application_context.0, + ) as *mut gst_player_sys::GstPlayerGMainContextSignalDispatcher, ) - as *mut ffi::GstPlayerGMainContextSignalDispatcher) } } } diff --git a/gstreamer-player/src/player_video_info.rs b/gstreamer-player/src/player_video_info.rs index b5eeddd40..ea0dcffa1 100644 --- a/gstreamer-player/src/player_video_info.rs +++ b/gstreamer-player/src/player_video_info.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use gst; +use gst_player_sys; use std::mem; use PlayerVideoInfo; @@ -17,7 +17,11 @@ impl PlayerVideoInfo { unsafe { let mut fps_n = mem::uninitialized(); let mut fps_d = mem::uninitialized(); - ffi::gst_player_video_info_get_framerate(self.to_glib_none().0, &mut fps_n, &mut fps_d); + gst_player_sys::gst_player_video_info_get_framerate( + self.to_glib_none().0, + &mut fps_n, + &mut fps_d, + ); (fps_n as i32, fps_d as i32).into() } } @@ -26,7 +30,7 @@ impl PlayerVideoInfo { unsafe { let mut par_n = mem::uninitialized(); let mut par_d = mem::uninitialized(); - ffi::gst_player_video_info_get_pixel_aspect_ratio( + gst_player_sys::gst_player_video_info_get_pixel_aspect_ratio( self.to_glib_none().0, &mut par_n, &mut par_d, diff --git a/gstreamer-player/src/player_video_overlay_video_renderer.rs b/gstreamer-player/src/player_video_overlay_video_renderer.rs index 521c9f45f..1c035ba3c 100644 --- a/gstreamer-player/src/player_video_overlay_video_renderer.rs +++ b/gstreamer-player/src/player_video_overlay_video_renderer.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use glib::IsA; use gst; +use gst_player_sys; use PlayerVideoOverlayVideoRenderer; use std::ptr; @@ -20,9 +20,9 @@ impl PlayerVideoOverlayVideoRenderer { pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer { assert_initialized_main_thread!(); - from_glib_full( - ffi::gst_player_video_overlay_video_renderer_new(window_handle as *mut _) as *mut _, - ) + from_glib_full(gst_player_sys::gst_player_video_overlay_video_renderer_new( + window_handle as *mut _, + ) as *mut _) } pub unsafe fn new_with_handle_and_sink>( @@ -31,30 +31,35 @@ impl PlayerVideoOverlayVideoRenderer { ) -> PlayerVideoOverlayVideoRenderer { assert_initialized_main_thread!(); - from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink( - window_handle as *mut _, - video_sink.as_ref().to_glib_none().0, - ) as *mut _) + from_glib_full( + gst_player_sys::gst_player_video_overlay_video_renderer_new_with_sink( + window_handle as *mut _, + video_sink.as_ref().to_glib_none().0, + ) as *mut _, + ) } pub fn new_with_sink>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink( - ptr::null_mut(), - video_sink.as_ref().to_glib_none().0, - ) as *mut _) + from_glib_full( + gst_player_sys::gst_player_video_overlay_video_renderer_new_with_sink( + ptr::null_mut(), + video_sink.as_ref().to_glib_none().0, + ) as *mut _, + ) } } pub unsafe fn get_window_handle(&self) -> uintptr_t { - ffi::gst_player_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0) - as uintptr_t + gst_player_sys::gst_player_video_overlay_video_renderer_get_window_handle( + self.to_glib_none().0, + ) as uintptr_t } pub unsafe fn set_window_handle(&self, window_handle: uintptr_t) { - ffi::gst_player_video_overlay_video_renderer_set_window_handle( + gst_player_sys::gst_player_video_overlay_video_renderer_set_window_handle( self.to_glib_none().0, window_handle as *mut _, ) diff --git a/gstreamer-rtsp-server/src/lib.rs b/gstreamer-rtsp-server/src/lib.rs index 734074e72..6d52d8ab4 100644 --- a/gstreamer-rtsp-server/src/lib.rs +++ b/gstreamer-rtsp-server/src/lib.rs @@ -13,24 +13,24 @@ extern crate lazy_static; extern crate libc; extern crate gio; -extern crate gio_sys as gio_ffi; +extern crate gio_sys as gio_sys; use std::ffi::CStr; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; #[macro_use] extern crate gstreamer as gst; extern crate gstreamer_net as gst_net; -extern crate gstreamer_net_sys as gst_net_ffi; +extern crate gstreamer_net_sys as gst_net_sys; extern crate gstreamer_rtsp as gst_rtsp; -extern crate gstreamer_rtsp_server_sys as ffi; -extern crate gstreamer_rtsp_sys as gst_rtsp_ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_rtsp_server_sys as gst_rtsp_server_sys; +extern crate gstreamer_rtsp_sys as gst_rtsp_sys; +extern crate gstreamer_sys as gst_sys; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; @@ -73,57 +73,57 @@ pub use rtsp_token::*; lazy_static! { pub static ref RTSP_ADDRESS_POOL_ANY_IPV4: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_ADDRESS_POOL_ANY_IPV4) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ANY_IPV4) .to_str() .unwrap() }; pub static ref RTSP_ADDRESS_POOL_ANY_IPV6: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_ADDRESS_POOL_ANY_IPV6) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ANY_IPV6) .to_str() .unwrap() }; pub static ref RTSP_AUTH_CHECK_CONNECT: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_CONNECT) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_CONNECT) .to_str() .unwrap() }; pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS) .to_str() .unwrap() }; pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT) .to_str() .unwrap() }; pub static ref RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS) .to_str() .unwrap() }; pub static ref RTSP_AUTH_CHECK_URL: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_URL) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_URL) .to_str() .unwrap() }; pub static ref RTSP_PERM_MEDIA_FACTORY_ACCESS: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_ACCESS) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_PERM_MEDIA_FACTORY_ACCESS) .to_str() .unwrap() }; pub static ref RTSP_PERM_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT) .to_str() .unwrap() }; pub static ref RTSP_TOKEN_MEDIA_FACTORY_ROLE: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE) .to_str() .unwrap() }; pub static ref RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe { - CStr::from_ptr(ffi::GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS) + CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS) .to_str() .unwrap() }; diff --git a/gstreamer-rtsp-server/src/rtsp_address_pool.rs b/gstreamer-rtsp-server/src/rtsp_address_pool.rs index 2b1876fac..589ea10f2 100644 --- a/gstreamer-rtsp-server/src/rtsp_address_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_address_pool.rs @@ -1,6 +1,6 @@ -use ffi; use glib::object::IsA; use glib::translate::*; +use gst_rtsp_server_sys; use std::ptr; use RTSPAddress; use RTSPAddressPool; @@ -26,7 +26,7 @@ impl> RTSPAddressPoolExtManual for O { ) -> Result { unsafe { let mut address = ptr::null_mut(); - let ret = from_glib(ffi::gst_rtsp_address_pool_reserve_address( + let ret = from_glib(gst_rtsp_server_sys::gst_rtsp_address_pool_reserve_address( self.as_ref().to_glib_none().0, ip_address.to_glib_none().0, port, diff --git a/gstreamer-rtsp-server/src/rtsp_auth.rs b/gstreamer-rtsp-server/src/rtsp_auth.rs index 94cd7fb9b..4fcd404b3 100644 --- a/gstreamer-rtsp-server/src/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/rtsp_auth.rs @@ -1,9 +1,9 @@ -use ffi; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; +use gst_rtsp_server_sys; use std::boxed::Box as Box_; use std::mem::transmute; @@ -34,7 +34,7 @@ impl> RTSPAuthExtManual for O { fn set_default_token<'a, P: Into>>(&self, token: P) { let mut token = token.into(); unsafe { - ffi::gst_rtsp_auth_set_default_token( + gst_rtsp_server_sys::gst_rtsp_auth_set_default_token( self.as_ref().to_glib_none().0, token.to_glib_none_mut().0, ); @@ -79,12 +79,12 @@ unsafe extern "C" fn accept_certificate_trampoline< + Sync + 'static, >( - this: *mut ffi::GstRTSPAuth, - connection: *mut gio_ffi::GTlsConnection, - peer_cert: *mut gio_ffi::GTlsCertificate, - errors: gio_ffi::GTlsCertificateFlags, - f: glib_ffi::gpointer, -) -> glib_ffi::gboolean + this: *mut gst_rtsp_server_sys::GstRTSPAuth, + connection: *mut gio_sys::GTlsConnection, + peer_cert: *mut gio_sys::GTlsCertificate, + errors: gio_sys::GTlsCertificateFlags, + f: glib_sys::gpointer, +) -> glib_sys::gboolean where P: IsA, { diff --git a/gstreamer-rtsp-server/src/rtsp_client.rs b/gstreamer-rtsp-server/src/rtsp_client.rs index 5fcdc1ea3..b4675da17 100644 --- a/gstreamer-rtsp-server/src/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/rtsp_client.rs @@ -1,8 +1,8 @@ -use ffi; use glib; use glib::object::IsA; use glib::source::SourceId; use glib::translate::*; +use gst_rtsp_server_sys; use RTSPClient; pub trait RTSPClientExtManual: 'static { @@ -13,7 +13,7 @@ impl> RTSPClientExtManual for O { fn attach<'a, P: Into>>(&self, context: P) -> SourceId { let context = context.into(); unsafe { - from_glib(ffi::gst_rtsp_client_attach( + from_glib(gst_rtsp_server_sys::gst_rtsp_client_attach( self.as_ref().to_glib_none().0, context.to_glib_none().0, )) diff --git a/gstreamer-rtsp-server/src/rtsp_context.rs b/gstreamer-rtsp-server/src/rtsp_context.rs index 003163bb6..8e18ee896 100644 --- a/gstreamer-rtsp-server/src/rtsp_context.rs +++ b/gstreamer-rtsp-server/src/rtsp_context.rs @@ -6,17 +6,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; +use gst_rtsp_server_sys; use std::ptr; #[derive(Debug, PartialEq, Eq)] -pub struct RTSPContext(ptr::NonNull); +pub struct RTSPContext(ptr::NonNull); impl RTSPContext { pub fn with_current_context T, T>(func: F) -> Option { unsafe { - let ptr = ffi::gst_rtsp_context_get_current(); + let ptr = gst_rtsp_server_sys::gst_rtsp_context_get_current(); if ptr.is_null() { return None; } @@ -30,9 +30,9 @@ impl RTSPContext { } #[doc(hidden)] -impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext { +impl glib::translate::FromGlibPtrBorrow<*mut gst_rtsp_server_sys::GstRTSPContext> for RTSPContext { #[inline] - unsafe fn from_glib_borrow(ptr: *mut ffi::GstRTSPContext) -> Self { + unsafe fn from_glib_borrow(ptr: *mut gst_rtsp_server_sys::GstRTSPContext) -> Self { assert!(!ptr.is_null()); RTSPContext(ptr::NonNull::new_unchecked(ptr)) } diff --git a/gstreamer-rtsp-server/src/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/rtsp_media_factory.rs index 0bc79bded..805ee98af 100644 --- a/gstreamer-rtsp-server/src/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/rtsp_media_factory.rs @@ -8,13 +8,13 @@ use RTSPMediaFactory; -#[cfg(any(feature = "v1_14", feature = "dox"))] -use ffi; #[cfg(any(feature = "v1_14", feature = "dox"))] use glib::translate::*; use glib::IsA; #[cfg(any(feature = "v1_14", feature = "dox"))] use gst; +#[cfg(any(feature = "v1_14", feature = "dox"))] +use gst_rtsp_server_sys; pub trait RTSPMediaFactoryExtManual: 'static { #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -25,7 +25,7 @@ impl> RTSPMediaFactoryExtManual for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn add_role_from_structure(&self, structure: &gst::StructureRef) { unsafe { - ffi::gst_rtsp_media_factory_add_role_from_structure( + gst_rtsp_server_sys::gst_rtsp_media_factory_add_role_from_structure( self.as_ref().to_glib_none().0, structure.as_mut_ptr(), ); diff --git a/gstreamer-rtsp-server/src/rtsp_server.rs b/gstreamer-rtsp-server/src/rtsp_server.rs index 1a12fd1e3..5c8ea432c 100644 --- a/gstreamer-rtsp-server/src/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/rtsp_server.rs @@ -1,8 +1,8 @@ -use ffi; use glib; use glib::object::IsA; use glib::source::SourceId; use glib::translate::*; +use gst_rtsp_server_sys; use RTSPServer; pub trait RTSPServerExtManual: 'static { @@ -13,7 +13,7 @@ impl> RTSPServerExtManual for O { fn attach<'a, P: Into>>(&self, context: P) -> SourceId { let context = context.into(); unsafe { - from_glib(ffi::gst_rtsp_server_attach( + from_glib(gst_rtsp_server_sys::gst_rtsp_server_attach( self.as_ref().to_glib_none().0, context.to_glib_none().0, )) diff --git a/gstreamer-rtsp-server/src/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/rtsp_session_pool.rs index 12f85639b..1342f5f2f 100644 --- a/gstreamer-rtsp-server/src/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_session_pool.rs @@ -1,16 +1,16 @@ -use ffi; use glib; use glib::object::IsA; use glib::source::{Continue, Priority}; use glib::translate::*; -use glib_ffi; -use glib_ffi::{gboolean, gpointer}; +use glib_sys; +use glib_sys::{gboolean, gpointer}; +use gst_rtsp_server_sys; use std::cell::RefCell; use std::mem::transmute; use RTSPSessionPool; unsafe extern "C" fn trampoline_watch Continue + Send + 'static>( - pool: *mut ffi::GstRTSPSessionPool, + pool: *mut gst_rtsp_server_sys::GstRTSPSessionPool, func: gpointer, ) -> gboolean { let func: &RefCell = &*(func as *const RefCell); @@ -54,18 +54,20 @@ impl> RTSPSessionPoolExtManual for O { { skip_assert_initialized!(); unsafe { - let source = ffi::gst_rtsp_session_pool_create_watch(self.as_ref().to_glib_none().0); - glib_ffi::g_source_set_callback( + let source = gst_rtsp_server_sys::gst_rtsp_session_pool_create_watch( + self.as_ref().to_glib_none().0, + ); + glib_sys::g_source_set_callback( source, Some(transmute(trampoline_watch:: as usize)), into_raw_watch(func), Some(destroy_closure_watch::), ); - glib_ffi::g_source_set_priority(source, priority.to_glib()); + glib_sys::g_source_set_priority(source, priority.to_glib()); let name = name.into(); if let Some(name) = name { - glib_ffi::g_source_set_name(source, name.to_glib_none().0); + glib_sys::g_source_set_name(source, name.to_glib_none().0); } from_glib_full(source) diff --git a/gstreamer-rtsp-server/src/rtsp_stream.rs b/gstreamer-rtsp-server/src/rtsp_stream.rs index 8b52b4059..f083de38d 100644 --- a/gstreamer-rtsp-server/src/rtsp_stream.rs +++ b/gstreamer-rtsp-server/src/rtsp_stream.rs @@ -1,7 +1,7 @@ -use ffi; use glib::object::IsA; use glib::translate::*; use gst; +use gst_rtsp_server_sys; use RTSPStream; pub trait RTSPStreamExtManual: 'static { @@ -13,7 +13,7 @@ pub trait RTSPStreamExtManual: 'static { impl> RTSPStreamExtManual for O { fn recv_rtcp(&self, buffer: &gst::Buffer) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_rtsp_stream_recv_rtcp( + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_recv_rtcp( self.as_ref().to_glib_none().0, buffer.to_glib_full(), )) @@ -23,7 +23,7 @@ impl> RTSPStreamExtManual for O { fn recv_rtp(&self, buffer: &gst::Buffer) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_rtsp_stream_recv_rtp( + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_recv_rtp( self.as_ref().to_glib_none().0, buffer.to_glib_full(), )) diff --git a/gstreamer-rtsp-server/src/rtsp_stream_transport.rs b/gstreamer-rtsp-server/src/rtsp_stream_transport.rs index af662dda9..1d744a69c 100644 --- a/gstreamer-rtsp-server/src/rtsp_stream_transport.rs +++ b/gstreamer-rtsp-server/src/rtsp_stream_transport.rs @@ -1,7 +1,7 @@ -use ffi; use glib::object::IsA; use glib::translate::*; use gst; +use gst_rtsp_server_sys; use RTSPStreamTransport; pub trait RTSPStreamTransportExtManual: 'static { @@ -19,7 +19,7 @@ impl> RTSPStreamTransportExtManual for O { buffer: &gst::Buffer, ) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(ffi::gst_rtsp_stream_transport_recv_data( + from_glib(gst_rtsp_server_sys::gst_rtsp_stream_transport_recv_data( self.as_ref().to_glib_none().0, channel, buffer.to_glib_full(), diff --git a/gstreamer-rtsp-server/src/rtsp_token.rs b/gstreamer-rtsp-server/src/rtsp_token.rs index 438e25679..97eb6803d 100644 --- a/gstreamer-rtsp-server/src/rtsp_token.rs +++ b/gstreamer-rtsp-server/src/rtsp_token.rs @@ -1,20 +1,24 @@ -use ffi; use glib; use glib::translate::*; use glib::value::ToSendValue; use gst; use gst::miniobject::*; +use gst_rtsp_server_sys; use std::fmt; -gst_define_mini_object_wrapper!(RTSPToken, RTSPTokenRef, ffi::GstRTSPToken, [Debug,], || { - ffi::gst_rtsp_token_get_type() -}); +gst_define_mini_object_wrapper!( + RTSPToken, + RTSPTokenRef, + gst_rtsp_server_sys::GstRTSPToken, + [Debug,], + || gst_rtsp_server_sys::gst_rtsp_token_get_type() +); impl RTSPToken { pub fn new_empty() -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_rtsp_token_new_empty()) } + unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_token_new_empty()) } } pub fn new(values: &[(&str, &ToSendValue)]) -> Self { @@ -36,7 +40,7 @@ impl RTSPToken { impl RTSPTokenRef { pub fn get_string(&self, field: &str) -> Option { unsafe { - from_glib_none(ffi::gst_rtsp_token_get_string( + from_glib_none(gst_rtsp_server_sys::gst_rtsp_token_get_string( self.as_mut_ptr(), field.to_glib_none().0, )) @@ -44,12 +48,16 @@ impl RTSPTokenRef { } pub fn get_structure(&self) -> Option { - unsafe { from_glib_none(ffi::gst_rtsp_token_get_structure(self.as_mut_ptr())) } + unsafe { + from_glib_none(gst_rtsp_server_sys::gst_rtsp_token_get_structure( + self.as_mut_ptr(), + )) + } } pub fn is_allowed(&self, field: &str) -> bool { unsafe { - from_glib(ffi::gst_rtsp_token_is_allowed( + from_glib(gst_rtsp_server_sys::gst_rtsp_token_is_allowed( self.as_mut_ptr(), field.to_glib_none().0, )) @@ -58,7 +66,8 @@ impl RTSPTokenRef { pub fn get_mut_structure(&mut self) -> Option<&mut gst::StructureRef> { unsafe { - let structure = ffi::gst_rtsp_token_writable_structure(self.as_mut_ptr()); + let structure = + gst_rtsp_server_sys::gst_rtsp_token_writable_structure(self.as_mut_ptr()); if structure.is_null() { None } else { diff --git a/gstreamer-rtsp/src/lib.rs b/gstreamer-rtsp/src/lib.rs index 42672561f..45f174a0a 100644 --- a/gstreamer-rtsp/src/lib.rs +++ b/gstreamer-rtsp/src/lib.rs @@ -12,17 +12,17 @@ extern crate libc; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_rtsp_sys as ffi; +extern crate gstreamer_rtsp_sys as gst_rtsp_sys; extern crate gstreamer_sdp as gst_sdp; -extern crate gstreamer_sdp_sys as gst_sdp_ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_sdp_sys as gst_sdp_sys; +extern crate gstreamer_sys as gst_sys; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-sdp/src/lib.rs b/gstreamer-sdp/src/lib.rs index b695309e1..9a7580933 100644 --- a/gstreamer-sdp/src/lib.rs +++ b/gstreamer-sdp/src/lib.rs @@ -11,15 +11,15 @@ extern crate libc; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; -extern crate gstreamer_sdp_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_sdp_sys as gst_sdp_sys; +extern crate gstreamer_sys as gst_sys; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-sdp/src/sdp_attribute.rs b/gstreamer-sdp/src/sdp_attribute.rs index cabb6b7e0..90e53274b 100644 --- a/gstreamer-sdp/src/sdp_attribute.rs +++ b/gstreamer-sdp/src/sdp_attribute.rs @@ -10,18 +10,22 @@ use std::ffi::CStr; use std::fmt; use std::mem; -use ffi; use glib::translate::*; +use gst_sdp_sys; #[repr(C)] -pub struct SDPAttribute(pub(crate) ffi::GstSDPAttribute); +pub struct SDPAttribute(pub(crate) gst_sdp_sys::GstSDPAttribute); impl SDPAttribute { pub fn new(key: &str, value: Option<&str>) -> Self { assert_initialized_main_thread!(); unsafe { let mut attr = mem::zeroed(); - ffi::gst_sdp_attribute_set(&mut attr, key.to_glib_none().0, value.to_glib_none().0); + gst_sdp_sys::gst_sdp_attribute_set( + &mut attr, + key.to_glib_none().0, + value.to_glib_none().0, + ); SDPAttribute(attr) } } @@ -52,7 +56,7 @@ impl Clone for SDPAttribute { impl Drop for SDPAttribute { fn drop(&mut self) { unsafe { - ffi::gst_sdp_attribute_clear(&mut self.0); + gst_sdp_sys::gst_sdp_attribute_clear(&mut self.0); } } } diff --git a/gstreamer-sdp/src/sdp_bandwidth.rs b/gstreamer-sdp/src/sdp_bandwidth.rs index 10beb2405..f158f400a 100644 --- a/gstreamer-sdp/src/sdp_bandwidth.rs +++ b/gstreamer-sdp/src/sdp_bandwidth.rs @@ -10,18 +10,18 @@ use std::ffi::CStr; use std::fmt; use std::mem; -use ffi; use glib::translate::*; +use gst_sdp_sys; #[repr(C)] -pub struct SDPBandwidth(pub(crate) ffi::GstSDPBandwidth); +pub struct SDPBandwidth(pub(crate) gst_sdp_sys::GstSDPBandwidth); impl SDPBandwidth { pub fn new(bwtype: &str, bandwidth: u32) -> Self { assert_initialized_main_thread!(); unsafe { let mut bw = mem::zeroed(); - ffi::gst_sdp_bandwidth_set(&mut bw, bwtype.to_glib_none().0, bandwidth); + gst_sdp_sys::gst_sdp_bandwidth_set(&mut bw, bwtype.to_glib_none().0, bandwidth); SDPBandwidth(bw) } } @@ -44,7 +44,7 @@ impl Clone for SDPBandwidth { impl Drop for SDPBandwidth { fn drop(&mut self) { unsafe { - ffi::gst_sdp_bandwidth_clear(&mut self.0); + gst_sdp_sys::gst_sdp_bandwidth_clear(&mut self.0); } } } diff --git a/gstreamer-sdp/src/sdp_connection.rs b/gstreamer-sdp/src/sdp_connection.rs index fbf3bcc19..67fbe5085 100644 --- a/gstreamer-sdp/src/sdp_connection.rs +++ b/gstreamer-sdp/src/sdp_connection.rs @@ -10,18 +10,18 @@ use std::ffi::CStr; use std::fmt; use std::mem; -use ffi; use glib::translate::*; +use gst_sdp_sys; #[repr(C)] -pub struct SDPConnection(pub(crate) ffi::GstSDPConnection); +pub struct SDPConnection(pub(crate) gst_sdp_sys::GstSDPConnection); impl SDPConnection { pub fn new(nettype: &str, addrtype: &str, address: &str, ttl: u32, addr_number: u32) -> Self { assert_initialized_main_thread!(); unsafe { let mut conn = mem::zeroed(); - ffi::gst_sdp_connection_set( + gst_sdp_sys::gst_sdp_connection_set( &mut conn, nettype.to_glib_none().0, addrtype.to_glib_none().0, @@ -69,7 +69,7 @@ impl Clone for SDPConnection { impl Drop for SDPConnection { fn drop(&mut self) { unsafe { - ffi::gst_sdp_connection_clear(&mut self.0); + gst_sdp_sys::gst_sdp_connection_clear(&mut self.0); } } } diff --git a/gstreamer-sdp/src/sdp_key.rs b/gstreamer-sdp/src/sdp_key.rs index 8b5016534..288e59393 100644 --- a/gstreamer-sdp/src/sdp_key.rs +++ b/gstreamer-sdp/src/sdp_key.rs @@ -9,10 +9,10 @@ use std::ffi::CStr; use std::fmt; -use ffi; +use gst_sdp_sys; #[repr(C)] -pub struct SDPKey(ffi::GstSDPKey); +pub struct SDPKey(gst_sdp_sys::GstSDPKey); impl SDPKey { pub fn type_(&self) -> &str { diff --git a/gstreamer-sdp/src/sdp_media.rs b/gstreamer-sdp/src/sdp_media.rs index 7280a5d05..15a86d449 100644 --- a/gstreamer-sdp/src/sdp_media.rs +++ b/gstreamer-sdp/src/sdp_media.rs @@ -13,10 +13,10 @@ use std::mem; use std::ops; use std::ptr; -use ffi; use glib::translate::*; use gst; use gst::prelude::*; +use gst_sdp_sys; use sdp_attribute::SDPAttribute; use sdp_bandwidth::SDPBandwidth; @@ -25,16 +25,16 @@ use sdp_key::SDPKey; glib_wrapper! { #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] - pub struct SDPMedia(Boxed); + pub struct SDPMedia(Boxed); match fn { copy => |ptr| { let mut copy = ptr::null_mut(); - ffi::gst_sdp_media_copy(ptr as *const ffi::GstSDPMedia, &mut copy); + gst_sdp_sys::gst_sdp_media_copy(ptr as *const gst_sdp_sys::GstSDPMedia, &mut copy); copy }, free => |ptr| { - ffi::gst_sdp_media_free(ptr); + gst_sdp_sys::gst_sdp_media_free(ptr); }, } } @@ -44,7 +44,7 @@ impl SDPMedia { assert_initialized_main_thread!(); unsafe { let mut media = ptr::null_mut(); - ffi::gst_sdp_media_new(&mut media); + gst_sdp_sys::gst_sdp_media_new(&mut media); from_glib_full(media) } } @@ -80,7 +80,7 @@ impl fmt::Display for SDPMedia { } #[repr(C)] -pub struct SDPMediaRef(ffi::GstSDPMedia); +pub struct SDPMediaRef(gst_sdp_sys::GstSDPMedia); impl fmt::Debug for SDPMediaRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -127,12 +127,18 @@ impl SDPMediaRef { pub fn add_attribute<'a, P: Into>>(&mut self, key: &str, value: P) { let value = value.into(); let value = value.to_glib_none(); - unsafe { ffi::gst_sdp_media_add_attribute(&mut self.0, key.to_glib_none().0, value.0) }; + unsafe { + gst_sdp_sys::gst_sdp_media_add_attribute(&mut self.0, key.to_glib_none().0, value.0) + }; } pub fn add_bandwidth(&mut self, bwtype: &str, bandwidth: u32) { unsafe { - ffi::gst_sdp_media_add_bandwidth(&mut self.0, bwtype.to_glib_none().0, bandwidth) + gst_sdp_sys::gst_sdp_media_add_bandwidth( + &mut self.0, + bwtype.to_glib_none().0, + bandwidth, + ) }; } @@ -145,7 +151,7 @@ impl SDPMediaRef { addr_number: u32, ) { unsafe { - ffi::gst_sdp_media_add_connection( + gst_sdp_sys::gst_sdp_media_add_connection( &mut self.0, nettype.to_glib_none().0, addrtype.to_glib_none().0, @@ -157,11 +163,11 @@ impl SDPMediaRef { } pub fn add_format(&mut self, format: &str) { - unsafe { ffi::gst_sdp_media_add_format(&mut self.0, format.to_glib_none().0) }; + unsafe { gst_sdp_sys::gst_sdp_media_add_format(&mut self.0, format.to_glib_none().0) }; } pub fn as_text(&self) -> Option { - unsafe { from_glib_full(ffi::gst_sdp_media_as_text(&self.0)) } + unsafe { from_glib_full(gst_sdp_sys::gst_sdp_media_as_text(&self.0)) } } pub fn attributes(&self) -> AttributesIter { @@ -181,27 +187,28 @@ impl SDPMediaRef { } pub fn attributes_len(&self) -> u32 { - unsafe { ffi::gst_sdp_media_attributes_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_media_attributes_len(&self.0) } } pub fn attributes_to_caps(&self, caps: &mut gst::CapsRef) -> Result<(), ()> { - let result = unsafe { ffi::gst_sdp_media_attributes_to_caps(&self.0, caps.as_mut_ptr()) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_media_attributes_to_caps(&self.0, caps.as_mut_ptr()) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } pub fn bandwidths_len(&self) -> u32 { - unsafe { ffi::gst_sdp_media_bandwidths_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_media_bandwidths_len(&self.0) } } pub fn connections_len(&self) -> u32 { - unsafe { ffi::gst_sdp_media_connections_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_media_connections_len(&self.0) } } pub fn formats_len(&self) -> u32 { - unsafe { ffi::gst_sdp_media_formats_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_media_formats_len(&self.0) } } pub fn get_attribute(&self, idx: u32) -> Option<&SDPAttribute> { @@ -210,7 +217,7 @@ impl SDPMediaRef { } unsafe { - let ptr = ffi::gst_sdp_media_get_attribute(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_media_get_attribute(&self.0, idx); if ptr.is_null() { None } else { @@ -221,7 +228,7 @@ impl SDPMediaRef { pub fn get_attribute_val(&self, key: &str) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_media_get_attribute_val(&self.0, key.to_glib_none().0); + let ptr = gst_sdp_sys::gst_sdp_media_get_attribute_val(&self.0, key.to_glib_none().0); if ptr.is_null() { None } else { @@ -236,7 +243,8 @@ impl SDPMediaRef { pub fn get_attribute_val_n(&self, key: &str, nth: u32) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_media_get_attribute_val_n(&self.0, key.to_glib_none().0, nth); + let ptr = + gst_sdp_sys::gst_sdp_media_get_attribute_val_n(&self.0, key.to_glib_none().0, nth); if ptr.is_null() { None } else { @@ -255,7 +263,7 @@ impl SDPMediaRef { } unsafe { - let ptr = ffi::gst_sdp_media_get_bandwidth(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_media_get_bandwidth(&self.0, idx); if ptr.is_null() { None } else { @@ -265,7 +273,7 @@ impl SDPMediaRef { } pub fn get_caps_from_media(&self, pt: i32) -> Option { - unsafe { from_glib_full(ffi::gst_sdp_media_get_caps_from_media(&self.0, pt)) } + unsafe { from_glib_full(gst_sdp_sys::gst_sdp_media_get_caps_from_media(&self.0, pt)) } } pub fn get_connection(&self, idx: u32) -> Option<&SDPConnection> { @@ -274,7 +282,7 @@ impl SDPMediaRef { } unsafe { - let ptr = ffi::gst_sdp_media_get_connection(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_media_get_connection(&self.0, idx); if ptr.is_null() { None } else { @@ -289,7 +297,7 @@ impl SDPMediaRef { } unsafe { - let ptr = ffi::gst_sdp_media_get_format(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_media_get_format(&self.0, idx); if ptr.is_null() { None } else { @@ -304,7 +312,7 @@ impl SDPMediaRef { pub fn get_information(&self) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_media_get_information(&self.0); + let ptr = gst_sdp_sys::gst_sdp_media_get_information(&self.0); if ptr.is_null() { None } else { @@ -319,7 +327,7 @@ impl SDPMediaRef { pub fn get_key(&self) -> Option<&SDPKey> { unsafe { - let ptr = ffi::gst_sdp_media_get_key(&self.0); + let ptr = gst_sdp_sys::gst_sdp_media_get_key(&self.0); if ptr.is_null() { None } else { @@ -330,7 +338,7 @@ impl SDPMediaRef { pub fn get_media(&self) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_media_get_media(&self.0); + let ptr = gst_sdp_sys::gst_sdp_media_get_media(&self.0); if ptr.is_null() { None } else { @@ -344,16 +352,16 @@ impl SDPMediaRef { } pub fn get_num_ports(&self) -> u32 { - unsafe { ffi::gst_sdp_media_get_num_ports(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_media_get_num_ports(&self.0) } } pub fn get_port(&self) -> u32 { - unsafe { ffi::gst_sdp_media_get_port(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_media_get_port(&self.0) } } pub fn get_proto(&self) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_media_get_proto(&self.0); + let ptr = gst_sdp_sys::gst_sdp_media_get_proto(&self.0); if ptr.is_null() { None } else { @@ -374,10 +382,11 @@ impl SDPMediaRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = unsafe { ffi::gst_sdp_media_insert_attribute(&mut self.0, idx, &mut attr.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_media_insert_attribute(&mut self.0, idx, &mut attr.0) }; mem::forget(attr); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -390,10 +399,11 @@ impl SDPMediaRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = unsafe { ffi::gst_sdp_media_insert_bandwidth(&mut self.0, idx, &mut bw.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_media_insert_bandwidth(&mut self.0, idx, &mut bw.0) }; mem::forget(bw); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -410,10 +420,11 @@ impl SDPMediaRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = unsafe { ffi::gst_sdp_media_insert_connection(&mut self.0, idx, &mut conn.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_media_insert_connection(&mut self.0, idx, &mut conn.0) }; mem::forget(conn); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -426,10 +437,11 @@ impl SDPMediaRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = - unsafe { ffi::gst_sdp_media_insert_format(&mut self.0, idx, format.to_glib_none().0) }; + let result = unsafe { + gst_sdp_sys::gst_sdp_media_insert_format(&mut self.0, idx, format.to_glib_none().0) + }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -439,9 +451,9 @@ impl SDPMediaRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_media_remove_attribute(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_media_remove_attribute(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -451,9 +463,9 @@ impl SDPMediaRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_media_remove_bandwidth(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_media_remove_bandwidth(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -463,9 +475,9 @@ impl SDPMediaRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_media_remove_connection(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_media_remove_connection(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -475,9 +487,9 @@ impl SDPMediaRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_media_remove_format(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_media_remove_format(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -487,10 +499,11 @@ impl SDPMediaRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_media_replace_attribute(&mut self.0, idx, &mut attr.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_media_replace_attribute(&mut self.0, idx, &mut attr.0) }; mem::forget(attr); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -500,10 +513,11 @@ impl SDPMediaRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_media_replace_bandwidth(&mut self.0, idx, &mut bw.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_media_replace_bandwidth(&mut self.0, idx, &mut bw.0) }; mem::forget(bw); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -514,10 +528,10 @@ impl SDPMediaRef { } let result = - unsafe { ffi::gst_sdp_media_replace_connection(&mut self.0, idx, &mut conn.0) }; + unsafe { gst_sdp_sys::gst_sdp_media_replace_connection(&mut self.0, idx, &mut conn.0) }; mem::forget(conn); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -527,46 +541,53 @@ impl SDPMediaRef { return Err(()); } - let result = - unsafe { ffi::gst_sdp_media_replace_format(&mut self.0, idx, format.to_glib_none().0) }; + let result = unsafe { + gst_sdp_sys::gst_sdp_media_replace_format(&mut self.0, idx, format.to_glib_none().0) + }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } pub fn set_information(&mut self, information: &str) { - unsafe { ffi::gst_sdp_media_set_information(&mut self.0, information.to_glib_none().0) }; + unsafe { + gst_sdp_sys::gst_sdp_media_set_information(&mut self.0, information.to_glib_none().0) + }; } pub fn set_key(&mut self, type_: &str, data: &str) { unsafe { - ffi::gst_sdp_media_set_key(&mut self.0, type_.to_glib_none().0, data.to_glib_none().0) + gst_sdp_sys::gst_sdp_media_set_key( + &mut self.0, + type_.to_glib_none().0, + data.to_glib_none().0, + ) }; } pub fn set_media(&mut self, med: &str) { - unsafe { ffi::gst_sdp_media_set_media(&mut self.0, med.to_glib_none().0) }; + unsafe { gst_sdp_sys::gst_sdp_media_set_media(&mut self.0, med.to_glib_none().0) }; } pub fn set_port_info(&mut self, port: u32, num_ports: u32) { - unsafe { ffi::gst_sdp_media_set_port_info(&mut self.0, port, num_ports) }; + unsafe { gst_sdp_sys::gst_sdp_media_set_port_info(&mut self.0, port, num_ports) }; } pub fn set_proto(&mut self, proto: &str) { - unsafe { ffi::gst_sdp_media_set_proto(&mut self.0, proto.to_glib_none().0) }; + unsafe { gst_sdp_sys::gst_sdp_media_set_proto(&mut self.0, proto.to_glib_none().0) }; } pub fn set_media_from_caps(caps: &gst::Caps, media: &mut SDPMedia) -> Result<(), ()> { assert_initialized_main_thread!(); let result = unsafe { - ffi::gst_sdp_media_set_media_from_caps( + gst_sdp_sys::gst_sdp_media_set_media_from_caps( caps.to_glib_none().0, media.to_glib_none_mut().0, ) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -590,7 +611,7 @@ impl ToOwned for SDPMediaRef { fn to_owned(&self) -> SDPMedia { unsafe { let mut ptr = ptr::null_mut(); - ffi::gst_sdp_media_copy(&self.0, &mut ptr); + gst_sdp_sys::gst_sdp_media_copy(&self.0, &mut ptr); from_glib_full(ptr) } } diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index 6d0049464..1f181d184 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -13,11 +13,11 @@ use std::mem; use std::ops; use std::ptr; -use ffi; use glib::translate::*; -use gobject_ffi; +use gobject_sys; use gst; use gst::MiniObject; +use gst_sdp_sys; use sdp_attribute::SDPAttribute; use sdp_bandwidth::SDPBandwidth; @@ -31,12 +31,12 @@ use sdp_zone::SDPZone; glib_wrapper! { #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] - pub struct SDPMessage(Boxed); + pub struct SDPMessage(Boxed); match fn { - copy => |ptr| gobject_ffi::g_boxed_copy(ffi::gst_sdp_message_get_type(), ptr as *mut _) as *mut ffi::GstSDPMessage, - free => |ptr| gobject_ffi::g_boxed_free(ffi::gst_sdp_message_get_type(), ptr as *mut _), - get_type => || ffi::gst_sdp_message_get_type(), + copy => |ptr| gobject_sys::g_boxed_copy(gst_sdp_sys::gst_sdp_message_get_type(), ptr as *mut _) as *mut gst_sdp_sys::GstSDPMessage, + free => |ptr| gobject_sys::g_boxed_free(gst_sdp_sys::gst_sdp_message_get_type(), ptr as *mut _), + get_type => || gst_sdp_sys::gst_sdp_message_get_type(), } } @@ -80,7 +80,7 @@ impl SDPMessage { assert_initialized_main_thread!(); unsafe { let mut msg = mem::zeroed(); - ffi::gst_sdp_message_new(&mut msg); + gst_sdp_sys::gst_sdp_message_new(&mut msg); from_glib_full(msg) } } @@ -90,12 +90,13 @@ impl SDPMessage { unsafe { let size = data.len() as u32; let mut msg = mem::zeroed(); - ffi::gst_sdp_message_new(&mut msg); - let result = ffi::gst_sdp_message_parse_buffer(data.to_glib_none().0, size, msg); + gst_sdp_sys::gst_sdp_message_new(&mut msg); + let result = + gst_sdp_sys::gst_sdp_message_parse_buffer(data.to_glib_none().0, size, msg); match result { - ffi::GST_SDP_OK => Ok(from_glib_full(msg)), + gst_sdp_sys::GST_SDP_OK => Ok(from_glib_full(msg)), _ => { - ffi::gst_sdp_message_uninit(msg); + gst_sdp_sys::gst_sdp_message_uninit(msg); Err(()) } } @@ -106,12 +107,12 @@ impl SDPMessage { assert_initialized_main_thread!(); unsafe { let mut msg = mem::zeroed(); - ffi::gst_sdp_message_new(&mut msg); - let result = ffi::gst_sdp_message_parse_uri(uri.to_glib_none().0, msg); + gst_sdp_sys::gst_sdp_message_new(&mut msg); + let result = gst_sdp_sys::gst_sdp_message_parse_uri(uri.to_glib_none().0, msg); match result { - ffi::GST_SDP_OK => Ok(from_glib_full(msg)), + gst_sdp_sys::GST_SDP_OK => Ok(from_glib_full(msg)), _ => { - ffi::gst_sdp_message_uninit(msg); + gst_sdp_sys::gst_sdp_message_uninit(msg); Err(()) } } @@ -120,7 +121,7 @@ impl SDPMessage { } #[repr(C)] -pub struct SDPMessageRef(ffi::GstSDPMessage); +pub struct SDPMessageRef(gst_sdp_sys::GstSDPMessage); impl fmt::Debug for SDPMessageRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -170,7 +171,7 @@ unsafe impl Sync for SDPMessageRef {} impl SDPMessageRef { pub fn add_attribute<'a, P: Into>>(&mut self, key: &str, value: P) { unsafe { - ffi::gst_sdp_message_add_attribute( + gst_sdp_sys::gst_sdp_message_add_attribute( &mut self.0, key.to_glib_none().0, value.into().to_glib_none().0, @@ -179,25 +180,25 @@ impl SDPMessageRef { } pub fn add_email(&mut self, email: &str) { - unsafe { ffi::gst_sdp_message_add_email(&mut self.0, email.to_glib_none().0) }; + unsafe { gst_sdp_sys::gst_sdp_message_add_email(&mut self.0, email.to_glib_none().0) }; } pub fn add_media(&mut self, media: SDPMedia) { unsafe { - ffi::gst_sdp_message_add_media( + gst_sdp_sys::gst_sdp_message_add_media( &mut self.0, - media.to_glib_none().0 as *mut ffi::GstSDPMedia, + media.to_glib_none().0 as *mut gst_sdp_sys::GstSDPMedia, ); } } pub fn add_phone(&mut self, phone: &str) { - unsafe { ffi::gst_sdp_message_add_phone(&mut self.0, phone.to_glib_none().0) }; + unsafe { gst_sdp_sys::gst_sdp_message_add_phone(&mut self.0, phone.to_glib_none().0) }; } pub fn add_time(&mut self, start: &str, stop: &str, repeat: &[&str]) { unsafe { - ffi::gst_sdp_message_add_time( + gst_sdp_sys::gst_sdp_message_add_time( &mut self.0, start.to_glib_none().0, stop.to_glib_none().0, @@ -208,7 +209,7 @@ impl SDPMessageRef { pub fn add_zone(&mut self, adj_time: &str, typed_time: &str) { unsafe { - ffi::gst_sdp_message_add_zone( + gst_sdp_sys::gst_sdp_message_add_zone( &mut self.0, adj_time.to_glib_none().0, typed_time.to_glib_none().0, @@ -217,31 +218,32 @@ impl SDPMessageRef { } pub fn as_text(&self) -> Option { - unsafe { from_glib_full(ffi::gst_sdp_message_as_text(&self.0)) } + unsafe { from_glib_full(gst_sdp_sys::gst_sdp_message_as_text(&self.0)) } } pub fn attributes_len(&self) -> u32 { - unsafe { ffi::gst_sdp_message_attributes_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_message_attributes_len(&self.0) } } pub fn attributes_to_caps(&self, caps: &mut gst::CapsRef) -> Result<(), ()> { - let result = unsafe { ffi::gst_sdp_message_attributes_to_caps(&self.0, caps.as_mut_ptr()) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_message_attributes_to_caps(&self.0, caps.as_mut_ptr()) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } pub fn bandwidths_len(&self) -> u32 { - unsafe { ffi::gst_sdp_message_bandwidths_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_message_bandwidths_len(&self.0) } } pub fn dump(&self) { - unsafe { ffi::gst_sdp_message_dump(&self.0) }; + unsafe { gst_sdp_sys::gst_sdp_message_dump(&self.0) }; } pub fn emails_len(&self) -> u32 { - unsafe { ffi::gst_sdp_message_emails_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_message_emails_len(&self.0) } } pub fn get_attribute(&self, idx: u32) -> Option<&SDPAttribute> { @@ -250,7 +252,7 @@ impl SDPMessageRef { } unsafe { - let ptr = ffi::gst_sdp_message_get_attribute(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_message_get_attribute(&self.0, idx); if ptr.is_null() { None } else { @@ -261,7 +263,7 @@ impl SDPMessageRef { pub fn get_attribute_val(&self, key: &str) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_message_get_attribute_val(&self.0, key.to_glib_none().0); + let ptr = gst_sdp_sys::gst_sdp_message_get_attribute_val(&self.0, key.to_glib_none().0); if ptr.is_null() { None } else { @@ -276,7 +278,11 @@ impl SDPMessageRef { pub fn get_attribute_val_n(&self, key: &str, nth: u32) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_message_get_attribute_val_n(&self.0, key.to_glib_none().0, nth); + let ptr = gst_sdp_sys::gst_sdp_message_get_attribute_val_n( + &self.0, + key.to_glib_none().0, + nth, + ); if ptr.is_null() { None } else { @@ -295,7 +301,7 @@ impl SDPMessageRef { } unsafe { - let ptr = ffi::gst_sdp_message_get_bandwidth(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_message_get_bandwidth(&self.0, idx); if ptr.is_null() { None } else { @@ -306,7 +312,7 @@ impl SDPMessageRef { pub fn get_connection(&self) -> Option<&SDPConnection> { unsafe { - let ptr = ffi::gst_sdp_message_get_connection(&self.0); + let ptr = gst_sdp_sys::gst_sdp_message_get_connection(&self.0); if ptr.is_null() { None } else { @@ -321,7 +327,7 @@ impl SDPMessageRef { } unsafe { - let ptr = ffi::gst_sdp_message_get_email(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_message_get_email(&self.0, idx); if ptr.is_null() { None } else { @@ -336,7 +342,7 @@ impl SDPMessageRef { pub fn get_information(&self) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_message_get_information(&self.0); + let ptr = gst_sdp_sys::gst_sdp_message_get_information(&self.0); if ptr.is_null() { None } else { @@ -351,7 +357,7 @@ impl SDPMessageRef { pub fn get_key(&self) -> Option<&SDPKey> { unsafe { - let ptr = ffi::gst_sdp_message_get_key(&self.0); + let ptr = gst_sdp_sys::gst_sdp_message_get_key(&self.0); if ptr.is_null() { None } else { @@ -366,7 +372,7 @@ impl SDPMessageRef { } unsafe { - let ptr = ffi::gst_sdp_message_get_media(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_message_get_media(&self.0, idx); if ptr.is_null() { None } else { @@ -377,7 +383,7 @@ impl SDPMessageRef { pub fn get_origin(&self) -> Option<&SDPOrigin> { unsafe { - let ptr = ffi::gst_sdp_message_get_origin(&self.0); + let ptr = gst_sdp_sys::gst_sdp_message_get_origin(&self.0); if ptr.is_null() { None } else { @@ -392,7 +398,7 @@ impl SDPMessageRef { } unsafe { - let ptr = ffi::gst_sdp_message_get_phone(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_message_get_phone(&self.0, idx); if ptr.is_null() { None } else { @@ -407,7 +413,7 @@ impl SDPMessageRef { pub fn get_session_name(&self) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_message_get_session_name(&self.0); + let ptr = gst_sdp_sys::gst_sdp_message_get_session_name(&self.0); if ptr.is_null() { None } else { @@ -426,7 +432,7 @@ impl SDPMessageRef { } unsafe { - let ptr = ffi::gst_sdp_message_get_time(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_message_get_time(&self.0, idx); if ptr.is_null() { None } else { @@ -437,7 +443,7 @@ impl SDPMessageRef { pub fn get_uri(&self) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_message_get_uri(&self.0); + let ptr = gst_sdp_sys::gst_sdp_message_get_uri(&self.0); if ptr.is_null() { None } else { @@ -452,7 +458,7 @@ impl SDPMessageRef { pub fn get_version(&self) -> Option<&str> { unsafe { - let ptr = ffi::gst_sdp_message_get_version(&self.0); + let ptr = gst_sdp_sys::gst_sdp_message_get_version(&self.0); if ptr.is_null() { None } else { @@ -471,7 +477,7 @@ impl SDPMessageRef { } unsafe { - let ptr = ffi::gst_sdp_message_get_zone(&self.0, idx); + let ptr = gst_sdp_sys::gst_sdp_message_get_zone(&self.0, idx); if ptr.is_null() { None } else { @@ -489,10 +495,10 @@ impl SDPMessageRef { let idx = idx.map(|idx| idx as i32).unwrap_or(-1); let result = - unsafe { ffi::gst_sdp_message_insert_attribute(&mut self.0, idx, &mut attr.0) }; + unsafe { gst_sdp_sys::gst_sdp_message_insert_attribute(&mut self.0, idx, &mut attr.0) }; mem::forget(attr); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -505,10 +511,11 @@ impl SDPMessageRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = unsafe { ffi::gst_sdp_message_insert_bandwidth(&mut self.0, idx, &mut bw.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_message_insert_bandwidth(&mut self.0, idx, &mut bw.0) }; mem::forget(bw); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -521,10 +528,11 @@ impl SDPMessageRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = - unsafe { ffi::gst_sdp_message_insert_email(&mut self.0, idx, email.to_glib_none().0) }; + let result = unsafe { + gst_sdp_sys::gst_sdp_message_insert_email(&mut self.0, idx, email.to_glib_none().0) + }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -537,10 +545,11 @@ impl SDPMessageRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = - unsafe { ffi::gst_sdp_message_insert_phone(&mut self.0, idx, phone.to_glib_none().0) }; + let result = unsafe { + gst_sdp_sys::gst_sdp_message_insert_phone(&mut self.0, idx, phone.to_glib_none().0) + }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -553,10 +562,11 @@ impl SDPMessageRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = unsafe { ffi::gst_sdp_message_insert_time(&mut self.0, idx, &mut time.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_message_insert_time(&mut self.0, idx, &mut time.0) }; mem::forget(time); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -569,20 +579,21 @@ impl SDPMessageRef { } let idx = idx.map(|idx| idx as i32).unwrap_or(-1); - let result = unsafe { ffi::gst_sdp_message_insert_zone(&mut self.0, idx, &mut zone.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_message_insert_zone(&mut self.0, idx, &mut zone.0) }; mem::forget(zone); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } pub fn medias_len(&self) -> u32 { - unsafe { ffi::gst_sdp_message_medias_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_message_medias_len(&self.0) } } pub fn phones_len(&self) -> u32 { - unsafe { ffi::gst_sdp_message_phones_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_message_phones_len(&self.0) } } pub fn remove_attribute(&mut self, idx: u32) -> Result<(), ()> { @@ -590,9 +601,9 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_remove_attribute(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_message_remove_attribute(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -602,9 +613,9 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_remove_bandwidth(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_message_remove_bandwidth(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -614,9 +625,9 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_remove_email(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_message_remove_email(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -626,9 +637,9 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_remove_phone(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_message_remove_phone(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -638,9 +649,9 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_remove_time(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_message_remove_time(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -650,9 +661,9 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_remove_zone(&mut self.0, idx) }; + let result = unsafe { gst_sdp_sys::gst_sdp_message_remove_zone(&mut self.0, idx) }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -662,11 +673,12 @@ impl SDPMessageRef { return Err(()); } - let result = - unsafe { ffi::gst_sdp_message_replace_attribute(&mut self.0, idx, &mut attr.0) }; + let result = unsafe { + gst_sdp_sys::gst_sdp_message_replace_attribute(&mut self.0, idx, &mut attr.0) + }; mem::forget(attr); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -676,10 +688,11 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_replace_bandwidth(&mut self.0, idx, &mut bw.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_message_replace_bandwidth(&mut self.0, idx, &mut bw.0) }; mem::forget(bw); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -689,10 +702,11 @@ impl SDPMessageRef { return Err(()); } - let result = - unsafe { ffi::gst_sdp_message_replace_email(&mut self.0, idx, email.to_glib_none().0) }; + let result = unsafe { + gst_sdp_sys::gst_sdp_message_replace_email(&mut self.0, idx, email.to_glib_none().0) + }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -702,10 +716,11 @@ impl SDPMessageRef { return Err(()); } - let result = - unsafe { ffi::gst_sdp_message_replace_phone(&mut self.0, idx, phone.to_glib_none().0) }; + let result = unsafe { + gst_sdp_sys::gst_sdp_message_replace_phone(&mut self.0, idx, phone.to_glib_none().0) + }; match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -715,10 +730,11 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_replace_time(&mut self.0, idx, &mut time.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_message_replace_time(&mut self.0, idx, &mut time.0) }; mem::forget(time); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -728,10 +744,11 @@ impl SDPMessageRef { return Err(()); } - let result = unsafe { ffi::gst_sdp_message_replace_zone(&mut self.0, idx, &mut zone.0) }; + let result = + unsafe { gst_sdp_sys::gst_sdp_message_replace_zone(&mut self.0, idx, &mut zone.0) }; mem::forget(zone); match result { - ffi::GST_SDP_OK => Ok(()), + gst_sdp_sys::GST_SDP_OK => Ok(()), _ => Err(()), } } @@ -745,7 +762,7 @@ impl SDPMessageRef { addr_number: u32, ) { unsafe { - ffi::gst_sdp_message_set_connection( + gst_sdp_sys::gst_sdp_message_set_connection( &mut self.0, nettype.to_glib_none().0, addrtype.to_glib_none().0, @@ -757,12 +774,18 @@ impl SDPMessageRef { } pub fn set_information(&mut self, information: &str) { - unsafe { ffi::gst_sdp_message_set_information(&mut self.0, information.to_glib_none().0) }; + unsafe { + gst_sdp_sys::gst_sdp_message_set_information(&mut self.0, information.to_glib_none().0) + }; } pub fn set_key(&mut self, type_: &str, data: &str) { unsafe { - ffi::gst_sdp_message_set_key(&mut self.0, type_.to_glib_none().0, data.to_glib_none().0) + gst_sdp_sys::gst_sdp_message_set_key( + &mut self.0, + type_.to_glib_none().0, + data.to_glib_none().0, + ) }; } @@ -776,7 +799,7 @@ impl SDPMessageRef { addr: &str, ) { unsafe { - ffi::gst_sdp_message_set_origin( + gst_sdp_sys::gst_sdp_message_set_origin( &mut self.0, username.to_glib_none().0, sess_id.to_glib_none().0, @@ -790,30 +813,33 @@ impl SDPMessageRef { pub fn set_session_name(&mut self, session_name: &str) { unsafe { - ffi::gst_sdp_message_set_session_name(&mut self.0, session_name.to_glib_none().0) + gst_sdp_sys::gst_sdp_message_set_session_name( + &mut self.0, + session_name.to_glib_none().0, + ) }; } pub fn set_uri(&mut self, uri: &str) { - unsafe { ffi::gst_sdp_message_set_uri(&mut self.0, uri.to_glib_none().0) }; + unsafe { gst_sdp_sys::gst_sdp_message_set_uri(&mut self.0, uri.to_glib_none().0) }; } pub fn set_version(&mut self, version: &str) { - unsafe { ffi::gst_sdp_message_set_version(&mut self.0, version.to_glib_none().0) }; + unsafe { gst_sdp_sys::gst_sdp_message_set_version(&mut self.0, version.to_glib_none().0) }; } pub fn times_len(&self) -> u32 { - unsafe { ffi::gst_sdp_message_times_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_message_times_len(&self.0) } } pub fn zones_len(&self) -> u32 { - unsafe { ffi::gst_sdp_message_zones_len(&self.0) } + unsafe { gst_sdp_sys::gst_sdp_message_zones_len(&self.0) } } pub fn as_uri(&self, scheme: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_sdp_message_as_uri( + from_glib_full(gst_sdp_sys::gst_sdp_message_as_uri( scheme.to_glib_none().0, &self.0, )) @@ -867,7 +893,7 @@ impl ToOwned for SDPMessageRef { fn to_owned(&self) -> SDPMessage { unsafe { let mut ptr = ptr::null_mut(); - ffi::gst_sdp_message_copy(&self.0, &mut ptr); + gst_sdp_sys::gst_sdp_message_copy(&self.0, &mut ptr); from_glib_full(ptr) } } diff --git a/gstreamer-sdp/src/sdp_origin.rs b/gstreamer-sdp/src/sdp_origin.rs index 3e96fc99b..011bc5394 100644 --- a/gstreamer-sdp/src/sdp_origin.rs +++ b/gstreamer-sdp/src/sdp_origin.rs @@ -9,10 +9,10 @@ use std::ffi::CStr; use std::fmt; -use ffi; +use gst_sdp_sys; #[repr(C)] -pub struct SDPOrigin(pub(crate) ffi::GstSDPOrigin); +pub struct SDPOrigin(pub(crate) gst_sdp_sys::GstSDPOrigin); impl SDPOrigin { pub fn username(&self) -> &str { diff --git a/gstreamer-sdp/src/sdp_time.rs b/gstreamer-sdp/src/sdp_time.rs index 1e548319b..985e918c5 100644 --- a/gstreamer-sdp/src/sdp_time.rs +++ b/gstreamer-sdp/src/sdp_time.rs @@ -11,18 +11,18 @@ use std::fmt; use std::mem; use std::os::raw::c_char; -use ffi; use glib::translate::*; +use gst_sdp_sys; #[repr(C)] -pub struct SDPTime(pub(crate) ffi::GstSDPTime); +pub struct SDPTime(pub(crate) gst_sdp_sys::GstSDPTime); impl SDPTime { pub fn new(start: &str, stop: &str, repeat: &[&str]) -> Self { assert_initialized_main_thread!(); unsafe { let mut time = mem::zeroed(); - ffi::gst_sdp_time_set( + gst_sdp_sys::gst_sdp_time_set( &mut time, start.to_glib_none().0, stop.to_glib_none().0, @@ -63,7 +63,7 @@ impl Clone for SDPTime { impl Drop for SDPTime { fn drop(&mut self) { unsafe { - ffi::gst_sdp_time_clear(&mut self.0); + gst_sdp_sys::gst_sdp_time_clear(&mut self.0); } } } diff --git a/gstreamer-sdp/src/sdp_zone.rs b/gstreamer-sdp/src/sdp_zone.rs index 1a48b4565..bcfa9c493 100644 --- a/gstreamer-sdp/src/sdp_zone.rs +++ b/gstreamer-sdp/src/sdp_zone.rs @@ -10,18 +10,18 @@ use std::ffi::CStr; use std::fmt; use std::mem; -use ffi; use glib::translate::*; +use gst_sdp_sys; #[repr(C)] -pub struct SDPZone(pub(crate) ffi::GstSDPZone); +pub struct SDPZone(pub(crate) gst_sdp_sys::GstSDPZone); impl SDPZone { pub fn new(time: &str, typed_time: &str) -> Self { assert_initialized_main_thread!(); unsafe { let mut zone = mem::zeroed(); - ffi::gst_sdp_zone_set( + gst_sdp_sys::gst_sdp_zone_set( &mut zone, time.to_glib_none().0, typed_time.to_glib_none().0, @@ -48,7 +48,7 @@ impl Clone for SDPZone { impl Drop for SDPZone { fn drop(&mut self) { unsafe { - ffi::gst_sdp_zone_clear(&mut self.0); + gst_sdp_sys::gst_sdp_zone_clear(&mut self.0); } } } diff --git a/gstreamer-video/src/functions.rs b/gstreamer-video/src/functions.rs index b5c42376c..2c8b972a5 100644 --- a/gstreamer-video/src/functions.rs +++ b/gstreamer-video/src/functions.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gst_ffi; +use glib_sys; +use gst_sys; +use gst_video_sys; use glib; use glib::translate::{from_glib_full, ToGlib, ToGlibPtr}; @@ -24,7 +24,7 @@ pub fn convert_sample( ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_video_convert_sample( + let ret = gst_video_sys::gst_video_convert_sample( sample.to_glib_none().0, caps.to_glib_none().0, timeout.to_glib(), @@ -73,9 +73,9 @@ unsafe fn convert_sample_async_unsafe( F: FnOnce(Result) + 'static, { unsafe extern "C" fn convert_sample_async_trampoline( - sample: *mut gst_ffi::GstSample, - error: *mut glib_ffi::GError, - user_data: glib_ffi::gpointer, + sample: *mut gst_sys::GstSample, + error: *mut glib_sys::GError, + user_data: glib_sys::gpointer, ) where F: FnOnce(Result) + 'static, { @@ -88,7 +88,7 @@ unsafe fn convert_sample_async_unsafe( callback(Err(from_glib_full(error))) } } - unsafe extern "C" fn convert_sample_async_free(user_data: glib_ffi::gpointer) + unsafe extern "C" fn convert_sample_async_free(user_data: glib_sys::gpointer) where F: FnOnce(Result) + 'static, { @@ -97,12 +97,12 @@ unsafe fn convert_sample_async_unsafe( let user_data: Box> = Box::new(Some(func)); - ffi::gst_video_convert_sample_async( + gst_video_sys::gst_video_convert_sample_async( sample.to_glib_none().0, caps.to_glib_none().0, timeout.to_glib(), Some(convert_sample_async_trampoline::), - Box::into_raw(user_data) as glib_ffi::gpointer, + Box::into_raw(user_data) as glib_sys::gpointer, Some(mem::transmute(convert_sample_async_free:: as usize)), ); } diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index a76d0f3a7..09ce563de 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -12,18 +12,18 @@ extern crate libc; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; #[macro_use] extern crate gstreamer as gst; extern crate gstreamer_base as gst_base; -extern crate gstreamer_base_sys as gst_base_ffi; -extern crate gstreamer_sys as gst_ffi; -extern crate gstreamer_video_sys as ffi; +extern crate gstreamer_base_sys as gst_base_sys; +extern crate gstreamer_sys as gst_sys; +extern crate gstreamer_video_sys as gst_video_sys; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-video/src/video_event.rs b/gstreamer-video/src/video_event.rs index ad8d271ed..fd89ba27a 100644 --- a/gstreamer-video/src/video_event.rs +++ b/gstreamer-video/src/video_event.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use gst_ffi; +use gst_sys; +use gst_video_sys; use glib::translate::{from_glib, from_glib_full, ToGlib}; use glib::ToSendValue; @@ -16,7 +16,11 @@ use gst::MiniObject; use std::mem; pub fn is_force_key_unit_event(event: &gst::EventRef) -> bool { - unsafe { from_glib(ffi::gst_video_event_is_force_key_unit(event.as_mut_ptr())) } + unsafe { + from_glib(gst_video_sys::gst_video_event_is_force_key_unit( + event.as_mut_ptr(), + )) + } } // FIXME: Copy from gstreamer/src/event.rs @@ -50,16 +54,16 @@ macro_rules! event_builder_generic_impl { unsafe { let event = $new_fn(&mut self); if let Some(seqnum) = self.seqnum { - gst_ffi::gst_event_set_seqnum(event, seqnum.to_glib()); + gst_sys::gst_event_set_seqnum(event, seqnum.to_glib()); } if let Some(running_time_offset) = self.running_time_offset { - gst_ffi::gst_event_set_running_time_offset(event, running_time_offset); + gst_sys::gst_event_set_running_time_offset(event, running_time_offset); } { let s = gst::StructureRef::from_glib_borrow_mut( - gst_ffi::gst_event_writable_structure(event) + gst_sys::gst_event_writable_structure(event) ); for (k, v) in self.other_fields { @@ -132,15 +136,15 @@ impl<'a> DownstreamForceKeyUnitEventBuilder<'a> { Self { count, ..self } } - event_builder_generic_impl!( - |s: &mut Self| ffi::gst_video_event_new_downstream_force_key_unit( + event_builder_generic_impl!(|s: &mut Self| { + gst_video_sys::gst_video_event_new_downstream_force_key_unit( s.timestamp.to_glib(), s.stream_time.to_glib(), s.running_time.to_glib(), s.all_headers.to_glib(), s.count, ) - ); + }); } #[derive(Clone, PartialEq, Eq, Debug)] @@ -162,14 +166,16 @@ pub fn parse_downstream_force_key_unit_event( let mut all_headers = mem::uninitialized(); let mut count = mem::uninitialized(); - let res: bool = from_glib(ffi::gst_video_event_parse_downstream_force_key_unit( - event.as_mut_ptr(), - &mut timestamp, - &mut stream_time, - &mut running_time, - &mut all_headers, - &mut count, - )); + let res: bool = from_glib( + gst_video_sys::gst_video_event_parse_downstream_force_key_unit( + event.as_mut_ptr(), + &mut timestamp, + &mut stream_time, + &mut running_time, + &mut all_headers, + &mut count, + ), + ); if res { Some(DownstreamForceKeyUnitEvent { timestamp: from_glib(timestamp), @@ -228,13 +234,13 @@ impl<'a> UpstreamForceKeyUnitEventBuilder<'a> { Self { count, ..self } } - event_builder_generic_impl!( - |s: &mut Self| ffi::gst_video_event_new_upstream_force_key_unit( + event_builder_generic_impl!(|s: &mut Self| { + gst_video_sys::gst_video_event_new_upstream_force_key_unit( s.running_time.to_glib(), s.all_headers.to_glib(), s.count, ) - ); + }); } #[derive(Clone, PartialEq, Eq, Debug)] @@ -252,12 +258,14 @@ pub fn parse_upstream_force_key_unit_event( let mut all_headers = mem::uninitialized(); let mut count = mem::uninitialized(); - let res: bool = from_glib(ffi::gst_video_event_parse_upstream_force_key_unit( - event.as_mut_ptr(), - &mut running_time, - &mut all_headers, - &mut count, - )); + let res: bool = from_glib( + gst_video_sys::gst_video_event_parse_upstream_force_key_unit( + event.as_mut_ptr(), + &mut running_time, + &mut all_headers, + &mut count, + ), + ); if res { Some(UpstreamForceKeyUnitEvent { running_time: from_glib(running_time), @@ -306,9 +314,9 @@ impl<'a> StillFrameEventBuilder<'a> { } } - event_builder_generic_impl!(|s: &mut Self| ffi::gst_video_event_new_still_frame( - s.in_still.to_glib() - )); + event_builder_generic_impl!( + |s: &mut Self| gst_video_sys::gst_video_event_new_still_frame(s.in_still.to_glib()) + ); } #[derive(Clone, PartialEq, Eq, Debug)] @@ -320,7 +328,7 @@ pub fn parse_still_frame_event(event: &gst::EventRef) -> Option unsafe { let mut in_still = mem::uninitialized(); - let res: bool = from_glib(ffi::gst_video_event_parse_still_frame( + let res: bool = from_glib(gst_video_sys::gst_video_event_parse_still_frame( event.as_mut_ptr(), &mut in_still, )); diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index 44feda1eb..68c262c19 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_video_sys; use std::ffi::CStr; use std::fmt; @@ -49,13 +49,17 @@ impl ::VideoFormat { pub fn from_string(s: &str) -> ::VideoFormat { assert_initialized_main_thread!(); - unsafe { from_glib(ffi::gst_video_format_from_string(s.to_glib_none().0)) } + unsafe { + from_glib(gst_video_sys::gst_video_format_from_string( + s.to_glib_none().0, + )) + } } pub fn from_fourcc(fourcc: u32) -> ::VideoFormat { assert_initialized_main_thread!(); - unsafe { from_glib(ffi::gst_video_format_from_fourcc(fourcc)) } + unsafe { from_glib(gst_video_sys::gst_video_format_from_fourcc(fourcc)) } } pub fn from_masks( @@ -70,7 +74,7 @@ impl ::VideoFormat { assert_initialized_main_thread!(); unsafe { - from_glib(ffi::gst_video_format_from_masks( + from_glib(gst_video_sys::gst_video_format_from_masks( depth as i32, bpp as i32, endianness.to_glib(), @@ -88,7 +92,7 @@ impl ::VideoFormat { } unsafe { - CStr::from_ptr(ffi::gst_video_format_to_string(self.to_glib())) + CStr::from_ptr(gst_video_sys::gst_video_format_to_string(self.to_glib())) .to_str() .unwrap() } diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index 2ddec75ea..0b6629bf1 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_video_sys; use std::ffi::CStr; use std::fmt; @@ -15,14 +15,14 @@ use std::str; use glib; use glib::translate::{from_glib, ToGlib}; -pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo); +pub struct VideoFormatInfo(&'static gst_video_sys::GstVideoFormatInfo); impl VideoFormatInfo { pub fn from_format(format: ::VideoFormat) -> VideoFormatInfo { assert_initialized_main_thread!(); unsafe { - let info = ffi::gst_video_format_get_info(format.to_glib()); + let info = gst_video_sys::gst_video_format_get_info(format.to_glib()); assert!(!info.is_null()); VideoFormatInfo(&*info) @@ -106,35 +106,35 @@ impl VideoFormatInfo { } pub fn has_alpha(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_ALPHA != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_ALPHA != 0 } pub fn has_palette(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_PALETTE != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_PALETTE != 0 } pub fn is_complex(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_COMPLEX != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_COMPLEX != 0 } pub fn is_gray(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_GRAY != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_GRAY != 0 } pub fn is_le(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_LE != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_LE != 0 } pub fn is_rgb(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_RGB != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_RGB != 0 } pub fn is_tiled(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_TILED != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_TILED != 0 } pub fn is_yuv(&self) -> bool { - self.0.flags & ffi::GST_VIDEO_FORMAT_FLAG_YUV != 0 + self.0.flags & gst_video_sys::GST_VIDEO_FORMAT_FLAG_YUV != 0 } pub fn scale_width(&self, component: u8, width: u32) -> u32 { @@ -190,26 +190,30 @@ impl From<::VideoFormat> for VideoFormatInfo { #[doc(hidden)] impl glib::translate::GlibPtrDefault for VideoFormatInfo { - type GlibType = *mut ffi::GstVideoFormatInfo; + type GlibType = *mut gst_video_sys::GstVideoFormatInfo; } #[doc(hidden)] -impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoFormatInfo> for VideoFormatInfo { +impl<'a> glib::translate::ToGlibPtr<'a, *const gst_video_sys::GstVideoFormatInfo> + for VideoFormatInfo +{ type Storage = &'a VideoFormatInfo; - fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstVideoFormatInfo, Self> { + fn to_glib_none( + &'a self, + ) -> glib::translate::Stash<'a, *const gst_video_sys::GstVideoFormatInfo, Self> { glib::translate::Stash(self.0, self) } - fn to_glib_full(&self) -> *const ffi::GstVideoFormatInfo { + fn to_glib_full(&self) -> *const gst_video_sys::GstVideoFormatInfo { unimplemented!() } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstVideoFormatInfo> for VideoFormatInfo { +impl glib::translate::FromGlibPtrNone<*mut gst_video_sys::GstVideoFormatInfo> for VideoFormatInfo { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstVideoFormatInfo) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_video_sys::GstVideoFormatInfo) -> Self { VideoFormatInfo(&*ptr) } } diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 0c4e54a1f..57c3139da 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use gst_ffi; +use gst_sys; +use gst_video_sys; use glib; use glib::translate::{from_glib, ToGlibPtr}; @@ -25,7 +25,7 @@ pub enum Writable {} #[derive(Debug)] pub struct VideoFrame( - ffi::GstVideoFrame, + gst_video_sys::GstVideoFrame, Option, ::VideoInfo, PhantomData, @@ -53,7 +53,7 @@ impl VideoFrame { pub fn copy(&self, dest: &mut VideoFrame) -> Result<(), glib::BoolError> { unsafe { - let res: bool = from_glib(ffi::gst_video_frame_copy(&mut dest.0, &self.0)); + let res: bool = from_glib(gst_video_sys::gst_video_frame_copy(&mut dest.0, &self.0)); if res { Ok(()) } else { @@ -70,7 +70,11 @@ impl VideoFrame { skip_assert_initialized!(); unsafe { - let res: bool = from_glib(ffi::gst_video_frame_copy_plane(&mut dest.0, &self.0, plane)); + let res: bool = from_glib(gst_video_sys::gst_video_frame_copy_plane( + &mut dest.0, + &self.0, + plane, + )); if res { Ok(()) } else { @@ -162,7 +166,7 @@ impl VideoFrame { } } - pub unsafe fn from_glib_full(frame: ffi::GstVideoFrame) -> Self { + pub unsafe fn from_glib_full(frame: gst_video_sys::GstVideoFrame) -> Self { let info = ::VideoInfo(ptr::read(&frame.info)); let buffer = gst::Buffer::from_glib_none(frame.buffer); VideoFrame(frame, Some(buffer), info, PhantomData) @@ -172,7 +176,7 @@ impl VideoFrame { impl Drop for VideoFrame { fn drop(&mut self) { unsafe { - ffi::gst_video_frame_unmap(&mut self.0); + gst_video_sys::gst_video_frame_unmap(&mut self.0); } } } @@ -186,11 +190,11 @@ impl VideoFrame { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map( &mut frame, info.to_glib_none().0 as *mut _, buffer.to_glib_none().0, - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_sys::GST_MAP_READ, )); if !res { @@ -211,12 +215,12 @@ impl VideoFrame { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map_id( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id( &mut frame, info.to_glib_none().0 as *mut _, buffer.to_glib_none().0, id, - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_sys::GST_MAP_READ, )); if !res { @@ -234,7 +238,7 @@ impl VideoFrame { VideoFrameRef(vframe, Some(self.buffer()), info, true) } - pub fn as_ptr(&self) -> *const ffi::GstVideoFrame { + pub fn as_ptr(&self) -> *const gst_video_sys::GstVideoFrame { &self.0 } } @@ -248,13 +252,13 @@ impl VideoFrame { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map( &mut frame, info.to_glib_none().0 as *mut _, buffer.to_glib_none().0, - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF - | gst_ffi::GST_MAP_READ - | gst_ffi::GST_MAP_WRITE, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF + | gst_sys::GST_MAP_READ + | gst_sys::GST_MAP_WRITE, )); if !res { @@ -275,14 +279,14 @@ impl VideoFrame { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map_id( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id( &mut frame, info.to_glib_none().0 as *mut _, buffer.to_glib_none().0, id, - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF - | gst_ffi::GST_MAP_READ - | gst_ffi::GST_MAP_WRITE, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF + | gst_sys::GST_MAP_READ + | gst_sys::GST_MAP_WRITE, )); if !res { @@ -334,20 +338,20 @@ impl VideoFrame { VideoFrameRef(vframe, Some(self.buffer_mut()), info, true) } - pub fn as_mut_ptr(&mut self) -> *mut ffi::GstVideoFrame { + pub fn as_mut_ptr(&mut self) -> *mut gst_video_sys::GstVideoFrame { &mut self.0 } } #[derive(Debug)] -pub struct VideoFrameRef(ffi::GstVideoFrame, Option, ::VideoInfo, bool); +pub struct VideoFrameRef(gst_video_sys::GstVideoFrame, Option, ::VideoInfo, bool); impl<'a> VideoFrameRef<&'a gst::BufferRef> { - pub fn as_ptr(&self) -> *const ffi::GstVideoFrame { + pub fn as_ptr(&self) -> *const gst_video_sys::GstVideoFrame { &self.0 } - pub unsafe fn from_glib_borrow(frame: *const ffi::GstVideoFrame) -> Self { + pub unsafe fn from_glib_borrow(frame: *const gst_video_sys::GstVideoFrame) -> Self { assert!(!frame.is_null()); let frame = ptr::read(frame); @@ -364,11 +368,11 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map( &mut frame, info.to_glib_none().0 as *mut _, buffer.as_mut_ptr(), - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_sys::GST_MAP_READ, )); if !res { @@ -389,12 +393,12 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map_id( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id( &mut frame, info.to_glib_none().0 as *mut _, buffer.as_mut_ptr(), id, - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_sys::GST_MAP_READ, )); if !res { @@ -423,7 +427,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { dest: &mut VideoFrameRef<&mut gst::BufferRef>, ) -> Result<(), glib::BoolError> { unsafe { - let res: bool = from_glib(ffi::gst_video_frame_copy(&mut dest.0, &self.0)); + let res: bool = from_glib(gst_video_sys::gst_video_frame_copy(&mut dest.0, &self.0)); if res { Ok(()) } else { @@ -440,7 +444,11 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { skip_assert_initialized!(); unsafe { - let res: bool = from_glib(ffi::gst_video_frame_copy_plane(&mut dest.0, &self.0, plane)); + let res: bool = from_glib(gst_video_sys::gst_video_frame_copy_plane( + &mut dest.0, + &self.0, + plane, + )); if res { Ok(()) } else { @@ -534,7 +542,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { } impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { - pub unsafe fn from_glib_borrow_mut(frame: *mut ffi::GstVideoFrame) -> Self { + pub unsafe fn from_glib_borrow_mut(frame: *mut gst_video_sys::GstVideoFrame) -> Self { assert!(!frame.is_null()); let frame = ptr::read(frame); @@ -551,13 +559,13 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map( &mut frame, info.to_glib_none().0 as *mut _, buffer.as_mut_ptr(), - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF - | gst_ffi::GST_MAP_READ - | gst_ffi::GST_MAP_WRITE, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF + | gst_sys::GST_MAP_READ + | gst_sys::GST_MAP_WRITE, )); if !res { @@ -578,14 +586,14 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { unsafe { let mut frame = mem::zeroed(); - let res: bool = from_glib(ffi::gst_video_frame_map_id( + let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id( &mut frame, info.to_glib_none().0 as *mut _, buffer.as_mut_ptr(), id, - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF - | gst_ffi::GST_MAP_READ - | gst_ffi::GST_MAP_WRITE, + gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF + | gst_sys::GST_MAP_READ + | gst_sys::GST_MAP_WRITE, )); if !res { @@ -631,7 +639,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { } } - pub fn as_mut_ptr(&mut self) -> *mut ffi::GstVideoFrame { + pub fn as_mut_ptr(&mut self) -> *mut gst_video_sys::GstVideoFrame { &mut self.0 } } @@ -651,7 +659,7 @@ impl Drop for VideoFrameRef { fn drop(&mut self) { if !self.3 { unsafe { - ffi::gst_video_frame_unmap(&mut self.0); + gst_video_sys::gst_video_frame_unmap(&mut self.0); } } } diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 48dc62d9e..a2a719620 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_video_sys; use glib; use glib::translate::{ @@ -34,21 +34,21 @@ pub enum VideoColorRange { #[doc(hidden)] impl ToGlib for VideoColorRange { - type GlibType = ffi::GstVideoColorRange; + type GlibType = gst_video_sys::GstVideoColorRange; - fn to_glib(&self) -> ffi::GstVideoColorRange { + fn to_glib(&self) -> gst_video_sys::GstVideoColorRange { match *self { - VideoColorRange::Unknown => ffi::GST_VIDEO_COLOR_RANGE_UNKNOWN, - VideoColorRange::Range0255 => ffi::GST_VIDEO_COLOR_RANGE_0_255, - VideoColorRange::Range16235 => ffi::GST_VIDEO_COLOR_RANGE_16_235, + VideoColorRange::Unknown => gst_video_sys::GST_VIDEO_COLOR_RANGE_UNKNOWN, + VideoColorRange::Range0255 => gst_video_sys::GST_VIDEO_COLOR_RANGE_0_255, + VideoColorRange::Range16235 => gst_video_sys::GST_VIDEO_COLOR_RANGE_16_235, VideoColorRange::__Unknown(value) => value, } } } #[doc(hidden)] -impl FromGlib for VideoColorRange { - fn from_glib(value: ffi::GstVideoColorRange) -> Self { +impl FromGlib for VideoColorRange { + fn from_glib(value: gst_video_sys::GstVideoColorRange) -> Self { skip_assert_initialized!(); match value as i32 { 0 => VideoColorRange::Unknown, @@ -61,7 +61,7 @@ impl FromGlib for VideoColorRange { impl glib::StaticType for VideoColorRange { fn static_type() -> glib::Type { - unsafe { from_glib(ffi::gst_video_color_range_get_type()) } + unsafe { from_glib(gst_video_sys::gst_video_color_range_get_type()) } } } @@ -73,17 +73,17 @@ impl<'a> glib::value::FromValueOptional<'a> for VideoColorRange { impl<'a> glib::value::FromValue<'a> for VideoColorRange { unsafe fn from_value(value: &glib::value::Value) -> Self { - from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) } } impl glib::value::SetValue for VideoColorRange { unsafe fn set_value(value: &mut glib::value::Value, this: &Self) { - gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32) + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32) } } -pub struct VideoColorimetry(ffi::GstVideoColorimetry); +pub struct VideoColorimetry(gst_video_sys::GstVideoColorimetry); impl VideoColorimetry { pub fn new( @@ -95,7 +95,7 @@ impl VideoColorimetry { assert_initialized_main_thread!(); let colorimetry = unsafe { - let mut colorimetry: ffi::GstVideoColorimetry = mem::zeroed(); + let mut colorimetry: gst_video_sys::GstVideoColorimetry = mem::zeroed(); colorimetry.range = range.to_glib(); colorimetry.matrix = matrix.to_glib(); @@ -109,7 +109,7 @@ impl VideoColorimetry { } pub fn to_string(&self) -> String { - unsafe { from_glib_full(ffi::gst_video_colorimetry_to_string(&self.0)) } + unsafe { from_glib_full(gst_video_sys::gst_video_colorimetry_to_string(&self.0)) } } pub fn from_string(s: &str) -> Option { @@ -117,7 +117,7 @@ impl VideoColorimetry { unsafe { let mut colorimetry = mem::zeroed(); - let valid: bool = from_glib(ffi::gst_video_colorimetry_from_string( + let valid: bool = from_glib(gst_video_sys::gst_video_colorimetry_from_string( &mut colorimetry, s.to_glib_none().0, )); @@ -154,7 +154,11 @@ impl Clone for VideoColorimetry { impl PartialEq for VideoColorimetry { fn eq(&self, other: &Self) -> bool { - unsafe { from_glib(ffi::gst_video_colorimetry_is_equal(&self.0, &other.0)) } + unsafe { + from_glib(gst_video_sys::gst_video_colorimetry_is_equal( + &self.0, &other.0, + )) + } } } @@ -206,7 +210,7 @@ impl ::VideoMultiviewFramePacking { } } -pub struct VideoInfo(pub(crate) ffi::GstVideoInfo); +pub struct VideoInfo(pub(crate) gst_video_sys::GstVideoInfo); impl fmt::Debug for VideoInfo { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { @@ -263,7 +267,7 @@ impl<'a> VideoInfoBuilder<'a> { unsafe { let mut info = mem::uninitialized(); - ffi::gst_video_info_set_format( + gst_video_sys::gst_video_info_set_format( &mut info, self.format.to_glib(), self.width, @@ -494,7 +498,10 @@ impl VideoInfo { unsafe { let mut info = mem::uninitialized(); - if from_glib(ffi::gst_video_info_from_caps(&mut info, caps.as_ptr())) { + if from_glib(gst_video_sys::gst_video_info_from_caps( + &mut info, + caps.as_ptr(), + )) { Some(VideoInfo(info)) } else { None @@ -503,7 +510,11 @@ impl VideoInfo { } pub fn to_caps(&self) -> Option { - unsafe { from_glib_full(ffi::gst_video_info_to_caps(&self.0 as *const _ as *mut _)) } + unsafe { + from_glib_full(gst_video_sys::gst_video_info_to_caps( + &self.0 as *const _ as *mut _, + )) + } } pub fn format(&self) -> ::VideoFormat { @@ -621,7 +632,7 @@ impl VideoInfo { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - if from_glib(ffi::gst_video_info_convert( + if from_glib(gst_video_sys::gst_video_info_convert( &self.0 as *const _ as *mut _, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -645,7 +656,7 @@ impl VideoInfo { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - if from_glib(ffi::gst_video_info_convert( + if from_glib(gst_video_sys::gst_video_info_convert( &self.0 as *const _ as *mut _, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -668,7 +679,7 @@ impl Clone for VideoInfo { impl PartialEq for VideoInfo { fn eq(&self, other: &Self) -> bool { - unsafe { from_glib(ffi::gst_video_info_is_equal(&self.0, &other.0)) } + unsafe { from_glib(gst_video_sys::gst_video_info_is_equal(&self.0, &other.0)) } } } @@ -679,26 +690,25 @@ unsafe impl Sync for VideoInfo {} impl glib::types::StaticType for VideoInfo { fn static_type() -> glib::types::Type { - unsafe { glib::translate::from_glib(ffi::gst_video_info_get_type()) } + unsafe { glib::translate::from_glib(gst_video_sys::gst_video_info_get_type()) } } } #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for VideoInfo { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstVideoInfo - ) + Option::::from_glib_none(gobject_sys::g_value_get_boxed(value.to_glib_none().0) + as *mut gst_video_sys::GstVideoInfo) } } #[doc(hidden)] impl glib::value::SetValue for VideoInfo { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_video_sys::GstVideoInfo>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -706,10 +716,10 @@ impl glib::value::SetValue for VideoInfo { #[doc(hidden)] impl glib::value::SetValueOptional for VideoInfo { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(&this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_video_sys::GstVideoInfo>::to_glib_none(&this).0 + as glib_sys::gpointer, ) } } @@ -723,36 +733,38 @@ impl glib::translate::Uninitialized for VideoInfo { #[doc(hidden)] impl glib::translate::GlibPtrDefault for VideoInfo { - type GlibType = *mut ffi::GstVideoInfo; + type GlibType = *mut gst_video_sys::GstVideoInfo; } #[doc(hidden)] -impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoInfo> for VideoInfo { +impl<'a> glib::translate::ToGlibPtr<'a, *const gst_video_sys::GstVideoInfo> for VideoInfo { type Storage = &'a VideoInfo; - fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstVideoInfo, Self> { + fn to_glib_none( + &'a self, + ) -> glib::translate::Stash<'a, *const gst_video_sys::GstVideoInfo, Self> { glib::translate::Stash(&self.0, self) } - fn to_glib_full(&self) -> *const ffi::GstVideoInfo { + fn to_glib_full(&self) -> *const gst_video_sys::GstVideoInfo { unimplemented!() } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstVideoInfo> for VideoInfo { +impl glib::translate::FromGlibPtrNone<*mut gst_video_sys::GstVideoInfo> for VideoInfo { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstVideoInfo) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_video_sys::GstVideoInfo) -> Self { VideoInfo(ptr::read(ptr)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrFull<*mut ffi::GstVideoInfo> for VideoInfo { +impl glib::translate::FromGlibPtrFull<*mut gst_video_sys::GstVideoInfo> for VideoInfo { #[inline] - unsafe fn from_glib_full(ptr: *mut ffi::GstVideoInfo) -> Self { + unsafe fn from_glib_full(ptr: *mut gst_video_sys::GstVideoInfo) -> Self { let info = from_glib_none(ptr); - glib_ffi::g_free(ptr as *mut _); + glib_sys::g_free(ptr as *mut _); info } } @@ -760,13 +772,21 @@ impl glib::translate::FromGlibPtrFull<*mut ffi::GstVideoInfo> for VideoInfo { #[cfg(any(feature = "v1_12", feature = "dox"))] impl ::VideoFieldOrder { pub fn to_string(self) -> String { - unsafe { from_glib_full(ffi::gst_video_field_order_to_string(self.to_glib())) } + unsafe { + from_glib_full(gst_video_sys::gst_video_field_order_to_string( + self.to_glib(), + )) + } } pub fn from_string(s: &str) -> Self { assert_initialized_main_thread!(); - unsafe { from_glib(ffi::gst_video_field_order_from_string(s.to_glib_none().0)) } + unsafe { + from_glib(gst_video_sys::gst_video_field_order_from_string( + s.to_glib_none().0, + )) + } } } @@ -789,14 +809,18 @@ impl fmt::Display for ::VideoFieldOrder { impl ::VideoInterlaceMode { pub fn to_string(self) -> String { - unsafe { from_glib_full(ffi::gst_video_interlace_mode_to_string(self.to_glib())) } + unsafe { + from_glib_full(gst_video_sys::gst_video_interlace_mode_to_string( + self.to_glib(), + )) + } } pub fn from_string(s: &str) -> Self { assert_initialized_main_thread!(); unsafe { - from_glib(ffi::gst_video_interlace_mode_from_string( + from_glib(gst_video_sys::gst_video_interlace_mode_from_string( s.to_glib_none().0, )) } diff --git a/gstreamer-video/src/video_meta.rs b/gstreamer-video/src/video_meta.rs index 8682b4c59..4eacb9cb1 100644 --- a/gstreamer-video/src/video_meta.rs +++ b/gstreamer-video/src/video_meta.rs @@ -8,15 +8,15 @@ use std::fmt; -use ffi; use glib; use glib::translate::{from_glib, ToGlib}; use gst; use gst::prelude::*; -use gst_ffi; +use gst_sys; +use gst_video_sys; #[repr(C)] -pub struct VideoMeta(ffi::GstVideoMeta); +pub struct VideoMeta(gst_video_sys::GstVideoMeta); impl VideoMeta { pub fn add( @@ -30,7 +30,7 @@ impl VideoMeta { assert!(buffer.get_size() >= info.size()); unsafe { - let meta = ffi::gst_buffer_add_video_meta( + let meta = gst_video_sys::gst_buffer_add_video_meta( buffer.as_mut_ptr(), flags.to_glib(), format.to_glib(), @@ -61,7 +61,7 @@ impl VideoMeta { assert!(buffer.get_size() >= info.size()); unsafe { - let meta = ffi::gst_buffer_add_video_meta_full( + let meta = gst_video_sys::gst_buffer_add_video_meta_full( buffer.as_mut_ptr(), flags.to_glib(), format.to_glib(), @@ -110,10 +110,10 @@ impl VideoMeta { } unsafe impl MetaAPI for VideoMeta { - type GstType = ffi::GstVideoMeta; + type GstType = gst_video_sys::GstVideoMeta; fn get_meta_api() -> glib::Type { - unsafe { from_glib(ffi::gst_video_meta_api_get_type()) } + unsafe { from_glib(gst_video_sys::gst_video_meta_api_get_type()) } } } @@ -133,7 +133,7 @@ impl fmt::Debug for VideoMeta { } #[repr(C)] -pub struct VideoOverlayCompositionMeta(ffi::GstVideoOverlayCompositionMeta); +pub struct VideoOverlayCompositionMeta(gst_video_sys::GstVideoOverlayCompositionMeta); impl VideoOverlayCompositionMeta { pub fn add<'a>( @@ -141,7 +141,7 @@ impl VideoOverlayCompositionMeta { overlay: &::VideoOverlayComposition, ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { unsafe { - let meta = ffi::gst_buffer_add_video_overlay_composition_meta( + let meta = gst_video_sys::gst_buffer_add_video_overlay_composition_meta( buffer.as_mut_ptr(), overlay.as_mut_ptr(), ); @@ -157,17 +157,17 @@ impl VideoOverlayCompositionMeta { pub fn set_overlay(&mut self, overlay: &::VideoOverlayComposition) { #![allow(clippy::cast_ptr_alignment)] unsafe { - gst_ffi::gst_mini_object_unref(self.0.overlay as *mut _); - self.0.overlay = gst_ffi::gst_mini_object_ref(overlay.as_mut_ptr() as *mut _) as *mut _; + gst_sys::gst_mini_object_unref(self.0.overlay as *mut _); + self.0.overlay = gst_sys::gst_mini_object_ref(overlay.as_mut_ptr() as *mut _) as *mut _; } } } unsafe impl MetaAPI for VideoOverlayCompositionMeta { - type GstType = ffi::GstVideoOverlayCompositionMeta; + type GstType = gst_video_sys::GstVideoOverlayCompositionMeta; fn get_meta_api() -> glib::Type { - unsafe { from_glib(ffi::gst_video_overlay_composition_meta_api_get_type()) } + unsafe { from_glib(gst_video_sys::gst_video_overlay_composition_meta_api_get_type()) } } } diff --git a/gstreamer-video/src/video_overlay.rs b/gstreamer-video/src/video_overlay.rs index 54cf0eac1..39456fbfa 100644 --- a/gstreamer-video/src/video_overlay.rs +++ b/gstreamer-video/src/video_overlay.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use gst; use gst::prelude::*; +use gst_video_sys; use libc::uintptr_t; use VideoOverlay; @@ -22,18 +22,18 @@ pub trait VideoOverlayExtManual: 'static { impl> VideoOverlayExtManual for O { unsafe fn set_window_handle(&self, handle: uintptr_t) { - ffi::gst_video_overlay_set_window_handle(self.as_ref().to_glib_none().0, handle) + gst_video_sys::gst_video_overlay_set_window_handle(self.as_ref().to_glib_none().0, handle) } unsafe fn got_window_handle(&self, handle: uintptr_t) { - ffi::gst_video_overlay_got_window_handle(self.as_ref().to_glib_none().0, handle) + gst_video_sys::gst_video_overlay_got_window_handle(self.as_ref().to_glib_none().0, handle) } } pub fn is_video_overlay_prepare_window_handle_message(msg: &gst::MessageRef) -> bool { unsafe { - from_glib(ffi::gst_is_video_overlay_prepare_window_handle_message( - msg.as_mut_ptr(), - )) + from_glib( + gst_video_sys::gst_is_video_overlay_prepare_window_handle_message(msg.as_mut_ptr()), + ) } } diff --git a/gstreamer-video/src/video_overlay_composition.rs b/gstreamer-video/src/video_overlay_composition.rs index cc1f51517..be74bcf05 100644 --- a/gstreamer-video/src/video_overlay_composition.rs +++ b/gstreamer-video/src/video_overlay_composition.rs @@ -8,9 +8,9 @@ use std::fmt; -use ffi; use gst; use gst::miniobject::*; +use gst_video_sys; use glib; use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib}; @@ -18,9 +18,9 @@ use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib}; gst_define_mini_object_wrapper!( VideoOverlayRectangle, VideoOverlayRectangleRef, - ffi::GstVideoOverlayRectangle, + gst_video_sys::GstVideoOverlayRectangle, [Debug,], - || ffi::gst_video_overlay_rectangle_get_type() + || gst_video_sys::gst_video_overlay_rectangle_get_type() ); impl fmt::Debug for VideoOverlayRectangleRef { @@ -44,7 +44,7 @@ impl VideoOverlayRectangle { ) -> Self { assert!(buffer.get_meta::<::VideoMeta>().is_some()); unsafe { - from_glib_full(ffi::gst_video_overlay_rectangle_new_raw( + from_glib_full(gst_video_sys::gst_video_overlay_rectangle_new_raw( buffer.as_mut_ptr(), render_x, render_y, @@ -59,22 +59,24 @@ impl VideoOverlayRectangle { impl VideoOverlayRectangleRef { pub fn get_flags(&self) -> ::VideoOverlayFormatFlags { unsafe { - from_glib(ffi::gst_video_overlay_rectangle_get_flags( + from_glib(gst_video_sys::gst_video_overlay_rectangle_get_flags( self.as_mut_ptr(), )) } } pub fn get_global_alpha(&self) -> f32 { - unsafe { ffi::gst_video_overlay_rectangle_get_global_alpha(self.as_mut_ptr()) } + unsafe { gst_video_sys::gst_video_overlay_rectangle_get_global_alpha(self.as_mut_ptr()) } } pub fn set_global_alpha(&mut self, alpha: f32) { - unsafe { ffi::gst_video_overlay_rectangle_set_global_alpha(self.as_mut_ptr(), alpha) } + unsafe { + gst_video_sys::gst_video_overlay_rectangle_set_global_alpha(self.as_mut_ptr(), alpha) + } } pub fn get_seqnum(&self) -> u32 { - unsafe { ffi::gst_video_overlay_rectangle_get_seqnum(self.as_mut_ptr()) } + unsafe { gst_video_sys::gst_video_overlay_rectangle_get_seqnum(self.as_mut_ptr()) } } pub fn get_render_rectangle(&self) -> (i32, i32, u32, u32) { @@ -84,7 +86,7 @@ impl VideoOverlayRectangleRef { let mut render_width = 0; let mut render_height = 0; - ffi::gst_video_overlay_rectangle_get_render_rectangle( + gst_video_sys::gst_video_overlay_rectangle_get_render_rectangle( self.as_mut_ptr(), &mut render_x, &mut render_y, @@ -104,7 +106,7 @@ impl VideoOverlayRectangleRef { render_height: u32, ) { unsafe { - ffi::gst_video_overlay_rectangle_set_render_rectangle( + gst_video_sys::gst_video_overlay_rectangle_set_render_rectangle( self.as_mut_ptr(), render_x, render_y, @@ -116,34 +118,40 @@ impl VideoOverlayRectangleRef { pub fn get_pixels_unscaled_raw(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { unsafe { - from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_raw( - self.as_mut_ptr(), - flags.to_glib(), - )) + from_glib_none( + gst_video_sys::gst_video_overlay_rectangle_get_pixels_unscaled_raw( + self.as_mut_ptr(), + flags.to_glib(), + ), + ) } } pub fn get_pixels_unscaled_ayuv(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { unsafe { - from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_ayuv( - self.as_mut_ptr(), - flags.to_glib(), - )) + from_glib_none( + gst_video_sys::gst_video_overlay_rectangle_get_pixels_unscaled_ayuv( + self.as_mut_ptr(), + flags.to_glib(), + ), + ) } } pub fn get_pixels_unscaled_argb(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { unsafe { - from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_argb( - self.as_mut_ptr(), - flags.to_glib(), - )) + from_glib_none( + gst_video_sys::gst_video_overlay_rectangle_get_pixels_unscaled_argb( + self.as_mut_ptr(), + flags.to_glib(), + ), + ) } } pub fn get_pixels_raw(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { unsafe { - from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_raw( + from_glib_none(gst_video_sys::gst_video_overlay_rectangle_get_pixels_raw( self.as_mut_ptr(), flags.to_glib(), )) @@ -152,7 +160,7 @@ impl VideoOverlayRectangleRef { pub fn get_pixels_ayuv(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { unsafe { - from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_ayuv( + from_glib_none(gst_video_sys::gst_video_overlay_rectangle_get_pixels_ayuv( self.as_mut_ptr(), flags.to_glib(), )) @@ -161,7 +169,7 @@ impl VideoOverlayRectangleRef { pub fn get_pixels_argb(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { unsafe { - from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_argb( + from_glib_none(gst_video_sys::gst_video_overlay_rectangle_get_pixels_argb( self.as_mut_ptr(), flags.to_glib(), )) @@ -172,9 +180,9 @@ impl VideoOverlayRectangleRef { gst_define_mini_object_wrapper!( VideoOverlayComposition, VideoOverlayCompositionRef, - ffi::GstVideoOverlayComposition, + gst_video_sys::GstVideoOverlayComposition, [Debug,], - || ffi::gst_video_overlay_composition_get_type() + || gst_video_sys::gst_video_overlay_composition_get_type() ); impl fmt::Debug for VideoOverlayCompositionRef { @@ -193,11 +201,12 @@ impl VideoOverlayComposition { Some(first) => first, }; - let composition = - Self::from_glib_full(ffi::gst_video_overlay_composition_new(first.as_mut_ptr())); + let composition = Self::from_glib_full( + gst_video_sys::gst_video_overlay_composition_new(first.as_mut_ptr()), + ); for rect in iter { - ffi::gst_video_overlay_composition_add_rectangle( + gst_video_sys::gst_video_overlay_composition_add_rectangle( composition.as_mut_ptr(), rect.as_mut_ptr(), ); @@ -210,7 +219,7 @@ impl VideoOverlayComposition { impl VideoOverlayCompositionRef { pub fn n_rectangles(&self) -> u32 { - unsafe { ffi::gst_video_overlay_composition_n_rectangles(self.as_mut_ptr()) } + unsafe { gst_video_sys::gst_video_overlay_composition_n_rectangles(self.as_mut_ptr()) } } pub fn get_rectangle(&self, idx: u32) -> Option { @@ -219,7 +228,7 @@ impl VideoOverlayCompositionRef { } unsafe { - from_glib_none(ffi::gst_video_overlay_composition_get_rectangle( + from_glib_none(gst_video_sys::gst_video_overlay_composition_get_rectangle( self.as_mut_ptr(), idx, )) @@ -227,7 +236,7 @@ impl VideoOverlayCompositionRef { } pub fn get_seqnum(&self) -> u32 { - unsafe { ffi::gst_video_overlay_composition_get_seqnum(self.as_mut_ptr()) } + unsafe { gst_video_sys::gst_video_overlay_composition_get_seqnum(self.as_mut_ptr()) } } pub fn blend( @@ -236,7 +245,10 @@ impl VideoOverlayCompositionRef { ) -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_video_overlay_composition_blend(self.as_mut_ptr(), frame.as_mut_ptr()), + gst_video_sys::gst_video_overlay_composition_blend( + self.as_mut_ptr(), + frame.as_mut_ptr() + ), "Failed to blend overlay composition", ) } diff --git a/gstreamer-video/src/video_rectangle.rs b/gstreamer-video/src/video_rectangle.rs index deb5d40bc..452817392 100644 --- a/gstreamer-video/src/video_rectangle.rs +++ b/gstreamer-video/src/video_rectangle.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::ToGlib; +use gst_video_sys; #[derive(Clone, Debug, Eq, PartialEq, Hash)] pub struct VideoRectangle { @@ -28,26 +28,26 @@ pub fn center_video_rectangle( dst: &VideoRectangle, scale: bool, ) -> VideoRectangle { - let mut result = ffi::GstVideoRectangle { + let mut result = gst_video_sys::GstVideoRectangle { x: 0, y: 0, w: 0, h: 0, }; - let src_rect = ffi::GstVideoRectangle { + let src_rect = gst_video_sys::GstVideoRectangle { x: src.x, y: src.y, w: src.w, h: src.h, }; - let dst_rect = ffi::GstVideoRectangle { + let dst_rect = gst_video_sys::GstVideoRectangle { x: dst.x, y: dst.y, w: dst.w, h: dst.h, }; unsafe { - ffi::gst_video_sink_center_rect(src_rect, dst_rect, &mut result, scale.to_glib()); + gst_video_sys::gst_video_sink_center_rect(src_rect, dst_rect, &mut result, scale.to_glib()); } VideoRectangle::new(result.x, result.y, result.w, result.h) } diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 6b8e242ac..d2c0fbcf0 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -6,15 +6,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::prelude::*; use glib::translate::*; use glib::value; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; use gst; use gst::prelude::*; +use gst_video_sys; use std::cmp; use std::fmt; use std::mem; @@ -26,15 +26,15 @@ use VideoTimeCodeFlags; #[cfg(any(feature = "v1_12", feature = "dox"))] use VideoTimeCodeInterval; -pub struct VideoTimeCode(ffi::GstVideoTimeCode); -pub struct ValidVideoTimeCode(ffi::GstVideoTimeCode); +pub struct VideoTimeCode(gst_video_sys::GstVideoTimeCode); +pub struct ValidVideoTimeCode(gst_video_sys::GstVideoTimeCode); impl VideoTimeCode { pub fn new_empty() -> VideoTimeCode { assert_initialized_main_thread!(); unsafe { let mut v = mem::zeroed(); - ffi::gst_video_time_code_clear(&mut v); + gst_video_sys::gst_video_time_code_clear(&mut v); VideoTimeCode(v) } } @@ -53,7 +53,7 @@ impl VideoTimeCode { assert_initialized_main_thread!(); unsafe { let mut v = mem::zeroed(); - ffi::gst_video_time_code_init( + gst_video_sys::gst_video_time_code_init( &mut v, *fps.numer() as u32, *fps.denom() as u32, @@ -81,7 +81,7 @@ impl VideoTimeCode { // assert!(fps_d > 0); // unsafe { // let mut v = mem::zeroed(); - // let res = ffi::gst_video_time_code_init_from_date_time_full( + // let res = gst_video_sys::gst_video_time_code_init_from_date_time_full( // &mut v, // *fps.numer() as u32, // *fps.denom() as u32, @@ -90,7 +90,7 @@ impl VideoTimeCode { // field_count, // ); // - // if res == glib_ffi::GFALSE { + // if res == glib_sys::GFALSE { // None // } else { // Some(VideoTimeCode(v)) @@ -102,14 +102,18 @@ impl VideoTimeCode { pub fn from_string(tc_str: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_video_time_code_new_from_string( + from_glib_full(gst_video_sys::gst_video_time_code_new_from_string( tc_str.to_glib_none().0, )) } } pub fn is_valid(&self) -> bool { - unsafe { from_glib(ffi::gst_video_time_code_is_valid(self.to_glib_none().0)) } + unsafe { + from_glib(gst_video_sys::gst_video_time_code_is_valid( + self.to_glib_none().0, + )) + } } pub fn set_fps(&mut self, fps: gst::Fraction) { @@ -191,14 +195,14 @@ impl ValidVideoTimeCode { pub fn add_frames(&mut self, frames: i64) { unsafe { - ffi::gst_video_time_code_add_frames(self.to_glib_none_mut().0, frames); + gst_video_sys::gst_video_time_code_add_frames(self.to_glib_none_mut().0, frames); } } #[cfg(any(feature = "v1_12", feature = "dox"))] pub fn add_interval(&self, tc_inter: &VideoTimeCodeInterval) -> Option { unsafe { - from_glib_full(ffi::gst_video_time_code_add_interval( + from_glib_full(gst_video_sys::gst_video_time_code_add_interval( self.to_glib_none().0, tc_inter.to_glib_none().0, )) @@ -206,25 +210,31 @@ impl ValidVideoTimeCode { } fn compare(&self, tc2: &ValidVideoTimeCode) -> i32 { - unsafe { ffi::gst_video_time_code_compare(self.to_glib_none().0, tc2.to_glib_none().0) } + unsafe { + gst_video_sys::gst_video_time_code_compare(self.to_glib_none().0, tc2.to_glib_none().0) + } } pub fn frames_since_daily_jam(&self) -> u64 { - unsafe { ffi::gst_video_time_code_frames_since_daily_jam(self.to_glib_none().0) } + unsafe { gst_video_sys::gst_video_time_code_frames_since_daily_jam(self.to_glib_none().0) } } pub fn increment_frame(&mut self) { unsafe { - ffi::gst_video_time_code_increment_frame(self.to_glib_none_mut().0); + gst_video_sys::gst_video_time_code_increment_frame(self.to_glib_none_mut().0); } } pub fn nsec_since_daily_jam(&self) -> u64 { - unsafe { ffi::gst_video_time_code_nsec_since_daily_jam(self.to_glib_none().0) } + unsafe { gst_video_sys::gst_video_time_code_nsec_since_daily_jam(self.to_glib_none().0) } } pub fn to_date_time(&self) -> Option { - unsafe { from_glib_full(ffi::gst_video_time_code_to_date_time(self.to_glib_none().0)) } + unsafe { + from_glib_full(gst_video_sys::gst_video_time_code_to_date_time( + self.to_glib_none().0, + )) + } } } @@ -232,7 +242,11 @@ macro_rules! generic_impl { ($name:ident) => { impl $name { pub fn to_string(&self) -> String { - unsafe { from_glib_full(ffi::gst_video_time_code_to_string(self.to_glib_none().0)) } + unsafe { + from_glib_full(gst_video_sys::gst_video_time_code_to_string( + self.to_glib_none().0, + )) + } } pub fn get_hours(&self) -> u32 { @@ -270,7 +284,7 @@ macro_rules! generic_impl { pub fn set_latest_daily_jam(&mut self, latest_daily_jam: Option<&glib::DateTime>) { unsafe { if !self.0.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_unref(self.0.config.latest_daily_jam); + glib_sys::g_date_time_unref(self.0.config.latest_daily_jam); } self.0.config.latest_daily_jam = latest_daily_jam.to_glib_full() @@ -283,7 +297,7 @@ macro_rules! generic_impl { unsafe { let v = self.0; if !v.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_ref(v.config.latest_daily_jam); + glib_sys::g_date_time_ref(v.config.latest_daily_jam); } $name(v) @@ -295,7 +309,7 @@ macro_rules! generic_impl { fn drop(&mut self) { unsafe { if !self.0.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_unref(self.0.config.latest_daily_jam); + glib_sys::g_date_time_unref(self.0.config.latest_daily_jam); } } } @@ -328,43 +342,45 @@ macro_rules! generic_impl { #[doc(hidden)] impl GlibPtrDefault for $name { - type GlibType = *mut ffi::GstVideoTimeCode; + type GlibType = *mut gst_video_sys::GstVideoTimeCode; } #[doc(hidden)] - impl<'a> ToGlibPtr<'a, *const ffi::GstVideoTimeCode> for $name { + impl<'a> ToGlibPtr<'a, *const gst_video_sys::GstVideoTimeCode> for $name { type Storage = &'a Self; #[inline] - fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstVideoTimeCode, Self> { + fn to_glib_none(&'a self) -> Stash<'a, *const gst_video_sys::GstVideoTimeCode, Self> { Stash(&self.0 as *const _, self) } #[inline] - fn to_glib_full(&self) -> *const ffi::GstVideoTimeCode { - unsafe { ffi::gst_video_time_code_copy(&self.0 as *const _) } + fn to_glib_full(&self) -> *const gst_video_sys::GstVideoTimeCode { + unsafe { gst_video_sys::gst_video_time_code_copy(&self.0 as *const _) } } } #[doc(hidden)] - impl<'a> ToGlibPtrMut<'a, *mut ffi::GstVideoTimeCode> for $name { + impl<'a> ToGlibPtrMut<'a, *mut gst_video_sys::GstVideoTimeCode> for $name { type Storage = &'a mut Self; #[inline] - fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::GstVideoTimeCode, Self> { + fn to_glib_none_mut( + &'a mut self, + ) -> StashMut<'a, *mut gst_video_sys::GstVideoTimeCode, Self> { let ptr = &mut self.0 as *mut _; StashMut(ptr, self) } } #[doc(hidden)] - impl FromGlibPtrNone<*mut ffi::GstVideoTimeCode> for $name { + impl FromGlibPtrNone<*mut gst_video_sys::GstVideoTimeCode> for $name { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstVideoTimeCode) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_video_sys::GstVideoTimeCode) -> Self { assert!(!ptr.is_null()); let v = ptr::read(ptr); if !v.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_ref(v.config.latest_daily_jam); + glib_sys::g_date_time_ref(v.config.latest_daily_jam); } $name(v) @@ -372,13 +388,13 @@ macro_rules! generic_impl { } #[doc(hidden)] - impl FromGlibPtrNone<*const ffi::GstVideoTimeCode> for $name { + impl FromGlibPtrNone<*const gst_video_sys::GstVideoTimeCode> for $name { #[inline] - unsafe fn from_glib_none(ptr: *const ffi::GstVideoTimeCode) -> Self { + unsafe fn from_glib_none(ptr: *const gst_video_sys::GstVideoTimeCode) -> Self { assert!(!ptr.is_null()); let v = ptr::read(ptr); if !v.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_ref(v.config.latest_daily_jam); + glib_sys::g_date_time_ref(v.config.latest_daily_jam); } $name(v) @@ -386,28 +402,28 @@ macro_rules! generic_impl { } #[doc(hidden)] - impl FromGlibPtrFull<*mut ffi::GstVideoTimeCode> for $name { + impl FromGlibPtrFull<*mut gst_video_sys::GstVideoTimeCode> for $name { #[inline] - unsafe fn from_glib_full(ptr: *mut ffi::GstVideoTimeCode) -> Self { + unsafe fn from_glib_full(ptr: *mut gst_video_sys::GstVideoTimeCode) -> Self { assert!(!ptr.is_null()); let v = ptr::read(ptr); if !v.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_ref(v.config.latest_daily_jam); + glib_sys::g_date_time_ref(v.config.latest_daily_jam); } - ffi::gst_video_time_code_free(ptr); + gst_video_sys::gst_video_time_code_free(ptr); $name(v) } } #[doc(hidden)] - impl FromGlibPtrBorrow<*mut ffi::GstVideoTimeCode> for $name { + impl FromGlibPtrBorrow<*mut gst_video_sys::GstVideoTimeCode> for $name { #[inline] - unsafe fn from_glib_borrow(ptr: *mut ffi::GstVideoTimeCode) -> Self { + unsafe fn from_glib_borrow(ptr: *mut gst_video_sys::GstVideoTimeCode) -> Self { assert!(!ptr.is_null()); let v = ptr::read(ptr); if !v.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_ref(v.config.latest_daily_jam); + glib_sys::g_date_time_ref(v.config.latest_daily_jam); } $name(v) @@ -416,26 +432,26 @@ macro_rules! generic_impl { impl StaticType for $name { fn static_type() -> glib::Type { - unsafe { from_glib(ffi::gst_video_time_code_get_type()) } + unsafe { from_glib(gst_video_sys::gst_video_time_code_get_type()) } } } #[doc(hidden)] impl<'a> value::FromValueOptional<'a> for $name { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::<$name>::from_glib_none(gobject_ffi::g_value_get_boxed( + Option::<$name>::from_glib_none(gobject_sys::g_value_get_boxed( value.to_glib_none().0, - ) as *mut ffi::GstVideoTimeCode) + ) as *mut gst_video_sys::GstVideoTimeCode) } } #[doc(hidden)] impl value::SetValue for $name { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - ToGlibPtr::<*const ffi::GstVideoTimeCode>::to_glib_none(this).0 - as glib_ffi::gpointer, + ToGlibPtr::<*const gst_video_sys::GstVideoTimeCode>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -443,10 +459,10 @@ macro_rules! generic_impl { #[doc(hidden)] impl value::SetValueOptional for $name { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - ToGlibPtr::<*const ffi::GstVideoTimeCode>::to_glib_none(&this).0 - as glib_ffi::gpointer, + ToGlibPtr::<*const gst_video_sys::GstVideoTimeCode>::to_glib_none(&this).0 + as glib_sys::gpointer, ) } } @@ -496,7 +512,7 @@ impl From for VideoTimeCode { } #[repr(C)] -pub struct VideoTimeCodeMeta(ffi::GstVideoTimeCodeMeta); +pub struct VideoTimeCodeMeta(gst_video_sys::GstVideoTimeCodeMeta); impl VideoTimeCodeMeta { pub fn add<'a>( @@ -504,7 +520,7 @@ impl VideoTimeCodeMeta { tc: &ValidVideoTimeCode, ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { unsafe { - let meta = ffi::gst_buffer_add_video_time_code_meta( + let meta = gst_video_sys::gst_buffer_add_video_time_code_meta( buffer.as_mut_ptr(), tc.to_glib_none().0 as *mut _, ); @@ -520,20 +536,20 @@ impl VideoTimeCodeMeta { pub fn set_tc(&mut self, tc: ValidVideoTimeCode) { #![allow(clippy::cast_ptr_alignment)] unsafe { - ffi::gst_video_time_code_clear(&mut self.0.tc); + gst_video_sys::gst_video_time_code_clear(&mut self.0.tc); self.0.tc = tc.0; if !self.0.tc.config.latest_daily_jam.is_null() { - glib_ffi::g_date_time_ref(self.0.tc.config.latest_daily_jam); + glib_sys::g_date_time_ref(self.0.tc.config.latest_daily_jam); } } } } unsafe impl MetaAPI for VideoTimeCodeMeta { - type GstType = ffi::GstVideoTimeCodeMeta; + type GstType = gst_video_sys::GstVideoTimeCodeMeta; fn get_meta_api() -> glib::Type { - unsafe { from_glib(ffi::gst_video_time_code_meta_api_get_type()) } + unsafe { from_glib(gst_video_sys::gst_video_time_code_meta_api_get_type()) } } } diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index d02ec1c00..617d6b9d6 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -6,26 +6,26 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::prelude::*; use glib::translate::*; use glib::value; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_video_sys; use std::cmp; use std::fmt; use std::mem; use std::ptr; #[derive(Clone)] -pub struct VideoTimeCodeInterval(ffi::GstVideoTimeCodeInterval); +pub struct VideoTimeCodeInterval(gst_video_sys::GstVideoTimeCodeInterval); impl VideoTimeCodeInterval { pub fn from_string(tc_inter_str: &str) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_video_time_code_interval_new_from_string( + from_glib_full(gst_video_sys::gst_video_time_code_interval_new_from_string( tc_inter_str.to_glib_none().0, )) } @@ -35,7 +35,9 @@ impl VideoTimeCodeInterval { assert_initialized_main_thread!(); unsafe { let mut v = mem::zeroed(); - ffi::gst_video_time_code_interval_init(&mut v, hours, minutes, seconds, frames); + gst_video_sys::gst_video_time_code_interval_init( + &mut v, hours, minutes, seconds, frames, + ); VideoTimeCodeInterval(v) } } @@ -131,69 +133,71 @@ impl fmt::Display for VideoTimeCodeInterval { #[doc(hidden)] impl GlibPtrDefault for VideoTimeCodeInterval { - type GlibType = *mut ffi::GstVideoTimeCodeInterval; + type GlibType = *mut gst_video_sys::GstVideoTimeCodeInterval; } #[doc(hidden)] -impl<'a> ToGlibPtr<'a, *const ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { +impl<'a> ToGlibPtr<'a, *const gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { type Storage = &'a Self; #[inline] - fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstVideoTimeCodeInterval, Self> { + fn to_glib_none(&'a self) -> Stash<'a, *const gst_video_sys::GstVideoTimeCodeInterval, Self> { Stash(&self.0 as *const _, self) } #[inline] - fn to_glib_full(&self) -> *const ffi::GstVideoTimeCodeInterval { - unsafe { ffi::gst_video_time_code_interval_copy(&self.0 as *const _) } + fn to_glib_full(&self) -> *const gst_video_sys::GstVideoTimeCodeInterval { + unsafe { gst_video_sys::gst_video_time_code_interval_copy(&self.0 as *const _) } } } #[doc(hidden)] -impl<'a> ToGlibPtrMut<'a, *mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { +impl<'a> ToGlibPtrMut<'a, *mut gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { type Storage = &'a mut Self; #[inline] - fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::GstVideoTimeCodeInterval, Self> { + fn to_glib_none_mut( + &'a mut self, + ) -> StashMut<'a, *mut gst_video_sys::GstVideoTimeCodeInterval, Self> { let ptr = &mut self.0 as *mut _; StashMut(ptr, self) } } #[doc(hidden)] -impl FromGlibPtrNone<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { +impl FromGlibPtrNone<*mut gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstVideoTimeCodeInterval) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_video_sys::GstVideoTimeCodeInterval) -> Self { assert!(!ptr.is_null()); VideoTimeCodeInterval(ptr::read(ptr)) } } #[doc(hidden)] -impl FromGlibPtrNone<*const ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { +impl FromGlibPtrNone<*const gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { #[inline] - unsafe fn from_glib_none(ptr: *const ffi::GstVideoTimeCodeInterval) -> Self { + unsafe fn from_glib_none(ptr: *const gst_video_sys::GstVideoTimeCodeInterval) -> Self { assert!(!ptr.is_null()); VideoTimeCodeInterval(ptr::read(ptr)) } } #[doc(hidden)] -impl FromGlibPtrFull<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { +impl FromGlibPtrFull<*mut gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { #[inline] - unsafe fn from_glib_full(ptr: *mut ffi::GstVideoTimeCodeInterval) -> Self { + unsafe fn from_glib_full(ptr: *mut gst_video_sys::GstVideoTimeCodeInterval) -> Self { assert!(!ptr.is_null()); let res = VideoTimeCodeInterval(ptr::read(ptr)); - ffi::gst_video_time_code_interval_free(ptr); + gst_video_sys::gst_video_time_code_interval_free(ptr); res } } #[doc(hidden)] -impl FromGlibPtrBorrow<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { +impl FromGlibPtrBorrow<*mut gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { #[inline] - unsafe fn from_glib_borrow(ptr: *mut ffi::GstVideoTimeCodeInterval) -> Self { + unsafe fn from_glib_borrow(ptr: *mut gst_video_sys::GstVideoTimeCodeInterval) -> Self { assert!(!ptr.is_null()); VideoTimeCodeInterval(ptr::read(ptr)) } @@ -201,27 +205,27 @@ impl FromGlibPtrBorrow<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInte impl StaticType for VideoTimeCodeInterval { fn static_type() -> glib::Type { - unsafe { from_glib(ffi::gst_video_time_code_interval_get_type()) } + unsafe { from_glib(gst_video_sys::gst_video_time_code_interval_get_type()) } } } #[doc(hidden)] impl<'a> value::FromValueOptional<'a> for VideoTimeCodeInterval { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_full(gobject_ffi::g_value_dup_boxed( + Option::::from_glib_full(gobject_sys::g_value_dup_boxed( value.to_glib_none().0, ) - as *mut ffi::GstVideoTimeCodeInterval) + as *mut gst_video_sys::GstVideoTimeCodeInterval) } } #[doc(hidden)] impl value::SetValue for VideoTimeCodeInterval { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - ToGlibPtr::<*const ffi::GstVideoTimeCodeInterval>::to_glib_none(this).0 - as glib_ffi::gpointer, + ToGlibPtr::<*const gst_video_sys::GstVideoTimeCodeInterval>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -229,10 +233,10 @@ impl value::SetValue for VideoTimeCodeInterval { #[doc(hidden)] impl value::SetValueOptional for VideoTimeCodeInterval { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - ToGlibPtr::<*const ffi::GstVideoTimeCodeInterval>::to_glib_none(&this).0 - as glib_ffi::gpointer, + ToGlibPtr::<*const gst_video_sys::GstVideoTimeCodeInterval>::to_glib_none(&this).0 + as glib_sys::gpointer, ) } } diff --git a/gstreamer-webrtc/src/auto/flags.rs b/gstreamer-webrtc/src/auto/flags.rs index fc9f2848b..a26983619 100644 --- a/gstreamer-webrtc/src/auto/flags.rs +++ b/gstreamer-webrtc/src/auto/flags.rs @@ -2,6 +2,6 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT -use ffi; +use gst_web_rtc_sys; use glib::translate::*; diff --git a/gstreamer-webrtc/src/lib.rs b/gstreamer-webrtc/src/lib.rs index 91b3f0d79..ff0e80172 100644 --- a/gstreamer-webrtc/src/lib.rs +++ b/gstreamer-webrtc/src/lib.rs @@ -10,16 +10,16 @@ extern crate libc; #[macro_use] extern crate glib; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; +extern crate glib_sys; +extern crate gobject_sys; extern crate gstreamer as gst; extern crate gstreamer_sdp as gst_sdp; -extern crate gstreamer_sys as gst_ffi; -extern crate gstreamer_webrtc_sys as ffi; +extern crate gstreamer_sys as gst_sys; +extern crate gstreamer_webrtc_sys as gst_web_rtc_sys; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; diff --git a/gstreamer-webrtc/src/web_rtc_session_description.rs b/gstreamer-webrtc/src/web_rtc_session_description.rs index 390e2cf7e..736555757 100644 --- a/gstreamer-webrtc/src/web_rtc_session_description.rs +++ b/gstreamer-webrtc/src/web_rtc_session_description.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; use gst_sdp; +use gst_web_rtc_sys; use std::mem; use WebRTCSDPType; use WebRTCSessionDescription; @@ -17,7 +17,7 @@ impl WebRTCSessionDescription { pub fn new(type_: WebRTCSDPType, mut sdp: gst_sdp::SDPMessage) -> WebRTCSessionDescription { assert_initialized_main_thread!(); unsafe { - let desc = from_glib_full(ffi::gst_webrtc_session_description_new( + let desc = from_glib_full(gst_web_rtc_sys::gst_webrtc_session_description_new( type_.to_glib(), sdp.to_glib_none_mut().0, )); diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index dc9788d99..8116a963e 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -18,7 +18,7 @@ use glib::signal::SignalHandlerId; use glib::translate::*; use glib::GString; -use ffi; +use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; @@ -55,7 +55,10 @@ impl> GstBinExtManual for O { for e in elements { unsafe { glib_result_from_gboolean!( - ffi::gst_bin_add(self.as_ref().to_glib_none().0, e.as_ref().to_glib_none().0), + gst_sys::gst_bin_add( + self.as_ref().to_glib_none().0, + e.as_ref().to_glib_none().0 + ), "Failed to add elements" )?; } @@ -68,7 +71,7 @@ impl> GstBinExtManual for O { for e in elements { unsafe { glib_result_from_gboolean!( - ffi::gst_bin_remove( + gst_sys::gst_bin_remove( self.as_ref().to_glib_none().0, e.as_ref().to_glib_none().0, ), @@ -97,7 +100,7 @@ impl> GstBinExtManual for O { fn iterate_all_by_interface(&self, iface: glib::types::Type) -> ::Iterator { unsafe { - from_glib_full(ffi::gst_bin_iterate_all_by_interface( + from_glib_full(gst_sys::gst_bin_iterate_all_by_interface( self.as_ref().to_glib_none().0, iface.to_glib(), )) @@ -106,31 +109,47 @@ impl> GstBinExtManual for O { fn iterate_elements(&self) -> ::Iterator { unsafe { - from_glib_full(ffi::gst_bin_iterate_elements( + from_glib_full(gst_sys::gst_bin_iterate_elements( self.as_ref().to_glib_none().0, )) } } fn iterate_recurse(&self) -> ::Iterator { - unsafe { from_glib_full(ffi::gst_bin_iterate_recurse(self.as_ref().to_glib_none().0)) } + unsafe { + from_glib_full(gst_sys::gst_bin_iterate_recurse( + self.as_ref().to_glib_none().0, + )) + } } fn iterate_sinks(&self) -> ::Iterator { - unsafe { from_glib_full(ffi::gst_bin_iterate_sinks(self.as_ref().to_glib_none().0)) } + unsafe { + from_glib_full(gst_sys::gst_bin_iterate_sinks( + self.as_ref().to_glib_none().0, + )) + } } fn iterate_sorted(&self) -> ::Iterator { - unsafe { from_glib_full(ffi::gst_bin_iterate_sorted(self.as_ref().to_glib_none().0)) } + unsafe { + from_glib_full(gst_sys::gst_bin_iterate_sorted( + self.as_ref().to_glib_none().0, + )) + } } fn iterate_sources(&self) -> ::Iterator { - unsafe { from_glib_full(ffi::gst_bin_iterate_sources(self.as_ref().to_glib_none().0)) } + unsafe { + from_glib_full(gst_sys::gst_bin_iterate_sources( + self.as_ref().to_glib_none().0, + )) + } } fn get_children(&self) -> Vec { unsafe { - let bin: &ffi::GstBin = &*(self.as_ptr() as *const _); + let bin: &gst_sys::GstBin = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&bin.element.object.lock); FromGlibPtrContainer::from_glib_none(bin.children) } @@ -157,9 +176,9 @@ unsafe extern "C" fn do_latency_trampoline< P, F: Fn(&P) -> Result<(), LoggableError> + Send + Sync + 'static, >( - this: *mut ffi::GstBin, - f: glib_ffi::gpointer, -) -> glib_ffi::gboolean + this: *mut gst_sys::GstBin, + f: glib_sys::gpointer, +) -> glib_sys::gboolean where P: IsA, { @@ -184,9 +203,9 @@ mod tests { ::init().unwrap(); let bin = ::Bin::new(None); - bin.add(&::ElementFactory::make("identity", "identity0").unwrap()) + bin.add(&::ElementFactory::make("identity", Some("identity0")).unwrap()) .unwrap(); - bin.add(&::ElementFactory::make("identity", "identity1").unwrap()) + bin.add(&::ElementFactory::make("identity", Some("identity1")).unwrap()) .unwrap(); let mut child_names = bin diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index 9285513e5..6a1bb10b4 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -20,10 +20,10 @@ use miniobject::*; use BufferFlags; use ClockTime; -use ffi; use glib; use glib::translate::{from_glib, from_glib_full, FromGlib, ToGlib}; -use glib_ffi; +use glib_sys; +use gst_sys; pub enum Readable {} pub enum Writable {} @@ -31,20 +31,20 @@ pub enum Writable {} gst_define_mini_object_wrapper!( Buffer, BufferRef, - ffi::GstBuffer, + gst_sys::GstBuffer, [Debug, PartialEq, Eq,], - || ffi::gst_buffer_get_type() + || gst_sys::gst_buffer_get_type() ); pub struct BufferMap<'a, T> { buffer: &'a BufferRef, - map_info: ffi::GstMapInfo, + map_info: gst_sys::GstMapInfo, phantom: PhantomData, } pub struct MappedBuffer { buffer: Option, - map_info: ffi::GstMapInfo, + map_info: gst_sys::GstMapInfo, phantom: PhantomData, } @@ -52,14 +52,14 @@ impl Buffer { pub fn new() -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_buffer_new()) } + unsafe { from_glib_full(gst_sys::gst_buffer_new()) } } pub fn with_size(size: usize) -> Option { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_buffer_new_allocate( + from_glib_full(gst_sys::gst_buffer_new_allocate( ptr::null_mut(), size, ptr::null_mut(), @@ -67,7 +67,7 @@ impl Buffer { } } - unsafe extern "C" fn drop_box(vec: glib_ffi::gpointer) { + unsafe extern "C" fn drop_box(vec: glib_sys::gpointer) { let slice: Box = Box::from_raw(vec as *mut T); drop(slice); } @@ -82,13 +82,13 @@ impl Buffer { (slice.len(), slice.as_mut_ptr()) }; let user_data = Box::into_raw(b); - from_glib_full(ffi::gst_buffer_new_wrapped_full( + from_glib_full(gst_sys::gst_buffer_new_wrapped_full( 0, - data as glib_ffi::gpointer, + data as glib_sys::gpointer, size, 0, size, - user_data as glib_ffi::gpointer, + user_data as glib_sys::gpointer, Some(Self::drop_box::), )) } @@ -104,25 +104,25 @@ impl Buffer { (slice.len(), slice.as_ptr()) }; let user_data = Box::into_raw(b); - from_glib_full(ffi::gst_buffer_new_wrapped_full( - ffi::GST_MEMORY_FLAG_READONLY, - data as glib_ffi::gpointer, + from_glib_full(gst_sys::gst_buffer_new_wrapped_full( + gst_sys::GST_MEMORY_FLAG_READONLY, + data as glib_sys::gpointer, size, 0, size, - user_data as glib_ffi::gpointer, + user_data as glib_sys::gpointer, Some(Self::drop_box::), )) } } pub fn into_mapped_buffer_readable(self) -> Result, Self> { - let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() }; + let mut map_info: gst_sys::GstMapInfo = unsafe { mem::zeroed() }; let res: bool = unsafe { - from_glib(ffi::gst_buffer_map( + from_glib(gst_sys::gst_buffer_map( self.as_mut_ptr(), &mut map_info, - ffi::GST_MAP_READ, + gst_sys::GST_MAP_READ, )) }; if res { @@ -137,12 +137,12 @@ impl Buffer { } pub fn into_mapped_buffer_writable(self) -> Result, Self> { - let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() }; + let mut map_info: gst_sys::GstMapInfo = unsafe { mem::zeroed() }; let res: bool = unsafe { - from_glib(ffi::gst_buffer_map( + from_glib(gst_sys::gst_buffer_map( self.as_mut_ptr(), &mut map_info, - ffi::GST_MAP_READWRITE, + gst_sys::GST_MAP_READWRITE, )) }; if res { @@ -158,7 +158,12 @@ impl Buffer { pub fn append(buffer: Self, other: Self) -> Self { skip_assert_initialized!(); - unsafe { from_glib_full(ffi::gst_buffer_append(buffer.into_ptr(), other.into_ptr())) } + unsafe { + from_glib_full(gst_sys::gst_buffer_append( + buffer.into_ptr(), + other.into_ptr(), + )) + } } } @@ -170,10 +175,11 @@ impl Default for Buffer { impl BufferRef { pub fn map_readable(&self) -> Option> { - let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() }; - let res = - unsafe { ffi::gst_buffer_map(self.as_mut_ptr(), &mut map_info, ffi::GST_MAP_READ) }; - if res == glib_ffi::GTRUE { + let mut map_info: gst_sys::GstMapInfo = unsafe { mem::zeroed() }; + let res = unsafe { + gst_sys::gst_buffer_map(self.as_mut_ptr(), &mut map_info, gst_sys::GST_MAP_READ) + }; + if res == glib_sys::GTRUE { Some(BufferMap { buffer: self, map_info, @@ -185,11 +191,11 @@ impl BufferRef { } pub fn map_writable(&mut self) -> Option> { - let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() }; + let mut map_info: gst_sys::GstMapInfo = unsafe { mem::zeroed() }; let res = unsafe { - ffi::gst_buffer_map(self.as_mut_ptr(), &mut map_info, ffi::GST_MAP_READWRITE) + gst_sys::gst_buffer_map(self.as_mut_ptr(), &mut map_info, gst_sys::GST_MAP_READWRITE) }; - if res == glib_ffi::GTRUE { + if res == glib_sys::GTRUE { Some(BufferMap { buffer: self, map_info, @@ -208,7 +214,7 @@ impl BufferRef { ) -> Option { let size_real = size.unwrap_or(usize::MAX); unsafe { - from_glib_full(ffi::gst_buffer_copy_region( + from_glib_full(gst_sys::gst_buffer_copy_region( self.as_mut_ptr(), flags.to_glib(), offset, @@ -227,7 +233,7 @@ impl BufferRef { let size_real = size.unwrap_or(usize::MAX); unsafe { glib_result_from_gboolean!( - ffi::gst_buffer_copy_into( + gst_sys::gst_buffer_copy_into( dest.as_mut_ptr(), self.as_mut_ptr(), flags.to_glib(), @@ -247,10 +253,10 @@ impl BufferRef { let copied = unsafe { let src = slice.as_ptr(); - ffi::gst_buffer_fill( + gst_sys::gst_buffer_fill( self.as_mut_ptr(), offset, - src as glib_ffi::gconstpointer, + src as glib_sys::gconstpointer, size, ) }; @@ -270,7 +276,7 @@ impl BufferRef { let copied = unsafe { let dest = slice.as_mut_ptr(); - ffi::gst_buffer_extract(self.as_mut_ptr(), offset, dest as glib_ffi::gpointer, size) + gst_sys::gst_buffer_extract(self.as_mut_ptr(), offset, dest as glib_sys::gpointer, size) }; if copied == size { @@ -281,18 +287,18 @@ impl BufferRef { } pub fn copy_deep(&self) -> Option { - unsafe { from_glib_full(ffi::gst_buffer_copy_deep(self.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_buffer_copy_deep(self.as_ptr())) } } pub fn get_size(&self) -> usize { - unsafe { ffi::gst_buffer_get_size(self.as_mut_ptr()) } + unsafe { gst_sys::gst_buffer_get_size(self.as_mut_ptr()) } } pub fn get_maxsize(&self) -> usize { let mut maxsize: usize = 0; unsafe { - ffi::gst_buffer_get_sizes_range( + gst_sys::gst_buffer_get_sizes_range( self.as_mut_ptr(), 0, -1, @@ -308,7 +314,7 @@ impl BufferRef { assert!(self.get_maxsize() >= size); unsafe { - ffi::gst_buffer_set_size(self.as_mut_ptr(), size as isize); + gst_sys::gst_buffer_set_size(self.as_mut_ptr(), size as isize); } } @@ -371,7 +377,7 @@ impl BufferRef { pub fn get_meta(&self) -> Option> { unsafe { - let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::get_meta_api().to_glib()); + let meta = gst_sys::gst_buffer_get_meta(self.as_mut_ptr(), T::get_meta_api().to_glib()); if meta.is_null() { None } else { @@ -382,7 +388,7 @@ impl BufferRef { pub fn get_meta_mut(&mut self) -> Option> { unsafe { - let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::get_meta_api().to_glib()); + let meta = gst_sys::gst_buffer_get_meta(self.as_mut_ptr(), T::get_meta_api().to_glib()); if meta.is_null() { None } else { @@ -405,7 +411,7 @@ macro_rules! define_iter( #[derive(Debug)] pub struct $name<'a, T: MetaAPI + 'a> { buffer: $typ, - state: glib_ffi::gpointer, + state: glib_sys::gpointer, meta_api: glib::Type, items: PhantomData<$mtyp>, } @@ -429,7 +435,7 @@ macro_rules! define_iter( fn next(&mut self) -> Option { loop { unsafe { - let meta = ffi::gst_buffer_iterate_meta(self.buffer.as_mut_ptr(), &mut self.state); + let meta = gst_sys::gst_buffer_iterate_meta(self.buffer.as_mut_ptr(), &mut self.state); if meta.is_null() { return None; @@ -452,14 +458,14 @@ define_iter!( MetaIter, &'a BufferRef, MetaRef<'a, T>, - |buffer: *const ffi::GstBuffer| BufferRef::from_ptr(buffer), + |buffer: *const gst_sys::GstBuffer| BufferRef::from_ptr(buffer), |buffer, meta| T::from_ptr(buffer, meta as *const ::GstType) ); define_iter!( MetaIterMut, &'a mut BufferRef, MetaRefMut<'a, T, ::meta::Iterated>, - |buffer: *mut ffi::GstBuffer| BufferRef::from_mut_ptr(buffer), + |buffer: *mut gst_sys::GstBuffer| BufferRef::from_mut_ptr(buffer), |buffer: &'a mut BufferRef, meta| T::from_mut_ptr(buffer, meta as *mut ::GstType) ); @@ -561,7 +567,7 @@ impl<'a, T> Eq for BufferMap<'a, T> {} impl<'a, T> Drop for BufferMap<'a, T> { fn drop(&mut self) { unsafe { - ffi::gst_buffer_unmap(self.buffer.as_mut_ptr(), &mut self.map_info); + gst_sys::gst_buffer_unmap(self.buffer.as_mut_ptr(), &mut self.map_info); } } } @@ -582,7 +588,7 @@ impl MappedBuffer { pub fn into_buffer(mut self) -> Buffer { let buffer = self.buffer.take().unwrap(); unsafe { - ffi::gst_buffer_unmap(buffer.as_mut_ptr(), &mut self.map_info); + gst_sys::gst_buffer_unmap(buffer.as_mut_ptr(), &mut self.map_info); } buffer @@ -625,7 +631,7 @@ impl Drop for MappedBuffer { fn drop(&mut self) { if let Some(ref buffer) = self.buffer { unsafe { - ffi::gst_buffer_unmap(buffer.as_mut_ptr(), &mut self.map_info); + gst_sys::gst_buffer_unmap(buffer.as_mut_ptr(), &mut self.map_info); } } } diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index f00c611ac..5d7642534 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -13,7 +13,7 @@ use glib; use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr, ToGlibPtrMut}; use glib::IsA; -use ffi; +use gst_sys; use std::mem; use std::ops; @@ -51,7 +51,7 @@ impl AsMut<::StructureRef> for BufferPoolConfig { impl BufferPoolConfig { pub fn add_option(&mut self, option: &str) { unsafe { - ffi::gst_buffer_pool_config_add_option( + gst_sys::gst_buffer_pool_config_add_option( self.0.to_glib_none_mut().0, option.to_glib_none().0, ); @@ -60,7 +60,7 @@ impl BufferPoolConfig { pub fn has_option(&self, option: &str) -> bool { unsafe { - from_glib(ffi::gst_buffer_pool_config_has_option( + from_glib(gst_sys::gst_buffer_pool_config_has_option( self.0.to_glib_none().0, option.to_glib_none().0, )) @@ -69,11 +69,11 @@ impl BufferPoolConfig { pub fn get_options(&self) -> Vec { unsafe { - let n = ffi::gst_buffer_pool_config_n_options(self.0.to_glib_none().0) as usize; + let n = gst_sys::gst_buffer_pool_config_n_options(self.0.to_glib_none().0) as usize; let mut options = Vec::with_capacity(n); for i in 0..n { - options.push(from_glib_none(ffi::gst_buffer_pool_config_get_option( + options.push(from_glib_none(gst_sys::gst_buffer_pool_config_get_option( self.0.to_glib_none().0, i as u32, ))); @@ -93,7 +93,7 @@ impl BufferPoolConfig { let caps = caps.into(); unsafe { - ffi::gst_buffer_pool_config_set_params( + gst_sys::gst_buffer_pool_config_set_params( self.0.to_glib_none_mut().0, caps.to_glib_none().0, size, @@ -110,7 +110,7 @@ impl BufferPoolConfig { let mut min_buffers = mem::uninitialized(); let mut max_buffers = mem::uninitialized(); - let ret: bool = from_glib(ffi::gst_buffer_pool_config_get_params( + let ret: bool = from_glib(gst_sys::gst_buffer_pool_config_get_params( self.0.to_glib_none().0, &mut caps, &mut size, @@ -136,7 +136,7 @@ impl BufferPoolConfig { unsafe { glib_result_from_gboolean!( - ffi::gst_buffer_pool_config_validate_params( + gst_sys::gst_buffer_pool_config_validate_params( self.0.to_glib_none().0, caps.to_glib_none().0, size, @@ -153,12 +153,12 @@ impl BufferPoolConfig { } #[derive(Debug)] -pub struct BufferPoolAcquireParams(ffi::GstBufferPoolAcquireParams); +pub struct BufferPoolAcquireParams(gst_sys::GstBufferPoolAcquireParams); impl BufferPoolAcquireParams { pub fn with_flags(flags: ::BufferPoolAcquireFlags) -> Self { - BufferPoolAcquireParams(ffi::GstBufferPoolAcquireParams { - format: ffi::GST_FORMAT_UNDEFINED, + BufferPoolAcquireParams(gst_sys::GstBufferPoolAcquireParams { + format: gst_sys::GST_FORMAT_UNDEFINED, start: -1, stop: -1, flags: flags.to_glib(), @@ -172,7 +172,7 @@ impl BufferPoolAcquireParams { flags: ::BufferPoolAcquireFlags, ) -> Self { unsafe { - BufferPoolAcquireParams(ffi::GstBufferPoolAcquireParams { + BufferPoolAcquireParams(gst_sys::GstBufferPoolAcquireParams { format: start.get_format().to_glib(), start: start.to_raw_value(), stop: stop.to_raw_value(), @@ -214,10 +214,10 @@ impl BufferPool { assert_initialized_main_thread!(); let (major, minor, _, _) = ::version(); if (major, minor) > (1, 12) { - unsafe { from_glib_full(ffi::gst_buffer_pool_new()) } + unsafe { from_glib_full(gst_sys::gst_buffer_pool_new()) } } else { // Work-around for 1.14 switching from transfer-floating to transfer-full - unsafe { from_glib_none(ffi::gst_buffer_pool_new()) } + unsafe { from_glib_none(gst_sys::gst_buffer_pool_new()) } } } } @@ -244,7 +244,7 @@ pub trait BufferPoolExtManual: 'static { impl> BufferPoolExtManual for O { fn get_config(&self) -> BufferPoolConfig { unsafe { - let ptr = ffi::gst_buffer_pool_get_config(self.as_ref().to_glib_none().0); + let ptr = gst_sys::gst_buffer_pool_get_config(self.as_ref().to_glib_none().0); BufferPoolConfig(from_glib_full(ptr)) } } @@ -252,7 +252,7 @@ impl> BufferPoolExtManual for O { fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_buffer_pool_set_config( + gst_sys::gst_buffer_pool_set_config( self.as_ref().to_glib_none().0, config.0.into_ptr() ), @@ -264,7 +264,7 @@ impl> BufferPoolExtManual for O { fn is_flushing(&self) -> bool { unsafe { let stash = self.as_ref().to_glib_none(); - let ptr: *mut ffi::GstBufferPool = stash.0; + let ptr: *mut gst_sys::GstBufferPool = stash.0; from_glib((*ptr).flushing) } @@ -282,7 +282,7 @@ impl> BufferPoolExtManual for O { unsafe { let mut buffer = ptr::null_mut(); - let ret: ::FlowReturn = from_glib(ffi::gst_buffer_pool_acquire_buffer( + let ret: ::FlowReturn = from_glib(gst_sys::gst_buffer_pool_acquire_buffer( self.as_ref().to_glib_none().0, &mut buffer, params_ptr, @@ -294,7 +294,10 @@ impl> BufferPoolExtManual for O { fn release_buffer(&self, buffer: ::Buffer) { unsafe { - ffi::gst_buffer_pool_release_buffer(self.as_ref().to_glib_none().0, buffer.into_ptr()); + gst_sys::gst_buffer_pool_release_buffer( + self.as_ref().to_glib_none().0, + buffer.into_ptr(), + ); } } } diff --git a/gstreamer/src/bufferlist.rs b/gstreamer/src/bufferlist.rs index f7517fc39..daceb2039 100644 --- a/gstreamer/src/bufferlist.rs +++ b/gstreamer/src/bufferlist.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::from_glib_full; +use gst_sys; use std::fmt; use miniobject::*; @@ -18,27 +18,27 @@ use BufferRef; gst_define_mini_object_wrapper!( BufferList, BufferListRef, - ffi::GstBufferList, + gst_sys::GstBufferList, [Debug,], - || ffi::gst_buffer_list_get_type() + || gst_sys::gst_buffer_list_get_type() ); impl BufferList { pub fn new() -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_buffer_list_new()) } + unsafe { from_glib_full(gst_sys::gst_buffer_list_new()) } } pub fn new_sized(size: usize) -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_buffer_list_new_sized(size as u32)) } + unsafe { from_glib_full(gst_sys::gst_buffer_list_new_sized(size as u32)) } } } impl BufferListRef { pub fn insert(&mut self, idx: i32, buffer: Buffer) { unsafe { - ffi::gst_buffer_list_insert(self.as_mut_ptr(), idx, buffer.into_ptr()); + gst_sys::gst_buffer_list_insert(self.as_mut_ptr(), idx, buffer.into_ptr()); } } @@ -47,16 +47,16 @@ impl BufferListRef { } pub fn copy_deep(&self) -> BufferList { - unsafe { from_glib_full(ffi::gst_buffer_list_copy_deep(self.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_buffer_list_copy_deep(self.as_ptr())) } } pub fn remove(&mut self, idx: u32, len: u32) { - unsafe { ffi::gst_buffer_list_remove(self.as_mut_ptr(), idx, len) } + unsafe { gst_sys::gst_buffer_list_remove(self.as_mut_ptr(), idx, len) } } pub fn get(&self, idx: u32) -> Option<&BufferRef> { unsafe { - let ptr = ffi::gst_buffer_list_get(self.as_mut_ptr(), idx); + let ptr = gst_sys::gst_buffer_list_get(self.as_mut_ptr(), idx); if ptr.is_null() { None } else { @@ -68,7 +68,7 @@ impl BufferListRef { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_writable(&mut self, idx: u32) -> Option<&mut BufferRef> { unsafe { - let ptr = ffi::gst_buffer_list_get_writable(self.as_mut_ptr(), idx); + let ptr = gst_sys::gst_buffer_list_get_writable(self.as_mut_ptr(), idx); if ptr.is_null() { None } else { @@ -78,12 +78,12 @@ impl BufferListRef { } pub fn len(&self) -> usize { - unsafe { ffi::gst_buffer_list_length(self.as_mut_ptr()) as usize } + unsafe { gst_sys::gst_buffer_list_length(self.as_mut_ptr()) as usize } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn calculate_size(&self) -> usize { - unsafe { ffi::gst_buffer_list_calculate_size(self.as_mut_ptr()) as usize } + unsafe { gst_sys::gst_buffer_list_calculate_size(self.as_mut_ptr()) as usize } } pub fn is_empty(&self) -> bool { diff --git a/gstreamer/src/bus.rs b/gstreamer/src/bus.rs index 4582f8581..cf56209d1 100644 --- a/gstreamer/src/bus.rs +++ b/gstreamer/src/bus.rs @@ -6,12 +6,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::source::{Continue, Priority, SourceId}; use glib::translate::*; -use glib_ffi; -use glib_ffi::{gboolean, gpointer}; +use glib_sys; +use glib_sys::{gboolean, gpointer}; +use gst_sys; use std::cell::RefCell; use std::mem::transmute; use std::ptr; @@ -21,8 +21,8 @@ use BusSyncReply; use Message; unsafe extern "C" fn trampoline_watch Continue + 'static>( - bus: *mut ffi::GstBus, - msg: *mut ffi::GstMessage, + bus: *mut gst_sys::GstBus, + msg: *mut gst_sys::GstMessage, func: gpointer, ) -> gboolean { let func: &RefCell = &*(func as *const RefCell); @@ -44,15 +44,15 @@ fn into_raw_watch Continue + 'static>(func: F) -> gp unsafe extern "C" fn trampoline_sync< F: Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static, >( - bus: *mut ffi::GstBus, - msg: *mut ffi::GstMessage, + bus: *mut gst_sys::GstBus, + msg: *mut gst_sys::GstMessage, func: gpointer, -) -> ffi::GstBusSyncReply { +) -> gst_sys::GstBusSyncReply { let f: &F = &*(func as *const F); let res = f(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).to_glib(); - if res == ffi::GST_BUS_DROP { - ffi::gst_mini_object_unref(msg as *mut _); + if res == gst_sys::GST_BUS_DROP { + gst_sys::gst_mini_object_unref(msg as *mut _); } res @@ -76,7 +76,7 @@ fn into_raw_sync BusSyncReply + Send + Sync + 'static>( impl Bus { pub fn add_signal_watch_full(&self, priority: Priority) { unsafe { - ffi::gst_bus_add_signal_watch_full(self.to_glib_none().0, priority.to_glib()); + gst_sys::gst_bus_add_signal_watch_full(self.to_glib_none().0, priority.to_glib()); } } @@ -91,18 +91,18 @@ impl Bus { { skip_assert_initialized!(); unsafe { - let source = ffi::gst_bus_create_watch(self.to_glib_none().0); - glib_ffi::g_source_set_callback( + let source = gst_sys::gst_bus_create_watch(self.to_glib_none().0); + glib_sys::g_source_set_callback( source, Some(transmute(trampoline_watch:: as usize)), into_raw_watch(func), Some(destroy_closure_watch::), ); - glib_ffi::g_source_set_priority(source, priority.to_glib()); + glib_sys::g_source_set_priority(source, priority.to_glib()); let name = name.into(); if let Some(name) = name { - glib_ffi::g_source_set_name(source, name.to_glib_none().0); + glib_sys::g_source_set_name(source, name.to_glib_none().0); } from_glib_full(source) @@ -114,9 +114,9 @@ impl Bus { F: FnMut(&Bus, &Message) -> Continue + Send + 'static, { unsafe { - let res = ffi::gst_bus_add_watch_full( + let res = gst_sys::gst_bus_add_watch_full( self.to_glib_none().0, - glib_ffi::G_PRIORITY_DEFAULT, + glib_sys::G_PRIORITY_DEFAULT, Some(trampoline_watch::), into_raw_watch(func), Some(destroy_closure_watch::), @@ -137,9 +137,9 @@ impl Bus { unsafe { assert!(glib::MainContext::ref_thread_default().is_owner()); - let res = ffi::gst_bus_add_watch_full( + let res = gst_sys::gst_bus_add_watch_full( self.to_glib_none().0, - glib_ffi::G_PRIORITY_DEFAULT, + glib_sys::G_PRIORITY_DEFAULT, Some(trampoline_watch::), into_raw_watch(func), Some(destroy_closure_watch::), @@ -158,7 +158,7 @@ impl Bus { F: Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static, { unsafe { - ffi::gst_bus_set_sync_handler( + gst_sys::gst_bus_set_sync_handler( self.to_glib_none().0, Some(trampoline_sync::), into_raw_sync(func), @@ -168,7 +168,9 @@ impl Bus { } pub fn unset_sync_handler(&self) { - unsafe { ffi::gst_bus_set_sync_handler(self.to_glib_none().0, None, ptr::null_mut(), None) } + unsafe { + gst_sys::gst_bus_set_sync_handler(self.to_glib_none().0, None, ptr::null_mut(), None) + } } pub fn iter(&self) -> Iter { diff --git a/gstreamer/src/bus_unix.rs b/gstreamer/src/bus_unix.rs index 9651a95ac..e7e63114e 100644 --- a/gstreamer/src/bus_unix.rs +++ b/gstreamer/src/bus_unix.rs @@ -9,8 +9,8 @@ #[macro_use] cfg_if! { if #[cfg(unix)] { - use ffi; - use glib_ffi; + use gst_sys; + use glib_sys; use glib::translate::ToGlibPtr; use std::mem; @@ -36,8 +36,8 @@ impl UnixBusExtManual for Bus { fn get_pollfd(&self) -> unix::io::RawFd { #[cfg(unix)] unsafe { - let mut pollfd: glib_ffi::GPollFD = mem::zeroed(); - ffi::gst_bus_get_pollfd(self.to_glib_none().0, &mut pollfd); + let mut pollfd: glib_sys::GPollFD = mem::zeroed(); + gst_sys::gst_bus_get_pollfd(self.to_glib_none().0, &mut pollfd); pollfd.fd } diff --git a/gstreamer/src/bus_windows.rs b/gstreamer/src/bus_windows.rs index 9a38003a9..98ef92e0b 100644 --- a/gstreamer/src/bus_windows.rs +++ b/gstreamer/src/bus_windows.rs @@ -9,8 +9,8 @@ #[macro_use] cfg_if! { if #[cfg(windows)] { - use ffi; - use glib_ffi; + use gst_sys; + use glib_sys; use glib::translate::ToGlibPtr; use std::mem; @@ -36,8 +36,8 @@ impl WindowsBusExtManual for Bus { fn get_pollfd(&self) -> windows::io::RawHandle { #[cfg(windows)] unsafe { - let mut pollfd: glib_ffi::GPollFD = mem::zeroed(); - ffi::gst_bus_get_pollfd(self.to_glib_none().0, &mut pollfd); + let mut pollfd: glib_sys::GPollFD = mem::zeroed(); + gst_sys::gst_bus_get_pollfd(self.to_glib_none().0, &mut pollfd); pollfd.fd as *mut _ } diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index b676c65a6..4e175b3bc 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -15,14 +15,18 @@ use structure::*; use CapsIntersectMode; -use ffi; use glib; use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; use glib::value::ToSendValue; +use gst_sys; -gst_define_mini_object_wrapper!(Caps, CapsRef, ffi::GstCaps, [Debug, PartialEq, Eq,], || { - ffi::gst_caps_get_type() -}); +gst_define_mini_object_wrapper!( + Caps, + CapsRef, + gst_sys::GstCaps, + [Debug, PartialEq, Eq,], + || gst_sys::gst_caps_get_type() +); impl Caps { pub fn builder(name: &str) -> Builder { @@ -32,12 +36,12 @@ impl Caps { pub fn new_empty() -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_caps_new_empty()) } + unsafe { from_glib_full(gst_sys::gst_caps_new_empty()) } } pub fn new_any() -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_caps_new_any()) } + unsafe { from_glib_full(gst_sys::gst_caps_new_any()) } } pub fn new_simple(name: &str, values: &[(&str, &ToSendValue)]) -> Self { @@ -52,23 +56,23 @@ impl Caps { pub fn from_string(value: &str) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_caps_from_string(value.to_glib_none().0)) } + unsafe { from_glib_full(gst_sys::gst_caps_from_string(value.to_glib_none().0)) } } pub fn fixate(caps: Self) -> Self { skip_assert_initialized!(); - unsafe { from_glib_full(ffi::gst_caps_fixate(caps.into_ptr())) } + unsafe { from_glib_full(gst_sys::gst_caps_fixate(caps.into_ptr())) } } pub fn merge(caps: Self, other: Self) -> Self { skip_assert_initialized!(); - unsafe { from_glib_full(ffi::gst_caps_merge(caps.into_ptr(), other.into_ptr())) } + unsafe { from_glib_full(gst_sys::gst_caps_merge(caps.into_ptr(), other.into_ptr())) } } pub fn merge_structure(caps: Self, structure: Structure) -> Self { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_caps_merge_structure( + from_glib_full(gst_sys::gst_caps_merge_structure( caps.into_ptr(), structure.into_ptr(), )) @@ -82,7 +86,7 @@ impl Caps { ) -> Self { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_caps_merge_structure_full( + from_glib_full(gst_sys::gst_caps_merge_structure_full( caps.into_ptr(), structure.into_ptr(), features.map(|f| f.into_ptr()).unwrap_or(ptr::null_mut()), @@ -92,17 +96,17 @@ impl Caps { pub fn normalize(caps: Self) -> Self { skip_assert_initialized!(); - unsafe { from_glib_full(ffi::gst_caps_normalize(caps.into_ptr())) } + unsafe { from_glib_full(gst_sys::gst_caps_normalize(caps.into_ptr())) } } pub fn simplify(caps: Self) -> Self { skip_assert_initialized!(); - unsafe { from_glib_full(ffi::gst_caps_simplify(caps.into_ptr())) } + unsafe { from_glib_full(gst_sys::gst_caps_simplify(caps.into_ptr())) } } pub fn truncate(caps: Self) -> Self { skip_assert_initialized!(); - unsafe { from_glib_full(ffi::gst_caps_truncate(caps.into_ptr())) } + unsafe { from_glib_full(gst_sys::gst_caps_truncate(caps.into_ptr())) } } } @@ -127,7 +131,7 @@ impl CapsRef { let value = value.to_value(); unsafe { - ffi::gst_caps_set_value( + gst_sys::gst_caps_set_value( self.as_mut_ptr(), name.to_glib_none().0, value.to_glib_none().0, @@ -137,7 +141,7 @@ impl CapsRef { } pub fn to_string(&self) -> String { - unsafe { from_glib_full(ffi::gst_caps_to_string(self.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_caps_to_string(self.as_ptr())) } } pub fn get_structure(&self, idx: u32) -> Option<&StructureRef> { @@ -146,7 +150,7 @@ impl CapsRef { } unsafe { - let structure = ffi::gst_caps_get_structure(self.as_ptr(), idx); + let structure = gst_sys::gst_caps_get_structure(self.as_ptr(), idx); if structure.is_null() { return None; } @@ -161,7 +165,7 @@ impl CapsRef { } unsafe { - let structure = ffi::gst_caps_get_structure(self.as_ptr(), idx); + let structure = gst_sys::gst_caps_get_structure(self.as_ptr(), idx); if structure.is_null() { return None; } @@ -176,7 +180,7 @@ impl CapsRef { } unsafe { - let features = ffi::gst_caps_get_features(self.as_ptr(), idx); + let features = gst_sys::gst_caps_get_features(self.as_ptr(), idx); Some(CapsFeaturesRef::from_glib_borrow(features)) } } @@ -187,7 +191,7 @@ impl CapsRef { } unsafe { - let features = ffi::gst_caps_get_features(self.as_ptr(), idx); + let features = gst_sys::gst_caps_get_features(self.as_ptr(), idx); Some(CapsFeaturesRef::from_glib_borrow_mut(features)) } } @@ -196,7 +200,7 @@ impl CapsRef { assert!(idx < self.get_size()); unsafe { - ffi::gst_caps_set_features( + gst_sys::gst_caps_set_features( self.as_mut_ptr(), idx, features.map(|f| f.into_ptr()).unwrap_or(ptr::null_mut()), @@ -205,7 +209,7 @@ impl CapsRef { } pub fn get_size(&self) -> u32 { - unsafe { ffi::gst_caps_get_size(self.as_ptr()) } + unsafe { gst_sys::gst_caps_get_size(self.as_ptr()) } } pub fn iter(&self) -> Iter { @@ -225,12 +229,12 @@ impl CapsRef { } pub fn append_structure(&mut self, structure: Structure) { - unsafe { ffi::gst_caps_append_structure(self.as_mut_ptr(), structure.into_ptr()) } + unsafe { gst_sys::gst_caps_append_structure(self.as_mut_ptr(), structure.into_ptr()) } } pub fn append_structure_full(&mut self, structure: Structure, features: Option) { unsafe { - ffi::gst_caps_append_structure_full( + gst_sys::gst_caps_append_structure_full( self.as_mut_ptr(), structure.into_ptr(), features.map(|f| f.into_ptr()).unwrap_or(ptr::null_mut()), @@ -239,20 +243,25 @@ impl CapsRef { } pub fn remove_structure(&mut self, idx: u32) { - unsafe { ffi::gst_caps_remove_structure(self.as_mut_ptr(), idx) } + unsafe { gst_sys::gst_caps_remove_structure(self.as_mut_ptr(), idx) } } pub fn append(&mut self, other: Caps) { - unsafe { ffi::gst_caps_append(self.as_mut_ptr(), other.into_ptr()) } + unsafe { gst_sys::gst_caps_append(self.as_mut_ptr(), other.into_ptr()) } } pub fn can_intersect(&self, other: &Self) -> bool { - unsafe { from_glib(ffi::gst_caps_can_intersect(self.as_ptr(), other.as_ptr())) } + unsafe { + from_glib(gst_sys::gst_caps_can_intersect( + self.as_ptr(), + other.as_ptr(), + )) + } } pub fn intersect(&self, other: &Self) -> Caps { unsafe { - from_glib_full(ffi::gst_caps_intersect( + from_glib_full(gst_sys::gst_caps_intersect( self.as_mut_ptr(), other.as_mut_ptr(), )) @@ -261,7 +270,7 @@ impl CapsRef { pub fn intersect_with_mode(&self, other: &Self, mode: CapsIntersectMode) -> Caps { unsafe { - from_glib_full(ffi::gst_caps_intersect_full( + from_glib_full(gst_sys::gst_caps_intersect_full( self.as_mut_ptr(), other.as_mut_ptr(), mode.to_glib(), @@ -271,7 +280,7 @@ impl CapsRef { pub fn is_always_compatible(&self, other: &Self) -> bool { unsafe { - from_glib(ffi::gst_caps_is_always_compatible( + from_glib(gst_sys::gst_caps_is_always_compatible( self.as_ptr(), other.as_ptr(), )) @@ -279,24 +288,29 @@ impl CapsRef { } pub fn is_any(&self) -> bool { - unsafe { from_glib(ffi::gst_caps_is_any(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_caps_is_any(self.as_ptr())) } } pub fn is_empty(&self) -> bool { - unsafe { from_glib(ffi::gst_caps_is_empty(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_caps_is_empty(self.as_ptr())) } } pub fn is_fixed(&self) -> bool { - unsafe { from_glib(ffi::gst_caps_is_fixed(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_caps_is_fixed(self.as_ptr())) } } pub fn is_equal_fixed(&self, other: &Self) -> bool { - unsafe { from_glib(ffi::gst_caps_is_equal_fixed(self.as_ptr(), other.as_ptr())) } + unsafe { + from_glib(gst_sys::gst_caps_is_equal_fixed( + self.as_ptr(), + other.as_ptr(), + )) + } } pub fn is_strictly_equal(&self, other: &Self) -> bool { unsafe { - from_glib(ffi::gst_caps_is_strictly_equal( + from_glib(gst_sys::gst_caps_is_strictly_equal( self.as_ptr(), other.as_ptr(), )) @@ -304,12 +318,17 @@ impl CapsRef { } pub fn is_subset(&self, superset: &Self) -> bool { - unsafe { from_glib(ffi::gst_caps_is_subset(self.as_ptr(), superset.as_ptr())) } + unsafe { + from_glib(gst_sys::gst_caps_is_subset( + self.as_ptr(), + superset.as_ptr(), + )) + } } pub fn is_subset_structure(&self, structure: &StructureRef) -> bool { unsafe { - from_glib(ffi::gst_caps_is_subset_structure( + from_glib(gst_sys::gst_caps_is_subset_structure( self.as_ptr(), structure.as_ptr(), )) @@ -322,7 +341,7 @@ impl CapsRef { features: Option<&CapsFeaturesRef>, ) -> bool { unsafe { - from_glib(ffi::gst_caps_is_subset_structure_full( + from_glib(gst_sys::gst_caps_is_subset_structure_full( self.as_ptr(), structure.as_ptr(), features.map(|f| f.as_ptr()).unwrap_or(ptr::null()), @@ -333,7 +352,7 @@ impl CapsRef { pub fn subtract(&self, other: &Self) -> Caps { skip_assert_initialized!(); unsafe { - from_glib_full(ffi::gst_caps_subtract( + from_glib_full(gst_sys::gst_caps_subtract( self.as_mut_ptr(), other.as_mut_ptr(), )) @@ -412,12 +431,12 @@ define_iter!( &'a CapsRef, &'a StructureRef, |caps: &CapsRef, idx| { - let ptr = ffi::gst_caps_get_structure(caps.as_ptr(), idx); + let ptr = gst_sys::gst_caps_get_structure(caps.as_ptr(), idx); if ptr.is_null() { None } else { Some(StructureRef::from_glib_borrow( - ptr as *const ffi::GstStructure, + ptr as *const gst_sys::GstStructure, )) } } @@ -427,12 +446,12 @@ define_iter!( &'a mut CapsRef, &'a mut StructureRef, |caps: &CapsRef, idx| { - let ptr = ffi::gst_caps_get_structure(caps.as_ptr(), idx); + let ptr = gst_sys::gst_caps_get_structure(caps.as_ptr(), idx); if ptr.is_null() { None } else { Some(StructureRef::from_glib_borrow_mut( - ptr as *mut ffi::GstStructure, + ptr as *mut gst_sys::GstStructure, )) } } @@ -442,14 +461,14 @@ define_iter!( &'a CapsRef, (&'a StructureRef, &'a CapsFeaturesRef), |caps: &CapsRef, idx| { - let ptr1 = ffi::gst_caps_get_structure(caps.as_ptr(), idx); - let ptr2 = ffi::gst_caps_get_features(caps.as_ptr(), idx); + let ptr1 = gst_sys::gst_caps_get_structure(caps.as_ptr(), idx); + let ptr2 = gst_sys::gst_caps_get_features(caps.as_ptr(), idx); if ptr1.is_null() || ptr2.is_null() { None } else { Some(( - StructureRef::from_glib_borrow(ptr1 as *const ffi::GstStructure), - CapsFeaturesRef::from_glib_borrow(ptr2 as *const ffi::GstCapsFeatures), + StructureRef::from_glib_borrow(ptr1 as *const gst_sys::GstStructure), + CapsFeaturesRef::from_glib_borrow(ptr2 as *const gst_sys::GstCapsFeatures), )) } } @@ -459,14 +478,14 @@ define_iter!( &'a mut CapsRef, (&'a mut StructureRef, &'a mut CapsFeaturesRef), |caps: &CapsRef, idx| { - let ptr1 = ffi::gst_caps_get_structure(caps.as_ptr(), idx); - let ptr2 = ffi::gst_caps_get_features(caps.as_ptr(), idx); + let ptr1 = gst_sys::gst_caps_get_structure(caps.as_ptr(), idx); + let ptr2 = gst_sys::gst_caps_get_features(caps.as_ptr(), idx); if ptr1.is_null() || ptr2.is_null() { None } else { Some(( - StructureRef::from_glib_borrow_mut(ptr1 as *mut ffi::GstStructure), - CapsFeaturesRef::from_glib_borrow_mut(ptr2 as *mut ffi::GstCapsFeatures), + StructureRef::from_glib_borrow_mut(ptr1 as *mut gst_sys::GstStructure), + CapsFeaturesRef::from_glib_borrow_mut(ptr2 as *mut gst_sys::GstCapsFeatures), )) } } @@ -486,7 +505,7 @@ impl fmt::Display for CapsRef { impl PartialEq for CapsRef { fn eq(&self, other: &CapsRef) -> bool { - unsafe { from_glib(ffi::gst_caps_is_equal(self.as_ptr(), other.as_ptr())) } + unsafe { from_glib(gst_sys::gst_caps_is_equal(self.as_ptr(), other.as_ptr())) } } } diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 16ec6e928..e0aea525e 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -15,14 +15,14 @@ use std::ops::{Deref, DerefMut}; use std::ptr; use std::str; -use ffi; use glib; use glib::translate::{ from_glib, from_glib_full, from_glib_none, FromGlibPtrFull, FromGlibPtrNone, GlibPtrDefault, Stash, StashMut, ToGlibPtr, ToGlibPtrMut, }; -use glib_ffi::gpointer; -use gobject_ffi; +use glib_sys::gpointer; +use gobject_sys; +use gst_sys; pub struct CapsFeatures(ptr::NonNull, PhantomData); unsafe impl Send for CapsFeatures {} @@ -44,7 +44,7 @@ impl CapsFeatures { unsafe { CapsFeatures( ptr::NonNull::new_unchecked( - ffi::gst_caps_features_new_empty() as *mut CapsFeaturesRef + gst_sys::gst_caps_features_new_empty() as *mut CapsFeaturesRef ), PhantomData, ) @@ -56,7 +56,7 @@ impl CapsFeatures { unsafe { CapsFeatures( ptr::NonNull::new_unchecked( - ffi::gst_caps_features_new_any() as *mut CapsFeaturesRef + gst_sys::gst_caps_features_new_any() as *mut CapsFeaturesRef ), PhantomData, ) @@ -66,7 +66,7 @@ impl CapsFeatures { pub fn from_string(value: &str) -> Option { assert_initialized_main_thread!(); unsafe { - let ptr = ffi::gst_caps_features_from_string(value.to_glib_none().0); + let ptr = gst_sys::gst_caps_features_from_string(value.to_glib_none().0); if ptr.is_null() { return None; } @@ -78,8 +78,8 @@ impl CapsFeatures { } } - pub unsafe fn into_ptr(self) -> *mut ffi::GstCapsFeatures { - let ptr = self.0.as_ptr() as *mut CapsFeaturesRef as *mut ffi::GstCapsFeatures; + pub unsafe fn into_ptr(self) -> *mut gst_sys::GstCapsFeatures { + let ptr = self.0.as_ptr() as *mut CapsFeaturesRef as *mut gst_sys::GstCapsFeatures; mem::forget(self); ptr @@ -115,7 +115,7 @@ impl AsMut for CapsFeatures { impl Clone for CapsFeatures { fn clone(&self) -> Self { unsafe { - let ptr = ffi::gst_caps_features_copy(&self.0.as_ref().0) as *mut CapsFeaturesRef; + let ptr = gst_sys::gst_caps_features_copy(&self.0.as_ref().0) as *mut CapsFeaturesRef; assert!(!ptr.is_null()); CapsFeatures(ptr::NonNull::new_unchecked(ptr), PhantomData) } @@ -124,7 +124,7 @@ impl Clone for CapsFeatures { impl Drop for CapsFeatures { fn drop(&mut self) { - unsafe { ffi::gst_caps_features_free(&mut self.0.as_mut().0) } + unsafe { gst_sys::gst_caps_features_free(&mut self.0.as_mut().0) } } } @@ -167,46 +167,46 @@ impl BorrowMut for CapsFeatures { impl glib::types::StaticType for CapsFeatures { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_caps_features_get_type()) } + unsafe { from_glib(gst_sys::gst_caps_features_get_type()) } } } -impl<'a> ToGlibPtr<'a, *const ffi::GstCapsFeatures> for CapsFeatures { +impl<'a> ToGlibPtr<'a, *const gst_sys::GstCapsFeatures> for CapsFeatures { type Storage = &'a Self; - fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstCapsFeatures, Self> { + fn to_glib_none(&'a self) -> Stash<'a, *const gst_sys::GstCapsFeatures, Self> { unsafe { Stash(&self.0.as_ref().0, self) } } - fn to_glib_full(&self) -> *const ffi::GstCapsFeatures { - unsafe { ffi::gst_caps_features_copy(&self.0.as_ref().0) } + fn to_glib_full(&self) -> *const gst_sys::GstCapsFeatures { + unsafe { gst_sys::gst_caps_features_copy(&self.0.as_ref().0) } } } -impl<'a> ToGlibPtr<'a, *mut ffi::GstCapsFeatures> for CapsFeatures { +impl<'a> ToGlibPtr<'a, *mut gst_sys::GstCapsFeatures> for CapsFeatures { type Storage = &'a Self; - fn to_glib_none(&'a self) -> Stash<'a, *mut ffi::GstCapsFeatures, Self> { + fn to_glib_none(&'a self) -> Stash<'a, *mut gst_sys::GstCapsFeatures, Self> { unsafe { Stash(&self.0.as_ref().0 as *const _ as *mut _, self) } } - fn to_glib_full(&self) -> *mut ffi::GstCapsFeatures { - unsafe { ffi::gst_caps_features_copy(&self.0.as_ref().0) } + fn to_glib_full(&self) -> *mut gst_sys::GstCapsFeatures { + unsafe { gst_sys::gst_caps_features_copy(&self.0.as_ref().0) } } } -impl<'a> ToGlibPtrMut<'a, *mut ffi::GstCapsFeatures> for CapsFeatures { +impl<'a> ToGlibPtrMut<'a, *mut gst_sys::GstCapsFeatures> for CapsFeatures { type Storage = &'a mut Self; - fn to_glib_none_mut(&'a mut self) -> StashMut<*mut ffi::GstCapsFeatures, Self> { + fn to_glib_none_mut(&'a mut self) -> StashMut<*mut gst_sys::GstCapsFeatures, Self> { unsafe { StashMut(&mut self.0.as_mut().0, self) } } } -impl FromGlibPtrNone<*const ffi::GstCapsFeatures> for CapsFeatures { - unsafe fn from_glib_none(ptr: *const ffi::GstCapsFeatures) -> Self { +impl FromGlibPtrNone<*const gst_sys::GstCapsFeatures> for CapsFeatures { + unsafe fn from_glib_none(ptr: *const gst_sys::GstCapsFeatures) -> Self { assert!(!ptr.is_null()); - let ptr = ffi::gst_caps_features_copy(ptr); + let ptr = gst_sys::gst_caps_features_copy(ptr); assert!(!ptr.is_null()); CapsFeatures( ptr::NonNull::new_unchecked(ptr as *mut CapsFeaturesRef), @@ -215,10 +215,10 @@ impl FromGlibPtrNone<*const ffi::GstCapsFeatures> for CapsFeatures { } } -impl FromGlibPtrNone<*mut ffi::GstCapsFeatures> for CapsFeatures { - unsafe fn from_glib_none(ptr: *mut ffi::GstCapsFeatures) -> Self { +impl FromGlibPtrNone<*mut gst_sys::GstCapsFeatures> for CapsFeatures { + unsafe fn from_glib_none(ptr: *mut gst_sys::GstCapsFeatures) -> Self { assert!(!ptr.is_null()); - let ptr = ffi::gst_caps_features_copy(ptr); + let ptr = gst_sys::gst_caps_features_copy(ptr); assert!(!ptr.is_null()); CapsFeatures( ptr::NonNull::new_unchecked(ptr as *mut CapsFeaturesRef), @@ -227,8 +227,8 @@ impl FromGlibPtrNone<*mut ffi::GstCapsFeatures> for CapsFeatures { } } -impl FromGlibPtrFull<*const ffi::GstCapsFeatures> for CapsFeatures { - unsafe fn from_glib_full(ptr: *const ffi::GstCapsFeatures) -> Self { +impl FromGlibPtrFull<*const gst_sys::GstCapsFeatures> for CapsFeatures { + unsafe fn from_glib_full(ptr: *const gst_sys::GstCapsFeatures) -> Self { assert!(!ptr.is_null()); CapsFeatures( ptr::NonNull::new_unchecked(ptr as *mut CapsFeaturesRef), @@ -237,8 +237,8 @@ impl FromGlibPtrFull<*const ffi::GstCapsFeatures> for CapsFeatures { } } -impl FromGlibPtrFull<*mut ffi::GstCapsFeatures> for CapsFeatures { - unsafe fn from_glib_full(ptr: *mut ffi::GstCapsFeatures) -> Self { +impl FromGlibPtrFull<*mut gst_sys::GstCapsFeatures> for CapsFeatures { + unsafe fn from_glib_full(ptr: *mut gst_sys::GstCapsFeatures) -> Self { assert!(!ptr.is_null()); CapsFeatures( ptr::NonNull::new_unchecked(ptr as *mut CapsFeaturesRef), @@ -249,60 +249,62 @@ impl FromGlibPtrFull<*mut ffi::GstCapsFeatures> for CapsFeatures { impl<'a> glib::value::FromValueOptional<'a> for CapsFeatures { unsafe fn from_value_optional(v: &'a glib::Value) -> Option { - let ptr = gobject_ffi::g_value_get_boxed(v.to_glib_none().0); + let ptr = gobject_sys::g_value_get_boxed(v.to_glib_none().0); assert!(!ptr.is_null()); - from_glib_none(ptr as *const ffi::GstCapsFeatures) + from_glib_none(ptr as *const gst_sys::GstCapsFeatures) } } impl glib::value::SetValue for CapsFeatures { unsafe fn set_value(v: &mut glib::Value, s: &Self) { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, s.0.as_ptr() as gpointer); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, s.0.as_ptr() as gpointer); } } impl glib::value::SetValueOptional for CapsFeatures { unsafe fn set_value_optional(v: &mut glib::Value, s: Option<&Self>) { if let Some(s) = s { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); } else { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, ptr::null_mut()); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, ptr::null_mut()); } } } impl GlibPtrDefault for CapsFeatures { - type GlibType = *mut ffi::GstCapsFeatures; + type GlibType = *mut gst_sys::GstCapsFeatures; } #[repr(C)] -pub struct CapsFeaturesRef(ffi::GstCapsFeatures); +pub struct CapsFeaturesRef(gst_sys::GstCapsFeatures); impl CapsFeaturesRef { - pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstCapsFeatures) -> &'a CapsFeaturesRef { + pub unsafe fn from_glib_borrow<'a>( + ptr: *const gst_sys::GstCapsFeatures, + ) -> &'a CapsFeaturesRef { assert!(!ptr.is_null()); &*(ptr as *mut CapsFeaturesRef) } pub unsafe fn from_glib_borrow_mut<'a>( - ptr: *mut ffi::GstCapsFeatures, + ptr: *mut gst_sys::GstCapsFeatures, ) -> &'a mut CapsFeaturesRef { assert!(!ptr.is_null()); &mut *(ptr as *mut CapsFeaturesRef) } - pub unsafe fn as_ptr(&self) -> *const ffi::GstCapsFeatures { - self as *const Self as *const ffi::GstCapsFeatures + pub unsafe fn as_ptr(&self) -> *const gst_sys::GstCapsFeatures { + self as *const Self as *const gst_sys::GstCapsFeatures } - pub unsafe fn as_mut_ptr(&self) -> *mut ffi::GstCapsFeatures { - self as *const Self as *mut ffi::GstCapsFeatures + pub unsafe fn as_mut_ptr(&self) -> *mut gst_sys::GstCapsFeatures { + self as *const Self as *mut gst_sys::GstCapsFeatures } pub fn to_string(&self) -> String { - unsafe { from_glib_full(ffi::gst_caps_features_to_string(self.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_caps_features_to_string(self.as_ptr())) } } pub fn is_empty(&self) -> bool { @@ -310,12 +312,12 @@ impl CapsFeaturesRef { } pub fn is_any(&self) -> bool { - unsafe { from_glib(ffi::gst_caps_features_is_any(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_caps_features_is_any(self.as_ptr())) } } pub fn contains(&self, feature: &str) -> bool { unsafe { - from_glib(ffi::gst_caps_features_contains( + from_glib(gst_sys::gst_caps_features_contains( self.as_ptr(), feature.to_glib_none().0, )) @@ -323,7 +325,7 @@ impl CapsFeaturesRef { } pub fn get_size(&self) -> u32 { - unsafe { ffi::gst_caps_features_get_size(self.as_ptr()) } + unsafe { gst_sys::gst_caps_features_get_size(self.as_ptr()) } } pub fn get_nth(&self, idx: u32) -> Option<&str> { @@ -332,7 +334,7 @@ impl CapsFeaturesRef { } unsafe { - let feature = ffi::gst_caps_features_get_nth(self.as_ptr(), idx); + let feature = gst_sys::gst_caps_features_get_nth(self.as_ptr(), idx); if feature.is_null() { return None; } @@ -342,11 +344,11 @@ impl CapsFeaturesRef { } pub fn add(&mut self, feature: &str) { - unsafe { ffi::gst_caps_features_add(self.as_mut_ptr(), feature.to_glib_none().0) } + unsafe { gst_sys::gst_caps_features_add(self.as_mut_ptr(), feature.to_glib_none().0) } } pub fn remove(&mut self, feature: &str) { - unsafe { ffi::gst_caps_features_remove(self.as_mut_ptr(), feature.to_glib_none().0) } + unsafe { gst_sys::gst_caps_features_remove(self.as_mut_ptr(), feature.to_glib_none().0) } } pub fn iter(&self) -> Iter { @@ -356,7 +358,7 @@ impl CapsFeaturesRef { // This is not an equivalence relation with regards to ANY. Everything is equal to ANY pub fn is_equal(&self, other: &CapsFeaturesRef) -> bool { unsafe { - from_glib(ffi::gst_caps_features_is_equal( + from_glib(gst_sys::gst_caps_features_is_equal( self.as_ptr(), other.as_ptr(), )) @@ -393,7 +395,7 @@ impl<'a> Iterator for Iter<'a> { } unsafe { - let feature = ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.idx); + let feature = gst_sys::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.idx); if feature.is_null() { return None; } @@ -425,7 +427,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> { unsafe { let feature = - ffi::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.n_features); + gst_sys::gst_caps_features_get_nth(self.caps_features.as_ptr(), self.n_features); if feature.is_null() { return None; } @@ -455,7 +457,9 @@ impl ToOwned for CapsFeaturesRef { type Owned = CapsFeatures; fn to_owned(&self) -> CapsFeatures { - unsafe { from_glib_full(ffi::gst_caps_features_copy(self.as_ptr() as *const _) as *mut _) } + unsafe { + from_glib_full(gst_sys::gst_caps_features_copy(self.as_ptr() as *const _) as *mut _) + } } } @@ -464,7 +468,7 @@ unsafe impl Send for CapsFeaturesRef {} lazy_static! { pub static ref CAPS_FEATURE_MEMORY_SYSTEM_MEMORY: &'static str = unsafe { - CStr::from_ptr(ffi::GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY) + CStr::from_ptr(gst_sys::GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY) .to_str() .unwrap() }; diff --git a/gstreamer/src/child_proxy.rs b/gstreamer/src/child_proxy.rs index 193bbd542..b12d388f8 100644 --- a/gstreamer/src/child_proxy.rs +++ b/gstreamer/src/child_proxy.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::object::IsA; use glib::translate::*; +use gst_sys; use std::ptr; use ChildProxy; @@ -21,7 +21,7 @@ pub trait ChildProxyExtManual: 'static { impl> ChildProxyExtManual for O { fn get_child_property(&self, name: &str) -> Option { unsafe { - let found: bool = from_glib(ffi::gst_child_proxy_lookup( + let found: bool = from_glib(gst_sys::gst_child_proxy_lookup( self.as_ref().to_glib_none().0, name.to_glib_none().0, ptr::null_mut(), @@ -32,7 +32,7 @@ impl> ChildProxyExtManual for O { } let mut value = glib::Value::uninitialized(); - ffi::gst_child_proxy_get_property( + gst_sys::gst_child_proxy_get_property( self.as_ref().to_glib_none().0, name.to_glib_none().0, value.to_glib_none_mut().0, @@ -43,7 +43,7 @@ impl> ChildProxyExtManual for O { fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError> { unsafe { - let found: bool = from_glib(ffi::gst_child_proxy_lookup( + let found: bool = from_glib(gst_sys::gst_child_proxy_lookup( self.as_ref().to_glib_none().0, name.to_glib_none().0, ptr::null_mut(), @@ -54,7 +54,7 @@ impl> ChildProxyExtManual for O { } let value = value.to_value(); - ffi::gst_child_proxy_set_property( + gst_sys::gst_child_proxy_set_property( self.as_ref().to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 64930b294..251acade2 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -6,11 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::*; use glib::IsA; -use glib_ffi::{gboolean, gpointer}; +use glib_sys::{gboolean, gpointer}; +use gst_sys; use libc::c_void; use std::cmp; use std::mem; @@ -27,14 +27,14 @@ glib_wrapper! { pub struct ClockId(Shared); match fn { - ref => |ptr| ffi::gst_clock_id_ref(ptr), - unref => |ptr| ffi::gst_clock_id_unref(ptr), + ref => |ptr| gst_sys::gst_clock_id_ref(ptr), + unref => |ptr| gst_sys::gst_clock_id_unref(ptr), } } unsafe extern "C" fn trampoline_wait_async( - clock: *mut ffi::GstClock, - time: ffi::GstClockTime, + clock: *mut gst_sys::GstClock, + time: gst_sys::GstClockTime, id: gpointer, func: gpointer, ) -> gboolean { @@ -44,7 +44,7 @@ unsafe extern "C" fn trampoline_wait_async(func impl ClockId { pub fn get_time(&self) -> ClockTime { - unsafe { from_glib(ffi::gst_clock_id_get_time(self.to_glib_none().0)) } + unsafe { from_glib(gst_sys::gst_clock_id_get_time(self.to_glib_none().0)) } } pub fn unschedule(&self) { - unsafe { ffi::gst_clock_id_unschedule(self.to_glib_none().0) } + unsafe { gst_sys::gst_clock_id_unschedule(self.to_glib_none().0) } } pub fn wait(&self) -> (Result, ClockTimeDiff) { unsafe { let mut jitter = mem::uninitialized(); - let res: ClockReturn = - from_glib(ffi::gst_clock_id_wait(self.to_glib_none().0, &mut jitter)); + let res: ClockReturn = from_glib(gst_sys::gst_clock_id_wait( + self.to_glib_none().0, + &mut jitter, + )); (res.into_result(), jitter) } } @@ -84,7 +86,7 @@ impl ClockId { F: Fn(&Clock, ClockTime, &ClockId) + Send + 'static, { let ret: ClockReturn = unsafe { - from_glib(ffi::gst_clock_id_wait_async( + from_glib(gst_sys::gst_clock_id_wait_async( self.to_glib_none().0, Some(trampoline_wait_async::), into_raw_wait_async(func), @@ -96,7 +98,8 @@ impl ClockId { pub fn compare_by_time(&self, other: &Self) -> cmp::Ordering { unsafe { - let res = ffi::gst_clock_id_compare_func(self.to_glib_none().0, other.to_glib_none().0); + let res = + gst_sys::gst_clock_id_compare_func(self.to_glib_none().0, other.to_glib_none().0); if res < 0 { cmp::Ordering::Less } else if res > 0 { @@ -120,7 +123,7 @@ impl Clock { cdenom: ClockTime, ) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_adjust_with_calibration( + from_glib(gst_sys::gst_clock_adjust_with_calibration( ptr::null_mut(), internal_target.to_glib(), cinternal.to_glib(), @@ -139,7 +142,7 @@ impl Clock { cdenom: ClockTime, ) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_unadjust_with_calibration( + from_glib(gst_sys::gst_clock_unadjust_with_calibration( ptr::null_mut(), external_target.to_glib(), cinternal.to_glib(), @@ -169,7 +172,7 @@ pub trait ClockExtManual: 'static { impl> ClockExtManual for O { fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> Option { unsafe { - from_glib_full(ffi::gst_clock_new_periodic_id( + from_glib_full(gst_sys::gst_clock_new_periodic_id( self.as_ref().to_glib_none().0, start_time.to_glib(), interval.to_glib(), @@ -185,7 +188,7 @@ impl> ClockExtManual for O { ) -> Result<(), glib::BoolError> { skip_assert_initialized!(); unsafe { - let res: bool = from_glib(ffi::gst_clock_periodic_id_reinit( + let res: bool = from_glib(gst_sys::gst_clock_periodic_id_reinit( self.as_ref().to_glib_none().0, id.to_glib_none().0, start_time.to_glib(), @@ -201,7 +204,7 @@ impl> ClockExtManual for O { fn new_single_shot_id(&self, time: ClockTime) -> Option { unsafe { - from_glib_full(ffi::gst_clock_new_single_shot_id( + from_glib_full(gst_sys::gst_clock_new_single_shot_id( self.as_ref().to_glib_none().0, time.to_glib(), )) @@ -210,7 +213,7 @@ impl> ClockExtManual for O { fn single_shot_id_reinit(&self, id: &ClockId, time: ClockTime) -> Result<(), glib::BoolError> { unsafe { - let res: bool = from_glib(ffi::gst_clock_single_shot_id_reinit( + let res: bool = from_glib(gst_sys::gst_clock_single_shot_id_reinit( self.as_ref().to_glib_none().0, id.to_glib_none().0, time.to_glib(), diff --git a/gstreamer/src/clock_time.rs b/gstreamer/src/clock_time.rs index c45fa4bc5..075274707 100644 --- a/gstreamer/src/clock_time.rs +++ b/gstreamer/src/clock_time.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::*; +use gst_sys; use std::{cmp, fmt}; #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug, Default)] @@ -107,22 +107,22 @@ impl fmt::Display for ClockTime { #[doc(hidden)] impl ToGlib for ClockTime { - type GlibType = ffi::GstClockTime; + type GlibType = gst_sys::GstClockTime; - fn to_glib(&self) -> ffi::GstClockTime { + fn to_glib(&self) -> gst_sys::GstClockTime { match self.0 { - None => ffi::GST_CLOCK_TIME_NONE, + None => gst_sys::GST_CLOCK_TIME_NONE, Some(v) => v, } } } #[doc(hidden)] -impl FromGlib for ClockTime { - fn from_glib(value: ffi::GstClockTime) -> Self { +impl FromGlib for ClockTime { + fn from_glib(value: gst_sys::GstClockTime) -> Self { skip_assert_initialized!(); match value { - ffi::GST_CLOCK_TIME_NONE => ClockTime(None), + gst_sys::GST_CLOCK_TIME_NONE => ClockTime(None), value => ClockTime(Some(value)), } } diff --git a/gstreamer/src/context.rs b/gstreamer/src/context.rs index e5a8b4fcc..6e158a45e 100644 --- a/gstreamer/src/context.rs +++ b/gstreamer/src/context.rs @@ -9,7 +9,7 @@ use std::ffi::CStr; use std::fmt; -use ffi; +use gst_sys; use glib; use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; @@ -17,15 +17,15 @@ use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; use miniobject::*; use StructureRef; -gst_define_mini_object_wrapper!(Context, ContextRef, ffi::GstContext, [Debug,], || { - ffi::gst_context_get_type() +gst_define_mini_object_wrapper!(Context, ContextRef, gst_sys::GstContext, [Debug,], || { + gst_sys::gst_context_get_type() }); impl Context { pub fn new(context_type: &str, persistent: bool) -> Self { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_context_new( + from_glib_full(gst_sys::gst_context_new( context_type.to_glib_none().0, persistent.to_glib(), )) @@ -36,14 +36,14 @@ impl Context { impl ContextRef { pub fn get_context_type(&self) -> &str { unsafe { - let raw = ffi::gst_context_get_context_type(self.as_mut_ptr()); + let raw = gst_sys::gst_context_get_context_type(self.as_mut_ptr()); CStr::from_ptr(raw).to_str().unwrap() } } pub fn has_context_type(&self, context_type: &str) -> bool { unsafe { - from_glib(ffi::gst_context_has_context_type( + from_glib(gst_sys::gst_context_has_context_type( self.as_mut_ptr(), context_type.to_glib_none().0, )) @@ -51,16 +51,18 @@ impl ContextRef { } pub fn is_persistent(&self) -> bool { - unsafe { from_glib(ffi::gst_context_is_persistent(self.as_mut_ptr())) } + unsafe { from_glib(gst_sys::gst_context_is_persistent(self.as_mut_ptr())) } } pub fn get_structure(&self) -> &StructureRef { - unsafe { StructureRef::from_glib_borrow(ffi::gst_context_get_structure(self.as_mut_ptr())) } + unsafe { + StructureRef::from_glib_borrow(gst_sys::gst_context_get_structure(self.as_mut_ptr())) + } } pub fn get_mut_structure(&mut self) -> &mut StructureRef { unsafe { - StructureRef::from_glib_borrow_mut(ffi::gst_context_writable_structure( + StructureRef::from_glib_borrow_mut(gst_sys::gst_context_writable_structure( self.as_mut_ptr(), )) } diff --git a/gstreamer/src/device_monitor.rs b/gstreamer/src/device_monitor.rs index ffcd761bb..cbb1f4e0e 100644 --- a/gstreamer/src/device_monitor.rs +++ b/gstreamer/src/device_monitor.rs @@ -13,17 +13,17 @@ use glib; use glib::object::IsA; use glib::translate::*; -use ffi; +use gst_sys; impl DeviceMonitor { pub fn new() -> DeviceMonitor { assert_initialized_main_thread!(); let (major, minor, _, _) = ::version(); if (major, minor) > (1, 12) { - unsafe { from_glib_full(ffi::gst_device_monitor_new()) } + unsafe { from_glib_full(gst_sys::gst_device_monitor_new()) } } else { // Work-around for 1.14 switching from transfer-floating to transfer-full - unsafe { from_glib_none(ffi::gst_device_monitor_new()) } + unsafe { from_glib_none(gst_sys::gst_device_monitor_new()) } } } } @@ -73,7 +73,7 @@ impl> DeviceMonitorExtManual for O { let classes = classes.into(); let caps = caps.into(); let id = unsafe { - ffi::gst_device_monitor_add_filter( + gst_sys::gst_device_monitor_add_filter( self.as_ref().to_glib_none().0, classes.to_glib_none().0, caps.to_glib_none().0, @@ -93,7 +93,7 @@ impl> DeviceMonitorExtManual for O { ) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_device_monitor_remove_filter( + gst_sys::gst_device_monitor_remove_filter( self.as_ref().to_glib_none().0, filter_id.to_glib() ), diff --git a/gstreamer/src/device_provider.rs b/gstreamer/src/device_provider.rs index dfdf61f43..48f0fa82e 100644 --- a/gstreamer/src/device_provider.rs +++ b/gstreamer/src/device_provider.rs @@ -13,8 +13,8 @@ use glib::translate::ToGlibPtr; use std::ffi::CStr; -use ffi; -use gobject_ffi; +use gobject_sys; +use gst_sys; pub trait DeviceProviderExtManual: 'static { fn get_metadata<'a>(&self, key: &str) -> Option<&'a str>; @@ -23,10 +23,10 @@ pub trait DeviceProviderExtManual: 'static { impl> DeviceProviderExtManual for O { fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> { unsafe { - let klass = (*(self.as_ptr() as *mut gobject_ffi::GTypeInstance)).g_class - as *mut ffi::GstDeviceProviderClass; + let klass = (*(self.as_ptr() as *mut gobject_sys::GTypeInstance)).g_class + as *mut gst_sys::GstDeviceProviderClass; - let ptr = ffi::gst_device_provider_class_get_metadata(klass, key.to_glib_none().0); + let ptr = gst_sys::gst_device_provider_class_get_metadata(klass, key.to_glib_none().0); if ptr.is_null() { None diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 989ec33fe..ff4369066 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -39,10 +39,10 @@ use std::mem; use libc; -use ffi; #[cfg(any(feature = "v1_10", feature = "dox"))] -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_sys; impl Element { pub fn link_many>(elements: &[&E]) -> Result<(), glib::BoolError> { @@ -50,7 +50,7 @@ impl Element { for e in elements.windows(2) { unsafe { glib_result_from_gboolean!( - ffi::gst_element_link( + gst_sys::gst_element_link( e[0].as_ref().to_glib_none().0, e[1].as_ref().to_glib_none().0, ), @@ -66,7 +66,7 @@ impl Element { skip_assert_initialized!(); for e in elements.windows(2) { unsafe { - ffi::gst_element_unlink( + gst_sys::gst_element_unlink( e[0].as_ref().to_glib_none().0, e[1].as_ref().to_glib_none().0, ); @@ -219,7 +219,7 @@ pub trait ElementExtManual: 'static { impl> ElementExtManual for O { fn get_element_class(&self) -> &ElementClass { unsafe { - let klass = (*(self.as_ptr() as *mut gobject_ffi::GTypeInstance)).g_class + let klass = (*(self.as_ptr() as *mut gobject_sys::GTypeInstance)).g_class as *const ElementClass; &*klass } @@ -230,7 +230,7 @@ impl> ElementExtManual for O { transition: StateChange, ) -> Result { let ret: StateChangeReturn = unsafe { - from_glib(ffi::gst_element_change_state( + from_glib(gst_sys::gst_element_change_state( self.as_ref().to_glib_none().0, transition.to_glib(), )) @@ -243,7 +243,7 @@ impl> ElementExtManual for O { ret: StateChangeReturn, ) -> Result { let ret: StateChangeReturn = unsafe { - from_glib(ffi::gst_element_continue_state( + from_glib(gst_sys::gst_element_continue_state( self.as_ref().to_glib_none().0, ret.to_glib(), )) @@ -258,7 +258,7 @@ impl> ElementExtManual for O { unsafe { let mut state = mem::uninitialized(); let mut pending = mem::uninitialized(); - let ret: StateChangeReturn = from_glib(ffi::gst_element_get_state( + let ret: StateChangeReturn = from_glib(gst_sys::gst_element_get_state( self.as_ref().to_glib_none().0, &mut state, &mut pending, @@ -270,7 +270,7 @@ impl> ElementExtManual for O { fn set_state(&self, state: State) -> Result { let ret: StateChangeReturn = unsafe { - from_glib(ffi::gst_element_set_state( + from_glib(gst_sys::gst_element_set_state( self.as_ref().to_glib_none().0, state.to_glib(), )) @@ -280,7 +280,7 @@ impl> ElementExtManual for O { fn query(&self, query: &mut QueryRef) -> bool { unsafe { - from_glib(ffi::gst_element_query( + from_glib(gst_sys::gst_element_query( self.as_ref().to_glib_none().0, query.as_mut_ptr(), )) @@ -289,7 +289,7 @@ impl> ElementExtManual for O { fn send_event(&self, event: Event) -> bool { unsafe { - from_glib(ffi::gst_element_send_event( + from_glib(gst_sys::gst_element_send_event( self.as_ref().to_glib_none().0, event.into_ptr(), )) @@ -320,12 +320,12 @@ impl> ElementExtManual for O { ) { unsafe { let type_ = match type_ { - ElementMessageType::Error => ffi::GST_MESSAGE_ERROR, - ElementMessageType::Warning => ffi::GST_MESSAGE_WARNING, - ElementMessageType::Info => ffi::GST_MESSAGE_INFO, + ElementMessageType::Error => gst_sys::GST_MESSAGE_ERROR, + ElementMessageType::Warning => gst_sys::GST_MESSAGE_WARNING, + ElementMessageType::Info => gst_sys::GST_MESSAGE_INFO, }; - ffi::gst_element_message_full( + gst_sys::gst_element_message_full( self.as_ref().to_glib_none().0, type_, T::domain().to_glib(), @@ -353,12 +353,12 @@ impl> ElementExtManual for O { ) { unsafe { let type_ = match type_ { - ElementMessageType::Error => ffi::GST_MESSAGE_ERROR, - ElementMessageType::Warning => ffi::GST_MESSAGE_WARNING, - ElementMessageType::Info => ffi::GST_MESSAGE_INFO, + ElementMessageType::Error => gst_sys::GST_MESSAGE_ERROR, + ElementMessageType::Warning => gst_sys::GST_MESSAGE_WARNING, + ElementMessageType::Info => gst_sys::GST_MESSAGE_INFO, }; - ffi::gst_element_message_full_with_details( + gst_sys::gst_element_message_full_with_details( self.as_ref().to_glib_none().0, type_, T::domain().to_glib(), @@ -385,9 +385,9 @@ impl> ElementExtManual for O { } = *msg; unsafe { - ffi::gst_element_message_full( + gst_sys::gst_element_message_full( self.as_ref().to_glib_none().0, - ffi::GST_MESSAGE_ERROR, + gst_sys::GST_MESSAGE_ERROR, error_domain.to_glib(), error_code, message.to_glib_full(), @@ -401,7 +401,7 @@ impl> ElementExtManual for O { fn iterate_pads(&self) -> ::Iterator { unsafe { - from_glib_full(ffi::gst_element_iterate_pads( + from_glib_full(gst_sys::gst_element_iterate_pads( self.as_ref().to_glib_none().0, )) } @@ -409,7 +409,7 @@ impl> ElementExtManual for O { fn iterate_sink_pads(&self) -> ::Iterator { unsafe { - from_glib_full(ffi::gst_element_iterate_sink_pads( + from_glib_full(gst_sys::gst_element_iterate_sink_pads( self.as_ref().to_glib_none().0, )) } @@ -417,7 +417,7 @@ impl> ElementExtManual for O { fn iterate_src_pads(&self) -> ::Iterator { unsafe { - from_glib_full(ffi::gst_element_iterate_src_pads( + from_glib_full(gst_sys::gst_element_iterate_src_pads( self.as_ref().to_glib_none().0, )) } @@ -425,7 +425,7 @@ impl> ElementExtManual for O { fn get_pads(&self) -> Vec { unsafe { - let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); + let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&elt.object.lock); FromGlibPtrContainer::from_glib_none(elt.pads) } @@ -433,7 +433,7 @@ impl> ElementExtManual for O { fn get_sink_pads(&self) -> Vec { unsafe { - let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); + let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&elt.object.lock); FromGlibPtrContainer::from_glib_none(elt.sinkpads) } @@ -441,7 +441,7 @@ impl> ElementExtManual for O { fn get_src_pads(&self) -> Vec { unsafe { - let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); + let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _); ::utils::MutexGuard::lock(&elt.object.lock); FromGlibPtrContainer::from_glib_none(elt.srcpads) } @@ -456,7 +456,7 @@ impl> ElementExtManual for O { let property_name = property_name.into(); let property_name = property_name.to_glib_none(); unsafe { - from_glib(ffi::gst_element_add_property_deep_notify_watch( + from_glib(gst_sys::gst_element_add_property_deep_notify_watch( self.as_ref().to_glib_none().0, property_name.0, include_value.to_glib(), @@ -473,7 +473,7 @@ impl> ElementExtManual for O { let property_name = property_name.into(); let property_name = property_name.to_glib_none(); unsafe { - from_glib(ffi::gst_element_add_property_notify_watch( + from_glib(gst_sys::gst_element_add_property_notify_watch( self.as_ref().to_glib_none().0, property_name.0, include_value.to_glib(), @@ -484,7 +484,7 @@ impl> ElementExtManual for O { #[cfg(any(feature = "v1_10", feature = "dox"))] fn remove_property_notify_watch(&self, watch_id: NotifyWatchId) { unsafe { - ffi::gst_element_remove_property_notify_watch( + gst_sys::gst_element_remove_property_notify_watch( self.as_ref().to_glib_none().0, watch_id.0, ); @@ -498,7 +498,7 @@ impl> ElementExtManual for O { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - let ret = from_glib(ffi::gst_element_query_convert( + let ret = from_glib(gst_sys::gst_element_query_convert( self.as_ref().to_glib_none().0, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -521,7 +521,7 @@ impl> ElementExtManual for O { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - let ret = from_glib(ffi::gst_element_query_convert( + let ret = from_glib(gst_sys::gst_element_query_convert( self.as_ref().to_glib_none().0, src_val.get_format().to_glib(), src_val.get_value(), @@ -539,7 +539,7 @@ impl> ElementExtManual for O { fn query_duration(&self) -> Option { unsafe { let mut duration = mem::uninitialized(); - let ret = from_glib(ffi::gst_element_query_duration( + let ret = from_glib(gst_sys::gst_element_query_duration( self.as_ref().to_glib_none().0, T::get_default_format().to_glib(), &mut duration, @@ -555,7 +555,7 @@ impl> ElementExtManual for O { fn query_duration_generic(&self, format: Format) -> Option { unsafe { let mut duration = mem::uninitialized(); - let ret = from_glib(ffi::gst_element_query_duration( + let ret = from_glib(gst_sys::gst_element_query_duration( self.as_ref().to_glib_none().0, format.to_glib(), &mut duration, @@ -571,7 +571,7 @@ impl> ElementExtManual for O { fn query_position(&self) -> Option { unsafe { let mut cur = mem::uninitialized(); - let ret = from_glib(ffi::gst_element_query_position( + let ret = from_glib(gst_sys::gst_element_query_position( self.as_ref().to_glib_none().0, T::get_default_format().to_glib(), &mut cur, @@ -587,7 +587,7 @@ impl> ElementExtManual for O { fn query_position_generic(&self, format: Format) -> Option { unsafe { let mut cur = mem::uninitialized(); - let ret = from_glib(ffi::gst_element_query_position( + let ret = from_glib(gst_sys::gst_element_query_position( self.as_ref().to_glib_none().0, format.to_glib(), &mut cur, @@ -616,7 +616,7 @@ impl> ElementExtManual for O { unsafe { glib_result_from_gboolean!( - ffi::gst_element_seek( + gst_sys::gst_element_seek( self.as_ref().to_glib_none().0, rate, start.get_format().to_glib(), @@ -639,7 +639,7 @@ impl> ElementExtManual for O { let seek_pos = seek_pos.into(); unsafe { glib_result_from_gboolean!( - ffi::gst_element_seek_simple( + gst_sys::gst_element_seek_simple( self.as_ref().to_glib_none().0, seek_pos.get_format().to_glib(), seek_flags.to_glib(), @@ -658,8 +658,8 @@ impl> ElementExtManual for O { let user_data: Box> = Box::new(Some(func)); unsafe extern "C" fn trampoline, F: FnOnce(&O) + Send + 'static>( - element: *mut ffi::GstElement, - user_data: glib_ffi::gpointer, + element: *mut gst_sys::GstElement, + user_data: glib_sys::gpointer, ) { let user_data: &mut Option = &mut *(user_data as *mut _); let callback = user_data.take().unwrap(); @@ -668,13 +668,13 @@ impl> ElementExtManual for O { } unsafe extern "C" fn free_user_data, F: FnOnce(&O) + Send + 'static>( - user_data: glib_ffi::gpointer, + user_data: glib_sys::gpointer, ) { let _: Box> = Box::from_raw(user_data as *mut _); } unsafe { - ffi::gst_element_call_async( + gst_sys::gst_element_call_async( self.as_ref().to_glib_none().0, Some(trampoline::), Box::into_raw(user_data) as *mut _, @@ -687,9 +687,10 @@ impl> ElementExtManual for O { impl ElementClass { pub fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> { unsafe { - let klass = self as *const _ as *const ffi::GstElementClass; + let klass = self as *const _ as *const gst_sys::GstElementClass; - let ptr = ffi::gst_element_class_get_metadata(klass as *mut _, key.to_glib_none().0); + let ptr = + gst_sys::gst_element_class_get_metadata(klass as *mut _, key.to_glib_none().0); if ptr.is_null() { None @@ -701,9 +702,9 @@ impl ElementClass { pub fn get_pad_template(&self, name: &str) -> Option { unsafe { - let klass = self as *const _ as *const ffi::GstElementClass; + let klass = self as *const _ as *const gst_sys::GstElementClass; - from_glib_none(ffi::gst_element_class_get_pad_template( + from_glib_none(gst_sys::gst_element_class_get_pad_template( klass as *mut _, name.to_glib_none().0, )) @@ -712,9 +713,9 @@ impl ElementClass { pub fn get_pad_template_list(&self) -> Vec { unsafe { - let klass = self as *const _ as *const ffi::GstElementClass; + let klass = self as *const _ as *const gst_sys::GstElementClass; - FromGlibPtrContainer::from_glib_none(ffi::gst_element_class_get_pad_template_list( + FromGlibPtrContainer::from_glib_none(gst_sys::gst_element_class_get_pad_template_list( klass as *mut _, )) } @@ -723,32 +724,32 @@ impl ElementClass { lazy_static! { pub static ref ELEMENT_METADATA_AUTHOR: &'static str = unsafe { - CStr::from_ptr(ffi::GST_ELEMENT_METADATA_AUTHOR) + CStr::from_ptr(gst_sys::GST_ELEMENT_METADATA_AUTHOR) .to_str() .unwrap() }; pub static ref ELEMENT_METADATA_DESCRIPTION: &'static str = unsafe { - CStr::from_ptr(ffi::GST_ELEMENT_METADATA_DESCRIPTION) + CStr::from_ptr(gst_sys::GST_ELEMENT_METADATA_DESCRIPTION) .to_str() .unwrap() }; pub static ref ELEMENT_METADATA_DOC_URI: &'static str = unsafe { - CStr::from_ptr(ffi::GST_ELEMENT_METADATA_DOC_URI) + CStr::from_ptr(gst_sys::GST_ELEMENT_METADATA_DOC_URI) .to_str() .unwrap() }; pub static ref ELEMENT_METADATA_ICON_NAME: &'static str = unsafe { - CStr::from_ptr(ffi::GST_ELEMENT_METADATA_ICON_NAME) + CStr::from_ptr(gst_sys::GST_ELEMENT_METADATA_ICON_NAME) .to_str() .unwrap() }; pub static ref ELEMENT_METADATA_KLASS: &'static str = unsafe { - CStr::from_ptr(ffi::GST_ELEMENT_METADATA_KLASS) + CStr::from_ptr(gst_sys::GST_ELEMENT_METADATA_KLASS) .to_str() .unwrap() }; pub static ref ELEMENT_METADATA_LONGNAME: &'static str = unsafe { - CStr::from_ptr(ffi::GST_ELEMENT_METADATA_LONGNAME) + CStr::from_ptr(gst_sys::GST_ELEMENT_METADATA_LONGNAME) .to_str() .unwrap() }; diff --git a/gstreamer/src/error.rs b/gstreamer/src/error.rs index d384e31e8..51261570f 100644 --- a/gstreamer/src/error.rs +++ b/gstreamer/src/error.rs @@ -125,14 +125,14 @@ macro_rules! gst_loggable_error( #[macro_export] macro_rules! gst_result_from_gboolean( // Plain strings - ($ffi_bool:expr, $cat:expr, $msg:expr) => { - glib_result_from_gboolean!($ffi_bool, $msg) + ($gst_sys_bool:expr, $cat:expr, $msg:expr) => { + glib_result_from_gboolean!($gst_sys_bool, $msg) .map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err)) }; // Format strings - ($ffi_bool:expr, $cat:expr, $($msg:tt)*) => { { - glib_result_from_gboolean!($ffi_bool, $($msg)*) + ($gst_sys_bool:expr, $cat:expr, $($msg:tt)*) => { { + glib_result_from_gboolean!($gst_sys_bool, $($msg)*) .map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err)) }}; ); diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 256a18027..287fc8dd0 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use miniobject::*; use structure::*; use GenericFormattedValue; @@ -67,7 +67,7 @@ impl cmp::PartialOrd for Seqnum { impl cmp::Ord for Seqnum { fn cmp(&self, other: &Seqnum) -> cmp::Ordering { unsafe { - let ret = ffi::gst_util_seqnum_compare(self.0, other.0); + let ret = gst_sys::gst_util_seqnum_compare(self.0, other.0); if ret < 0 { cmp::Ordering::Less } else if ret > 0 { @@ -112,23 +112,23 @@ impl FromGlib for GroupId { impl EventType { pub fn is_upstream(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_UPSTREAM != 0 + (self.to_glib() as u32) & gst_sys::GST_EVENT_TYPE_UPSTREAM != 0 } pub fn is_downstream(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_DOWNSTREAM != 0 + (self.to_glib() as u32) & gst_sys::GST_EVENT_TYPE_DOWNSTREAM != 0 } pub fn is_serialized(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_SERIALIZED != 0 + (self.to_glib() as u32) & gst_sys::GST_EVENT_TYPE_SERIALIZED != 0 } pub fn is_sticky(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY != 0 + (self.to_glib() as u32) & gst_sys::GST_EVENT_TYPE_STICKY != 0 } pub fn is_sticky_multi(self) -> bool { - (self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY_MULTI != 0 + (self.to_glib() as u32) & gst_sys::GST_EVENT_TYPE_STICKY_MULTI != 0 } } @@ -141,9 +141,9 @@ impl PartialOrd for EventType { let v1 = self.to_glib() as u32; let v2 = other.to_glib() as u32; - let stream_start = ffi::GST_EVENT_STREAM_START as u32; - let segment = ffi::GST_EVENT_SEGMENT as u32; - let eos = ffi::GST_EVENT_EOS as u32; + let stream_start = gst_sys::GST_EVENT_STREAM_START as u32; + let segment = gst_sys::GST_EVENT_SEGMENT as u32; + let eos = gst_sys::GST_EVENT_EOS as u32; // Strictly ordered range between stream_start and segment, // and EOS is bigger than everything else @@ -164,26 +164,26 @@ impl PartialOrd for EventType { } } -gst_define_mini_object_wrapper!(Event, EventRef, ffi::GstEvent, [Debug,], || { - ffi::gst_event_get_type() +gst_define_mini_object_wrapper!(Event, EventRef, gst_sys::GstEvent, [Debug,], || { + gst_sys::gst_event_get_type() }); impl EventRef { pub fn get_seqnum(&self) -> Seqnum { - unsafe { from_glib(ffi::gst_event_get_seqnum(self.as_mut_ptr())) } + unsafe { from_glib(gst_sys::gst_event_get_seqnum(self.as_mut_ptr())) } } pub fn get_running_time_offset(&self) -> i64 { - unsafe { ffi::gst_event_get_running_time_offset(self.as_mut_ptr()) } + unsafe { gst_sys::gst_event_get_running_time_offset(self.as_mut_ptr()) } } pub fn set_running_time_offset(&mut self, offset: i64) { - unsafe { ffi::gst_event_set_running_time_offset(self.as_mut_ptr(), offset) } + unsafe { gst_sys::gst_event_set_running_time_offset(self.as_mut_ptr(), offset) } } pub fn get_structure(&self) -> Option<&StructureRef> { unsafe { - let structure = ffi::gst_event_get_structure(self.as_mut_ptr()); + let structure = gst_sys::gst_event_get_structure(self.as_mut_ptr()); if structure.is_null() { None } else { @@ -220,39 +220,45 @@ impl EventRef { let type_ = unsafe { (*self.as_ptr()).type_ }; match type_ { - ffi::GST_EVENT_FLUSH_START => EventView::FlushStart(FlushStart(self)), - ffi::GST_EVENT_FLUSH_STOP => EventView::FlushStop(FlushStop(self)), - ffi::GST_EVENT_STREAM_START => EventView::StreamStart(StreamStart(self)), - ffi::GST_EVENT_CAPS => EventView::Caps(Caps(self)), - ffi::GST_EVENT_SEGMENT => EventView::Segment(Segment(self)), - ffi::GST_EVENT_STREAM_COLLECTION => EventView::StreamCollection(StreamCollection(self)), - ffi::GST_EVENT_TAG => EventView::Tag(Tag(self)), - ffi::GST_EVENT_BUFFERSIZE => EventView::BufferSize(BufferSize(self)), - ffi::GST_EVENT_SINK_MESSAGE => EventView::SinkMessage(SinkMessage(self)), - ffi::GST_EVENT_STREAM_GROUP_DONE => EventView::StreamGroupDone(StreamGroupDone(self)), - ffi::GST_EVENT_EOS => EventView::Eos(Eos(self)), - ffi::GST_EVENT_TOC => EventView::Toc(Toc(self)), - ffi::GST_EVENT_PROTECTION => EventView::Protection(Protection(self)), - ffi::GST_EVENT_SEGMENT_DONE => EventView::SegmentDone(SegmentDone(self)), - ffi::GST_EVENT_GAP => EventView::Gap(Gap(self)), - ffi::GST_EVENT_QOS => EventView::Qos(Qos(self)), - ffi::GST_EVENT_SEEK => EventView::Seek(Seek(self)), - ffi::GST_EVENT_NAVIGATION => EventView::Navigation(Navigation(self)), - ffi::GST_EVENT_LATENCY => EventView::Latency(Latency(self)), - ffi::GST_EVENT_STEP => EventView::Step(Step(self)), - ffi::GST_EVENT_RECONFIGURE => EventView::Reconfigure(Reconfigure(self)), - ffi::GST_EVENT_TOC_SELECT => EventView::TocSelect(TocSelect(self)), - ffi::GST_EVENT_SELECT_STREAMS => EventView::SelectStreams(SelectStreams(self)), - ffi::GST_EVENT_CUSTOM_UPSTREAM => EventView::CustomUpstream(CustomUpstream(self)), - ffi::GST_EVENT_CUSTOM_DOWNSTREAM => EventView::CustomDownstream(CustomDownstream(self)), - ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB => { + gst_sys::GST_EVENT_FLUSH_START => EventView::FlushStart(FlushStart(self)), + gst_sys::GST_EVENT_FLUSH_STOP => EventView::FlushStop(FlushStop(self)), + gst_sys::GST_EVENT_STREAM_START => EventView::StreamStart(StreamStart(self)), + gst_sys::GST_EVENT_CAPS => EventView::Caps(Caps(self)), + gst_sys::GST_EVENT_SEGMENT => EventView::Segment(Segment(self)), + gst_sys::GST_EVENT_STREAM_COLLECTION => { + EventView::StreamCollection(StreamCollection(self)) + } + gst_sys::GST_EVENT_TAG => EventView::Tag(Tag(self)), + gst_sys::GST_EVENT_BUFFERSIZE => EventView::BufferSize(BufferSize(self)), + gst_sys::GST_EVENT_SINK_MESSAGE => EventView::SinkMessage(SinkMessage(self)), + gst_sys::GST_EVENT_STREAM_GROUP_DONE => { + EventView::StreamGroupDone(StreamGroupDone(self)) + } + gst_sys::GST_EVENT_EOS => EventView::Eos(Eos(self)), + gst_sys::GST_EVENT_TOC => EventView::Toc(Toc(self)), + gst_sys::GST_EVENT_PROTECTION => EventView::Protection(Protection(self)), + gst_sys::GST_EVENT_SEGMENT_DONE => EventView::SegmentDone(SegmentDone(self)), + gst_sys::GST_EVENT_GAP => EventView::Gap(Gap(self)), + gst_sys::GST_EVENT_QOS => EventView::Qos(Qos(self)), + gst_sys::GST_EVENT_SEEK => EventView::Seek(Seek(self)), + gst_sys::GST_EVENT_NAVIGATION => EventView::Navigation(Navigation(self)), + gst_sys::GST_EVENT_LATENCY => EventView::Latency(Latency(self)), + gst_sys::GST_EVENT_STEP => EventView::Step(Step(self)), + gst_sys::GST_EVENT_RECONFIGURE => EventView::Reconfigure(Reconfigure(self)), + gst_sys::GST_EVENT_TOC_SELECT => EventView::TocSelect(TocSelect(self)), + gst_sys::GST_EVENT_SELECT_STREAMS => EventView::SelectStreams(SelectStreams(self)), + gst_sys::GST_EVENT_CUSTOM_UPSTREAM => EventView::CustomUpstream(CustomUpstream(self)), + gst_sys::GST_EVENT_CUSTOM_DOWNSTREAM => { + EventView::CustomDownstream(CustomDownstream(self)) + } + gst_sys::GST_EVENT_CUSTOM_DOWNSTREAM_OOB => { EventView::CustomDownstreamOob(CustomDownstreamOob(self)) } - ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY => { + gst_sys::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY => { EventView::CustomDownstreamSticky(CustomDownstreamSticky(self)) } - ffi::GST_EVENT_CUSTOM_BOTH => EventView::CustomBoth(CustomBoth(self)), - ffi::GST_EVENT_CUSTOM_BOTH_OOB => EventView::CustomBothOob(CustomBothOob(self)), + gst_sys::GST_EVENT_CUSTOM_BOTH => EventView::CustomBoth(CustomBoth(self)), + gst_sys::GST_EVENT_CUSTOM_BOTH_OOB => EventView::CustomBothOob(CustomBothOob(self)), _ => EventView::Other, } } @@ -449,7 +455,7 @@ impl fmt::Debug for EventRef { f.debug_struct("Event") .field("ptr", unsafe { &self.as_ptr() }) .field("type", &unsafe { - let type_ = ffi::gst_event_type_get_name((*self.as_ptr()).type_); + let type_ = gst_sys::gst_event_type_get_name((*self.as_ptr()).type_); CStr::from_ptr(type_).to_str().unwrap() }) .field("seqnum", &self.get_seqnum()) @@ -516,7 +522,7 @@ impl<'a> FlushStop<'a> { unsafe { let mut reset_time = mem::uninitialized(); - ffi::gst_event_parse_flush_stop(self.as_mut_ptr(), &mut reset_time); + gst_sys::gst_event_parse_flush_stop(self.as_mut_ptr(), &mut reset_time); from_glib(reset_time) } @@ -529,7 +535,7 @@ impl<'a> StreamStart<'a> { unsafe { let mut stream_id = ptr::null(); - ffi::gst_event_parse_stream_start(self.as_mut_ptr(), &mut stream_id); + gst_sys::gst_event_parse_stream_start(self.as_mut_ptr(), &mut stream_id); CStr::from_ptr(stream_id).to_str().unwrap() } } @@ -538,7 +544,7 @@ impl<'a> StreamStart<'a> { unsafe { let mut stream_flags = mem::uninitialized(); - ffi::gst_event_parse_stream_flags(self.as_mut_ptr(), &mut stream_flags); + gst_sys::gst_event_parse_stream_flags(self.as_mut_ptr(), &mut stream_flags); from_glib(stream_flags) } @@ -548,7 +554,7 @@ impl<'a> StreamStart<'a> { unsafe { let mut group_id = mem::uninitialized(); - ffi::gst_event_parse_group_id(self.as_mut_ptr(), &mut group_id); + gst_sys::gst_event_parse_group_id(self.as_mut_ptr(), &mut group_id); from_glib(group_id) } @@ -561,7 +567,7 @@ impl<'a> Caps<'a> { unsafe { let mut caps = ptr::null_mut(); - ffi::gst_event_parse_caps(self.as_mut_ptr(), &mut caps); + gst_sys::gst_event_parse_caps(self.as_mut_ptr(), &mut caps); ::CapsRef::from_ptr(caps) } } @@ -573,8 +579,8 @@ impl<'a> Segment<'a> { unsafe { let mut segment = ptr::null(); - ffi::gst_event_parse_segment(self.as_mut_ptr(), &mut segment); - &*(segment as *mut ffi::GstSegment as *mut ::Segment) + gst_sys::gst_event_parse_segment(self.as_mut_ptr(), &mut segment); + &*(segment as *mut gst_sys::GstSegment as *mut ::Segment) } } } @@ -586,7 +592,7 @@ impl<'a> StreamCollection<'a> { unsafe { let mut stream_collection = ptr::null_mut(); - ffi::gst_event_parse_stream_collection(self.as_mut_ptr(), &mut stream_collection); + gst_sys::gst_event_parse_stream_collection(self.as_mut_ptr(), &mut stream_collection); from_glib_full(stream_collection) } } @@ -598,7 +604,7 @@ impl<'a> Tag<'a> { unsafe { let mut tags = ptr::null_mut(); - ffi::gst_event_parse_tag(self.as_mut_ptr(), &mut tags); + gst_sys::gst_event_parse_tag(self.as_mut_ptr(), &mut tags); ::TagListRef::from_ptr(tags) } } @@ -613,7 +619,7 @@ impl<'a> BufferSize<'a> { let mut maxsize = mem::uninitialized(); let mut async = mem::uninitialized(); - ffi::gst_event_parse_buffer_size( + gst_sys::gst_event_parse_buffer_size( self.as_mut_ptr(), &mut fmt, &mut minsize, @@ -635,7 +641,7 @@ impl<'a> SinkMessage<'a> { unsafe { let mut msg = ptr::null_mut(); - ffi::gst_event_parse_sink_message(self.as_mut_ptr(), &mut msg); + gst_sys::gst_event_parse_sink_message(self.as_mut_ptr(), &mut msg); from_glib_full(msg) } } @@ -648,7 +654,7 @@ impl<'a> StreamGroupDone<'a> { unsafe { let mut group_id = mem::uninitialized(); - ffi::gst_event_parse_stream_group_done(self.as_mut_ptr(), &mut group_id); + gst_sys::gst_event_parse_stream_group_done(self.as_mut_ptr(), &mut group_id); from_glib(group_id) } @@ -664,7 +670,7 @@ impl<'a> Toc<'a> { let mut toc = ptr::null_mut(); let mut updated = mem::uninitialized(); - ffi::gst_event_parse_toc(self.as_mut_ptr(), &mut toc, &mut updated); + gst_sys::gst_event_parse_toc(self.as_mut_ptr(), &mut toc, &mut updated); (::TocRef::from_ptr(toc), from_glib(updated)) } } @@ -678,7 +684,7 @@ impl<'a> Protection<'a> { let mut buffer = ptr::null_mut(); let mut origin = ptr::null(); - ffi::gst_event_parse_protection( + gst_sys::gst_event_parse_protection( self.as_mut_ptr(), &mut system_id, &mut buffer, @@ -705,7 +711,7 @@ impl<'a> SegmentDone<'a> { let mut fmt = mem::uninitialized(); let mut position = mem::uninitialized(); - ffi::gst_event_parse_segment_done(self.as_mut_ptr(), &mut fmt, &mut position); + gst_sys::gst_event_parse_segment_done(self.as_mut_ptr(), &mut fmt, &mut position); GenericFormattedValue::new(from_glib(fmt), position) } @@ -719,7 +725,7 @@ impl<'a> Gap<'a> { let mut timestamp = mem::uninitialized(); let mut duration = mem::uninitialized(); - ffi::gst_event_parse_gap(self.as_mut_ptr(), &mut timestamp, &mut duration); + gst_sys::gst_event_parse_gap(self.as_mut_ptr(), &mut timestamp, &mut duration); (from_glib(timestamp), from_glib(duration)) } @@ -735,7 +741,7 @@ impl<'a> Qos<'a> { let mut diff = mem::uninitialized(); let mut timestamp = mem::uninitialized(); - ffi::gst_event_parse_qos( + gst_sys::gst_event_parse_qos( self.as_mut_ptr(), &mut type_, &mut proportion, @@ -769,7 +775,7 @@ impl<'a> Seek<'a> { let mut stop_type = mem::uninitialized(); let mut stop = mem::uninitialized(); - ffi::gst_event_parse_seek( + gst_sys::gst_event_parse_seek( self.as_mut_ptr(), &mut rate, &mut fmt, @@ -800,7 +806,7 @@ impl<'a> Latency<'a> { unsafe { let mut latency = mem::uninitialized(); - ffi::gst_event_parse_latency(self.as_mut_ptr(), &mut latency); + gst_sys::gst_event_parse_latency(self.as_mut_ptr(), &mut latency); from_glib(latency) } @@ -817,7 +823,7 @@ impl<'a> Step<'a> { let mut flush = mem::uninitialized(); let mut intermediate = mem::uninitialized(); - ffi::gst_event_parse_step( + gst_sys::gst_event_parse_step( self.as_mut_ptr(), &mut fmt, &mut amount, @@ -844,7 +850,7 @@ impl<'a> TocSelect<'a> { unsafe { let mut uid = ptr::null_mut(); - ffi::gst_event_parse_toc_select(self.as_mut_ptr(), &mut uid); + gst_sys::gst_event_parse_toc_select(self.as_mut_ptr(), &mut uid); CStr::from_ptr(uid).to_str().unwrap() } @@ -858,7 +864,7 @@ impl<'a> SelectStreams<'a> { unsafe { let mut streams = ptr::null_mut(); - ffi::gst_event_parse_select_streams(self.as_mut_ptr(), &mut streams); + gst_sys::gst_event_parse_select_streams(self.as_mut_ptr(), &mut streams); FromGlibPtrContainer::from_glib_full(streams) } @@ -945,16 +951,16 @@ macro_rules! event_builder_generic_impl { unsafe { let event = $new_fn(&mut self); if let Some(seqnum) = self.builder.seqnum { - ffi::gst_event_set_seqnum(event, seqnum.to_glib()); + gst_sys::gst_event_set_seqnum(event, seqnum.to_glib()); } if let Some(running_time_offset) = self.builder.running_time_offset { - ffi::gst_event_set_running_time_offset(event, running_time_offset); + gst_sys::gst_event_set_running_time_offset(event, running_time_offset); } if !self.builder.other_fields.is_empty() { let s = StructureRef::from_glib_borrow_mut( - ffi::gst_event_writable_structure(event) + gst_sys::gst_event_writable_structure(event) ); for (k, v) in self.builder.other_fields { @@ -979,7 +985,7 @@ impl<'a> FlushStartBuilder<'a> { } } - event_builder_generic_impl!(|_| ffi::gst_event_new_flush_start()); + event_builder_generic_impl!(|_| gst_sys::gst_event_new_flush_start()); } pub struct FlushStopBuilder<'a> { @@ -995,7 +1001,9 @@ impl<'a> FlushStopBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_flush_stop(s.reset_time.to_glib())); + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_flush_stop( + s.reset_time.to_glib() + )); } pub struct StreamStartBuilder<'a> { @@ -1030,12 +1038,12 @@ impl<'a> StreamStartBuilder<'a> { } event_builder_generic_impl!(|s: &Self| { - let ev = ffi::gst_event_new_stream_start(s.stream_id.to_glib_none().0); + let ev = gst_sys::gst_event_new_stream_start(s.stream_id.to_glib_none().0); if let Some(flags) = s.flags { - ffi::gst_event_set_stream_flags(ev, flags.to_glib()); + gst_sys::gst_event_set_stream_flags(ev, flags.to_glib()); } if let Some(group_id) = s.group_id { - ffi::gst_event_set_group_id(ev, group_id.to_glib()); + gst_sys::gst_event_set_group_id(ev, group_id.to_glib()); } ev }); @@ -1054,7 +1062,7 @@ impl<'a> CapsBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_caps(s.caps.as_mut_ptr())); + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_caps(s.caps.as_mut_ptr())); } pub struct SegmentBuilder<'a> { @@ -1070,7 +1078,9 @@ impl<'a> SegmentBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_segment(s.segment.to_glib_none().0)); + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_segment( + s.segment.to_glib_none().0 + )); } #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -1088,7 +1098,7 @@ impl<'a> StreamCollectionBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_stream_collection( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_stream_collection( s.stream_collection.to_glib_none().0 )); } @@ -1108,7 +1118,7 @@ impl<'a> TagBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let tags = s.tags.take().unwrap(); - ffi::gst_event_new_tag(tags.into_ptr()) + gst_sys::gst_event_new_tag(tags.into_ptr()) }); } @@ -1129,7 +1139,7 @@ impl<'a> BufferSizeBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_buffer_size( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_buffer_size( s.minsize.get_format().to_glib(), s.minsize.get_value(), s.maxsize.get_value(), @@ -1152,7 +1162,7 @@ impl<'a> SinkMessageBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_sink_message( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_sink_message( s.name.to_glib_none().0, s.msg.as_mut_ptr() )); @@ -1173,7 +1183,7 @@ impl<'a> StreamGroupDoneBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_stream_group_done( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_stream_group_done( s.group_id.to_glib() )); } @@ -1189,7 +1199,7 @@ impl<'a> EosBuilder<'a> { } } - event_builder_generic_impl!(|_| ffi::gst_event_new_eos()); + event_builder_generic_impl!(|_| gst_sys::gst_event_new_eos()); } pub struct TocBuilder<'a> { @@ -1207,7 +1217,7 @@ impl<'a> TocBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_toc( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_toc( s.toc.to_glib_none().0, s.updated.to_glib() )); @@ -1237,7 +1247,7 @@ impl<'a> ProtectionBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_protection( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_protection( s.system_id.to_glib_none().0, s.data.as_mut_ptr(), s.origin.to_glib_none().0, @@ -1257,7 +1267,7 @@ impl<'a> SegmentDoneBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_segment_done( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_segment_done( s.position.get_format().to_glib(), s.position.get_value() )); @@ -1278,7 +1288,7 @@ impl<'a> GapBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_gap( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_gap( s.timestamp.to_glib(), s.duration.to_glib() )); @@ -1303,7 +1313,7 @@ impl<'a> QosBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_qos( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_qos( s.type_.to_glib(), s.proportion, s.diff, @@ -1341,7 +1351,7 @@ impl<'a> SeekBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_seek( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_seek( s.rate, s.start.get_format().to_glib(), s.flags.to_glib(), @@ -1367,7 +1377,7 @@ impl<'a> NavigationBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let structure = s.structure.take(); - let ev = ffi::gst_event_new_navigation(structure.to_glib_none().0); + let ev = gst_sys::gst_event_new_navigation(structure.to_glib_none().0); mem::forget(structure); ev @@ -1387,7 +1397,7 @@ impl<'a> LatencyBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_latency(s.latency.to_glib())); + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_latency(s.latency.to_glib())); } pub struct StepBuilder<'a> { @@ -1409,7 +1419,7 @@ impl<'a> StepBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_step( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_step( s.amount.get_format().to_glib(), s.amount.get_value() as u64, s.rate, @@ -1429,7 +1439,7 @@ impl<'a> ReconfigureBuilder<'a> { } } - event_builder_generic_impl!(|_| ffi::gst_event_new_reconfigure()); + event_builder_generic_impl!(|_| gst_sys::gst_event_new_reconfigure()); } pub struct TocSelectBuilder<'a> { @@ -1445,7 +1455,9 @@ impl<'a> TocSelectBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_toc_select(s.uid.to_glib_none().0)); + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_toc_select( + s.uid.to_glib_none().0 + )); } #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -1463,7 +1475,7 @@ impl<'a> SelectStreamsBuilder<'a> { } } - event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_select_streams( + event_builder_generic_impl!(|s: &Self| gst_sys::gst_event_new_select_streams( s.streams.to_glib_full() )); } @@ -1483,8 +1495,10 @@ impl<'a> CustomUpstreamBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let structure = s.structure.take(); - let ev = - ffi::gst_event_new_custom(ffi::GST_EVENT_CUSTOM_UPSTREAM, structure.to_glib_none().0); + let ev = gst_sys::gst_event_new_custom( + gst_sys::GST_EVENT_CUSTOM_UPSTREAM, + structure.to_glib_none().0, + ); mem::forget(structure); ev @@ -1506,8 +1520,10 @@ impl<'a> CustomDownstreamBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let structure = s.structure.take(); - let ev = - ffi::gst_event_new_custom(ffi::GST_EVENT_CUSTOM_DOWNSTREAM, structure.to_glib_none().0); + let ev = gst_sys::gst_event_new_custom( + gst_sys::GST_EVENT_CUSTOM_DOWNSTREAM, + structure.to_glib_none().0, + ); mem::forget(structure); ev @@ -1529,8 +1545,8 @@ impl<'a> CustomDownstreamOobBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let structure = s.structure.take(); - let ev = ffi::gst_event_new_custom( - ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB, + let ev = gst_sys::gst_event_new_custom( + gst_sys::GST_EVENT_CUSTOM_DOWNSTREAM_OOB, structure.to_glib_none().0, ); mem::forget(structure); @@ -1554,8 +1570,8 @@ impl<'a> CustomDownstreamStickyBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let structure = s.structure.take(); - let ev = ffi::gst_event_new_custom( - ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY, + let ev = gst_sys::gst_event_new_custom( + gst_sys::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY, structure.to_glib_none().0, ); mem::forget(structure); @@ -1579,7 +1595,10 @@ impl<'a> CustomBothBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let structure = s.structure.take(); - let ev = ffi::gst_event_new_custom(ffi::GST_EVENT_CUSTOM_BOTH, structure.to_glib_none().0); + let ev = gst_sys::gst_event_new_custom( + gst_sys::GST_EVENT_CUSTOM_BOTH, + structure.to_glib_none().0, + ); mem::forget(structure); ev @@ -1601,8 +1620,10 @@ impl<'a> CustomBothOobBuilder<'a> { event_builder_generic_impl!(|s: &mut Self| { let structure = s.structure.take(); - let ev = - ffi::gst_event_new_custom(ffi::GST_EVENT_CUSTOM_BOTH_OOB, structure.to_glib_none().0); + let ev = gst_sys::gst_event_new_custom( + gst_sys::GST_EVENT_CUSTOM_BOTH_OOB, + structure.to_glib_none().0, + ); mem::forget(structure); ev diff --git a/gstreamer/src/functions.rs b/gstreamer/src/functions.rs index 477a8c29c..aa707cd92 100644 --- a/gstreamer/src/functions.rs +++ b/gstreamer/src/functions.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; +use gst_sys; use std::ptr; use Element; @@ -25,7 +25,7 @@ pub fn parse_bin_from_description_full<'a, P: Into> let mut context = context.into(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_parse_bin_from_description_full( + let ret = gst_sys::gst_parse_bin_from_description_full( bin_description.to_glib_none().0, ghost_unlinked_pads.to_glib(), context.to_glib_none_mut().0, @@ -49,7 +49,7 @@ pub fn parse_launch_full<'a, P: Into>>( let mut context = context.into(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_parse_launch_full( + let ret = gst_sys::gst_parse_launch_full( pipeline_description.to_glib_none().0, context.to_glib_none_mut().0, flags.to_glib(), @@ -72,7 +72,7 @@ pub fn parse_launchv_full<'a, P: Into>>( let mut context = context.into(); unsafe { let mut error = ptr::null_mut(); - let ret = ffi::gst_parse_launchv_full( + let ret = gst_sys::gst_parse_launchv_full( argv.to_glib_none().0, context.to_glib_none_mut().0, flags.to_glib(), @@ -89,9 +89,9 @@ pub fn parse_launchv_full<'a, P: Into>>( pub fn util_group_id_next() -> ::GroupId { assert_initialized_main_thread!(); unsafe { - let v = from_glib(ffi::gst_util_group_id_next()); + let v = from_glib(gst_sys::gst_util_group_id_next()); if v == ::GROUP_ID_INVALID { - return from_glib(ffi::gst_util_group_id_next()); + return from_glib(gst_sys::gst_util_group_id_next()); } v } @@ -100,9 +100,9 @@ pub fn util_group_id_next() -> ::GroupId { pub fn util_seqnum_next() -> ::Seqnum { assert_initialized_main_thread!(); unsafe { - let v = from_glib(ffi::gst_util_seqnum_next()); + let v = from_glib(gst_sys::gst_util_seqnum_next()); if v == ::SEQNUM_INVALID { - return from_glib(ffi::gst_util_seqnum_next()); + return from_glib(gst_sys::gst_util_seqnum_next()); } v } diff --git a/gstreamer/src/ghost_pad.rs b/gstreamer/src/ghost_pad.rs index 29b51470d..298f28186 100644 --- a/gstreamer/src/ghost_pad.rs +++ b/gstreamer/src/ghost_pad.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::Cast; use glib::object::IsA; use glib::translate::*; +use gst_sys; use GhostPad; use Object; use Pad; @@ -22,7 +22,7 @@ impl GhostPad { let name = name.into(); let name = name.to_glib_none(); unsafe { - Option::::from_glib_none(ffi::gst_ghost_pad_new( + Option::::from_glib_none(gst_sys::gst_ghost_pad_new( name.0, target.as_ref().to_glib_none().0, )) @@ -39,7 +39,7 @@ impl GhostPad { let name = name.into(); let name = name.to_glib_none(); unsafe { - Option::::from_glib_none(ffi::gst_ghost_pad_new_from_template( + Option::::from_glib_none(gst_sys::gst_ghost_pad_new_from_template( name.0, target.as_ref().to_glib_none().0, templ.to_glib_none().0, @@ -63,8 +63,8 @@ impl GhostPad { let parent = parent.into(); unsafe { glib_result_from_gboolean!( - ffi::gst_ghost_pad_activate_mode_default( - pad.to_glib_none().0 as *mut ffi::GstPad, + gst_sys::gst_ghost_pad_activate_mode_default( + pad.to_glib_none().0 as *mut gst_sys::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, mode.to_glib(), active.to_glib(), @@ -89,8 +89,8 @@ impl GhostPad { let parent = parent.into(); unsafe { glib_result_from_gboolean!( - ffi::gst_ghost_pad_internal_activate_mode_default( - pad.to_glib_none().0 as *mut ffi::GstPad, + gst_sys::gst_ghost_pad_internal_activate_mode_default( + pad.to_glib_none().0 as *mut gst_sys::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, mode.to_glib(), active.to_glib(), diff --git a/gstreamer/src/gobject.rs b/gstreamer/src/gobject.rs index 6979c6760..072759124 100644 --- a/gstreamer/src/gobject.rs +++ b/gstreamer/src/gobject.rs @@ -2,7 +2,7 @@ use glib; use glib::translate::ToGlibPtr; use glib::IsA; -use ffi; +use gst_sys; pub trait GObjectExtManualGst: 'static { fn set_property_from_str(&self, name: &str, value: &str); @@ -11,7 +11,7 @@ pub trait GObjectExtManualGst: 'static { impl> GObjectExtManualGst for O { fn set_property_from_str(&self, name: &str, value: &str) { unsafe { - ffi::gst_util_set_object_arg( + gst_sys::gst_util_set_object_arg( self.as_ref().to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index 59e04e257..4ca9fd0b5 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -6,15 +6,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::*; use glib::value::{FromValueOptional, ToValue}; use glib::StaticType; use glib::Value; -use glib_ffi; -use glib_ffi::{gconstpointer, gpointer}; -use gobject_ffi; +use glib_sys; +use glib_sys::{gconstpointer, gpointer}; +use gobject_sys; +use gst_sys; use std::error::Error; use std::ffi::CString; use std::fmt; @@ -50,7 +50,7 @@ impl Error for IteratorError { // Implemented manually so that we can use generics for the item #[derive(Debug)] pub struct Iterator { - iter: ptr::NonNull, + iter: ptr::NonNull, borrowed: bool, phantom: PhantomData, } @@ -63,22 +63,23 @@ where pub fn next(&mut self) -> Result, IteratorError> { unsafe { let mut value = Value::uninitialized(); - let res = ffi::gst_iterator_next(self.to_glib_none_mut().0, value.to_glib_none_mut().0); + let res = + gst_sys::gst_iterator_next(self.to_glib_none_mut().0, value.to_glib_none_mut().0); match res { - ffi::GST_ITERATOR_OK => match value.get::() { + gst_sys::GST_ITERATOR_OK => match value.get::() { Some(value) => Ok(Some(value)), None => Err(IteratorError::Error), }, - ffi::GST_ITERATOR_DONE => Ok(None), - ffi::GST_ITERATOR_RESYNC => Err(IteratorError::Resync), - ffi::GST_ITERATOR_ERROR | _ => Err(IteratorError::Error), + gst_sys::GST_ITERATOR_DONE => Ok(None), + gst_sys::GST_ITERATOR_RESYNC => Err(IteratorError::Resync), + gst_sys::GST_ITERATOR_ERROR | _ => Err(IteratorError::Error), } } } pub fn resync(&mut self) { unsafe { - ffi::gst_iterator_resync(self.to_glib_none_mut().0); + gst_sys::gst_iterator_resync(self.to_glib_none_mut().0); } } @@ -92,12 +93,12 @@ where let func_box: Box bool + Send + Sync + 'static> = Box::new(func); let mut closure_value = glib::Value::from_type(from_glib(filter_boxed_get_type::())); - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( closure_value.to_glib_none_mut().0, Arc::into_raw(Arc::new(func_box)) as gpointer, ); - from_glib_full(ffi::gst_iterator_filter( + from_glib_full(gst_sys::gst_iterator_filter( it as *mut _, Some(filter_trampoline::), closure_value.to_glib_none().0, @@ -115,7 +116,7 @@ where let mut func = func; let func_ptr = &mut func as *mut F as gpointer; - let res = from_glib(ffi::gst_iterator_find_custom( + let res = from_glib(gst_sys::gst_iterator_find_custom( self.to_glib_none_mut().0, Some(find_trampoline::), elem.to_glib_none_mut().0, @@ -137,16 +138,16 @@ where let mut func = func; let func_ptr = &mut func as *mut F as gpointer; - let res = ffi::gst_iterator_foreach( + let res = gst_sys::gst_iterator_foreach( self.to_glib_none_mut().0, Some(foreach_trampoline::), func_ptr, ); match res { - ffi::GST_ITERATOR_OK | ffi::GST_ITERATOR_DONE => Ok(()), - ffi::GST_ITERATOR_RESYNC => Err(IteratorError::Resync), - ffi::GST_ITERATOR_ERROR | _ => Err(IteratorError::Error), + gst_sys::GST_ITERATOR_OK | gst_sys::GST_ITERATOR_DONE => Ok(()), + gst_sys::GST_ITERATOR_RESYNC => Err(IteratorError::Resync), + gst_sys::GST_ITERATOR_ERROR | _ => Err(IteratorError::Error), } } } @@ -161,12 +162,12 @@ where let mut accum = Some(init); let mut ret = glib::Value::from_type(glib::Type::Pointer); - gobject_ffi::g_value_set_pointer( + gobject_sys::g_value_set_pointer( ret.to_glib_none_mut().0, &mut accum as *mut _ as gpointer, ); - let res = ffi::gst_iterator_fold( + let res = gst_sys::gst_iterator_fold( self.to_glib_none_mut().0, Some(fold_trampoline::), ret.to_glib_none_mut().0, @@ -174,9 +175,9 @@ where ); match res { - ffi::GST_ITERATOR_OK | ffi::GST_ITERATOR_DONE => Ok(accum.unwrap()), - ffi::GST_ITERATOR_RESYNC => Err(IteratorError::Resync), - ffi::GST_ITERATOR_ERROR | _ => Err(IteratorError::Error), + gst_sys::GST_ITERATOR_OK | gst_sys::GST_ITERATOR_DONE => Ok(accum.unwrap()), + gst_sys::GST_ITERATOR_RESYNC => Err(IteratorError::Resync), + gst_sys::GST_ITERATOR_ERROR | _ => Err(IteratorError::Error), } } } @@ -190,7 +191,7 @@ where static DUMMY_COOKIE: u32 = 0; unsafe { - let it = ffi::gst_iterator_new( + let it = gst_sys::gst_iterator_new( mem::size_of::>() as u32, T::static_type().to_glib(), ptr::null_mut(), @@ -226,7 +227,7 @@ struct RsIterator> where for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static, { - iter: ffi::GstIterator, + iter: gst_sys::GstIterator, imp: Option, phantom: PhantomData, } @@ -240,8 +241,8 @@ where } unsafe extern "C" fn rs_iterator_copy>( - it: *const ffi::GstIterator, - copy: *mut ffi::GstIterator, + it: *const gst_sys::GstIterator, + copy: *mut gst_sys::GstIterator, ) where for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static, { @@ -251,7 +252,7 @@ unsafe extern "C" fn rs_iterator_copy>( ptr::write(&mut (*copy).imp, (*it).imp.clone()); } -unsafe extern "C" fn rs_iterator_free>(it: *mut ffi::GstIterator) +unsafe extern "C" fn rs_iterator_free>(it: *mut gst_sys::GstIterator) where for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static, { @@ -260,9 +261,9 @@ where } unsafe extern "C" fn rs_iterator_next>( - it: *mut ffi::GstIterator, - result: *mut gobject_ffi::GValue, -) -> ffi::GstIteratorResult + it: *mut gst_sys::GstIterator, + result: *mut gobject_sys::GValue, +) -> gst_sys::GstIteratorResult where for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static, { @@ -272,17 +273,17 @@ where let value = value.to_value(); ptr::write(result, ptr::read(value.to_glib_none().0)); mem::forget(value); - ffi::GST_ITERATOR_OK + gst_sys::GST_ITERATOR_OK } - None => ffi::GST_ITERATOR_DONE, + None => gst_sys::GST_ITERATOR_DONE, Some(Err(res)) => match res { - IteratorError::Resync => ffi::GST_ITERATOR_RESYNC, - IteratorError::Error => ffi::GST_ITERATOR_ERROR, + IteratorError::Resync => gst_sys::GST_ITERATOR_RESYNC, + IteratorError::Error => gst_sys::GST_ITERATOR_ERROR, }, } } -unsafe extern "C" fn rs_iterator_resync>(it: *mut ffi::GstIterator) +unsafe extern "C" fn rs_iterator_resync>(it: *mut gst_sys::GstIterator) where for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static, { @@ -330,10 +331,10 @@ unsafe extern "C" fn filter_trampoline(value: gconstpointer, func: gconstpoin where for<'a> T: FromValueOptional<'a> + 'static, { - let value = value as *const gobject_ffi::GValue; + let value = value as *const gobject_sys::GValue; - let func = func as *const gobject_ffi::GValue; - let func = gobject_ffi::g_value_get_boxed(func); + let func = func as *const gobject_sys::GValue; + let func = gobject_sys::g_value_get_boxed(func); #[allow(clippy::transmute_ptr_to_ref)] let func: &&(Fn(T) -> bool + Send + Sync + 'static) = mem::transmute(func); @@ -361,10 +362,10 @@ unsafe extern "C" fn filter_boxed_unref(boxed: gpointer) { let _ = Arc::from_raw(boxed as *const (Box bool + Send + Sync + 'static>)); } -unsafe extern "C" fn filter_boxed_get_type() -> glib_ffi::GType { +unsafe extern "C" fn filter_boxed_get_type() -> glib_sys::GType { use std::sync::{Once, ONCE_INIT}; - static mut TYPE: glib_ffi::GType = gobject_ffi::G_TYPE_INVALID; + static mut TYPE: glib_sys::GType = gobject_sys::G_TYPE_INVALID; static ONCE: Once = ONCE_INIT; ONCE.call_once(|| { @@ -378,7 +379,7 @@ unsafe extern "C" fn filter_boxed_get_type() -> glib_ff idx )) .unwrap(); - if gobject_ffi::g_type_from_name(type_name.as_ptr()) == gobject_ffi::G_TYPE_INVALID + if gobject_sys::g_type_from_name(type_name.as_ptr()) == gobject_sys::G_TYPE_INVALID { break type_name; } @@ -386,7 +387,7 @@ unsafe extern "C" fn filter_boxed_get_type() -> glib_ff } }; - TYPE = gobject_ffi::g_boxed_type_register_static( + TYPE = gobject_sys::g_boxed_type_register_static( type_name.as_ptr(), Some(filter_boxed_ref::), Some(filter_boxed_unref::), @@ -403,7 +404,7 @@ unsafe extern "C" fn find_trampoline bool>( where for<'a> T: FromValueOptional<'a> + 'static, { - let value = value as *const gobject_ffi::GValue; + let value = value as *const gobject_sys::GValue; let func = func as *mut F; let value = &*(value as *const glib::Value); @@ -417,7 +418,7 @@ where } unsafe extern "C" fn foreach_trampoline( - value: *const gobject_ffi::GValue, + value: *const gobject_sys::GValue, func: gpointer, ) where for<'a> T: FromValueOptional<'a> + 'static, @@ -430,10 +431,10 @@ unsafe extern "C" fn foreach_trampoline( } unsafe extern "C" fn fold_trampoline Result>( - value: *const gobject_ffi::GValue, - ret: *mut gobject_ffi::GValue, + value: *const gobject_sys::GValue, + ret: *mut gobject_sys::GValue, func: gpointer, -) -> glib_ffi::gboolean +) -> glib_sys::gboolean where for<'a> T: FromValueOptional<'a> + 'static, { @@ -441,23 +442,23 @@ where let value = &*(value as *const glib::Value); let value = value.get::().unwrap(); - let accum = &mut *(gobject_ffi::g_value_get_pointer(ret) as *mut Option); + let accum = &mut *(gobject_sys::g_value_get_pointer(ret) as *mut Option); match (*func)(accum.take().unwrap(), value) { Ok(next_accum) => { *accum = Some(next_accum); - glib_ffi::GTRUE + glib_sys::GTRUE } Err(next_accum) => { *accum = Some(next_accum); - glib_ffi::GFALSE + glib_sys::GFALSE } } } impl Clone for Iterator { fn clone(&self) -> Self { - unsafe { from_glib_full(ffi::gst_iterator_copy(self.to_glib_none().0)) } + unsafe { from_glib_full(gst_sys::gst_iterator_copy(self.to_glib_none().0)) } } } @@ -465,7 +466,7 @@ impl Drop for Iterator { fn drop(&mut self) { if !self.borrowed { unsafe { - ffi::gst_iterator_free(self.iter.as_ptr()); + gst_sys::gst_iterator_free(self.iter.as_ptr()); } } } @@ -473,7 +474,7 @@ impl Drop for Iterator { impl glib::types::StaticType for Iterator { fn static_type() -> glib::types::Type { - unsafe { glib::translate::from_glib(ffi::gst_iterator_get_type()) } + unsafe { glib::translate::from_glib(gst_sys::gst_iterator_get_type()) } } } @@ -481,7 +482,7 @@ impl glib::types::StaticType for Iterator { impl<'a, T: StaticType> glib::value::FromValueOptional<'a> for Iterator { unsafe fn from_value_optional(value: &glib::Value) -> Option { Option::>::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstIterator, + gobject_sys::g_value_get_boxed(value.to_glib_none().0) as *mut gst_sys::GstIterator, ) } } @@ -489,10 +490,10 @@ impl<'a, T: StaticType> glib::value::FromValueOptional<'a> for Iterator { #[doc(hidden)] impl glib::value::SetValue for Iterator { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstIterator>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -500,76 +501,76 @@ impl glib::value::SetValue for Iterator { #[doc(hidden)] impl glib::value::SetValueOptional for Iterator { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(&this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstIterator>::to_glib_none(&this).0 + as glib_sys::gpointer, ) } } #[doc(hidden)] impl glib::translate::GlibPtrDefault for Iterator { - type GlibType = *mut ffi::GstIterator; + type GlibType = *mut gst_sys::GstIterator; } #[doc(hidden)] -impl<'a, T: 'static> glib::translate::ToGlibPtr<'a, *const ffi::GstIterator> for Iterator { +impl<'a, T: 'static> glib::translate::ToGlibPtr<'a, *const gst_sys::GstIterator> for Iterator { type Storage = &'a Iterator; - fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstIterator, Self> { + fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const gst_sys::GstIterator, Self> { glib::translate::Stash(self.iter.as_ptr(), self) } - fn to_glib_full(&self) -> *const ffi::GstIterator { + fn to_glib_full(&self) -> *const gst_sys::GstIterator { unimplemented!() } } #[doc(hidden)] -impl<'a, T: 'static> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstIterator> for Iterator { +impl<'a, T: 'static> glib::translate::ToGlibPtrMut<'a, *mut gst_sys::GstIterator> for Iterator { type Storage = &'a mut Iterator; #[inline] fn to_glib_none_mut( &'a mut self, - ) -> glib::translate::StashMut<'a, *mut ffi::GstIterator, Self> { + ) -> glib::translate::StashMut<'a, *mut gst_sys::GstIterator, Self> { glib::translate::StashMut(self.iter.as_ptr(), self) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*const ffi::GstIterator> for Iterator { +impl glib::translate::FromGlibPtrNone<*const gst_sys::GstIterator> for Iterator { #[inline] - unsafe fn from_glib_none(ptr: *const ffi::GstIterator) -> Self { + unsafe fn from_glib_none(ptr: *const gst_sys::GstIterator) -> Self { assert_ne!( - gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), - glib_ffi::GFALSE + gobject_sys::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib_sys::GFALSE ); - from_glib_full(ffi::gst_iterator_copy(ptr)) + from_glib_full(gst_sys::gst_iterator_copy(ptr)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstIterator> for Iterator { +impl glib::translate::FromGlibPtrNone<*mut gst_sys::GstIterator> for Iterator { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstIterator) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_sys::GstIterator) -> Self { assert_ne!( - gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), - glib_ffi::GFALSE + gobject_sys::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib_sys::GFALSE ); - from_glib_full(ffi::gst_iterator_copy(ptr)) + from_glib_full(gst_sys::gst_iterator_copy(ptr)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstIterator> for Iterator { +impl glib::translate::FromGlibPtrBorrow<*mut gst_sys::GstIterator> for Iterator { #[inline] - unsafe fn from_glib_borrow(ptr: *mut ffi::GstIterator) -> Self { + unsafe fn from_glib_borrow(ptr: *mut gst_sys::GstIterator) -> Self { assert!(!ptr.is_null()); assert_ne!( - gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), - glib_ffi::GFALSE + gobject_sys::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib_sys::GFALSE ); Self { iter: ptr::NonNull::new_unchecked(ptr), @@ -580,13 +581,13 @@ impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstIterator> fo } #[doc(hidden)] -impl glib::translate::FromGlibPtrFull<*mut ffi::GstIterator> for Iterator { +impl glib::translate::FromGlibPtrFull<*mut gst_sys::GstIterator> for Iterator { #[inline] - unsafe fn from_glib_full(ptr: *mut ffi::GstIterator) -> Self { + unsafe fn from_glib_full(ptr: *mut gst_sys::GstIterator) -> Self { assert!(!ptr.is_null()); assert_ne!( - gobject_ffi::g_type_is_a((*ptr).type_, T::static_type().to_glib()), - glib_ffi::GFALSE + gobject_sys::g_type_is_a((*ptr).type_, T::static_type().to_glib()), + glib_sys::GFALSE ); Self { iter: ptr::NonNull::new_unchecked(ptr), diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 715aabfad..b8045b950 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -18,11 +18,11 @@ extern crate libc; // Re-exported for the subclass gst_plugin_define! macro #[doc(hidden)] -pub extern crate glib_sys as glib_ffi; +pub extern crate glib_sys; #[doc(hidden)] -pub extern crate gobject_sys as gobject_ffi; +pub extern crate gobject_sys; #[doc(hidden)] -pub extern crate gstreamer_sys as ffi; +pub extern crate gstreamer_sys as gst_sys; #[macro_use] #[doc(hidden)] @@ -47,7 +47,7 @@ use glib::translate::{from_glib, from_glib_full}; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; @@ -266,7 +266,7 @@ use std::ptr; pub fn init() -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - if from_glib(ffi::gst_init_check( + if from_glib(gst_sys::gst_init_check( ptr::null_mut(), ptr::null_mut(), &mut error, @@ -279,10 +279,10 @@ pub fn init() -> Result<(), glib::Error> { } pub unsafe fn deinit() { - ffi::gst_deinit(); + gst_sys::gst_deinit(); } -pub const BUFFER_OFFSET_NONE: u64 = ffi::GST_BUFFER_OFFSET_NONE; +pub const BUFFER_OFFSET_NONE: u64 = gst_sys::GST_BUFFER_OFFSET_NONE; pub const CLOCK_TIME_NONE: ClockTime = ClockTime(None); pub const SECOND: ClockTime = ClockTime(Some(1_000_000_000)); @@ -295,8 +295,8 @@ pub const MSECOND_VAL: u64 = 1_000_000; pub const USECOND_VAL: u64 = 1_000; pub const NSECOND_VAL: u64 = 1; -pub const FORMAT_PERCENT_MAX: u32 = ffi::GST_FORMAT_PERCENT_MAX as u32; -pub const FORMAT_PERCENT_SCALE: u32 = ffi::GST_FORMAT_PERCENT_SCALE as u32; +pub const FORMAT_PERCENT_MAX: u32 = gst_sys::GST_FORMAT_PERCENT_MAX as u32; +pub const FORMAT_PERCENT_SCALE: u32 = gst_sys::GST_FORMAT_PERCENT_SCALE as u32; // Re-export all the traits in a prelude module, so that applications // can always "use gst::prelude::*" without getting conflicts diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index e07a47d67..dba6d872f 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -11,14 +11,14 @@ use std::ffi::CStr; use std::fmt; use std::ptr; -use ffi; -use gobject_ffi; +use gobject_sys; +use gst_sys; use glib::translate::{from_glib, ToGlib, ToGlibPtr}; use glib::IsA; #[derive(PartialEq, Eq, Clone, Copy)] -pub struct DebugCategory(ptr::NonNull); +pub struct DebugCategory(ptr::NonNull); impl DebugCategory { pub fn new<'a, P: Into>>( @@ -29,9 +29,9 @@ impl DebugCategory { extern "C" { fn _gst_debug_category_new( name: *const c_char, - color: ffi::GstDebugColorFlags, + color: gst_sys::GstDebugColorFlags, description: *const c_char, - ) -> *mut ffi::GstDebugCategory; + ) -> *mut gst_sys::GstDebugCategory; } let description = description.into(); @@ -50,7 +50,7 @@ impl DebugCategory { pub fn get(name: &str) -> Option { unsafe { extern "C" { - fn _gst_debug_get_category(name: *const c_char) -> *mut ffi::GstDebugCategory; + fn _gst_debug_get_category(name: *const c_char) -> *mut gst_sys::GstDebugCategory; } let cat = _gst_debug_get_category(name.to_glib_none().0); @@ -64,24 +64,24 @@ impl DebugCategory { } pub fn get_threshold(self) -> ::DebugLevel { - from_glib(unsafe { ffi::gst_debug_category_get_threshold(self.0.as_ptr()) }) + from_glib(unsafe { gst_sys::gst_debug_category_get_threshold(self.0.as_ptr()) }) } pub fn set_threshold(self, threshold: ::DebugLevel) { - unsafe { ffi::gst_debug_category_set_threshold(self.0.as_ptr(), threshold.to_glib()) } + unsafe { gst_sys::gst_debug_category_set_threshold(self.0.as_ptr(), threshold.to_glib()) } } pub fn reset_threshold(self) { - unsafe { ffi::gst_debug_category_reset_threshold(self.0.as_ptr()) } + unsafe { gst_sys::gst_debug_category_reset_threshold(self.0.as_ptr()) } } pub fn get_color(self) -> ::DebugColorFlags { - unsafe { from_glib(ffi::gst_debug_category_get_color(self.0.as_ptr())) } + unsafe { from_glib(gst_sys::gst_debug_category_get_color(self.0.as_ptr())) } } pub fn get_name<'a>(self) -> &'a str { unsafe { - CStr::from_ptr(ffi::gst_debug_category_get_name(self.0.as_ptr())) + CStr::from_ptr(gst_sys::gst_debug_category_get_name(self.0.as_ptr())) .to_str() .unwrap() } @@ -89,7 +89,7 @@ impl DebugCategory { pub fn get_description<'a>(self) -> Option<&'a str> { unsafe { - let ptr = ffi::gst_debug_category_get_description(self.0.as_ptr()); + let ptr = gst_sys::gst_debug_category_get_description(self.0.as_ptr()); if ptr.is_null() { None @@ -116,12 +116,12 @@ impl DebugCategory { } let obj_ptr = match obj { - Some(obj) => obj.to_glib_none().0 as *mut gobject_ffi::GObject, + Some(obj) => obj.to_glib_none().0 as *mut gobject_sys::GObject, None => ptr::null_mut(), }; unsafe { - ffi::gst_debug_log( + gst_sys::gst_debug_log( self.0.as_ptr(), level.to_glib(), file.to_glib_none().0, @@ -319,7 +319,7 @@ mod tests { gst_trace!(cat, "meh"); gst_memdump!(cat, "meh"); - let obj = ::Bin::new("meh"); + let obj = ::Bin::new(Some("meh")); gst_error!(cat, obj: &obj, "meh"); gst_warning!(cat, obj: &obj, "meh"); gst_fixme!(cat, obj: &obj, "meh"); diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index bed9748a0..e60ee46fa 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use miniobject::*; use structure::*; use GenericFormattedValue; @@ -28,8 +28,8 @@ use glib::value::ToSendValue; use glib::Cast; use glib::IsA; -gst_define_mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, [Debug,], || { - ffi::gst_message_get_type() +gst_define_mini_object_wrapper!(Message, MessageRef, gst_sys::GstMessage, [Debug,], || { + gst_sys::gst_message_get_type() }); impl MessageRef { @@ -38,12 +38,12 @@ impl MessageRef { } pub fn get_seqnum(&self) -> Seqnum { - unsafe { from_glib(ffi::gst_message_get_seqnum(self.as_mut_ptr())) } + unsafe { from_glib(gst_sys::gst_message_get_seqnum(self.as_mut_ptr())) } } pub fn get_structure(&self) -> Option<&StructureRef> { unsafe { - let structure = ffi::gst_message_get_structure(self.as_mut_ptr()); + let structure = gst_sys::gst_message_get_structure(self.as_mut_ptr()); if structure.is_null() { None } else { @@ -56,48 +56,50 @@ impl MessageRef { let type_ = unsafe { (*self.as_ptr()).type_ }; match type_ { - ffi::GST_MESSAGE_EOS => MessageView::Eos(Eos(self)), - ffi::GST_MESSAGE_ERROR => MessageView::Error(Error(self)), - ffi::GST_MESSAGE_WARNING => MessageView::Warning(Warning(self)), - ffi::GST_MESSAGE_INFO => MessageView::Info(Info(self)), - ffi::GST_MESSAGE_TAG => MessageView::Tag(Tag(self)), - ffi::GST_MESSAGE_BUFFERING => MessageView::Buffering(Buffering(self)), - ffi::GST_MESSAGE_STATE_CHANGED => MessageView::StateChanged(StateChanged(self)), - ffi::GST_MESSAGE_STATE_DIRTY => MessageView::StateDirty(StateDirty(self)), - ffi::GST_MESSAGE_STEP_DONE => MessageView::StepDone(StepDone(self)), - ffi::GST_MESSAGE_CLOCK_PROVIDE => MessageView::ClockProvide(ClockProvide(self)), - ffi::GST_MESSAGE_CLOCK_LOST => MessageView::ClockLost(ClockLost(self)), - ffi::GST_MESSAGE_NEW_CLOCK => MessageView::NewClock(NewClock(self)), - ffi::GST_MESSAGE_STRUCTURE_CHANGE => { + gst_sys::GST_MESSAGE_EOS => MessageView::Eos(Eos(self)), + gst_sys::GST_MESSAGE_ERROR => MessageView::Error(Error(self)), + gst_sys::GST_MESSAGE_WARNING => MessageView::Warning(Warning(self)), + gst_sys::GST_MESSAGE_INFO => MessageView::Info(Info(self)), + gst_sys::GST_MESSAGE_TAG => MessageView::Tag(Tag(self)), + gst_sys::GST_MESSAGE_BUFFERING => MessageView::Buffering(Buffering(self)), + gst_sys::GST_MESSAGE_STATE_CHANGED => MessageView::StateChanged(StateChanged(self)), + gst_sys::GST_MESSAGE_STATE_DIRTY => MessageView::StateDirty(StateDirty(self)), + gst_sys::GST_MESSAGE_STEP_DONE => MessageView::StepDone(StepDone(self)), + gst_sys::GST_MESSAGE_CLOCK_PROVIDE => MessageView::ClockProvide(ClockProvide(self)), + gst_sys::GST_MESSAGE_CLOCK_LOST => MessageView::ClockLost(ClockLost(self)), + gst_sys::GST_MESSAGE_NEW_CLOCK => MessageView::NewClock(NewClock(self)), + gst_sys::GST_MESSAGE_STRUCTURE_CHANGE => { MessageView::StructureChange(StructureChange(self)) } - ffi::GST_MESSAGE_STREAM_STATUS => MessageView::StreamStatus(StreamStatus(self)), - ffi::GST_MESSAGE_APPLICATION => MessageView::Application(Application(self)), - ffi::GST_MESSAGE_ELEMENT => MessageView::Element(Element(self)), - ffi::GST_MESSAGE_SEGMENT_START => MessageView::SegmentStart(SegmentStart(self)), - ffi::GST_MESSAGE_SEGMENT_DONE => MessageView::SegmentDone(SegmentDone(self)), - ffi::GST_MESSAGE_DURATION_CHANGED => { + gst_sys::GST_MESSAGE_STREAM_STATUS => MessageView::StreamStatus(StreamStatus(self)), + gst_sys::GST_MESSAGE_APPLICATION => MessageView::Application(Application(self)), + gst_sys::GST_MESSAGE_ELEMENT => MessageView::Element(Element(self)), + gst_sys::GST_MESSAGE_SEGMENT_START => MessageView::SegmentStart(SegmentStart(self)), + gst_sys::GST_MESSAGE_SEGMENT_DONE => MessageView::SegmentDone(SegmentDone(self)), + gst_sys::GST_MESSAGE_DURATION_CHANGED => { MessageView::DurationChanged(DurationChanged(self)) } - ffi::GST_MESSAGE_LATENCY => MessageView::Latency(Latency(self)), - ffi::GST_MESSAGE_ASYNC_START => MessageView::AsyncStart(AsyncStart(self)), - ffi::GST_MESSAGE_ASYNC_DONE => MessageView::AsyncDone(AsyncDone(self)), - ffi::GST_MESSAGE_REQUEST_STATE => MessageView::RequestState(RequestState(self)), - ffi::GST_MESSAGE_STEP_START => MessageView::StepStart(StepStart(self)), - ffi::GST_MESSAGE_QOS => MessageView::Qos(Qos(self)), - ffi::GST_MESSAGE_PROGRESS => MessageView::Progress(Progress(self)), - ffi::GST_MESSAGE_TOC => MessageView::Toc(Toc(self)), - ffi::GST_MESSAGE_RESET_TIME => MessageView::ResetTime(ResetTime(self)), - ffi::GST_MESSAGE_STREAM_START => MessageView::StreamStart(StreamStart(self)), - ffi::GST_MESSAGE_NEED_CONTEXT => MessageView::NeedContext(NeedContext(self)), - ffi::GST_MESSAGE_HAVE_CONTEXT => MessageView::HaveContext(HaveContext(self)), - ffi::GST_MESSAGE_DEVICE_ADDED => MessageView::DeviceAdded(DeviceAdded(self)), - ffi::GST_MESSAGE_DEVICE_REMOVED => MessageView::DeviceRemoved(DeviceRemoved(self)), - ffi::GST_MESSAGE_PROPERTY_NOTIFY => MessageView::PropertyNotify(PropertyNotify(self)), - ffi::GST_MESSAGE_STREAM_COLLECTION => { + gst_sys::GST_MESSAGE_LATENCY => MessageView::Latency(Latency(self)), + gst_sys::GST_MESSAGE_ASYNC_START => MessageView::AsyncStart(AsyncStart(self)), + gst_sys::GST_MESSAGE_ASYNC_DONE => MessageView::AsyncDone(AsyncDone(self)), + gst_sys::GST_MESSAGE_REQUEST_STATE => MessageView::RequestState(RequestState(self)), + gst_sys::GST_MESSAGE_STEP_START => MessageView::StepStart(StepStart(self)), + gst_sys::GST_MESSAGE_QOS => MessageView::Qos(Qos(self)), + gst_sys::GST_MESSAGE_PROGRESS => MessageView::Progress(Progress(self)), + gst_sys::GST_MESSAGE_TOC => MessageView::Toc(Toc(self)), + gst_sys::GST_MESSAGE_RESET_TIME => MessageView::ResetTime(ResetTime(self)), + gst_sys::GST_MESSAGE_STREAM_START => MessageView::StreamStart(StreamStart(self)), + gst_sys::GST_MESSAGE_NEED_CONTEXT => MessageView::NeedContext(NeedContext(self)), + gst_sys::GST_MESSAGE_HAVE_CONTEXT => MessageView::HaveContext(HaveContext(self)), + gst_sys::GST_MESSAGE_DEVICE_ADDED => MessageView::DeviceAdded(DeviceAdded(self)), + gst_sys::GST_MESSAGE_DEVICE_REMOVED => MessageView::DeviceRemoved(DeviceRemoved(self)), + gst_sys::GST_MESSAGE_PROPERTY_NOTIFY => { + MessageView::PropertyNotify(PropertyNotify(self)) + } + gst_sys::GST_MESSAGE_STREAM_COLLECTION => { MessageView::StreamCollection(StreamCollection(self)) } - ffi::GST_MESSAGE_STREAMS_SELECTED => { + gst_sys::GST_MESSAGE_STREAMS_SELECTED => { MessageView::StreamsSelected(StreamsSelected(self)) } _ => MessageView::Other, @@ -345,7 +347,7 @@ impl fmt::Debug for MessageRef { f.debug_struct("Message") .field("ptr", unsafe { &self.as_ptr() }) .field("type", &unsafe { - let type_ = ffi::gst_message_type_get_name((*self.as_ptr()).type_); + let type_ = gst_sys::gst_message_type_get_name((*self.as_ptr()).type_); CStr::from_ptr(type_).to_str().unwrap() }) .field("seqnum", &self.get_seqnum()) @@ -421,7 +423,7 @@ impl<'a> Error<'a> { unsafe { let mut error = ptr::null_mut(); - ffi::gst_message_parse_error(self.as_mut_ptr(), &mut error, ptr::null_mut()); + gst_sys::gst_message_parse_error(self.as_mut_ptr(), &mut error, ptr::null_mut()); from_glib_full(error) } @@ -431,7 +433,7 @@ impl<'a> Error<'a> { unsafe { let mut debug = ptr::null_mut(); - ffi::gst_message_parse_error(self.as_mut_ptr(), ptr::null_mut(), &mut debug); + gst_sys::gst_message_parse_error(self.as_mut_ptr(), ptr::null_mut(), &mut debug); from_glib_full(debug) } @@ -442,7 +444,7 @@ impl<'a> Error<'a> { unsafe { let mut details = ptr::null(); - ffi::gst_message_parse_error_details(self.as_mut_ptr(), &mut details); + gst_sys::gst_message_parse_error_details(self.as_mut_ptr(), &mut details); if details.is_null() { None @@ -459,7 +461,7 @@ impl<'a> Warning<'a> { unsafe { let mut error = ptr::null_mut(); - ffi::gst_message_parse_warning(self.as_mut_ptr(), &mut error, ptr::null_mut()); + gst_sys::gst_message_parse_warning(self.as_mut_ptr(), &mut error, ptr::null_mut()); from_glib_full(error) } @@ -469,7 +471,7 @@ impl<'a> Warning<'a> { unsafe { let mut debug = ptr::null_mut(); - ffi::gst_message_parse_warning(self.as_mut_ptr(), ptr::null_mut(), &mut debug); + gst_sys::gst_message_parse_warning(self.as_mut_ptr(), ptr::null_mut(), &mut debug); from_glib_full(debug) } @@ -480,7 +482,7 @@ impl<'a> Warning<'a> { unsafe { let mut details = ptr::null(); - ffi::gst_message_parse_error_details(self.as_mut_ptr(), &mut details); + gst_sys::gst_message_parse_error_details(self.as_mut_ptr(), &mut details); if details.is_null() { None @@ -497,7 +499,7 @@ impl<'a> Info<'a> { unsafe { let mut error = ptr::null_mut(); - ffi::gst_message_parse_info(self.as_mut_ptr(), &mut error, ptr::null_mut()); + gst_sys::gst_message_parse_info(self.as_mut_ptr(), &mut error, ptr::null_mut()); from_glib_full(error) } @@ -507,7 +509,7 @@ impl<'a> Info<'a> { unsafe { let mut debug = ptr::null_mut(); - ffi::gst_message_parse_info(self.as_mut_ptr(), ptr::null_mut(), &mut debug); + gst_sys::gst_message_parse_info(self.as_mut_ptr(), ptr::null_mut(), &mut debug); from_glib_full(debug) } @@ -518,7 +520,7 @@ impl<'a> Info<'a> { unsafe { let mut details = ptr::null(); - ffi::gst_message_parse_error_details(self.as_mut_ptr(), &mut details); + gst_sys::gst_message_parse_error_details(self.as_mut_ptr(), &mut details); if details.is_null() { None @@ -534,7 +536,7 @@ impl<'a> Tag<'a> { pub fn get_tags(&self) -> TagList { unsafe { let mut tags = ptr::null_mut(); - ffi::gst_message_parse_tag(self.as_mut_ptr(), &mut tags); + gst_sys::gst_message_parse_tag(self.as_mut_ptr(), &mut tags); from_glib_full(tags) } } @@ -545,7 +547,7 @@ impl<'a> Buffering<'a> { pub fn get_percent(&self) -> i32 { unsafe { let mut p = mem::uninitialized(); - ffi::gst_message_parse_buffering(self.as_mut_ptr(), &mut p); + gst_sys::gst_message_parse_buffering(self.as_mut_ptr(), &mut p); p } } @@ -557,7 +559,7 @@ impl<'a> Buffering<'a> { let mut avg_out = mem::uninitialized(); let mut buffering_left = mem::uninitialized(); - ffi::gst_message_parse_buffering_stats( + gst_sys::gst_message_parse_buffering_stats( self.as_mut_ptr(), &mut mode, &mut avg_in, @@ -576,7 +578,7 @@ impl<'a> StateChanged<'a> { unsafe { let mut state = mem::uninitialized(); - ffi::gst_message_parse_state_changed( + gst_sys::gst_message_parse_state_changed( self.as_mut_ptr(), &mut state, ptr::null_mut(), @@ -591,7 +593,7 @@ impl<'a> StateChanged<'a> { unsafe { let mut state = mem::uninitialized(); - ffi::gst_message_parse_state_changed( + gst_sys::gst_message_parse_state_changed( self.as_mut_ptr(), ptr::null_mut(), &mut state, @@ -606,7 +608,7 @@ impl<'a> StateChanged<'a> { unsafe { let mut state = mem::uninitialized(); - ffi::gst_message_parse_state_changed( + gst_sys::gst_message_parse_state_changed( self.as_mut_ptr(), ptr::null_mut(), ptr::null_mut(), @@ -641,7 +643,7 @@ impl<'a> StepDone<'a> { let mut duration = mem::uninitialized(); let mut eos = mem::uninitialized(); - ffi::gst_message_parse_step_done( + gst_sys::gst_message_parse_step_done( self.as_mut_ptr(), &mut format, &mut amount, @@ -670,7 +672,11 @@ impl<'a> ClockProvide<'a> { let mut clock = ptr::null_mut(); unsafe { - ffi::gst_message_parse_clock_provide(self.as_mut_ptr(), &mut clock, ptr::null_mut()); + gst_sys::gst_message_parse_clock_provide( + self.as_mut_ptr(), + &mut clock, + ptr::null_mut(), + ); from_glib_none(clock) } @@ -680,7 +686,11 @@ impl<'a> ClockProvide<'a> { unsafe { let mut ready = mem::uninitialized(); - ffi::gst_message_parse_clock_provide(self.as_mut_ptr(), ptr::null_mut(), &mut ready); + gst_sys::gst_message_parse_clock_provide( + self.as_mut_ptr(), + ptr::null_mut(), + &mut ready, + ); from_glib(ready) } @@ -693,7 +703,7 @@ impl<'a> ClockLost<'a> { let mut clock = ptr::null_mut(); unsafe { - ffi::gst_message_parse_clock_lost(self.as_mut_ptr(), &mut clock); + gst_sys::gst_message_parse_clock_lost(self.as_mut_ptr(), &mut clock); from_glib_none(clock) } @@ -706,7 +716,7 @@ impl<'a> NewClock<'a> { let mut clock = ptr::null_mut(); unsafe { - ffi::gst_message_parse_new_clock(self.as_mut_ptr(), &mut clock); + gst_sys::gst_message_parse_new_clock(self.as_mut_ptr(), &mut clock); from_glib_none(clock) } @@ -721,7 +731,7 @@ impl<'a> StructureChange<'a> { let mut owner = ptr::null_mut(); let mut busy = mem::uninitialized(); - ffi::gst_message_parse_structure_change( + gst_sys::gst_message_parse_structure_change( self.as_mut_ptr(), &mut type_, &mut owner, @@ -740,7 +750,7 @@ impl<'a> StreamStatus<'a> { let mut type_ = mem::uninitialized(); let mut owner = ptr::null_mut(); - ffi::gst_message_parse_stream_status(self.as_mut_ptr(), &mut type_, &mut owner); + gst_sys::gst_message_parse_stream_status(self.as_mut_ptr(), &mut type_, &mut owner); (from_glib(type_), from_glib_none(owner)) } @@ -748,7 +758,7 @@ impl<'a> StreamStatus<'a> { pub fn get_stream_status_object(&self) -> Option { unsafe { - let value = ffi::gst_message_get_stream_status_object(self.as_mut_ptr()); + let value = gst_sys::gst_message_get_stream_status_object(self.as_mut_ptr()); from_glib_none(value) } @@ -766,7 +776,7 @@ impl<'a> SegmentStart<'a> { let mut format = mem::uninitialized(); let mut position = mem::uninitialized(); - ffi::gst_message_parse_segment_start(self.as_mut_ptr(), &mut format, &mut position); + gst_sys::gst_message_parse_segment_start(self.as_mut_ptr(), &mut format, &mut position); GenericFormattedValue::new(from_glib(format), position) } @@ -780,7 +790,7 @@ impl<'a> SegmentDone<'a> { let mut format = mem::uninitialized(); let mut position = mem::uninitialized(); - ffi::gst_message_parse_segment_done(self.as_mut_ptr(), &mut format, &mut position); + gst_sys::gst_message_parse_segment_done(self.as_mut_ptr(), &mut format, &mut position); GenericFormattedValue::new(from_glib(format), position) } @@ -797,7 +807,7 @@ impl<'a> AsyncDone<'a> { unsafe { let mut running_time = mem::uninitialized(); - ffi::gst_message_parse_async_done(self.as_mut_ptr(), &mut running_time); + gst_sys::gst_message_parse_async_done(self.as_mut_ptr(), &mut running_time); from_glib(running_time) } @@ -810,7 +820,7 @@ impl<'a> RequestState<'a> { unsafe { let mut state = mem::uninitialized(); - ffi::gst_message_parse_request_state(self.as_mut_ptr(), &mut state); + gst_sys::gst_message_parse_request_state(self.as_mut_ptr(), &mut state); from_glib(state) } @@ -828,7 +838,7 @@ impl<'a> StepStart<'a> { let mut flush = mem::uninitialized(); let mut intermediate = mem::uninitialized(); - ffi::gst_message_parse_step_start( + gst_sys::gst_message_parse_step_start( self.as_mut_ptr(), &mut active, &mut format, @@ -859,7 +869,7 @@ impl<'a> Qos<'a> { let mut timestamp = mem::uninitialized(); let mut duration = mem::uninitialized(); - ffi::gst_message_parse_qos( + gst_sys::gst_message_parse_qos( self.as_mut_ptr(), &mut live, &mut running_time, @@ -884,7 +894,7 @@ impl<'a> Qos<'a> { let mut proportion = mem::uninitialized(); let mut quality = mem::uninitialized(); - ffi::gst_message_parse_qos_values( + gst_sys::gst_message_parse_qos_values( self.as_mut_ptr(), &mut jitter, &mut proportion, @@ -901,7 +911,7 @@ impl<'a> Qos<'a> { let mut processed = mem::uninitialized(); let mut dropped = mem::uninitialized(); - ffi::gst_message_parse_qos_stats( + gst_sys::gst_message_parse_qos_stats( self.as_mut_ptr(), &mut format, &mut processed, @@ -924,7 +934,12 @@ impl<'a> Progress<'a> { let mut code = ptr::null_mut(); let mut text = ptr::null_mut(); - ffi::gst_message_parse_progress(self.as_mut_ptr(), &mut type_, &mut code, &mut text); + gst_sys::gst_message_parse_progress( + self.as_mut_ptr(), + &mut type_, + &mut code, + &mut text, + ); let code = CStr::from_ptr(code).to_str().unwrap(); let text = CStr::from_ptr(text).to_str().unwrap(); @@ -940,7 +955,7 @@ impl<'a> Toc<'a> { unsafe { let mut toc = ptr::null_mut(); let mut updated = mem::uninitialized(); - ffi::gst_message_parse_toc(self.as_mut_ptr(), &mut toc, &mut updated); + gst_sys::gst_message_parse_toc(self.as_mut_ptr(), &mut toc, &mut updated); (from_glib_full(toc), from_glib(updated)) } } @@ -952,7 +967,7 @@ impl<'a> ResetTime<'a> { unsafe { let mut running_time = mem::uninitialized(); - ffi::gst_message_parse_reset_time(self.as_mut_ptr(), &mut running_time); + gst_sys::gst_message_parse_reset_time(self.as_mut_ptr(), &mut running_time); from_glib(running_time) } @@ -965,7 +980,7 @@ impl<'a> StreamStart<'a> { unsafe { let mut group_id = mem::uninitialized(); - if from_glib(ffi::gst_message_parse_group_id( + if from_glib(gst_sys::gst_message_parse_group_id( self.as_mut_ptr(), &mut group_id, )) { @@ -983,7 +998,7 @@ impl<'a> NeedContext<'a> { unsafe { let mut context_type = ptr::null(); - ffi::gst_message_parse_context_type(self.as_mut_ptr(), &mut context_type); + gst_sys::gst_message_parse_context_type(self.as_mut_ptr(), &mut context_type); CStr::from_ptr(context_type).to_str().unwrap() } @@ -995,7 +1010,7 @@ impl<'a> HaveContext<'a> { pub fn get_context(&self) -> ::Context { unsafe { let mut context = ptr::null_mut(); - ffi::gst_message_parse_have_context(self.as_mut_ptr(), &mut context); + gst_sys::gst_message_parse_have_context(self.as_mut_ptr(), &mut context); from_glib_full(context) } } @@ -1007,7 +1022,7 @@ impl<'a> DeviceAdded<'a> { unsafe { let mut device = ptr::null_mut(); - ffi::gst_message_parse_device_added(self.as_mut_ptr(), &mut device); + gst_sys::gst_message_parse_device_added(self.as_mut_ptr(), &mut device); from_glib_none(device) } @@ -1020,7 +1035,7 @@ impl<'a> DeviceRemoved<'a> { unsafe { let mut device = ptr::null_mut(); - ffi::gst_message_parse_device_removed(self.as_mut_ptr(), &mut device); + gst_sys::gst_message_parse_device_removed(self.as_mut_ptr(), &mut device); from_glib_none(device) } @@ -1036,7 +1051,7 @@ impl<'a> PropertyNotify<'a> { let mut property_name = ptr::null(); let mut value = ptr::null(); - ffi::gst_message_parse_property_notify( + gst_sys::gst_message_parse_property_notify( self.as_mut_ptr(), &mut object, &mut property_name, @@ -1063,7 +1078,7 @@ impl<'a> StreamCollection<'a> { unsafe { let mut collection = ptr::null_mut(); - ffi::gst_message_parse_stream_collection(self.as_mut_ptr(), &mut collection); + gst_sys::gst_message_parse_stream_collection(self.as_mut_ptr(), &mut collection); from_glib_full(collection) } @@ -1077,7 +1092,7 @@ impl<'a> StreamsSelected<'a> { unsafe { let mut collection = ptr::null_mut(); - ffi::gst_message_parse_streams_selected(self.as_mut_ptr(), &mut collection); + gst_sys::gst_message_parse_streams_selected(self.as_mut_ptr(), &mut collection); from_glib_full(collection) } @@ -1086,11 +1101,11 @@ impl<'a> StreamsSelected<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_streams(&self) -> Vec<::Stream> { unsafe { - let n = ffi::gst_message_streams_selected_get_size(self.as_mut_ptr()); + let n = gst_sys::gst_message_streams_selected_get_size(self.as_mut_ptr()); (0..n) .map(|i| { - from_glib_full(ffi::gst_message_streams_selected_get_stream( + from_glib_full(gst_sys::gst_message_streams_selected_get_stream( self.as_mut_ptr(), i, )) @@ -1105,7 +1120,7 @@ impl<'a> Redirect<'a> { #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn get_entries(&self) -> Vec<(&str, Option, Option<&StructureRef>)> { unsafe { - let n = ffi::gst_message_get_num_redirect_entries(self.as_mut_ptr()); + let n = gst_sys::gst_message_get_num_redirect_entries(self.as_mut_ptr()); (0..n) .map(|i| { @@ -1113,7 +1128,7 @@ impl<'a> Redirect<'a> { let mut tags = ptr::null_mut(); let mut structure = ptr::null(); - ffi::gst_message_parse_redirect_entry( + gst_sys::gst_message_parse_redirect_entry( self.as_mut_ptr(), i, &mut location, @@ -1218,13 +1233,13 @@ macro_rules! message_builder_generic_impl { let src = self.builder.src.to_glib_none().0; let msg = $new_fn(&mut self, src); if let Some(seqnum) = self.builder.seqnum { - ffi::gst_message_set_seqnum(msg, seqnum.to_glib()); + gst_sys::gst_message_set_seqnum(msg, seqnum.to_glib()); } #[cfg(any(feature = "v1_14", feature = "dox"))] { if !self.builder.other_fields.is_empty() { - let structure = ffi::gst_message_writable_structure(msg); + let structure = gst_sys::gst_message_writable_structure(msg); if !structure.is_null() { let structure = StructureRef::from_glib_borrow_mut(structure as *mut _); @@ -1253,7 +1268,7 @@ impl<'a> EosBuilder<'a> { } } - message_builder_generic_impl!(|_, src| ffi::gst_message_new_eos(src)); + message_builder_generic_impl!(|_, src| gst_sys::gst_message_new_eos(src)); } pub trait MessageErrorDomain: glib::error::ErrorDomain {} @@ -1308,7 +1323,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> { let error = glib::Error::new(s.error, s.message); - ffi::gst_message_new_error_with_details( + gst_sys::gst_message_new_error_with_details( src, mut_override(error.to_glib_none().0), s.debug.to_glib_none().0, @@ -1319,7 +1334,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> { { let error = glib::Error::new(s.error, s.message); - ffi::gst_message_new_error( + gst_sys::gst_message_new_error( src, mut_override(error.to_glib_none().0), s.debug.to_glib_none().0, @@ -1373,7 +1388,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> { let error = glib::Error::new(s.error, s.message); - ffi::gst_message_new_warning_with_details( + gst_sys::gst_message_new_warning_with_details( src, mut_override(error.to_glib_none().0), s.debug.to_glib_none().0, @@ -1384,7 +1399,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> { { let error = glib::Error::new(s.error, s.message); - ffi::gst_message_new_warning( + gst_sys::gst_message_new_warning( src, mut_override(error.to_glib_none().0), s.debug.to_glib_none().0, @@ -1438,7 +1453,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> { let error = glib::Error::new(s.error, s.message); - ffi::gst_message_new_info_with_details( + gst_sys::gst_message_new_info_with_details( src, mut_override(error.to_glib_none().0), s.debug.to_glib_none().0, @@ -1449,7 +1464,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> { { let error = glib::Error::new(s.error, s.message); - ffi::gst_message_new_info( + gst_sys::gst_message_new_info( src, mut_override(error.to_glib_none().0), s.debug.to_glib_none().0, @@ -1471,7 +1486,7 @@ impl<'a> TagBuilder<'a> { } } - message_builder_generic_impl!(|s: &Self, src| ffi::gst_message_new_tag( + message_builder_generic_impl!(|s: &Self, src| gst_sys::gst_message_new_tag( src, s.tags.to_glib_full() )); @@ -1507,10 +1522,10 @@ impl<'a> BufferingBuilder<'a> { } message_builder_generic_impl!(|s: &mut Self, src| { - let msg = ffi::gst_message_new_buffering(src, s.percent); + let msg = gst_sys::gst_message_new_buffering(src, s.percent); if let Some((mode, avg_in, avg_out, buffering_left)) = s.stats { - ffi::gst_message_set_buffering_stats( + gst_sys::gst_message_set_buffering_stats( msg, mode.to_glib(), avg_in, @@ -1540,7 +1555,7 @@ impl<'a> StateChangedBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_state_changed( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_state_changed( src, s.old.to_glib(), s.new.to_glib(), @@ -1559,7 +1574,7 @@ impl<'a> StateDirtyBuilder<'a> { } } - message_builder_generic_impl!(|_, src| ffi::gst_message_new_state_dirty(src)); + message_builder_generic_impl!(|_, src| gst_sys::gst_message_new_state_dirty(src)); } pub struct StepDoneBuilder<'a> { @@ -1593,7 +1608,7 @@ impl<'a> StepDoneBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_done( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_step_done( src, s.amount.get_format().to_glib(), s.amount.get_value() as u64, @@ -1620,7 +1635,7 @@ impl<'a> ClockProvideBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_clock_provide( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_clock_provide( src, s.clock.to_glib_none().0, s.ready.to_glib() @@ -1640,7 +1655,7 @@ impl<'a> ClockLostBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_clock_lost( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_clock_lost( src, s.clock.to_glib_none().0 )); @@ -1659,7 +1674,7 @@ impl<'a> NewClockBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_new_clock( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_new_clock( src, s.clock.to_glib_none().0 )); @@ -1682,12 +1697,14 @@ impl<'a> StructureChangeBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_structure_change( - src, - s.type_.to_glib(), - s.owner.to_glib_none().0, - s.busy.to_glib(), - )); + message_builder_generic_impl!( + |s: &mut Self, src| gst_sys::gst_message_new_structure_change( + src, + s.type_.to_glib(), + s.owner.to_glib_none().0, + s.busy.to_glib(), + ) + ); } pub struct StreamStatusBuilder<'a> { @@ -1715,10 +1732,13 @@ impl<'a> StreamStatusBuilder<'a> { } message_builder_generic_impl!(|s: &mut Self, src| { - let msg = - ffi::gst_message_new_stream_status(src, s.type_.to_glib(), s.owner.to_glib_none().0); + let msg = gst_sys::gst_message_new_stream_status( + src, + s.type_.to_glib(), + s.owner.to_glib_none().0, + ); if let Some(status_object) = s.status_object { - ffi::gst_message_set_stream_status_object( + gst_sys::gst_message_set_stream_status_object( msg, status_object.to_send_value().to_glib_none().0, ); @@ -1740,7 +1760,7 @@ impl<'a> ApplicationBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_application( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_application( src, s.structure.take().unwrap().into_ptr() )); @@ -1759,7 +1779,7 @@ impl<'a> ElementBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_element( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_element( src, s.structure.take().unwrap().into_ptr() )); @@ -1778,7 +1798,7 @@ impl<'a> SegmentStartBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_start( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_segment_start( src, s.position.get_format().to_glib(), s.position.get_value(), @@ -1798,7 +1818,7 @@ impl<'a> SegmentDoneBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_done( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_segment_done( src, s.position.get_format().to_glib(), s.position.get_value(), @@ -1816,7 +1836,7 @@ impl<'a> DurationChangedBuilder<'a> { } } - message_builder_generic_impl!(|_, src| ffi::gst_message_new_duration_changed(src)); + message_builder_generic_impl!(|_, src| gst_sys::gst_message_new_duration_changed(src)); } pub struct LatencyBuilder<'a> { @@ -1830,7 +1850,7 @@ impl<'a> LatencyBuilder<'a> { } } - message_builder_generic_impl!(|_, src| ffi::gst_message_new_latency(src)); + message_builder_generic_impl!(|_, src| gst_sys::gst_message_new_latency(src)); } pub struct AsyncStartBuilder<'a> { @@ -1844,7 +1864,7 @@ impl<'a> AsyncStartBuilder<'a> { } } - message_builder_generic_impl!(|_, src| ffi::gst_message_new_async_start(src)); + message_builder_generic_impl!(|_, src| gst_sys::gst_message_new_async_start(src)); } pub struct AsyncDoneBuilder<'a> { @@ -1860,7 +1880,7 @@ impl<'a> AsyncDoneBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_async_done( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_async_done( src, s.running_time.to_glib() )); @@ -1879,7 +1899,7 @@ impl<'a> RequestStateBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_request_state( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_request_state( src, s.state.to_glib() )); @@ -1912,7 +1932,7 @@ impl<'a> StepStartBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_start( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_step_start( src, s.active.to_glib(), s.amount.get_format().to_glib(), @@ -1972,7 +1992,7 @@ impl<'a> QosBuilder<'a> { } message_builder_generic_impl!(|s: &mut Self, src| { - let msg = ffi::gst_message_new_qos( + let msg = gst_sys::gst_message_new_qos( src, s.live.to_glib(), s.running_time.to_glib(), @@ -1981,10 +2001,10 @@ impl<'a> QosBuilder<'a> { s.duration.to_glib(), ); if let Some((jitter, proportion, quality)) = s.values { - ffi::gst_message_set_qos_values(msg, jitter, proportion, quality); + gst_sys::gst_message_set_qos_values(msg, jitter, proportion, quality); } if let Some((processed, dropped)) = s.stats { - ffi::gst_message_set_qos_stats( + gst_sys::gst_message_set_qos_stats( msg, processed.get_format().to_glib(), processed.get_value() as u64, @@ -2012,7 +2032,7 @@ impl<'a> ProgressBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_progress( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_progress( src, s.type_.to_glib(), s.code.to_glib_none().0, @@ -2035,7 +2055,7 @@ impl<'a> TocBuilder<'a> { } } - message_builder_generic_impl!(|s: &Self, src| ffi::gst_message_new_toc( + message_builder_generic_impl!(|s: &Self, src| gst_sys::gst_message_new_toc( src, s.toc.to_glib_none().0, s.updated.to_glib() @@ -2055,7 +2075,7 @@ impl<'a> ResetTimeBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_reset_time( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_reset_time( src, s.running_time.to_glib() )); @@ -2082,9 +2102,9 @@ impl<'a> StreamStartBuilder<'a> { } message_builder_generic_impl!(|s: &mut Self, src| { - let msg = ffi::gst_message_new_stream_start(src); + let msg = gst_sys::gst_message_new_stream_start(src); if let Some(group_id) = s.group_id { - ffi::gst_message_set_group_id(msg, group_id.to_glib()); + gst_sys::gst_message_set_group_id(msg, group_id.to_glib()); } msg }); @@ -2103,7 +2123,7 @@ impl<'a> NeedContextBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_need_context( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_need_context( src, s.context_type.to_glib_none().0 )); @@ -2124,7 +2144,7 @@ impl<'a> HaveContextBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| { let context = s.context.take().unwrap(); - ffi::gst_message_new_have_context(src, context.into_ptr()) + gst_sys::gst_message_new_have_context(src, context.into_ptr()) }); } @@ -2141,7 +2161,7 @@ impl<'a> DeviceAddedBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_device_added( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_device_added( src, s.device.to_glib_none().0 )); @@ -2160,7 +2180,7 @@ impl<'a> DeviceRemovedBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_device_removed( + message_builder_generic_impl!(|s: &mut Self, src| gst_sys::gst_message_new_device_removed( src, s.device.to_glib_none().0 )); @@ -2192,7 +2212,7 @@ impl<'a> PropertyNotifyBuilder<'a> { message_builder_generic_impl!(|s: &mut Self, src| { let val = s.value.map(|v| v.to_send_value()); - ffi::gst_message_new_property_notify( + gst_sys::gst_message_new_property_notify( src, s.property_name.to_glib_none().0, mut_override( @@ -2219,10 +2239,12 @@ impl<'a> StreamCollectionBuilder<'a> { } } - message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_stream_collection( - src, - s.collection.to_glib_none().0 - )); + message_builder_generic_impl!( + |s: &mut Self, src| gst_sys::gst_message_new_stream_collection( + src, + s.collection.to_glib_none().0 + ) + ); } #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -2252,10 +2274,10 @@ impl<'a> StreamsSelectedBuilder<'a> { } message_builder_generic_impl!(|s: &mut Self, src| { - let msg = ffi::gst_message_new_streams_selected(src, s.collection.to_glib_none().0); + let msg = gst_sys::gst_message_new_streams_selected(src, s.collection.to_glib_none().0); if let Some(streams) = s.streams { for stream in streams { - ffi::gst_message_streams_selected_add(msg, stream.to_glib_none().0); + gst_sys::gst_message_streams_selected_add(msg, stream.to_glib_none().0); } } msg @@ -2317,7 +2339,7 @@ impl<'a> RedirectBuilder<'a> { ptr::null_mut() }; - let msg = ffi::gst_message_new_redirect( + let msg = gst_sys::gst_message_new_redirect( src, s.location.to_glib_none().0, s.tag_list.to_glib_full(), @@ -2331,7 +2353,7 @@ impl<'a> RedirectBuilder<'a> { } else { ptr::null_mut() }; - ffi::gst_message_add_redirect_entry( + gst_sys::gst_message_add_redirect_entry( msg, location.to_glib_none().0, tag_list.to_glib_full(), diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index 5a98407bd..10f0507cd 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -13,10 +13,10 @@ use std::ops; use miniobject::MiniObject; use BufferRef; -use ffi; use glib; use glib::translate::{from_glib, FromGlib}; -use glib_ffi; +use glib_sys; +use gst_sys; pub unsafe trait MetaAPI: Sized { type GstType; @@ -30,7 +30,7 @@ pub unsafe trait MetaAPI: Sized { if meta_api != glib::Type::Invalid { assert_eq!( meta_api, - from_glib((*(*(ptr as *const ffi::GstMeta)).info).api) + from_glib((*(*(ptr as *const gst_sys::GstMeta)).info).api) ) } @@ -50,7 +50,7 @@ pub unsafe trait MetaAPI: Sized { if meta_api != glib::Type::Invalid { assert_eq!( meta_api, - from_glib((*(*(ptr as *const ffi::GstMeta)).info).api) + from_glib((*(*(ptr as *const gst_sys::GstMeta)).info).api) ) } @@ -115,7 +115,7 @@ impl<'a, T: MetaAPI, U> AsRef> for MetaRefMut<'a, T, U> { impl<'a, T: MetaAPI> MetaRef<'a, T> { pub fn get_api(&self) -> glib::Type { unsafe { - let meta = self.meta as *const _ as *const ffi::GstMeta; + let meta = self.meta as *const _ as *const gst_sys::GstMeta; let info = (*meta).info; glib::Type::from_glib((*info).api) } @@ -142,7 +142,7 @@ impl<'a> MetaRef<'a, Meta> { impl<'a, T: MetaAPI, U> MetaRefMut<'a, T, U> { pub fn get_api(&self) -> glib::Type { unsafe { - let meta = self.meta as *const _ as *const ffi::GstMeta; + let meta = self.meta as *const _ as *const gst_sys::GstMeta; let info = (*meta).info; glib::Type::from_glib((*info).api) } @@ -160,11 +160,11 @@ impl<'a, T: MetaAPI, U> MetaRefMut<'a, T, U> { impl<'a, T: MetaAPI> MetaRefMut<'a, T, Standalone> { pub fn remove(mut self) { unsafe { - let res = ffi::gst_buffer_remove_meta( + let res = gst_sys::gst_buffer_remove_meta( self.buffer.as_mut_ptr(), - self.as_mut_ptr() as *mut ffi::GstMeta, + self.as_mut_ptr() as *mut gst_sys::GstMeta, ); - assert_ne!(res, glib_ffi::GFALSE); + assert_ne!(res, glib_sys::GFALSE); } } } @@ -183,7 +183,7 @@ impl<'a, U> MetaRefMut<'a, Meta, U> { } #[repr(C)] -pub struct Meta(ffi::GstMeta); +pub struct Meta(gst_sys::GstMeta); impl Meta { fn get_api(&self) -> glib::Type { @@ -192,7 +192,7 @@ impl Meta { } unsafe impl MetaAPI for Meta { - type GstType = ffi::GstMeta; + type GstType = gst_sys::GstMeta; fn get_meta_api() -> glib::Type { glib::Type::Invalid @@ -208,7 +208,7 @@ impl fmt::Debug for Meta { } #[repr(C)] -pub struct ParentBufferMeta(ffi::GstParentBufferMeta); +pub struct ParentBufferMeta(gst_sys::GstParentBufferMeta); impl ParentBufferMeta { pub fn add<'a>( @@ -216,8 +216,10 @@ impl ParentBufferMeta { parent: &BufferRef, ) -> MetaRefMut<'a, Self, Standalone> { unsafe { - let meta = - ffi::gst_buffer_add_parent_buffer_meta(buffer.as_mut_ptr(), parent.as_mut_ptr()); + let meta = gst_sys::gst_buffer_add_parent_buffer_meta( + buffer.as_mut_ptr(), + parent.as_mut_ptr(), + ); Self::from_mut_ptr(buffer, meta) } @@ -229,10 +231,10 @@ impl ParentBufferMeta { } unsafe impl MetaAPI for ParentBufferMeta { - type GstType = ffi::GstParentBufferMeta; + type GstType = gst_sys::GstParentBufferMeta; fn get_meta_api() -> glib::Type { - unsafe { from_glib(ffi::gst_parent_buffer_meta_api_get_type()) } + unsafe { from_glib(gst_sys::gst_parent_buffer_meta_api_get_type()) } } } diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 4b632ce8a..1a6e3e93d 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -11,16 +11,16 @@ use std::mem; use std::ptr; use std::{borrow, fmt, ops}; -use ffi; use glib; use glib::translate::{ from_glib, from_glib_full, from_glib_none, FromGlibContainerAsVec, FromGlibPtrArrayContainerAsVec, FromGlibPtrBorrow, FromGlibPtrFull, FromGlibPtrNone, GlibPtrDefault, Stash, StashMut, ToGlibContainerFromSlice, ToGlibPtr, ToGlibPtrMut, }; -use glib_ffi; -use glib_ffi::gpointer; -use gobject_ffi; +use glib_sys; +use glib_sys::gpointer; +use gobject_sys; +use gst_sys; pub struct GstRc { obj: ptr::NonNull, @@ -32,7 +32,7 @@ impl GstRc { pub unsafe fn from_glib_none(ptr: *const T::GstType) -> Self { assert!(!ptr.is_null()); - ffi::gst_mini_object_ref(ptr as *mut ffi::GstMiniObject); + gst_sys::gst_mini_object_ref(ptr as *mut gst_sys::GstMiniObject); GstRc { obj: ptr::NonNull::new_unchecked(ptr as *mut T::GstType as *mut T), @@ -67,8 +67,8 @@ impl GstRc { return self.obj.as_mut(); } - let ptr = T::from_mut_ptr(ffi::gst_mini_object_make_writable( - self.as_mut_ptr() as *mut ffi::GstMiniObject + let ptr = T::from_mut_ptr(gst_sys::gst_mini_object_make_writable( + self.as_mut_ptr() as *mut gst_sys::GstMiniObject ) as *mut T::GstType); self.obj = ptr::NonNull::new_unchecked(ptr); assert!(self.is_writable()); @@ -87,8 +87,8 @@ impl GstRc { pub fn is_writable(&self) -> bool { unsafe { - from_glib(ffi::gst_mini_object_is_writable( - self.as_ptr() as *const ffi::GstMiniObject + from_glib(gst_sys::gst_mini_object_is_writable( + self.as_ptr() as *const gst_sys::GstMiniObject )) } } @@ -139,7 +139,7 @@ impl Drop for GstRc { fn drop(&mut self) { if !self.borrowed { unsafe { - ffi::gst_mini_object_unref(self.as_mut_ptr() as *mut ffi::GstMiniObject); + gst_sys::gst_mini_object_unref(self.as_mut_ptr() as *mut gst_sys::GstMiniObject); } } } @@ -190,16 +190,16 @@ where unsafe fn from_mut_ptr<'a>(ptr: *mut Self::GstType) -> &'a mut Self { assert!(!ptr.is_null()); assert_ne!( - ffi::gst_mini_object_is_writable(ptr as *mut ffi::GstMiniObject), - glib_ffi::GFALSE + gst_sys::gst_mini_object_is_writable(ptr as *mut gst_sys::GstMiniObject), + glib_sys::GFALSE ); &mut *(ptr as *mut Self) } fn copy(&self) -> GstRc { unsafe { - GstRc::from_glib_full(ffi::gst_mini_object_copy( - self.as_ptr() as *const ffi::GstMiniObject + GstRc::from_glib_full(gst_sys::gst_mini_object_copy( + self.as_ptr() as *const gst_sys::GstMiniObject ) as *const Self::GstType) } } @@ -214,7 +214,7 @@ impl<'a, T: MiniObject + 'static> ToGlibPtr<'a, *const T::GstType> for GstRc fn to_glib_full(&self) -> *const T::GstType { unsafe { - ffi::gst_mini_object_ref(self.as_mut_ptr() as *mut ffi::GstMiniObject); + gst_sys::gst_mini_object_ref(self.as_mut_ptr() as *mut gst_sys::GstMiniObject); self.as_ptr() } } @@ -229,7 +229,7 @@ impl<'a, T: MiniObject + 'static> ToGlibPtr<'a, *mut T::GstType> for GstRc { fn to_glib_full(&self) -> *mut T::GstType { unsafe { - ffi::gst_mini_object_ref(self.as_mut_ptr() as *mut ffi::GstMiniObject); + gst_sys::gst_mini_object_ref(self.as_mut_ptr() as *mut gst_sys::GstMiniObject); self.as_mut_ptr() } } @@ -265,7 +265,7 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect(); let v_ptr = unsafe { - let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) + let v_ptr = glib_sys::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as *mut *mut T::GstType; for (i, s) in v.iter().enumerate() { @@ -281,7 +281,7 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT fn to_glib_full_from_slice(t: &[GstRc]) -> *mut *mut T::GstType { skip_assert_initialized!(); unsafe { - let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) + let v_ptr = glib_sys::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as *mut *mut T::GstType; for (i, s) in t.iter().enumerate() { @@ -375,7 +375,7 @@ impl FromGlibContainerAsVec<*mut T::GstType, *mut *mut unsafe fn from_glib_container_num_as_vec(ptr: *mut *mut T::GstType, num: usize) -> Vec { let res = FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, num); - glib_ffi::g_free(ptr as *mut _); + glib_sys::g_free(ptr as *mut _); res } @@ -388,7 +388,7 @@ impl FromGlibContainerAsVec<*mut T::GstType, *mut *mut for i in 0..num { res.push(from_glib_full(ptr::read(ptr.add(i)))); } - glib_ffi::g_free(ptr as *mut _); + glib_sys::g_free(ptr as *mut _); res } } @@ -464,23 +464,23 @@ impl<'a, T: MiniObject + glib::StaticType + 'static> glib::value::FromValueOptio for GstRc { unsafe fn from_value_optional(v: &'a glib::Value) -> Option { - let ptr = gobject_ffi::g_value_get_boxed(v.to_glib_none().0); + let ptr = gobject_sys::g_value_get_boxed(v.to_glib_none().0); from_glib_none(ptr as *const T::GstType) } } impl glib::value::SetValue for GstRc { unsafe fn set_value(v: &mut glib::Value, s: &Self) { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); } } impl glib::value::SetValueOptional for GstRc { unsafe fn set_value_optional(v: &mut glib::Value, s: Option<&Self>) { if let Some(s) = s { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); } else { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, ptr::null_mut()); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, ptr::null_mut()); } } } @@ -491,28 +491,28 @@ impl GlibPtrDefault for GstRc { #[macro_export] macro_rules! gst_define_mini_object_wrapper( - ($name:ident, $ref_name:ident, $ffi_name:path, [$($derives:ident,)*], $get_type:expr) => { + ($name:ident, $ref_name:ident, $gst_sys_name:path, [$($derives:ident,)*], $get_type:expr) => { #[derive($($derives,)*)] #[derive(Clone)] pub struct $name($crate::GstRc<$ref_name>); #[repr(C)] - pub struct $ref_name($ffi_name); + pub struct $ref_name($gst_sys_name); impl $name { - pub unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self { + pub unsafe fn from_glib_none(ptr: *const $gst_sys_name) -> Self { $name($crate::glib::translate::from_glib_none(ptr)) } - pub unsafe fn from_glib_full(ptr: *const $ffi_name) -> Self { + pub unsafe fn from_glib_full(ptr: *const $gst_sys_name) -> Self { $name($crate::glib::translate::from_glib_full(ptr)) } - pub unsafe fn from_glib_borrow(ptr: *const $ffi_name) -> Self { + pub unsafe fn from_glib_borrow(ptr: *const $gst_sys_name) -> Self { $name($crate::glib::translate::from_glib_borrow(ptr)) } - pub unsafe fn into_ptr(self) -> *mut $ffi_name { + pub unsafe fn into_ptr(self) -> *mut $gst_sys_name { self.0.into_ptr() } @@ -571,64 +571,64 @@ macro_rules! gst_define_mini_object_wrapper( } } - impl<'a> $crate::glib::translate::ToGlibPtr<'a, *const $ffi_name> for $name { - type Storage = $crate::glib::translate::Stash<'a, *const $ffi_name, $crate::GstRc<$ref_name>>; + impl<'a> $crate::glib::translate::ToGlibPtr<'a, *const $gst_sys_name> for $name { + type Storage = $crate::glib::translate::Stash<'a, *const $gst_sys_name, $crate::GstRc<$ref_name>>; - fn to_glib_none(&'a self) -> $crate::glib::translate::Stash<'a, *const $ffi_name, Self> { + fn to_glib_none(&'a self) -> $crate::glib::translate::Stash<'a, *const $gst_sys_name, Self> { let stash = $crate::glib::translate::ToGlibPtr::to_glib_none(&self.0); $crate::glib::translate::Stash(stash.0, stash) } - fn to_glib_full(&self) -> *const $ffi_name { + fn to_glib_full(&self) -> *const $gst_sys_name { $crate::glib::translate::ToGlibPtr::to_glib_full(&self.0) } } - impl<'a> $crate::glib::translate::ToGlibPtr<'a, *mut $ffi_name> for $name { - type Storage = $crate::glib::translate::Stash<'a, *mut $ffi_name, $crate::GstRc<$ref_name>>; + impl<'a> $crate::glib::translate::ToGlibPtr<'a, *mut $gst_sys_name> for $name { + type Storage = $crate::glib::translate::Stash<'a, *mut $gst_sys_name, $crate::GstRc<$ref_name>>; - fn to_glib_none(&'a self) -> $crate::glib::translate::Stash<'a, *mut $ffi_name, Self> { + fn to_glib_none(&'a self) -> $crate::glib::translate::Stash<'a, *mut $gst_sys_name, Self> { let stash = $crate::glib::translate::ToGlibPtr::to_glib_none(&self.0); $crate::glib::translate::Stash(stash.0, stash) } - fn to_glib_full(&self) -> *mut $ffi_name { + fn to_glib_full(&self) -> *mut $gst_sys_name { $crate::glib::translate::ToGlibPtr::to_glib_full(&self.0) } } - impl<'a> $crate::glib::translate::ToGlibPtrMut<'a, *mut $ffi_name> for $name { - type Storage = $crate::glib::translate::StashMut<'a, *mut $ffi_name, $crate::GstRc<$ref_name>>; + impl<'a> $crate::glib::translate::ToGlibPtrMut<'a, *mut $gst_sys_name> for $name { + type Storage = $crate::glib::translate::StashMut<'a, *mut $gst_sys_name, $crate::GstRc<$ref_name>>; - fn to_glib_none_mut(&'a mut self) -> $crate::glib::translate::StashMut<*mut $ffi_name, Self> { + fn to_glib_none_mut(&'a mut self) -> $crate::glib::translate::StashMut<*mut $gst_sys_name, Self> { let stash = $crate::glib::translate::ToGlibPtrMut::to_glib_none_mut(&mut self.0); $crate::glib::translate::StashMut(stash.0, stash) } } - impl<'a> $crate::glib::translate::ToGlibContainerFromSlice<'a, *mut *mut $ffi_name> for $name { + impl<'a> $crate::glib::translate::ToGlibContainerFromSlice<'a, *mut *mut $gst_sys_name> for $name { #[allow(clippy::type_complexity)] type Storage = ( - Vec<$crate::glib::translate::Stash<'a, *mut $ffi_name, $name>>, - Option>, + Vec<$crate::glib::translate::Stash<'a, *mut $gst_sys_name, $name>>, + Option>, ); - fn to_glib_none_from_slice(t: &'a [$name]) -> (*mut *mut $ffi_name, Self::Storage) { + fn to_glib_none_from_slice(t: &'a [$name]) -> (*mut *mut $gst_sys_name, Self::Storage) { skip_assert_initialized!(); let v: Vec<_> = t.iter().map(|s| $crate::glib::translate::ToGlibPtr::to_glib_none(s)).collect(); let mut v_ptr: Vec<_> = v.iter().map(|s| s.0).collect(); - v_ptr.push(::std::ptr::null_mut() as *mut $ffi_name); + v_ptr.push(::std::ptr::null_mut() as *mut $gst_sys_name); - (v_ptr.as_ptr() as *mut *mut $ffi_name, (v, Some(v_ptr))) + (v_ptr.as_ptr() as *mut *mut $gst_sys_name, (v, Some(v_ptr))) } - fn to_glib_container_from_slice(t: &'a [$name]) -> (*mut *mut $ffi_name, Self::Storage) { + fn to_glib_container_from_slice(t: &'a [$name]) -> (*mut *mut $gst_sys_name, Self::Storage) { skip_assert_initialized!(); let v: Vec<_> = t.iter().map(|s| $crate::glib::translate::ToGlibPtr::to_glib_none(s)).collect(); let v_ptr = unsafe { - let v_ptr = $crate::glib_ffi::g_malloc0(::std::mem::size_of::<*mut $ffi_name>() * t.len() + 1) - as *mut *mut $ffi_name; + let v_ptr = $crate::glib_sys::g_malloc0(::std::mem::size_of::<*mut $gst_sys_name>() * t.len() + 1) + as *mut *mut $gst_sys_name; for (i, s) in v.iter().enumerate() { ::std::ptr::write(v_ptr.add(i), s.0); @@ -640,11 +640,11 @@ macro_rules! gst_define_mini_object_wrapper( (v_ptr, (v, None)) } - fn to_glib_full_from_slice(t: &[$name]) -> *mut *mut $ffi_name { + fn to_glib_full_from_slice(t: &[$name]) -> *mut *mut $gst_sys_name { skip_assert_initialized!(); unsafe { - let v_ptr = $crate::glib_ffi::g_malloc0(::std::mem::size_of::<*mut $ffi_name>() * t.len() + 1) - as *mut *mut $ffi_name; + let v_ptr = $crate::glib_sys::g_malloc0(::std::mem::size_of::<*mut $gst_sys_name>() * t.len() + 1) + as *mut *mut $gst_sys_name; for (i, s) in t.iter().enumerate() { ::std::ptr::write(v_ptr.add(i), $crate::glib::translate::ToGlibPtr::to_glib_full(&s)); @@ -655,75 +655,75 @@ macro_rules! gst_define_mini_object_wrapper( } } - impl<'a> $crate::glib::translate::ToGlibContainerFromSlice<'a, *const *mut $ffi_name> + impl<'a> $crate::glib::translate::ToGlibContainerFromSlice<'a, *const *mut $gst_sys_name> for $name { #[allow(clippy::type_complexity)] type Storage = ( - Vec<$crate::glib::translate::Stash<'a, *mut $ffi_name, $name>>, - Option>, + Vec<$crate::glib::translate::Stash<'a, *mut $gst_sys_name, $name>>, + Option>, ); - fn to_glib_none_from_slice(t: &'a [$name]) -> (*const *mut $ffi_name, Self::Storage) { + fn to_glib_none_from_slice(t: &'a [$name]) -> (*const *mut $gst_sys_name, Self::Storage) { skip_assert_initialized!(); let (ptr, stash) = - $crate::glib::translate::ToGlibContainerFromSlice::<'a, *mut *mut $ffi_name>::to_glib_none_from_slice(t); - (ptr as *const *mut $ffi_name, stash) + $crate::glib::translate::ToGlibContainerFromSlice::<'a, *mut *mut $gst_sys_name>::to_glib_none_from_slice(t); + (ptr as *const *mut $gst_sys_name, stash) } - fn to_glib_container_from_slice(_: &'a [$name]) -> (*const *mut $ffi_name, Self::Storage) { + fn to_glib_container_from_slice(_: &'a [$name]) -> (*const *mut $gst_sys_name, Self::Storage) { skip_assert_initialized!(); // Can't have consumer free a *const pointer unimplemented!() } - fn to_glib_full_from_slice(_: &[$name]) -> *const *mut $ffi_name { + fn to_glib_full_from_slice(_: &[$name]) -> *const *mut $gst_sys_name { skip_assert_initialized!(); // Can't have consumer free a *const pointer unimplemented!() } } - impl $crate::glib::translate::FromGlibPtrNone<*const $ffi_name> for $name { - unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self { + impl $crate::glib::translate::FromGlibPtrNone<*const $gst_sys_name> for $name { + unsafe fn from_glib_none(ptr: *const $gst_sys_name) -> Self { Self::from_glib_none(ptr) } } - impl $crate::glib::translate::FromGlibPtrNone<*mut $ffi_name> for $name { - unsafe fn from_glib_none(ptr: *mut $ffi_name) -> Self { + impl $crate::glib::translate::FromGlibPtrNone<*mut $gst_sys_name> for $name { + unsafe fn from_glib_none(ptr: *mut $gst_sys_name) -> Self { Self::from_glib_none(ptr) } } - impl $crate::glib::translate::FromGlibPtrFull<*const $ffi_name> for $name { - unsafe fn from_glib_full(ptr: *const $ffi_name) -> Self { + impl $crate::glib::translate::FromGlibPtrFull<*const $gst_sys_name> for $name { + unsafe fn from_glib_full(ptr: *const $gst_sys_name) -> Self { Self::from_glib_full(ptr) } } - impl $crate::glib::translate::FromGlibPtrFull<*mut $ffi_name> for $name { - unsafe fn from_glib_full(ptr: *mut $ffi_name) -> Self { + impl $crate::glib::translate::FromGlibPtrFull<*mut $gst_sys_name> for $name { + unsafe fn from_glib_full(ptr: *mut $gst_sys_name) -> Self { Self::from_glib_full(ptr) } } - impl $crate::glib::translate::FromGlibPtrBorrow<*const $ffi_name> for $name { - unsafe fn from_glib_borrow(ptr: *const $ffi_name) -> Self { + impl $crate::glib::translate::FromGlibPtrBorrow<*const $gst_sys_name> for $name { + unsafe fn from_glib_borrow(ptr: *const $gst_sys_name) -> Self { Self::from_glib_borrow(ptr) } } - impl $crate::glib::translate::FromGlibPtrBorrow<*mut $ffi_name> for $name { - unsafe fn from_glib_borrow(ptr: *mut $ffi_name) -> Self { + impl $crate::glib::translate::FromGlibPtrBorrow<*mut $gst_sys_name> for $name { + unsafe fn from_glib_borrow(ptr: *mut $gst_sys_name) -> Self { Self::from_glib_borrow(ptr) } } - impl $crate::glib::translate::FromGlibContainerAsVec<*mut $ffi_name, *mut *mut $ffi_name> + impl $crate::glib::translate::FromGlibContainerAsVec<*mut $gst_sys_name, *mut *mut $gst_sys_name> for $name { - unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec { + unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut $gst_sys_name, num: usize) -> Vec { if num == 0 || ptr.is_null() { return Vec::new(); } @@ -735,13 +735,13 @@ macro_rules! gst_define_mini_object_wrapper( res } - unsafe fn from_glib_container_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec { + unsafe fn from_glib_container_num_as_vec(ptr: *mut *mut $gst_sys_name, num: usize) -> Vec { let res = $crate::glib::translate::FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, num); - $crate::glib_ffi::g_free(ptr as *mut _); + $crate::glib_sys::g_free(ptr as *mut _); res } - unsafe fn from_glib_full_num_as_vec(ptr: *mut *mut $ffi_name, num: usize) -> Vec { + unsafe fn from_glib_full_num_as_vec(ptr: *mut *mut $gst_sys_name, num: usize) -> Vec { if num == 0 || ptr.is_null() { return Vec::new(); } @@ -750,57 +750,57 @@ macro_rules! gst_define_mini_object_wrapper( for i in 0..num { res.push($crate::glib::translate::from_glib_full(::std::ptr::read(ptr.add(i)))); } - $crate::glib_ffi::g_free(ptr as *mut _); + $crate::glib_sys::g_free(ptr as *mut _); res } } - impl $crate::glib::translate::FromGlibPtrArrayContainerAsVec<*mut $ffi_name, *mut *mut $ffi_name> + impl $crate::glib::translate::FromGlibPtrArrayContainerAsVec<*mut $gst_sys_name, *mut *mut $gst_sys_name> for $name { - unsafe fn from_glib_none_as_vec(ptr: *mut *mut $ffi_name) -> Vec { + unsafe fn from_glib_none_as_vec(ptr: *mut *mut $gst_sys_name) -> Vec { $crate::glib::translate::FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, glib::translate::c_ptr_array_len(ptr)) } - unsafe fn from_glib_container_as_vec(ptr: *mut *mut $ffi_name) -> Vec { + unsafe fn from_glib_container_as_vec(ptr: *mut *mut $gst_sys_name) -> Vec { $crate::glib::translate::FromGlibContainerAsVec::from_glib_container_num_as_vec(ptr, glib::translate::c_ptr_array_len(ptr)) } - unsafe fn from_glib_full_as_vec(ptr: *mut *mut $ffi_name) -> Vec { + unsafe fn from_glib_full_as_vec(ptr: *mut *mut $gst_sys_name) -> Vec { $crate::glib::translate::FromGlibContainerAsVec::from_glib_full_num_as_vec(ptr, glib::translate::c_ptr_array_len(ptr)) } } - impl $crate::glib::translate::FromGlibContainerAsVec<*mut $ffi_name, *const *mut $ffi_name> + impl $crate::glib::translate::FromGlibContainerAsVec<*mut $gst_sys_name, *const *mut $gst_sys_name> for $name { - unsafe fn from_glib_none_num_as_vec(ptr: *const *mut $ffi_name, num: usize) -> Vec { + unsafe fn from_glib_none_num_as_vec(ptr: *const *mut $gst_sys_name, num: usize) -> Vec { $crate::glib::translate::FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr as *mut *mut _, num) } - unsafe fn from_glib_container_num_as_vec(_: *const *mut $ffi_name, _: usize) -> Vec { + unsafe fn from_glib_container_num_as_vec(_: *const *mut $gst_sys_name, _: usize) -> Vec { // Can't free a *const unimplemented!() } - unsafe fn from_glib_full_num_as_vec(_: *const *mut $ffi_name, _: usize) -> Vec { + unsafe fn from_glib_full_num_as_vec(_: *const *mut $gst_sys_name, _: usize) -> Vec { // Can't free a *const unimplemented!() } } - impl $crate::glib::translate::FromGlibPtrArrayContainerAsVec<*mut $ffi_name, *const *mut $ffi_name> for $name + impl $crate::glib::translate::FromGlibPtrArrayContainerAsVec<*mut $gst_sys_name, *const *mut $gst_sys_name> for $name { - unsafe fn from_glib_none_as_vec(ptr: *const *mut $ffi_name) -> Vec { + unsafe fn from_glib_none_as_vec(ptr: *const *mut $gst_sys_name) -> Vec { $crate::glib::translate::FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _) } - unsafe fn from_glib_container_as_vec(_: *const *mut $ffi_name) -> Vec { + unsafe fn from_glib_container_as_vec(_: *const *mut $gst_sys_name) -> Vec { // Can't free a *const unimplemented!() } - unsafe fn from_glib_full_as_vec(_: *const *mut $ffi_name) -> Vec { + unsafe fn from_glib_full_as_vec(_: *const *mut $gst_sys_name) -> Vec { // Can't free a *const unimplemented!() } @@ -827,11 +827,11 @@ macro_rules! gst_define_mini_object_wrapper( } impl $crate::glib::translate::GlibPtrDefault for $name { - type GlibType = *mut $ffi_name; + type GlibType = *mut $gst_sys_name; } unsafe impl $crate::MiniObject for $ref_name { - type GstType = $ffi_name; + type GstType = $gst_sys_name; } impl $crate::glib::types::StaticType for $ref_name { diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index 65ba83c6e..16c6e6564 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -12,7 +12,7 @@ use glib::signal::SignalHandlerId; use glib::translate::{from_glib_borrow, from_glib_none, ToGlibPtr}; use glib::IsA; -use gobject_ffi; +use gobject_sys; pub trait GstObjectExtManual: 'static { fn connect_deep_notify< @@ -44,14 +44,14 @@ impl> GstObjectExtManual for O { }; let obj: glib::Object = - unsafe { from_glib_borrow(self.as_ptr() as *mut gobject_ffi::GObject) }; + unsafe { from_glib_borrow(self.as_ptr() as *mut gobject_sys::GObject) }; obj.connect(signal_name.as_str(), false, move |values| { let obj: O = unsafe { values[0].get::<::Object>().unwrap().unsafe_cast() }; let prop_obj: ::Object = values[1].get().unwrap(); let pspec = unsafe { - let pspec = gobject_ffi::g_value_get_param(values[2].to_glib_none().0); + let pspec = gobject_sys::g_value_get_param(values[2].to_glib_none().0); from_glib_none(pspec) }; @@ -74,7 +74,7 @@ mod tests { ::init().unwrap(); let bin = ::Bin::new(None); - let identity = ::ElementFactory::make("identity", "id").unwrap(); + let identity = ::ElementFactory::make("identity", Some("id")).unwrap(); bin.add(&identity).unwrap(); let notify = Arc::new(Mutex::new(None)); diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 77da98bf5..89086572d 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -40,12 +40,12 @@ use glib::translate::{ FromGlibPtrBorrow, ToGlib, ToGlibPtr, }; use glib::StaticType; -use glib_ffi; -use glib_ffi::gpointer; +use glib_sys; +use glib_sys::gpointer; use libc; -use ffi; +use gst_sys; impl Pad { pub fn new_from_static_template<'a, P: Into>>( @@ -55,7 +55,7 @@ impl Pad { assert_initialized_main_thread!(); let name = name.into(); unsafe { - from_glib_none(ffi::gst_pad_new_from_static_template( + from_glib_none(gst_sys::gst_pad_new_from_static_template( mut_override(templ.to_glib_none().0), name.to_glib_none().0, )) @@ -98,7 +98,7 @@ pub enum PadProbeData<'a> { Query(&'a mut QueryRef), Event(Event), #[doc(hidden)] - __Unknown(*mut ffi::GstMiniObject), + __Unknown(*mut gst_sys::GstMiniObject), } #[derive(Debug)] @@ -106,8 +106,8 @@ pub struct StreamLock(Pad); impl Drop for StreamLock { fn drop(&mut self) { unsafe { - let pad: *mut ffi::GstPad = self.0.to_glib_none().0; - glib_ffi::g_rec_mutex_unlock(&mut (*pad).stream_rec_lock); + let pad: *mut gst_sys::GstPad = self.0.to_glib_none().0; + glib_sys::g_rec_mutex_unlock(&mut (*pad).stream_rec_lock); } } } @@ -275,7 +275,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - let id = ffi::gst_pad_add_probe( + let id = gst_sys::gst_pad_add_probe( self.as_ref().to_glib_none().0, mask.to_glib(), Some(trampoline_pad_probe::), @@ -293,13 +293,13 @@ impl> PadExtManual for O { fn remove_probe(&self, id: PadProbeId) { unsafe { - ffi::gst_pad_remove_probe(self.as_ref().to_glib_none().0, id.to_glib()); + gst_sys::gst_pad_remove_probe(self.as_ref().to_glib_none().0, id.to_glib()); } } fn chain(&self, buffer: Buffer) -> Result { unsafe { - FlowReturn::from_glib(ffi::gst_pad_chain( + FlowReturn::from_glib(gst_sys::gst_pad_chain( self.as_ref().to_glib_none().0, buffer.into_ptr(), )) @@ -309,7 +309,7 @@ impl> PadExtManual for O { fn push(&self, buffer: Buffer) -> Result { unsafe { - FlowReturn::from_glib(ffi::gst_pad_push( + FlowReturn::from_glib(gst_sys::gst_pad_push( self.as_ref().to_glib_none().0, buffer.into_ptr(), )) @@ -319,7 +319,7 @@ impl> PadExtManual for O { fn chain_list(&self, list: BufferList) -> Result { unsafe { - FlowReturn::from_glib(ffi::gst_pad_chain_list( + FlowReturn::from_glib(gst_sys::gst_pad_chain_list( self.as_ref().to_glib_none().0, list.into_ptr(), )) @@ -329,7 +329,7 @@ impl> PadExtManual for O { fn push_list(&self, list: BufferList) -> Result { unsafe { - FlowReturn::from_glib(ffi::gst_pad_push_list( + FlowReturn::from_glib(gst_sys::gst_pad_push_list( self.as_ref().to_glib_none().0, list.into_ptr(), )) @@ -340,7 +340,7 @@ impl> PadExtManual for O { fn get_range(&self, offset: u64, size: u32) -> Result { unsafe { let mut buffer = ptr::null_mut(); - let ret: FlowReturn = from_glib(ffi::gst_pad_get_range( + let ret: FlowReturn = from_glib(gst_sys::gst_pad_get_range( self.as_ref().to_glib_none().0, offset, size, @@ -353,7 +353,7 @@ impl> PadExtManual for O { fn pull_range(&self, offset: u64, size: u32) -> Result { unsafe { let mut buffer = ptr::null_mut(); - let ret: FlowReturn = from_glib(ffi::gst_pad_pull_range( + let ret: FlowReturn = from_glib(gst_sys::gst_pad_pull_range( self.as_ref().to_glib_none().0, offset, size, @@ -365,7 +365,7 @@ impl> PadExtManual for O { fn query(&self, query: &mut QueryRef) -> bool { unsafe { - from_glib(ffi::gst_pad_query( + from_glib(gst_sys::gst_pad_query( self.as_ref().to_glib_none().0, query.as_mut_ptr(), )) @@ -374,7 +374,7 @@ impl> PadExtManual for O { fn peer_query(&self, query: &mut QueryRef) -> bool { unsafe { - from_glib(ffi::gst_pad_peer_query( + from_glib(gst_sys::gst_pad_peer_query( self.as_ref().to_glib_none().0, query.as_mut_ptr(), )) @@ -389,7 +389,7 @@ impl> PadExtManual for O { skip_assert_initialized!(); let parent = parent.into(); unsafe { - from_glib(ffi::gst_pad_query_default( + from_glib(gst_sys::gst_pad_query_default( self.as_ref().to_glib_none().0, parent.map(|p| p.as_ref()).to_glib_none().0, query.as_mut_ptr(), @@ -399,7 +399,7 @@ impl> PadExtManual for O { fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool { unsafe { - from_glib(ffi::gst_pad_proxy_query_accept_caps( + from_glib(gst_sys::gst_pad_proxy_query_accept_caps( self.as_ref().to_glib_none().0, query.as_mut_ptr(), )) @@ -408,7 +408,7 @@ impl> PadExtManual for O { fn proxy_query_caps(&self, query: &mut QueryRef) -> bool { unsafe { - from_glib(ffi::gst_pad_proxy_query_accept_caps( + from_glib(gst_sys::gst_pad_proxy_query_accept_caps( self.as_ref().to_glib_none().0, query.as_mut_ptr(), )) @@ -423,7 +423,7 @@ impl> PadExtManual for O { skip_assert_initialized!(); let parent = parent.into(); unsafe { - from_glib(ffi::gst_pad_event_default( + from_glib(gst_sys::gst_pad_event_default( self.as_ref().to_glib_none().0, parent.map(|p| p.as_ref()).to_glib_none().0, event.into_ptr(), @@ -433,7 +433,7 @@ impl> PadExtManual for O { fn push_event(&self, event: Event) -> bool { unsafe { - from_glib(ffi::gst_pad_push_event( + from_glib(gst_sys::gst_pad_push_event( self.as_ref().to_glib_none().0, event.into_ptr(), )) @@ -442,7 +442,7 @@ impl> PadExtManual for O { fn send_event(&self, event: Event) -> bool { unsafe { - from_glib(ffi::gst_pad_send_event( + from_glib(gst_sys::gst_pad_send_event( self.as_ref().to_glib_none().0, event.into_ptr(), )) @@ -451,7 +451,7 @@ impl> PadExtManual for O { fn get_last_flow_return(&self) -> Result { let ret: FlowReturn = unsafe { - from_glib(ffi::gst_pad_get_last_flow_return( + from_glib(gst_sys::gst_pad_get_last_flow_return( self.as_ref().to_glib_none().0, )) }; @@ -460,7 +460,7 @@ impl> PadExtManual for O { fn iterate_internal_links(&self) -> ::Iterator { unsafe { - from_glib_full(ffi::gst_pad_iterate_internal_links( + from_glib_full(gst_sys::gst_pad_iterate_internal_links( self.as_ref().to_glib_none().0, )) } @@ -472,7 +472,7 @@ impl> PadExtManual for O { ) -> ::Iterator { let parent = parent.into(); unsafe { - from_glib_full(ffi::gst_pad_iterate_internal_links_default( + from_glib_full(gst_sys::gst_pad_iterate_internal_links_default( self.as_ref().to_glib_none().0, parent.map(|p| p.as_ref()).to_glib_none().0, )) @@ -481,7 +481,7 @@ impl> PadExtManual for O { fn link>(&self, sinkpad: &P) -> Result { let ret: PadLinkReturn = unsafe { - from_glib(ffi::gst_pad_link( + from_glib(gst_sys::gst_pad_link( self.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0, )) @@ -495,7 +495,7 @@ impl> PadExtManual for O { flags: PadLinkCheck, ) -> Result { let ret: PadLinkReturn = unsafe { - from_glib(ffi::gst_pad_link_full( + from_glib(gst_sys::gst_pad_link_full( self.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0, flags.to_glib(), @@ -506,9 +506,9 @@ impl> PadExtManual for O { fn stream_lock(&self) -> StreamLock { unsafe { - let ptr: &mut ffi::GstPad = &mut *(self.as_ptr() as *mut _); - glib_ffi::g_rec_mutex_lock(&mut ptr.stream_rec_lock); - StreamLock(from_glib_none(ptr as *mut ffi::GstPad)) + let ptr: &mut gst_sys::GstPad = &mut *(self.as_ptr() as *mut _); + glib_sys::g_rec_mutex_lock(&mut ptr.stream_rec_lock); + StreamLock(from_glib_none(ptr as *mut gst_sys::GstPad)) } } @@ -519,7 +519,7 @@ impl> PadExtManual for O { #[allow(clippy::type_complexity)] unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_activate_function_full( + gst_sys::gst_pad_set_activate_function_full( self.as_ref().to_glib_none().0, Some(trampoline_activate_function::), Box::into_raw(func_box) as gpointer, @@ -538,7 +538,7 @@ impl> PadExtManual for O { #[allow(clippy::type_complexity)] unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_activatemode_function_full( + gst_sys::gst_pad_set_activatemode_function_full( self.as_ref().to_glib_none().0, Some(trampoline_activatemode_function::), Box::into_raw(func_box) as gpointer, @@ -556,7 +556,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_chain_function_full( + gst_sys::gst_pad_set_chain_function_full( self.as_ref().to_glib_none().0, Some(trampoline_chain_function::), Box::into_raw(func_box) as gpointer, @@ -574,7 +574,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_chain_list_function_full( + gst_sys::gst_pad_set_chain_list_function_full( self.as_ref().to_glib_none().0, Some(trampoline_chain_list_function::), Box::into_raw(func_box) as gpointer, @@ -589,7 +589,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_event_function_full( + gst_sys::gst_pad_set_event_function_full( self.as_ref().to_glib_none().0, Some(trampoline_event_function::), Box::into_raw(func_box) as gpointer, @@ -607,7 +607,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_event_full_function_full( + gst_sys::gst_pad_set_event_full_function_full( self.as_ref().to_glib_none().0, Some(trampoline_event_full_function::), Box::into_raw(func_box) as gpointer, @@ -625,7 +625,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_getrange_function_full( + gst_sys::gst_pad_set_getrange_function_full( self.as_ref().to_glib_none().0, Some(trampoline_getrange_function::), Box::into_raw(func_box) as gpointer, @@ -640,7 +640,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_iterate_internal_links_function_full( + gst_sys::gst_pad_set_iterate_internal_links_function_full( self.as_ref().to_glib_none().0, Some(trampoline_iterate_internal_links_function::), Box::into_raw(func_box) as gpointer, @@ -658,7 +658,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_link_function_full( + gst_sys::gst_pad_set_link_function_full( self.as_ref().to_glib_none().0, Some(trampoline_link_function::), Box::into_raw(func_box) as gpointer, @@ -673,7 +673,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_query_function_full( + gst_sys::gst_pad_set_query_function_full( self.as_ref().to_glib_none().0, Some(trampoline_query_function::), Box::into_raw(func_box) as gpointer, @@ -688,7 +688,7 @@ impl> PadExtManual for O { { unsafe { let func_box: Box = Box::new(func); - ffi::gst_pad_set_unlink_function_full( + gst_sys::gst_pad_set_unlink_function_full( self.as_ref().to_glib_none().0, Some(trampoline_unlink_function::), Box::into_raw(func_box) as gpointer, @@ -700,7 +700,7 @@ impl> PadExtManual for O { fn start_task(&self, func: F) -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_pad_start_task( + gst_sys::gst_pad_start_task( self.as_ref().to_glib_none().0, Some(trampoline_pad_task::), into_raw_pad_task(func), @@ -718,7 +718,7 @@ impl> PadExtManual for O { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_peer_query_convert( + let ret = from_glib(gst_sys::gst_pad_peer_query_convert( self.as_ref().to_glib_none().0, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -741,7 +741,7 @@ impl> PadExtManual for O { let src_val = src_val.into(); unsafe { let mut dest_val = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_peer_query_convert( + let ret = from_glib(gst_sys::gst_pad_peer_query_convert( self.as_ref().to_glib_none().0, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -759,7 +759,7 @@ impl> PadExtManual for O { fn peer_query_duration(&self) -> Option { unsafe { let mut duration = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_peer_query_duration( + let ret = from_glib(gst_sys::gst_pad_peer_query_duration( self.as_ref().to_glib_none().0, T::get_default_format().to_glib(), &mut duration, @@ -775,7 +775,7 @@ impl> PadExtManual for O { fn peer_query_duration_generic(&self, format: Format) -> Option { unsafe { let mut duration = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_peer_query_duration( + let ret = from_glib(gst_sys::gst_pad_peer_query_duration( self.as_ref().to_glib_none().0, format.to_glib(), &mut duration, @@ -791,7 +791,7 @@ impl> PadExtManual for O { fn peer_query_position(&self) -> Option { unsafe { let mut cur = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_peer_query_position( + let ret = from_glib(gst_sys::gst_pad_peer_query_position( self.as_ref().to_glib_none().0, T::get_default_format().to_glib(), &mut cur, @@ -807,7 +807,7 @@ impl> PadExtManual for O { fn peer_query_position_generic(&self, format: Format) -> Option { unsafe { let mut cur = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_peer_query_position( + let ret = from_glib(gst_sys::gst_pad_peer_query_position( self.as_ref().to_glib_none().0, format.to_glib(), &mut cur, @@ -828,7 +828,7 @@ impl> PadExtManual for O { unsafe { let mut dest_val = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_query_convert( + let ret = from_glib(gst_sys::gst_pad_query_convert( self.as_ref().to_glib_none().0, src_val.get_format().to_glib(), src_val.to_raw_value(), @@ -852,7 +852,7 @@ impl> PadExtManual for O { unsafe { let mut dest_val = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_query_convert( + let ret = from_glib(gst_sys::gst_pad_query_convert( self.as_ref().to_glib_none().0, src_val.get_format().to_glib(), src_val.get_value(), @@ -870,7 +870,7 @@ impl> PadExtManual for O { fn query_duration(&self) -> Option { unsafe { let mut duration = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_query_duration( + let ret = from_glib(gst_sys::gst_pad_query_duration( self.as_ref().to_glib_none().0, T::get_default_format().to_glib(), &mut duration, @@ -886,7 +886,7 @@ impl> PadExtManual for O { fn query_duration_generic(&self, format: Format) -> Option { unsafe { let mut duration = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_query_duration( + let ret = from_glib(gst_sys::gst_pad_query_duration( self.as_ref().to_glib_none().0, format.to_glib(), &mut duration, @@ -902,7 +902,7 @@ impl> PadExtManual for O { fn query_position(&self) -> Option { unsafe { let mut cur = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_query_position( + let ret = from_glib(gst_sys::gst_pad_query_position( self.as_ref().to_glib_none().0, T::get_default_format().to_glib(), &mut cur, @@ -918,7 +918,7 @@ impl> PadExtManual for O { fn query_position_generic(&self, format: Format) -> Option { unsafe { let mut cur = mem::uninitialized(); - let ret = from_glib(ffi::gst_pad_query_position( + let ret = from_glib(gst_sys::gst_pad_query_position( self.as_ref().to_glib_none().0, format.to_glib(), &mut cur, @@ -933,7 +933,7 @@ impl> PadExtManual for O { fn get_mode(&self) -> ::PadMode { unsafe { - let ptr: &ffi::GstPad = &*(self.as_ptr() as *const _); + let ptr: &gst_sys::GstPad = &*(self.as_ptr() as *const _); from_glib(ptr.mode) } } @@ -943,10 +943,10 @@ impl> PadExtManual for O { func: F, ) { unsafe extern "C" fn trampoline( - _pad: *mut ffi::GstPad, - event: *mut *mut ffi::GstEvent, - user_data: glib_ffi::gpointer, - ) -> glib_ffi::gboolean { + _pad: *mut gst_sys::GstPad, + event: *mut *mut gst_sys::GstEvent, + user_data: glib_sys::gpointer, + ) -> glib_sys::gboolean { let func = user_data as *mut &mut (FnMut(Event) -> Result, Option>); let res = (*func)(from_glib_full(*event)); @@ -954,19 +954,19 @@ impl> PadExtManual for O { match res { Ok(Some(ev)) => { *event = ev.into_ptr(); - glib_ffi::GTRUE + glib_sys::GTRUE } Err(Some(ev)) => { *event = ev.into_ptr(); - glib_ffi::GFALSE + glib_sys::GFALSE } Ok(None) => { *event = ptr::null_mut(); - glib_ffi::GTRUE + glib_sys::GTRUE } Err(None) => { *event = ptr::null_mut(); - glib_ffi::GFALSE + glib_sys::GFALSE } } } @@ -976,9 +976,9 @@ impl> PadExtManual for O { let func_obj: &mut (FnMut(Event) -> Result, Option>) = &mut func; let func_ptr = &func_obj as *const &mut (FnMut(Event) -> Result, Option>) - as glib_ffi::gpointer; + as glib_sys::gpointer; - ffi::gst_pad_sticky_events_foreach( + gst_sys::gst_pad_sticky_events_foreach( self.as_ref().to_glib_none().0, Some(trampoline), func_ptr, @@ -988,7 +988,7 @@ impl> PadExtManual for O { fn store_sticky_event(&self, event: &Event) -> Result { let ret: FlowReturn = unsafe { - from_glib(ffi::gst_pad_store_sticky_event( + from_glib(gst_sys::gst_pad_store_sticky_event( self.as_ref().to_glib_none().0, event.to_glib_none().0, )) @@ -1001,10 +1001,10 @@ unsafe extern "C" fn trampoline_pad_probe< T, F: Fn(&T, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - info: *mut ffi::GstPadProbeInfo, + pad: *mut gst_sys::GstPad, + info: *mut gst_sys::GstPadProbeInfo, func: gpointer, -) -> ffi::GstPadProbeReturn +) -> gst_sys::GstPadProbeReturn where T: IsA, { @@ -1019,27 +1019,27 @@ where data: if (*info).data.is_null() { None } else { - let data = (*info).data as *mut ffi::GstMiniObject; + let data = (*info).data as *mut gst_sys::GstMiniObject; (*info).data = ptr::null_mut(); if (*data).type_ == Buffer::static_type().to_glib() { data_type = Some(Buffer::static_type()); Some(PadProbeData::Buffer(from_glib_full( - data as *const ffi::GstBuffer, + data as *const gst_sys::GstBuffer, ))) } else if (*data).type_ == BufferList::static_type().to_glib() { data_type = Some(BufferList::static_type()); Some(PadProbeData::BufferList(from_glib_full( - data as *const ffi::GstBufferList, + data as *const gst_sys::GstBufferList, ))) } else if (*data).type_ == Query::static_type().to_glib() { data_type = Some(Query::static_type()); Some(PadProbeData::Query(QueryRef::from_mut_ptr( - data as *mut ffi::GstQuery, + data as *mut gst_sys::GstQuery, ))) } else if (*data).type_ == Event::static_type().to_glib() { data_type = Some(Event::static_type()); Some(PadProbeData::Event(from_glib_full( - data as *const ffi::GstEvent, + data as *const gst_sys::GstEvent, ))) } else { Some(PadProbeData::__Unknown(data)) @@ -1081,9 +1081,9 @@ unsafe extern "C" fn trampoline_activate_function< T, F: Fn(&T, &Option<::Object>) -> Result<(), LoggableError> + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, -) -> glib_ffi::gboolean + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, +) -> glib_sys::gboolean where T: IsA, { @@ -1106,11 +1106,11 @@ unsafe extern "C" fn trampoline_activatemode_function< T, F: Fn(&T, &Option<::Object>, ::PadMode, bool) -> Result<(), LoggableError> + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, - mode: ffi::GstPadMode, - active: glib_ffi::gboolean, -) -> glib_ffi::gboolean + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, + mode: gst_sys::GstPadMode, + active: glib_sys::gboolean, +) -> glib_sys::gboolean where T: IsA, { @@ -1135,10 +1135,10 @@ unsafe extern "C" fn trampoline_chain_function< T, F: Fn(&T, &Option<::Object>, ::Buffer) -> Result + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, - buffer: *mut ffi::GstBuffer, -) -> ffi::GstFlowReturn + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, + buffer: *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: IsA, { @@ -1160,10 +1160,10 @@ unsafe extern "C" fn trampoline_chain_list_function< + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, - list: *mut ffi::GstBufferList, -) -> ffi::GstFlowReturn + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, + list: *mut gst_sys::GstBufferList, +) -> gst_sys::GstFlowReturn where T: IsA, { @@ -1182,10 +1182,10 @@ unsafe extern "C" fn trampoline_event_function< T, F: Fn(&T, &Option<::Object>, ::Event) -> bool + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, - event: *mut ffi::GstEvent, -) -> glib_ffi::gboolean + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, + event: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: IsA, { @@ -1203,10 +1203,10 @@ unsafe extern "C" fn trampoline_event_full_function< T, F: Fn(&T, &Option<::Object>, ::Event) -> Result + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, - event: *mut ffi::GstEvent, -) -> ffi::GstFlowReturn + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, + event: *mut gst_sys::GstEvent, +) -> gst_sys::GstFlowReturn where T: IsA, { @@ -1225,12 +1225,12 @@ unsafe extern "C" fn trampoline_getrange_function< T, F: Fn(&T, &Option<::Object>, u64, u32) -> Result<::Buffer, FlowError> + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, offset: u64, length: u32, - buffer: *mut *mut ffi::GstBuffer, -) -> ffi::GstFlowReturn + buffer: *mut *mut gst_sys::GstBuffer, +) -> gst_sys::GstFlowReturn where T: IsA, { @@ -1254,9 +1254,9 @@ unsafe extern "C" fn trampoline_iterate_internal_links_function< T, F: Fn(&T, &Option<::Object>) -> ::Iterator + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, -) -> *mut ffi::GstIterator + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, +) -> *mut gst_sys::GstIterator where T: IsA, { @@ -1280,10 +1280,10 @@ unsafe extern "C" fn trampoline_link_function< + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, - peer: *mut ffi::GstPad, -) -> ffi::GstPadLinkReturn + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, + peer: *mut gst_sys::GstPad, +) -> gst_sys::GstPadLinkReturn where T: IsA, { @@ -1302,10 +1302,10 @@ unsafe extern "C" fn trampoline_query_function< T, F: Fn(&T, &Option<::Object>, &mut ::QueryRef) -> bool + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, - query: *mut ffi::GstQuery, -) -> glib_ffi::gboolean + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, + query: *mut gst_sys::GstQuery, +) -> glib_sys::gboolean where T: IsA, { @@ -1323,8 +1323,8 @@ unsafe extern "C" fn trampoline_unlink_function< T, F: Fn(&T, &Option<::Object>) + Send + Sync + 'static, >( - pad: *mut ffi::GstPad, - parent: *mut ffi::GstObject, + pad: *mut gst_sys::GstPad, + parent: *mut gst_sys::GstObject, ) where T: IsA, { @@ -1366,7 +1366,7 @@ mod tests { fn test_event_chain_functions() { ::init().unwrap(); - let pad = ::Pad::new("sink", ::PadDirection::Sink); + let pad = ::Pad::new(Some("sink"), ::PadDirection::Sink); let events = Arc::new(Mutex::new(Vec::new())); let events_clone = events.clone(); @@ -1414,7 +1414,7 @@ mod tests { fn test_task() { ::init().unwrap(); - let pad = ::Pad::new("sink", ::PadDirection::Sink); + let pad = ::Pad::new(Some("sink"), ::PadDirection::Sink); let (sender, receiver) = channel(); let mut i = 0; diff --git a/gstreamer/src/pad_template.rs b/gstreamer/src/pad_template.rs index 48052e740..c2d6c792e 100644 --- a/gstreamer/src/pad_template.rs +++ b/gstreamer/src/pad_template.rs @@ -12,10 +12,10 @@ use PadTemplate; #[cfg(any(feature = "v1_14", feature = "dox"))] use StaticPadTemplate; -#[cfg(any(feature = "v1_14", feature = "dox"))] -use ffi; #[cfg(any(feature = "v1_14", feature = "dox"))] use glib; +#[cfg(any(feature = "v1_14", feature = "dox"))] +use gst_sys; impl PadTemplate { #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -26,7 +26,7 @@ impl PadTemplate { assert_initialized_main_thread!(); unsafe { from_glib_none( - ffi::gst_pad_template_new_from_static_pad_template_with_gtype( + gst_sys::gst_pad_template_new_from_static_pad_template_with_gtype( mut_override(pad_template.to_glib_none().0), pad_type.to_glib(), ), diff --git a/gstreamer/src/param_spec.rs b/gstreamer/src/param_spec.rs index 283d2bf0e..376940be6 100644 --- a/gstreamer/src/param_spec.rs +++ b/gstreamer/src/param_spec.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::*; +use gst_sys; pub trait GstParamSpecExt { #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -41,7 +41,7 @@ impl GstParamSpecExt for glib::ParamSpec { flags: glib::ParamFlags, ) -> glib::ParamSpec { unsafe { - from_glib_full(ffi::gst_param_spec_array( + from_glib_full(gst_sys::gst_param_spec_array( name.to_glib_none().0, nick.to_glib_none().0, blurb.to_glib_none().0, @@ -61,7 +61,7 @@ impl GstParamSpecExt for glib::ParamSpec { flags: glib::ParamFlags, ) -> glib::ParamSpec { unsafe { - from_glib_full(ffi::gst_param_spec_fraction( + from_glib_full(gst_sys::gst_param_spec_fraction( name.to_glib_none().0, nick.to_glib_none().0, blurb.to_glib_none().0, diff --git a/gstreamer/src/parse_context.rs b/gstreamer/src/parse_context.rs index 6ce80538f..63d2183c4 100644 --- a/gstreamer/src/parse_context.rs +++ b/gstreamer/src/parse_context.rs @@ -6,33 +6,33 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; -use gobject_ffi; +use gobject_sys; +use gst_sys; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] - pub struct ParseContext(Boxed); + pub struct ParseContext(Boxed); match fn { copy => |ptr| { - gobject_ffi::g_boxed_copy(ffi::gst_parse_context_get_type(), ptr as *mut _) as *mut ffi::GstParseContext + gobject_sys::g_boxed_copy(gst_sys::gst_parse_context_get_type(), ptr as *mut _) as *mut gst_sys::GstParseContext }, free => |ptr| { - gobject_ffi::g_boxed_free(ffi::gst_parse_context_get_type(), ptr as *mut _) + gobject_sys::g_boxed_free(gst_sys::gst_parse_context_get_type(), ptr as *mut _) }, - get_type => || ffi::gst_parse_context_get_type(), + get_type => || gst_sys::gst_parse_context_get_type(), } } impl ParseContext { pub fn new() -> Self { - unsafe { from_glib_full(ffi::gst_parse_context_new()) } + unsafe { from_glib_full(gst_sys::gst_parse_context_new()) } } pub fn get_missing_elements(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_full(ffi::gst_parse_context_get_missing_elements( + FromGlibPtrContainer::from_glib_full(gst_sys::gst_parse_context_get_missing_elements( mut_override(self.to_glib_none().0), )) } diff --git a/gstreamer/src/plugin.rs b/gstreamer/src/plugin.rs index f922faf19..3908766bd 100644 --- a/gstreamer/src/plugin.rs +++ b/gstreamer/src/plugin.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use Plugin; use Structure; use StructureRef; @@ -16,7 +16,7 @@ use glib::translate::*; impl Plugin { pub fn get_cache_data(&self) -> Option<&StructureRef> { unsafe { - let cache_data = ffi::gst_plugin_get_cache_data(self.to_glib_none().0); + let cache_data = gst_sys::gst_plugin_get_cache_data(self.to_glib_none().0); if cache_data.is_null() { None } else { @@ -27,7 +27,7 @@ impl Plugin { pub fn set_cache_data(&self, cache_data: Structure) { unsafe { - ffi::gst_plugin_set_cache_data(self.to_glib_none().0, cache_data.into_ptr()); + gst_sys::gst_plugin_set_cache_data(self.to_glib_none().0, cache_data.into_ptr()); } } } diff --git a/gstreamer/src/promise.rs b/gstreamer/src/promise.rs index 8f19d23f2..ee9423f88 100644 --- a/gstreamer/src/promise.rs +++ b/gstreamer/src/promise.rs @@ -6,21 +6,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; -use glib_ffi; +use glib_sys; +use gst_sys; use PromiseResult; use Structure; use StructureRef; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] - pub struct Promise(Shared); + pub struct Promise(Shared); match fn { - ref => |ptr| ffi::gst_mini_object_ref(ptr as *mut _), - unref => |ptr| ffi::gst_mini_object_unref(ptr as *mut _), - get_type => || ffi::gst_promise_get_type(), + ref => |ptr| gst_sys::gst_mini_object_ref(ptr as *mut _), + unref => |ptr| gst_sys::gst_mini_object_unref(ptr as *mut _), + get_type => || gst_sys::gst_promise_get_type(), } } @@ -28,7 +28,7 @@ impl Promise { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn new() -> Promise { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_promise_new()) } + unsafe { from_glib_full(gst_sys::gst_promise_new()) } } #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -39,8 +39,8 @@ impl Promise { let user_data: Box> = Box::new(Some(func)); unsafe extern "C" fn trampoline( - promise: *mut ffi::GstPromise, - user_data: glib_ffi::gpointer, + promise: *mut gst_sys::GstPromise, + user_data: glib_sys::gpointer, ) { let user_data: &mut Option = &mut *(user_data as *mut _); let callback = user_data.take().unwrap(); @@ -49,13 +49,13 @@ impl Promise { } unsafe extern "C" fn free_user_data( - user_data: glib_ffi::gpointer, + user_data: glib_sys::gpointer, ) { let _: Box> = Box::from_raw(user_data as *mut _); } unsafe { - from_glib_full(ffi::gst_promise_new_with_change_func( + from_glib_full(gst_sys::gst_promise_new_with_change_func( Some(trampoline::), Box::into_raw(user_data) as *mut _, Some(free_user_data::), @@ -66,14 +66,14 @@ impl Promise { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn expire(&self) { unsafe { - ffi::gst_promise_expire(self.to_glib_none().0); + gst_sys::gst_promise_expire(self.to_glib_none().0); } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn get_reply(&self) -> Option<&StructureRef> { unsafe { - let s = ffi::gst_promise_get_reply(self.to_glib_none().0); + let s = gst_sys::gst_promise_get_reply(self.to_glib_none().0); if s.is_null() { None } else { @@ -85,20 +85,20 @@ impl Promise { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn interrupt(&self) { unsafe { - ffi::gst_promise_interrupt(self.to_glib_none().0); + gst_sys::gst_promise_interrupt(self.to_glib_none().0); } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn reply(&self, s: Structure) { unsafe { - ffi::gst_promise_reply(self.to_glib_none().0, s.into_ptr()); + gst_sys::gst_promise_reply(self.to_glib_none().0, s.into_ptr()); } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn wait(&self) -> PromiseResult { - unsafe { from_glib(ffi::gst_promise_wait(self.to_glib_none().0)) } + unsafe { from_glib(gst_sys::gst_promise_wait(self.to_glib_none().0)) } } } diff --git a/gstreamer/src/proxy_pad.rs b/gstreamer/src/proxy_pad.rs index d7bb5d4c4..31771bf90 100644 --- a/gstreamer/src/proxy_pad.rs +++ b/gstreamer/src/proxy_pad.rs @@ -19,7 +19,7 @@ use ProxyPad; use glib::object::IsA; use glib::translate::{from_glib, from_glib_full, ToGlibPtr}; -use ffi; +use gst_sys; impl ProxyPad { pub fn chain_default<'a, P: IsA, Q: IsA + 'a, R: Into>>( @@ -30,8 +30,8 @@ impl ProxyPad { skip_assert_initialized!(); let parent = parent.into(); let ret: FlowReturn = unsafe { - from_glib(ffi::gst_proxy_pad_chain_default( - pad.as_ptr() as *mut ffi::GstPad, + from_glib(gst_sys::gst_proxy_pad_chain_default( + pad.as_ptr() as *mut gst_sys::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, buffer.into_ptr(), )) @@ -47,8 +47,8 @@ impl ProxyPad { skip_assert_initialized!(); let parent = parent.into(); let ret: FlowReturn = unsafe { - from_glib(ffi::gst_proxy_pad_chain_list_default( - pad.as_ptr() as *mut ffi::GstPad, + from_glib(gst_sys::gst_proxy_pad_chain_list_default( + pad.as_ptr() as *mut gst_sys::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, list.into_ptr(), )) @@ -65,8 +65,8 @@ impl ProxyPad { skip_assert_initialized!(); unsafe { let mut buffer = ptr::null_mut(); - let ret: FlowReturn = from_glib(ffi::gst_proxy_pad_getrange_default( - pad.as_ptr() as *mut ffi::GstPad, + let ret: FlowReturn = from_glib(gst_sys::gst_proxy_pad_getrange_default( + pad.as_ptr() as *mut gst_sys::GstPad, parent.as_ref().to_glib_none().0, offset, size, @@ -88,8 +88,8 @@ impl ProxyPad { skip_assert_initialized!(); let parent = parent.into(); unsafe { - from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default( - pad.as_ptr() as *mut ffi::GstPad, + from_glib_full(gst_sys::gst_proxy_pad_iterate_internal_links_default( + pad.as_ptr() as *mut gst_sys::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, )) } diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index a82092575..90e2f0c20 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use miniobject::*; use structure::*; use GenericFormattedValue; @@ -19,36 +19,52 @@ use std::ptr; use glib; use glib::translate::*; -use glib_ffi; +use glib_sys; -gst_define_mini_object_wrapper!(Query, QueryRef, ffi::GstQuery, [Debug,], || { - ffi::gst_query_get_type() +gst_define_mini_object_wrapper!(Query, QueryRef, gst_sys::GstQuery, [Debug,], || { + gst_sys::gst_query_get_type() }); impl Query { pub fn new_position(fmt: ::Format) -> Position { assert_initialized_main_thread!(); - unsafe { Position::(from_glib_full(ffi::gst_query_new_position(fmt.to_glib()))) } + unsafe { + Position::(from_glib_full(gst_sys::gst_query_new_position( + fmt.to_glib(), + ))) + } } pub fn new_duration(fmt: ::Format) -> Duration { assert_initialized_main_thread!(); - unsafe { Duration::(from_glib_full(ffi::gst_query_new_duration(fmt.to_glib()))) } + unsafe { + Duration::(from_glib_full(gst_sys::gst_query_new_duration( + fmt.to_glib(), + ))) + } } pub fn new_latency() -> Latency { assert_initialized_main_thread!(); - unsafe { Latency::(from_glib_full(ffi::gst_query_new_latency())) } + unsafe { Latency::(from_glib_full(gst_sys::gst_query_new_latency())) } } pub fn new_seeking(fmt: ::Format) -> Seeking { assert_initialized_main_thread!(); - unsafe { Seeking::(from_glib_full(ffi::gst_query_new_seeking(fmt.to_glib()))) } + unsafe { + Seeking::(from_glib_full(gst_sys::gst_query_new_seeking( + fmt.to_glib(), + ))) + } } pub fn new_segment(fmt: ::Format) -> Segment { assert_initialized_main_thread!(); - unsafe { Segment::(from_glib_full(ffi::gst_query_new_segment(fmt.to_glib()))) } + unsafe { + Segment::(from_glib_full(gst_sys::gst_query_new_segment( + fmt.to_glib(), + ))) + } } pub fn new_convert>( @@ -58,7 +74,7 @@ impl Query { assert_initialized_main_thread!(); let value = value.into(); unsafe { - Convert::(from_glib_full(ffi::gst_query_new_convert( + Convert::(from_glib_full(gst_sys::gst_query_new_convert( value.get_format().to_glib(), value.get_value(), dest_fmt.to_glib(), @@ -68,19 +84,23 @@ impl Query { pub fn new_formats() -> Formats { assert_initialized_main_thread!(); - unsafe { Formats::(from_glib_full(ffi::gst_query_new_formats())) } + unsafe { Formats::(from_glib_full(gst_sys::gst_query_new_formats())) } } pub fn new_buffering(fmt: ::Format) -> Buffering { assert_initialized_main_thread!(); - unsafe { Buffering::(from_glib_full(ffi::gst_query_new_buffering(fmt.to_glib()))) } + unsafe { + Buffering::(from_glib_full(gst_sys::gst_query_new_buffering( + fmt.to_glib(), + ))) + } } pub fn new_custom(structure: ::Structure) -> Custom { assert_initialized_main_thread!(); unsafe { - Custom::(from_glib_full(ffi::gst_query_new_custom( - ffi::GST_QUERY_CUSTOM, + Custom::(from_glib_full(gst_sys::gst_query_new_custom( + gst_sys::GST_QUERY_CUSTOM, structure.into_ptr(), ))) } @@ -88,13 +108,13 @@ impl Query { pub fn new_uri() -> Uri { assert_initialized_main_thread!(); - unsafe { Uri::(from_glib_full(ffi::gst_query_new_uri())) } + unsafe { Uri::(from_glib_full(gst_sys::gst_query_new_uri())) } } pub fn new_allocation(caps: &::Caps, need_pool: bool) -> Allocation { assert_initialized_main_thread!(); unsafe { - Allocation::(from_glib_full(ffi::gst_query_new_allocation( + Allocation::(from_glib_full(gst_sys::gst_query_new_allocation( caps.as_mut_ptr(), need_pool.to_glib(), ))) @@ -103,13 +123,13 @@ impl Query { pub fn new_scheduling() -> Scheduling { assert_initialized_main_thread!(); - unsafe { Scheduling::(from_glib_full(ffi::gst_query_new_scheduling())) } + unsafe { Scheduling::(from_glib_full(gst_sys::gst_query_new_scheduling())) } } pub fn new_accept_caps(caps: &::Caps) -> AcceptCaps { assert_initialized_main_thread!(); unsafe { - AcceptCaps::(from_glib_full(ffi::gst_query_new_accept_caps( + AcceptCaps::(from_glib_full(gst_sys::gst_query_new_accept_caps( caps.as_mut_ptr(), ))) } @@ -119,7 +139,7 @@ impl Query { assert_initialized_main_thread!(); let filter = filter.into(); unsafe { - Caps::(from_glib_full(ffi::gst_query_new_caps( + Caps::(from_glib_full(gst_sys::gst_query_new_caps( filter.to_glib_none().0, ))) } @@ -127,13 +147,13 @@ impl Query { pub fn new_drain() -> Drain { assert_initialized_main_thread!(); - unsafe { Drain::(from_glib_full(ffi::gst_query_new_drain())) } + unsafe { Drain::(from_glib_full(gst_sys::gst_query_new_drain())) } } pub fn new_context(context_type: &str) -> Context { assert_initialized_main_thread!(); unsafe { - Context::(from_glib_full(ffi::gst_query_new_context( + Context::(from_glib_full(gst_sys::gst_query_new_context( context_type.to_glib_none().0, ))) } @@ -143,7 +163,7 @@ impl Query { impl QueryRef { pub fn get_structure(&self) -> Option<&StructureRef> { unsafe { - let structure = ffi::gst_query_get_structure(self.as_mut_ptr()); + let structure = gst_sys::gst_query_get_structure(self.as_mut_ptr()); if structure.is_null() { None } else { @@ -154,45 +174,45 @@ impl QueryRef { pub fn get_mut_structure(&mut self) -> &mut StructureRef { unsafe { - let structure = ffi::gst_query_writable_structure(self.as_mut_ptr()); + let structure = gst_sys::gst_query_writable_structure(self.as_mut_ptr()); StructureRef::from_glib_borrow_mut(structure) } } pub fn is_downstream(&self) -> bool { - unsafe { ((*self.as_ptr()).type_ as u32) & ffi::GST_QUERY_TYPE_DOWNSTREAM != 0 } + unsafe { ((*self.as_ptr()).type_ as u32) & gst_sys::GST_QUERY_TYPE_DOWNSTREAM != 0 } } pub fn is_upstream(&self) -> bool { - unsafe { ((*self.as_ptr()).type_ as u32) & ffi::GST_QUERY_TYPE_UPSTREAM != 0 } + unsafe { ((*self.as_ptr()).type_ as u32) & gst_sys::GST_QUERY_TYPE_UPSTREAM != 0 } } pub fn is_serialized(&self) -> bool { - unsafe { ((*self.as_ptr()).type_ as u32) & ffi::GST_QUERY_TYPE_SERIALIZED != 0 } + unsafe { ((*self.as_ptr()).type_ as u32) & gst_sys::GST_QUERY_TYPE_SERIALIZED != 0 } } pub fn view(&self) -> QueryView<&Self> { let type_ = unsafe { (*self.as_ptr()).type_ }; match type_ { - ffi::GST_QUERY_POSITION => QueryView::Position(Position(self)), - ffi::GST_QUERY_DURATION => QueryView::Duration(Duration(self)), - ffi::GST_QUERY_LATENCY => QueryView::Latency(Latency(self)), - ffi::GST_QUERY_JITTER => QueryView::Jitter(Jitter(self)), - ffi::GST_QUERY_RATE => QueryView::Rate(Rate(self)), - ffi::GST_QUERY_SEEKING => QueryView::Seeking(Seeking(self)), - ffi::GST_QUERY_SEGMENT => QueryView::Segment(Segment(self)), - ffi::GST_QUERY_CONVERT => QueryView::Convert(Convert(self)), - ffi::GST_QUERY_FORMATS => QueryView::Formats(Formats(self)), - ffi::GST_QUERY_BUFFERING => QueryView::Buffering(Buffering(self)), - ffi::GST_QUERY_CUSTOM => QueryView::Custom(Custom(self)), - ffi::GST_QUERY_URI => QueryView::Uri(Uri(self)), - ffi::GST_QUERY_ALLOCATION => QueryView::Allocation(Allocation(self)), - ffi::GST_QUERY_SCHEDULING => QueryView::Scheduling(Scheduling(self)), - ffi::GST_QUERY_ACCEPT_CAPS => QueryView::AcceptCaps(AcceptCaps(self)), - ffi::GST_QUERY_CAPS => QueryView::Caps(Caps(self)), - ffi::GST_QUERY_DRAIN => QueryView::Drain(Drain(self)), - ffi::GST_QUERY_CONTEXT => QueryView::Context(Context(self)), + gst_sys::GST_QUERY_POSITION => QueryView::Position(Position(self)), + gst_sys::GST_QUERY_DURATION => QueryView::Duration(Duration(self)), + gst_sys::GST_QUERY_LATENCY => QueryView::Latency(Latency(self)), + gst_sys::GST_QUERY_JITTER => QueryView::Jitter(Jitter(self)), + gst_sys::GST_QUERY_RATE => QueryView::Rate(Rate(self)), + gst_sys::GST_QUERY_SEEKING => QueryView::Seeking(Seeking(self)), + gst_sys::GST_QUERY_SEGMENT => QueryView::Segment(Segment(self)), + gst_sys::GST_QUERY_CONVERT => QueryView::Convert(Convert(self)), + gst_sys::GST_QUERY_FORMATS => QueryView::Formats(Formats(self)), + gst_sys::GST_QUERY_BUFFERING => QueryView::Buffering(Buffering(self)), + gst_sys::GST_QUERY_CUSTOM => QueryView::Custom(Custom(self)), + gst_sys::GST_QUERY_URI => QueryView::Uri(Uri(self)), + gst_sys::GST_QUERY_ALLOCATION => QueryView::Allocation(Allocation(self)), + gst_sys::GST_QUERY_SCHEDULING => QueryView::Scheduling(Scheduling(self)), + gst_sys::GST_QUERY_ACCEPT_CAPS => QueryView::AcceptCaps(AcceptCaps(self)), + gst_sys::GST_QUERY_CAPS => QueryView::Caps(Caps(self)), + gst_sys::GST_QUERY_DRAIN => QueryView::Drain(Drain(self)), + gst_sys::GST_QUERY_CONTEXT => QueryView::Context(Context(self)), _ => QueryView::Other(Other(self)), } } @@ -207,7 +227,7 @@ impl fmt::Debug for QueryRef { f.debug_struct("Query") .field("ptr", unsafe { &self.as_ptr() }) .field("type", &unsafe { - let type_ = ffi::gst_query_type_get_name((*self.as_ptr()).type_); + let type_ = gst_sys::gst_query_type_get_name((*self.as_ptr()).type_); CStr::from_ptr(type_).to_str().unwrap() }) .field("structure", &self.get_structure()) @@ -216,40 +236,40 @@ impl fmt::Debug for QueryRef { } pub unsafe trait AsPtr { - unsafe fn as_ptr(&self) -> *mut ffi::GstQuery; + unsafe fn as_ptr(&self) -> *mut gst_sys::GstQuery; } pub unsafe trait AsMutPtr: AsPtr { - unsafe fn as_mut_ptr(&self) -> *mut ffi::GstQuery; + unsafe fn as_mut_ptr(&self) -> *mut gst_sys::GstQuery; } unsafe impl AsPtr for Query { - unsafe fn as_ptr(&self) -> *mut ffi::GstQuery { - self.as_ref().as_ptr() as *mut ffi::GstQuery + unsafe fn as_ptr(&self) -> *mut gst_sys::GstQuery { + self.as_ref().as_ptr() as *mut gst_sys::GstQuery } } unsafe impl AsMutPtr for Query { - unsafe fn as_mut_ptr(&self) -> *mut ffi::GstQuery { + unsafe fn as_mut_ptr(&self) -> *mut gst_sys::GstQuery { self.as_ref().as_mut_ptr() } } unsafe impl<'a> AsPtr for &'a QueryRef { - unsafe fn as_ptr(&self) -> *mut ffi::GstQuery { - MiniObject::as_ptr(self as &QueryRef) as *mut ffi::GstQuery + unsafe fn as_ptr(&self) -> *mut gst_sys::GstQuery { + MiniObject::as_ptr(self as &QueryRef) as *mut gst_sys::GstQuery } } unsafe impl<'a> AsPtr for &'a mut QueryRef { - unsafe fn as_ptr(&self) -> *mut ffi::GstQuery { - MiniObject::as_ptr(self as &QueryRef) as *mut ffi::GstQuery + unsafe fn as_ptr(&self) -> *mut gst_sys::GstQuery { + MiniObject::as_ptr(self as &QueryRef) as *mut gst_sys::GstQuery } } unsafe impl<'a> AsMutPtr for &'a mut QueryRef { - unsafe fn as_mut_ptr(&self) -> *mut ffi::GstQuery { - MiniObject::as_mut_ptr(self as &QueryRef) as *mut ffi::GstQuery + unsafe fn as_mut_ptr(&self) -> *mut gst_sys::GstQuery { + MiniObject::as_mut_ptr(self as &QueryRef) as *mut gst_sys::GstQuery } } @@ -341,7 +361,7 @@ impl Position { let mut fmt = mem::uninitialized(); let mut pos = mem::uninitialized(); - ffi::gst_query_parse_position(self.0.as_ptr(), &mut fmt, &mut pos); + gst_sys::gst_query_parse_position(self.0.as_ptr(), &mut fmt, &mut pos); GenericFormattedValue::new(from_glib(fmt), pos) } @@ -351,7 +371,7 @@ impl Position { unsafe { let mut fmt = mem::uninitialized(); - ffi::gst_query_parse_position(self.0.as_ptr(), &mut fmt, ptr::null_mut()); + gst_sys::gst_query_parse_position(self.0.as_ptr(), &mut fmt, ptr::null_mut()); from_glib(fmt) } @@ -363,7 +383,7 @@ impl Position { let pos = pos.into(); assert_eq!(pos.get_format(), self.get_format()); unsafe { - ffi::gst_query_set_position( + gst_sys::gst_query_set_position( self.0.as_mut_ptr(), pos.get_format().to_glib(), pos.get_value(), @@ -379,7 +399,7 @@ impl Duration { let mut fmt = mem::uninitialized(); let mut pos = mem::uninitialized(); - ffi::gst_query_parse_duration(self.0.as_ptr(), &mut fmt, &mut pos); + gst_sys::gst_query_parse_duration(self.0.as_ptr(), &mut fmt, &mut pos); GenericFormattedValue::new(from_glib(fmt), pos) } @@ -389,7 +409,7 @@ impl Duration { unsafe { let mut fmt = mem::uninitialized(); - ffi::gst_query_parse_duration(self.0.as_ptr(), &mut fmt, ptr::null_mut()); + gst_sys::gst_query_parse_duration(self.0.as_ptr(), &mut fmt, ptr::null_mut()); from_glib(fmt) } @@ -401,7 +421,7 @@ impl Duration { let dur = dur.into(); assert_eq!(dur.get_format(), self.get_format()); unsafe { - ffi::gst_query_set_duration( + gst_sys::gst_query_set_duration( self.0.as_mut_ptr(), dur.get_format().to_glib(), dur.get_value(), @@ -418,7 +438,7 @@ impl Latency { let mut min = mem::uninitialized(); let mut max = mem::uninitialized(); - ffi::gst_query_parse_latency(self.0.as_ptr(), &mut live, &mut min, &mut max); + gst_sys::gst_query_parse_latency(self.0.as_ptr(), &mut live, &mut min, &mut max); (from_glib(live), from_glib(min), from_glib(max)) } @@ -428,7 +448,7 @@ impl Latency { impl Latency { pub fn set(&mut self, live: bool, min: ::ClockTime, max: ::ClockTime) { unsafe { - ffi::gst_query_set_latency( + gst_sys::gst_query_set_latency( self.0.as_mut_ptr(), live.to_glib(), min.to_glib(), @@ -449,7 +469,7 @@ impl Seeking { let mut seekable = mem::uninitialized(); let mut start = mem::uninitialized(); let mut end = mem::uninitialized(); - ffi::gst_query_parse_seeking( + gst_sys::gst_query_parse_seeking( self.0.as_ptr(), &mut fmt, &mut seekable, @@ -468,7 +488,7 @@ impl Seeking { pub fn get_format(&self) -> ::Format { unsafe { let mut fmt = mem::uninitialized(); - ffi::gst_query_parse_seeking( + gst_sys::gst_query_parse_seeking( self.0.as_ptr(), &mut fmt, ptr::null_mut(), @@ -490,7 +510,7 @@ impl Seeking { assert_eq!(start.get_format(), end.get_format()); unsafe { - ffi::gst_query_set_seeking( + gst_sys::gst_query_set_seeking( self.0.as_mut_ptr(), start.get_format().to_glib(), seekable.to_glib(), @@ -510,7 +530,7 @@ impl Segment { let mut start = mem::uninitialized(); let mut stop = mem::uninitialized(); - ffi::gst_query_parse_segment( + gst_sys::gst_query_parse_segment( self.0.as_ptr(), &mut rate, &mut fmt, @@ -529,7 +549,7 @@ impl Segment { unsafe { let mut fmt = mem::uninitialized(); - ffi::gst_query_parse_segment( + gst_sys::gst_query_parse_segment( self.0.as_ptr(), ptr::null_mut(), &mut fmt, @@ -549,7 +569,7 @@ impl Segment { assert_eq!(start.get_format(), stop.get_format()); unsafe { - ffi::gst_query_set_segment( + gst_sys::gst_query_set_segment( self.0.as_mut_ptr(), rate, start.get_format().to_glib(), @@ -569,7 +589,7 @@ impl Convert { let mut dest_fmt = mem::uninitialized(); let mut dest = mem::uninitialized(); - ffi::gst_query_parse_convert( + gst_sys::gst_query_parse_convert( self.0.as_ptr(), &mut src_fmt, &mut src, @@ -589,7 +609,7 @@ impl Convert { let mut src = mem::uninitialized(); let mut dest_fmt = mem::uninitialized(); - ffi::gst_query_parse_convert( + gst_sys::gst_query_parse_convert( self.0.as_ptr(), &mut src_fmt, &mut src, @@ -610,7 +630,7 @@ impl Convert { let dest = dest.into(); unsafe { - ffi::gst_query_set_convert( + gst_sys::gst_query_set_convert( self.0.as_mut_ptr(), src.get_format().to_glib(), src.get_value(), @@ -626,12 +646,12 @@ impl Formats { pub fn get_result(&self) -> Vec<::Format> { unsafe { let mut n = mem::uninitialized(); - ffi::gst_query_parse_n_formats(self.0.as_ptr(), &mut n); + gst_sys::gst_query_parse_n_formats(self.0.as_ptr(), &mut n); let mut res = Vec::with_capacity(n as usize); for i in 0..n { let mut fmt = mem::uninitialized(); - ffi::gst_query_parse_nth_format(self.0.as_ptr(), i, &mut fmt); + gst_sys::gst_query_parse_nth_format(self.0.as_ptr(), i, &mut fmt); res.push(from_glib(fmt)); } @@ -644,7 +664,11 @@ impl Formats { pub fn set(&mut self, formats: &[::Format]) { unsafe { let v: Vec<_> = formats.iter().map(|f| f.to_glib()).collect(); - ffi::gst_query_set_formatsv(self.0.as_mut_ptr(), v.len() as i32, v.as_ptr() as *mut _); + gst_sys::gst_query_set_formatsv( + self.0.as_mut_ptr(), + v.len() as i32, + v.as_ptr() as *mut _, + ); } } } @@ -655,7 +679,7 @@ impl Buffering { unsafe { let mut fmt = mem::uninitialized(); - ffi::gst_query_parse_buffering_range( + gst_sys::gst_query_parse_buffering_range( self.0.as_ptr(), &mut fmt, ptr::null_mut(), @@ -672,7 +696,7 @@ impl Buffering { let mut busy = mem::uninitialized(); let mut percent = mem::uninitialized(); - ffi::gst_query_parse_buffering_percent(self.0.as_ptr(), &mut busy, &mut percent); + gst_sys::gst_query_parse_buffering_percent(self.0.as_ptr(), &mut busy, &mut percent); (from_glib(busy), percent) } @@ -685,7 +709,7 @@ impl Buffering { let mut stop = mem::uninitialized(); let mut estimated_total = mem::uninitialized(); - ffi::gst_query_parse_buffering_range( + gst_sys::gst_query_parse_buffering_range( self.0.as_ptr(), &mut fmt, &mut start, @@ -707,7 +731,7 @@ impl Buffering { let mut avg_out = mem::uninitialized(); let mut buffering_left = mem::uninitialized(); - ffi::gst_query_parse_buffering_stats( + gst_sys::gst_query_parse_buffering_stats( self.0.as_ptr(), &mut mode, &mut avg_in, @@ -722,7 +746,7 @@ impl Buffering { pub fn get_ranges(&self) -> Vec<(GenericFormattedValue, GenericFormattedValue)> { unsafe { let mut fmt = mem::uninitialized(); - ffi::gst_query_parse_buffering_range( + gst_sys::gst_query_parse_buffering_range( self.0.as_ptr(), &mut fmt, ptr::null_mut(), @@ -731,12 +755,12 @@ impl Buffering { ); let fmt = from_glib(fmt); - let n = ffi::gst_query_get_n_buffering_ranges(self.0.as_ptr()); + let n = gst_sys::gst_query_get_n_buffering_ranges(self.0.as_ptr()); let mut res = Vec::with_capacity(n as usize); for i in 0..n { let mut start = mem::uninitialized(); let mut stop = mem::uninitialized(); - let s: bool = from_glib(ffi::gst_query_parse_nth_buffering_range( + let s: bool = from_glib(gst_sys::gst_query_parse_nth_buffering_range( self.0.as_ptr(), i, &mut start, @@ -758,7 +782,7 @@ impl Buffering { impl Buffering { pub fn set_percent(&mut self, busy: bool, percent: i32) { unsafe { - ffi::gst_query_set_buffering_percent(self.0.as_mut_ptr(), busy.to_glib(), percent); + gst_sys::gst_query_set_buffering_percent(self.0.as_mut_ptr(), busy.to_glib(), percent); } } @@ -775,7 +799,7 @@ impl Buffering { assert_eq!(start.get_format(), stop.get_format()); unsafe { - ffi::gst_query_set_buffering_range( + gst_sys::gst_query_set_buffering_range( self.0.as_mut_ptr(), start.get_format().to_glib(), start.get_value(), @@ -794,7 +818,7 @@ impl Buffering { ) { skip_assert_initialized!(); unsafe { - ffi::gst_query_set_buffering_stats( + gst_sys::gst_query_set_buffering_stats( self.0.as_mut_ptr(), mode.to_glib(), avg_in, @@ -816,7 +840,7 @@ impl Buffering { let stop = stop.into(); assert_eq!(start.get_format(), fmt); assert_eq!(stop.get_format(), fmt); - ffi::gst_query_add_buffering_range( + gst_sys::gst_query_add_buffering_range( self.0.as_mut_ptr(), start.get_value(), stop.get_value(), @@ -833,7 +857,7 @@ impl Uri { pub fn get_uri(&self) -> Option { unsafe { let mut uri = ptr::null_mut(); - ffi::gst_query_parse_uri(self.0.as_ptr(), &mut uri); + gst_sys::gst_query_parse_uri(self.0.as_ptr(), &mut uri); from_glib_full(uri) } } @@ -841,9 +865,9 @@ impl Uri { pub fn get_redirection(&self) -> (Option, bool) { unsafe { let mut uri = ptr::null_mut(); - ffi::gst_query_parse_uri_redirection(self.0.as_ptr(), &mut uri); + gst_sys::gst_query_parse_uri_redirection(self.0.as_ptr(), &mut uri); let mut permanent = mem::uninitialized(); - ffi::gst_query_parse_uri_redirection_permanent(self.0.as_ptr(), &mut permanent); + gst_sys::gst_query_parse_uri_redirection_permanent(self.0.as_ptr(), &mut permanent); (from_glib_full(uri), from_glib(permanent)) } @@ -854,15 +878,18 @@ impl Uri { pub fn set_uri<'b, U: Into<&'b str>>(&mut self, uri: U) { let uri = uri.into(); unsafe { - ffi::gst_query_set_uri(self.0.as_mut_ptr(), uri.to_glib_none().0); + gst_sys::gst_query_set_uri(self.0.as_mut_ptr(), uri.to_glib_none().0); } } pub fn set_redirection<'b, U: Into<&'b str>>(&mut self, uri: U, permanent: bool) { let uri = uri.into(); unsafe { - ffi::gst_query_set_uri_redirection(self.0.as_mut_ptr(), uri.to_glib_none().0); - ffi::gst_query_set_uri_redirection_permanent(self.0.as_mut_ptr(), permanent.to_glib()); + gst_sys::gst_query_set_uri_redirection(self.0.as_mut_ptr(), uri.to_glib_none().0); + gst_sys::gst_query_set_uri_redirection_permanent( + self.0.as_mut_ptr(), + permanent.to_glib(), + ); } } } @@ -874,14 +901,14 @@ impl Allocation { let mut caps = ptr::null_mut(); let mut need_pool = 0; - ffi::gst_query_parse_allocation(self.0.as_ptr(), &mut caps, &mut need_pool); + gst_sys::gst_query_parse_allocation(self.0.as_ptr(), &mut caps, &mut need_pool); (::CapsRef::from_ptr(caps), from_glib(need_pool)) } } pub fn get_allocation_pools(&self) -> Vec<(Option<::BufferPool>, u32, u32, u32)> { unsafe { - let n = ffi::gst_query_get_n_allocation_pools(self.0.as_ptr()); + let n = gst_sys::gst_query_get_n_allocation_pools(self.0.as_ptr()); let mut pools = Vec::with_capacity(n as usize); for i in 0..n { let mut pool = ptr::null_mut(); @@ -889,7 +916,7 @@ impl Allocation { let mut min_buffers = 0; let mut max_buffers = 0; - ffi::gst_query_parse_nth_allocation_pool( + gst_sys::gst_query_parse_nth_allocation_pool( self.0.as_ptr(), i, &mut pool, @@ -906,13 +933,16 @@ impl Allocation { pub fn get_allocation_metas(&self) -> Vec<(glib::Type, Option<&::StructureRef>)> { unsafe { - let n = ffi::gst_query_get_n_allocation_metas(self.0.as_ptr()); + let n = gst_sys::gst_query_get_n_allocation_metas(self.0.as_ptr()); let mut metas = Vec::with_capacity(n as usize); for i in 0..n { let mut structure = ptr::null(); - let api = - ffi::gst_query_parse_nth_allocation_meta(self.0.as_ptr(), i, &mut structure); + let api = gst_sys::gst_query_parse_nth_allocation_meta( + self.0.as_ptr(), + i, + &mut structure, + ); metas.push(( from_glib(api), if structure.is_null() { @@ -930,11 +960,11 @@ impl Allocation { pub fn find_allocation_meta(&self) -> Option { unsafe { let mut idx = 0; - if ffi::gst_query_find_allocation_meta( + if gst_sys::gst_query_find_allocation_meta( self.0.as_ptr(), U::get_meta_api().to_glib(), &mut idx, - ) != glib_ffi::GFALSE + ) != glib_sys::GFALSE { Some(idx) } else { @@ -953,7 +983,7 @@ impl Allocation { max_buffers: u32, ) { unsafe { - ffi::gst_query_add_allocation_pool( + gst_sys::gst_query_add_allocation_pool( self.0.as_mut_ptr(), pool.to_glib_none().0, size, @@ -972,7 +1002,7 @@ impl Allocation { max_buffers: u32, ) { unsafe { - ffi::gst_query_set_nth_allocation_pool( + gst_sys::gst_query_set_nth_allocation_pool( self.0.as_mut_ptr(), idx, pool.to_glib_none().0, @@ -985,13 +1015,13 @@ impl Allocation { pub fn remove_nth_allocation_pool(&mut self, idx: u32) { unsafe { - ffi::gst_query_remove_nth_allocation_pool(self.0.as_mut_ptr(), idx); + gst_sys::gst_query_remove_nth_allocation_pool(self.0.as_mut_ptr(), idx); } } pub fn add_allocation_meta(&mut self, structure: Option<&::StructureRef>) { unsafe { - ffi::gst_query_add_allocation_meta( + gst_sys::gst_query_add_allocation_meta( self.0.as_mut_ptr(), U::get_meta_api().to_glib(), if let Some(structure) = structure { @@ -1005,7 +1035,7 @@ impl Allocation { pub fn remove_nth_allocation_meta(&mut self, idx: u32) { unsafe { - ffi::gst_query_remove_nth_allocation_meta(self.0.as_mut_ptr(), idx); + gst_sys::gst_query_remove_nth_allocation_meta(self.0.as_mut_ptr(), idx); } } } @@ -1014,7 +1044,7 @@ declare_concrete_query!(Scheduling, T); impl Scheduling { pub fn has_scheduling_mode(&self, mode: ::PadMode) -> bool { unsafe { - from_glib(ffi::gst_query_has_scheduling_mode( + from_glib(gst_sys::gst_query_has_scheduling_mode( self.0.as_ptr(), mode.to_glib(), )) @@ -1028,7 +1058,7 @@ impl Scheduling { ) -> bool { skip_assert_initialized!(); unsafe { - from_glib(ffi::gst_query_has_scheduling_mode_with_flags( + from_glib(gst_sys::gst_query_has_scheduling_mode_with_flags( self.0.as_ptr(), mode.to_glib(), flags.to_glib(), @@ -1038,10 +1068,10 @@ impl Scheduling { pub fn get_scheduling_modes(&self) -> Vec<::PadMode> { unsafe { - let n = ffi::gst_query_get_n_scheduling_modes(self.0.as_ptr()); + let n = gst_sys::gst_query_get_n_scheduling_modes(self.0.as_ptr()); let mut res = Vec::with_capacity(n as usize); for i in 0..n { - res.push(from_glib(ffi::gst_query_parse_nth_scheduling_mode( + res.push(from_glib(gst_sys::gst_query_parse_nth_scheduling_mode( self.0.as_ptr(), i, ))); @@ -1058,7 +1088,7 @@ impl Scheduling { let mut maxsize = mem::uninitialized(); let mut align = mem::uninitialized(); - ffi::gst_query_parse_scheduling( + gst_sys::gst_query_parse_scheduling( self.0.as_ptr(), &mut flags, &mut minsize, @@ -1075,14 +1105,14 @@ impl Scheduling { pub fn add_scheduling_modes(&mut self, modes: &[::PadMode]) { unsafe { for mode in modes { - ffi::gst_query_add_scheduling_mode(self.0.as_mut_ptr(), mode.to_glib()); + gst_sys::gst_query_add_scheduling_mode(self.0.as_mut_ptr(), mode.to_glib()); } } } pub fn set(&mut self, flags: ::SchedulingFlags, minsize: i32, maxsize: i32, align: i32) { unsafe { - ffi::gst_query_set_scheduling( + gst_sys::gst_query_set_scheduling( self.0.as_mut_ptr(), flags.to_glib(), minsize, @@ -1098,7 +1128,7 @@ impl AcceptCaps { pub fn get_caps(&self) -> &::CapsRef { unsafe { let mut caps = ptr::null_mut(); - ffi::gst_query_parse_accept_caps(self.0.as_ptr(), &mut caps); + gst_sys::gst_query_parse_accept_caps(self.0.as_ptr(), &mut caps); ::CapsRef::from_ptr(caps) } } @@ -1106,7 +1136,7 @@ impl AcceptCaps { pub fn get_result(&self) -> bool { unsafe { let mut accepted = mem::uninitialized(); - ffi::gst_query_parse_accept_caps_result(self.0.as_ptr(), &mut accepted); + gst_sys::gst_query_parse_accept_caps_result(self.0.as_ptr(), &mut accepted); from_glib(accepted) } } @@ -1115,7 +1145,7 @@ impl AcceptCaps { impl AcceptCaps { pub fn set_result(&mut self, accepted: bool) { unsafe { - ffi::gst_query_set_accept_caps_result(self.0.as_mut_ptr(), accepted.to_glib()); + gst_sys::gst_query_set_accept_caps_result(self.0.as_mut_ptr(), accepted.to_glib()); } } } @@ -1125,7 +1155,7 @@ impl Caps { pub fn get_filter(&self) -> Option<&::CapsRef> { unsafe { let mut caps = ptr::null_mut(); - ffi::gst_query_parse_caps(self.0.as_ptr(), &mut caps); + gst_sys::gst_query_parse_caps(self.0.as_ptr(), &mut caps); if caps.is_null() { None } else { @@ -1137,7 +1167,7 @@ impl Caps { pub fn get_result(&self) -> Option<&::CapsRef> { unsafe { let mut caps = ptr::null_mut(); - ffi::gst_query_parse_caps_result(self.0.as_ptr(), &mut caps); + gst_sys::gst_query_parse_caps_result(self.0.as_ptr(), &mut caps); if caps.is_null() { None } else { @@ -1150,7 +1180,7 @@ impl Caps { impl Caps { pub fn set_result(&mut self, caps: &::Caps) { unsafe { - ffi::gst_query_set_caps_result(self.0.as_mut_ptr(), caps.as_mut_ptr()); + gst_sys::gst_query_set_caps_result(self.0.as_mut_ptr(), caps.as_mut_ptr()); } } } @@ -1162,7 +1192,7 @@ impl Context { pub fn get_context(&self) -> Option<&::ContextRef> { unsafe { let mut context = ptr::null_mut(); - ffi::gst_query_parse_context(self.0.as_ptr(), &mut context); + gst_sys::gst_query_parse_context(self.0.as_ptr(), &mut context); if context.is_null() { None } else { @@ -1174,7 +1204,7 @@ impl Context { pub fn get_context_type(&self) -> &str { unsafe { let mut context_type = ptr::null(); - ffi::gst_query_parse_context_type(self.0.as_ptr(), &mut context_type); + gst_sys::gst_query_parse_context_type(self.0.as_ptr(), &mut context_type); CStr::from_ptr(context_type).to_str().unwrap() } } @@ -1183,7 +1213,7 @@ impl Context { impl Context { pub fn set_context(&mut self, context: &::Context) { unsafe { - ffi::gst_query_set_context(self.0.as_mut_ptr(), context.as_mut_ptr()); + gst_sys::gst_query_set_context(self.0.as_mut_ptr(), context.as_mut_ptr()); } } } @@ -1272,7 +1302,7 @@ mod tests { } #[test] - fn test_concrete_to_ffi() { + fn test_concrete_to_sys() { ::init().unwrap(); let p = Query::new_position(::Format::Time); diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index fde74c53e..a076a7177 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -9,7 +9,7 @@ use std::fmt; use std::ptr; -use ffi; +use gst_sys; use glib; use glib::translate::{from_glib_full, from_glib_none, mut_override, ToGlibPtr}; @@ -24,8 +24,8 @@ use Segment; use Structure; use StructureRef; -gst_define_mini_object_wrapper!(Sample, SampleRef, ffi::GstSample, [Debug,], || { - ffi::gst_sample_get_type() +gst_define_mini_object_wrapper!(Sample, SampleRef, gst_sys::GstSample, [Debug,], || { + gst_sys::gst_sample_get_type() }); impl Sample { @@ -39,7 +39,7 @@ impl Sample { unsafe { let info = info.map(|i| i.into_ptr()).unwrap_or(ptr::null_mut()); - from_glib_full(ffi::gst_sample_new( + from_glib_full(gst_sys::gst_sample_new( buffer.to_glib_none().0, caps.to_glib_none().0, segment.to_glib_none().0, @@ -57,7 +57,10 @@ impl Sample { assert_initialized_main_thread!(); let sample = Self::new(None, caps, segment, info); unsafe { - ffi::gst_sample_set_buffer_list(sample.to_glib_none().0, buffer_list.to_glib_none().0); + gst_sys::gst_sample_set_buffer_list( + sample.to_glib_none().0, + buffer_list.to_glib_none().0, + ); } sample } @@ -65,24 +68,24 @@ impl Sample { impl SampleRef { pub fn get_buffer(&self) -> Option { - unsafe { from_glib_none(ffi::gst_sample_get_buffer(self.as_mut_ptr())) } + unsafe { from_glib_none(gst_sys::gst_sample_get_buffer(self.as_mut_ptr())) } } pub fn get_buffer_list(&self) -> Option { - unsafe { from_glib_none(ffi::gst_sample_get_buffer_list(self.as_mut_ptr())) } + unsafe { from_glib_none(gst_sys::gst_sample_get_buffer_list(self.as_mut_ptr())) } } pub fn get_caps(&self) -> Option { - unsafe { from_glib_none(ffi::gst_sample_get_caps(self.as_mut_ptr())) } + unsafe { from_glib_none(gst_sys::gst_sample_get_caps(self.as_mut_ptr())) } } pub fn get_segment(&self) -> Option { - unsafe { from_glib_none(ffi::gst_sample_get_segment(self.as_mut_ptr())) } + unsafe { from_glib_none(gst_sys::gst_sample_get_segment(self.as_mut_ptr())) } } pub fn get_info(&self) -> Option<&StructureRef> { unsafe { - let ptr = ffi::gst_sample_get_info(self.as_mut_ptr()); + let ptr = gst_sys::gst_sample_get_info(self.as_mut_ptr()); if ptr.is_null() { None } else { diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index b82052f93..0d6b3f5e2 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -6,11 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::*; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_sys; use std::fmt; use std::marker::PhantomData; use std::mem; @@ -23,12 +23,12 @@ use SeekType; pub type Segment = FormattedSegment; #[repr(C)] -pub struct FormattedSegment(ffi::GstSegment, PhantomData); +pub struct FormattedSegment(gst_sys::GstSegment, PhantomData); impl Segment { pub fn reset_with_format(&mut self, format: Format) { unsafe { - ffi::gst_segment_init(self.to_glib_none_mut().0, format.to_glib()); + gst_sys::gst_segment_init(self.to_glib_none_mut().0, format.to_glib()); } } @@ -78,7 +78,7 @@ impl FormattedSegment { assert_initialized_main_thread!(); let segment = unsafe { let mut segment = mem::zeroed(); - ffi::gst_segment_init(&mut segment, T::get_default_format().to_glib()); + gst_sys::gst_segment_init(&mut segment, T::get_default_format().to_glib()); segment }; FormattedSegment(segment, PhantomData) @@ -96,7 +96,7 @@ impl FormattedSegment { pub fn reset(&mut self) { unsafe { - ffi::gst_segment_init(&mut self.0, T::get_default_format().to_glib()); + gst_sys::gst_segment_init(&mut self.0, T::get_default_format().to_glib()); } } @@ -112,7 +112,7 @@ impl FormattedSegment { unsafe { let mut clip_start = mem::uninitialized(); let mut clip_stop = mem::uninitialized(); - let ret = from_glib(ffi::gst_segment_clip( + let ret = from_glib(gst_sys::gst_segment_clip( &self.0, start.get_format().to_glib(), start.to_raw_value() as u64, @@ -152,7 +152,7 @@ impl FormattedSegment { unsafe { let mut update = mem::uninitialized(); - let ret = from_glib(ffi::gst_segment_do_seek( + let ret = from_glib(gst_sys::gst_segment_do_seek( &mut self.0, rate, self.get_format().to_glib(), @@ -174,7 +174,7 @@ impl FormattedSegment { pub fn offset_running_time(&mut self, offset: i64) -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - ffi::gst_segment_offset_running_time( + gst_sys::gst_segment_offset_running_time( &mut self.0, self.get_format().to_glib(), offset, @@ -194,7 +194,7 @@ impl FormattedSegment { unsafe { T::from_raw( self.get_format(), - ffi::gst_segment_position_from_running_time( + gst_sys::gst_segment_position_from_running_time( &self.0, self.get_format().to_glib(), running_time.to_raw_value() as u64, @@ -212,7 +212,7 @@ impl FormattedSegment { unsafe { let mut position = mem::uninitialized(); - let ret = ffi::gst_segment_position_from_running_time_full( + let ret = gst_sys::gst_segment_position_from_running_time_full( &self.0, self.get_format().to_glib(), running_time.to_raw_value() as u64, @@ -232,7 +232,7 @@ impl FormattedSegment { unsafe { T::from_raw( self.get_format(), - ffi::gst_segment_position_from_stream_time( + gst_sys::gst_segment_position_from_stream_time( &self.0, self.get_format().to_glib(), stream_time.to_raw_value() as u64, @@ -250,7 +250,7 @@ impl FormattedSegment { unsafe { let mut position = mem::uninitialized(); - let ret = ffi::gst_segment_position_from_stream_time_full( + let ret = gst_sys::gst_segment_position_from_stream_time_full( &self.0, self.get_format().to_glib(), stream_time.to_raw_value() as u64, @@ -269,7 +269,7 @@ impl FormattedSegment { unsafe { glib_result_from_gboolean!( - ffi::gst_segment_set_running_time( + gst_sys::gst_segment_set_running_time( &mut self.0, self.get_format().to_glib(), running_time.to_raw_value() as u64, @@ -289,7 +289,7 @@ impl FormattedSegment { unsafe { T::from_raw( self.get_format(), - ffi::gst_segment_to_running_time( + gst_sys::gst_segment_to_running_time( &self.0, self.get_format().to_glib(), position.to_raw_value() as u64, @@ -307,7 +307,7 @@ impl FormattedSegment { unsafe { let mut running_time = mem::uninitialized(); - let ret = ffi::gst_segment_to_running_time_full( + let ret = gst_sys::gst_segment_to_running_time_full( &self.0, self.get_format().to_glib(), position.to_raw_value() as u64, @@ -327,7 +327,7 @@ impl FormattedSegment { unsafe { T::from_raw( self.get_format(), - ffi::gst_segment_to_stream_time( + gst_sys::gst_segment_to_stream_time( &self.0, self.get_format().to_glib(), position.to_raw_value() as u64, @@ -345,7 +345,7 @@ impl FormattedSegment { unsafe { let mut stream_time = mem::uninitialized(); - let ret = ffi::gst_segment_to_stream_time_full( + let ret = gst_sys::gst_segment_to_stream_time_full( &self.0, self.get_format().to_glib(), position.to_raw_value() as u64, @@ -489,7 +489,7 @@ impl FormattedSegment { impl PartialEq for FormattedSegment { #[inline] fn eq(&self, other: &Self) -> bool { - unsafe { from_glib(ffi::gst_segment_is_equal(&self.0, &other.0)) } + unsafe { from_glib(gst_sys::gst_segment_is_equal(&self.0, &other.0)) } } } @@ -561,7 +561,7 @@ impl Default for FormattedSegment { impl glib::types::StaticType for FormattedSegment { fn static_type() -> glib::types::Type { - unsafe { glib::translate::from_glib(ffi::gst_segment_get_type()) } + unsafe { glib::translate::from_glib(gst_sys::gst_segment_get_type()) } } } @@ -569,7 +569,7 @@ impl glib::types::StaticType for FormattedSegment { impl<'a> glib::value::FromValueOptional<'a> for Segment { unsafe fn from_value_optional(value: &glib::Value) -> Option { Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstSegment + gobject_sys::g_value_get_boxed(value.to_glib_none().0) as *mut gst_sys::GstSegment ) } } @@ -577,10 +577,10 @@ impl<'a> glib::value::FromValueOptional<'a> for Segment { #[doc(hidden)] impl glib::value::SetValue for FormattedSegment { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstSegment>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -588,76 +588,78 @@ impl glib::value::SetValue for FormattedSegment { #[doc(hidden)] impl glib::value::SetValueOptional for FormattedSegment { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(&this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstSegment>::to_glib_none(&this).0 + as glib_sys::gpointer, ) } } #[doc(hidden)] impl glib::translate::GlibPtrDefault for FormattedSegment { - type GlibType = *mut ffi::GstSegment; + type GlibType = *mut gst_sys::GstSegment; } #[doc(hidden)] -impl<'a, T: FormattedValue> glib::translate::ToGlibPtr<'a, *const ffi::GstSegment> +impl<'a, T: FormattedValue> glib::translate::ToGlibPtr<'a, *const gst_sys::GstSegment> for FormattedSegment { type Storage = &'a FormattedSegment; - fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstSegment, Self> { + fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const gst_sys::GstSegment, Self> { glib::translate::Stash(&self.0, self) } - fn to_glib_full(&self) -> *const ffi::GstSegment { + fn to_glib_full(&self) -> *const gst_sys::GstSegment { unimplemented!() } } #[doc(hidden)] -impl<'a, T: FormattedValue> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstSegment> +impl<'a, T: FormattedValue> glib::translate::ToGlibPtrMut<'a, *mut gst_sys::GstSegment> for FormattedSegment { type Storage = &'a mut FormattedSegment; #[inline] - fn to_glib_none_mut(&'a mut self) -> glib::translate::StashMut<'a, *mut ffi::GstSegment, Self> { + fn to_glib_none_mut( + &'a mut self, + ) -> glib::translate::StashMut<'a, *mut gst_sys::GstSegment, Self> { glib::translate::StashMut(&mut self.0, self) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*const ffi::GstSegment> for Segment { +impl glib::translate::FromGlibPtrNone<*const gst_sys::GstSegment> for Segment { #[inline] - unsafe fn from_glib_none(ptr: *const ffi::GstSegment) -> Self { + unsafe fn from_glib_none(ptr: *const gst_sys::GstSegment) -> Self { FormattedSegment(ptr::read(ptr), PhantomData) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstSegment> for Segment { +impl glib::translate::FromGlibPtrNone<*mut gst_sys::GstSegment> for Segment { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstSegment) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_sys::GstSegment) -> Self { FormattedSegment(ptr::read(ptr), PhantomData) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstSegment> for Segment { +impl glib::translate::FromGlibPtrBorrow<*mut gst_sys::GstSegment> for Segment { #[inline] - unsafe fn from_glib_borrow(ptr: *mut ffi::GstSegment) -> Self { + unsafe fn from_glib_borrow(ptr: *mut gst_sys::GstSegment) -> Self { FormattedSegment(ptr::read(ptr), PhantomData) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrFull<*mut ffi::GstSegment> for Segment { +impl glib::translate::FromGlibPtrFull<*mut gst_sys::GstSegment> for Segment { #[inline] - unsafe fn from_glib_full(ptr: *mut ffi::GstSegment) -> Self { + unsafe fn from_glib_full(ptr: *mut gst_sys::GstSegment) -> Self { let segment = from_glib_none(ptr); - glib_ffi::g_free(ptr as *mut _); + glib_sys::g_free(ptr as *mut _); segment } } diff --git a/gstreamer/src/static_caps.rs b/gstreamer/src/static_caps.rs index 37b269122..34fabe9a9 100644 --- a/gstreamer/src/static_caps.rs +++ b/gstreamer/src/static_caps.rs @@ -8,9 +8,9 @@ use Caps; -use ffi; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_sys; use glib; use glib::translate::{from_glib_full, FromGlibPtrNone, ToGlibPtr, ToGlibPtrMut}; @@ -20,11 +20,11 @@ use std::fmt; use std::ptr; #[repr(C)] -pub struct StaticCaps(ptr::NonNull); +pub struct StaticCaps(ptr::NonNull); impl StaticCaps { pub fn get(&self) -> Caps { - unsafe { from_glib_full(ffi::gst_static_caps_get(self.0.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_static_caps_get(self.0.as_ptr())) } } } @@ -43,7 +43,7 @@ impl fmt::Debug for StaticCaps { impl glib::types::StaticType for StaticCaps { fn static_type() -> glib::types::Type { - unsafe { glib::translate::from_glib(ffi::gst_static_caps_get_type()) } + unsafe { glib::translate::from_glib(gst_sys::gst_static_caps_get_type()) } } } @@ -51,7 +51,7 @@ impl glib::types::StaticType for StaticCaps { impl<'a> glib::value::FromValueOptional<'a> for StaticCaps { unsafe fn from_value_optional(value: &glib::Value) -> Option { Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstStaticCaps + gobject_sys::g_value_get_boxed(value.to_glib_none().0) as *mut gst_sys::GstStaticCaps ) } } @@ -59,10 +59,10 @@ impl<'a> glib::value::FromValueOptional<'a> for StaticCaps { #[doc(hidden)] impl glib::value::SetValue for StaticCaps { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstStaticCaps>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -70,63 +70,63 @@ impl glib::value::SetValue for StaticCaps { #[doc(hidden)] impl glib::value::SetValueOptional for StaticCaps { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(&this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstStaticCaps>::to_glib_none(&this).0 + as glib_sys::gpointer, ) } } #[doc(hidden)] impl glib::translate::GlibPtrDefault for StaticCaps { - type GlibType = *mut ffi::GstStaticCaps; + type GlibType = *mut gst_sys::GstStaticCaps; } #[doc(hidden)] -impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstStaticCaps> for StaticCaps { +impl<'a> glib::translate::ToGlibPtr<'a, *const gst_sys::GstStaticCaps> for StaticCaps { type Storage = &'a StaticCaps; - fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstStaticCaps, Self> { + fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const gst_sys::GstStaticCaps, Self> { glib::translate::Stash(self.0.as_ptr(), self) } - fn to_glib_full(&self) -> *const ffi::GstStaticCaps { + fn to_glib_full(&self) -> *const gst_sys::GstStaticCaps { unimplemented!() } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticCaps> for StaticCaps { +impl glib::translate::FromGlibPtrNone<*const gst_sys::GstStaticCaps> for StaticCaps { #[inline] - unsafe fn from_glib_none(ptr: *const ffi::GstStaticCaps) -> Self { + unsafe fn from_glib_none(ptr: *const gst_sys::GstStaticCaps) -> Self { assert!(!ptr.is_null()); StaticCaps(ptr::NonNull::new_unchecked(ptr as *mut _)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticCaps> for StaticCaps { +impl glib::translate::FromGlibPtrNone<*mut gst_sys::GstStaticCaps> for StaticCaps { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstStaticCaps) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_sys::GstStaticCaps) -> Self { assert!(!ptr.is_null()); StaticCaps(ptr::NonNull::new_unchecked(ptr)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstStaticCaps> for StaticCaps { +impl glib::translate::FromGlibPtrBorrow<*mut gst_sys::GstStaticCaps> for StaticCaps { #[inline] - unsafe fn from_glib_borrow(ptr: *mut ffi::GstStaticCaps) -> Self { + unsafe fn from_glib_borrow(ptr: *mut gst_sys::GstStaticCaps) -> Self { assert!(!ptr.is_null()); StaticCaps(ptr::NonNull::new_unchecked(ptr)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrFull<*mut ffi::GstStaticCaps> for StaticCaps { +impl glib::translate::FromGlibPtrFull<*mut gst_sys::GstStaticCaps> for StaticCaps { #[inline] - unsafe fn from_glib_full(_ptr: *mut ffi::GstStaticCaps) -> Self { + unsafe fn from_glib_full(_ptr: *mut gst_sys::GstStaticCaps) -> Self { unimplemented!(); } } diff --git a/gstreamer/src/static_pad_template.rs b/gstreamer/src/static_pad_template.rs index 94df90ee8..cf60ecb51 100644 --- a/gstreamer/src/static_pad_template.rs +++ b/gstreamer/src/static_pad_template.rs @@ -9,9 +9,9 @@ use Caps; use PadTemplate; -use ffi; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_sys; use glib; use glib::translate::{ @@ -23,15 +23,15 @@ use std::fmt; use std::ptr; #[repr(C)] -pub struct StaticPadTemplate(ptr::NonNull); +pub struct StaticPadTemplate(ptr::NonNull); impl StaticPadTemplate { pub fn get(&self) -> PadTemplate { - unsafe { from_glib_full(ffi::gst_static_pad_template_get(self.0.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_static_pad_template_get(self.0.as_ptr())) } } pub fn get_caps(&self) -> Caps { - unsafe { from_glib_full(ffi::gst_static_pad_template_get_caps(self.0.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_static_pad_template_get_caps(self.0.as_ptr())) } } pub fn name_template<'a>(&self) -> &'a str { @@ -75,26 +75,26 @@ impl fmt::Debug for StaticPadTemplate { impl glib::types::StaticType for StaticPadTemplate { fn static_type() -> glib::types::Type { - unsafe { glib::translate::from_glib(ffi::gst_static_pad_template_get_type()) } + unsafe { glib::translate::from_glib(gst_sys::gst_static_pad_template_get_type()) } } } #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for StaticPadTemplate { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none(gobject_ffi::g_value_get_boxed( + Option::::from_glib_none(gobject_sys::g_value_get_boxed( value.to_glib_none().0, - ) as *mut ffi::GstStaticPadTemplate) + ) as *mut gst_sys::GstStaticPadTemplate) } } #[doc(hidden)] impl glib::value::SetValue for StaticPadTemplate { unsafe fn set_value(value: &mut glib::Value, this: &Self) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstStaticPadTemplate>::to_glib_none(this).0 + as glib_sys::gpointer, ) } } @@ -102,65 +102,67 @@ impl glib::value::SetValue for StaticPadTemplate { #[doc(hidden)] impl glib::value::SetValueOptional for StaticPadTemplate { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { - gobject_ffi::g_value_set_boxed( + gobject_sys::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(&this).0 - as glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const gst_sys::GstStaticPadTemplate>::to_glib_none(&this) + .0 as glib_sys::gpointer, ) } } #[doc(hidden)] impl glib::translate::GlibPtrDefault for StaticPadTemplate { - type GlibType = *mut ffi::GstStaticPadTemplate; + type GlibType = *mut gst_sys::GstStaticPadTemplate; } #[doc(hidden)] -impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstStaticPadTemplate> for StaticPadTemplate { +impl<'a> glib::translate::ToGlibPtr<'a, *const gst_sys::GstStaticPadTemplate> + for StaticPadTemplate +{ type Storage = &'a StaticPadTemplate; fn to_glib_none( &'a self, - ) -> glib::translate::Stash<'a, *const ffi::GstStaticPadTemplate, Self> { + ) -> glib::translate::Stash<'a, *const gst_sys::GstStaticPadTemplate, Self> { glib::translate::Stash(self.0.as_ptr(), self) } - fn to_glib_full(&self) -> *const ffi::GstStaticPadTemplate { + fn to_glib_full(&self) -> *const gst_sys::GstStaticPadTemplate { unimplemented!() } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*const ffi::GstStaticPadTemplate> for StaticPadTemplate { +impl glib::translate::FromGlibPtrNone<*const gst_sys::GstStaticPadTemplate> for StaticPadTemplate { #[inline] - unsafe fn from_glib_none(ptr: *const ffi::GstStaticPadTemplate) -> Self { + unsafe fn from_glib_none(ptr: *const gst_sys::GstStaticPadTemplate) -> Self { assert!(!ptr.is_null()); StaticPadTemplate(ptr::NonNull::new_unchecked(ptr as *mut _)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrNone<*mut ffi::GstStaticPadTemplate> for StaticPadTemplate { +impl glib::translate::FromGlibPtrNone<*mut gst_sys::GstStaticPadTemplate> for StaticPadTemplate { #[inline] - unsafe fn from_glib_none(ptr: *mut ffi::GstStaticPadTemplate) -> Self { + unsafe fn from_glib_none(ptr: *mut gst_sys::GstStaticPadTemplate) -> Self { assert!(!ptr.is_null()); StaticPadTemplate(ptr::NonNull::new_unchecked(ptr)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstStaticPadTemplate> for StaticPadTemplate { +impl glib::translate::FromGlibPtrBorrow<*mut gst_sys::GstStaticPadTemplate> for StaticPadTemplate { #[inline] - unsafe fn from_glib_borrow(ptr: *mut ffi::GstStaticPadTemplate) -> Self { + unsafe fn from_glib_borrow(ptr: *mut gst_sys::GstStaticPadTemplate) -> Self { assert!(!ptr.is_null()); StaticPadTemplate(ptr::NonNull::new_unchecked(ptr)) } } #[doc(hidden)] -impl glib::translate::FromGlibPtrFull<*mut ffi::GstStaticPadTemplate> for StaticPadTemplate { +impl glib::translate::FromGlibPtrFull<*mut gst_sys::GstStaticPadTemplate> for StaticPadTemplate { #[inline] - unsafe fn from_glib_full(_ptr: *mut ffi::GstStaticPadTemplate) -> Self { + unsafe fn from_glib_full(_ptr: *mut gst_sys::GstStaticPadTemplate) -> Self { unimplemented!(); } } diff --git a/gstreamer/src/stream.rs b/gstreamer/src/stream.rs index f4fa96878..35b01c760 100644 --- a/gstreamer/src/stream.rs +++ b/gstreamer/src/stream.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::translate::*; +use gst_sys; use Caps; use Stream; use StreamFlags; @@ -30,7 +30,7 @@ impl Stream { let (major, minor, _, _) = ::version(); if (major, minor) > (1, 12) { unsafe { - from_glib_full(ffi::gst_stream_new( + from_glib_full(gst_sys::gst_stream_new( stream_id.0, caps.0, type_.to_glib(), @@ -40,7 +40,7 @@ impl Stream { } else { // Work-around for 1.14 switching from transfer-floating to transfer-full unsafe { - from_glib_none(ffi::gst_stream_new( + from_glib_none(gst_sys::gst_stream_new( stream_id.0, caps.0, type_.to_glib(), diff --git a/gstreamer/src/stream_collection.rs b/gstreamer/src/stream_collection.rs index 541a29417..7b4497269 100644 --- a/gstreamer/src/stream_collection.rs +++ b/gstreamer/src/stream_collection.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; +use gst_sys; use Stream; use StreamCollection; @@ -75,17 +75,17 @@ impl StreamCollection { let upstream_id = upstream_id.to_glib_none(); let (major, minor, _, _) = ::version(); if (major, minor) > (1, 12) { - unsafe { from_glib_full(ffi::gst_stream_collection_new(upstream_id.0)) } + unsafe { from_glib_full(gst_sys::gst_stream_collection_new(upstream_id.0)) } } else { // Work-around for 1.14 switching from transfer-floating to transfer-full - unsafe { from_glib_none(ffi::gst_stream_collection_new(upstream_id.0)) } + unsafe { from_glib_none(gst_sys::gst_stream_collection_new(upstream_id.0)) } } } #[cfg(any(feature = "v1_10", feature = "dox"))] pub fn add_stream>(&self, stream: &P) { unsafe { - ffi::gst_stream_collection_add_stream( + gst_sys::gst_stream_collection_add_stream( self.to_glib_none().0, stream.as_ref().to_glib_full(), ); diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 48c5d87b0..83c3a76a6 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -17,15 +17,15 @@ use std::str; use Fraction; -use ffi; use glib; use glib::translate::{ from_glib, from_glib_full, from_glib_none, FromGlibPtrFull, FromGlibPtrNone, GlibPtrDefault, Stash, StashMut, ToGlib, ToGlibPtr, ToGlibPtrMut, }; use glib::value::{FromValueOptional, SendValue, ToSendValue}; -use glib_ffi::gpointer; -use gobject_ffi; +use glib_sys::gpointer; +use gobject_sys; +use gst_sys; pub struct Structure(ptr::NonNull, PhantomData); unsafe impl Send for Structure {} @@ -40,7 +40,7 @@ impl Structure { pub fn new_empty(name: &str) -> Structure { assert_initialized_main_thread!(); unsafe { - let ptr = ffi::gst_structure_new_empty(name.to_glib_none().0) as *mut StructureRef; + let ptr = gst_sys::gst_structure_new_empty(name.to_glib_none().0) as *mut StructureRef; assert!(!ptr.is_null()); Structure(ptr::NonNull::new_unchecked(ptr), PhantomData) } @@ -60,7 +60,7 @@ impl Structure { pub fn from_string(s: &str) -> Option { assert_initialized_main_thread!(); unsafe { - let structure = ffi::gst_structure_from_string(s.to_glib_none().0, ptr::null_mut()); + let structure = gst_sys::gst_structure_from_string(s.to_glib_none().0, ptr::null_mut()); if structure.is_null() { None } else { @@ -72,8 +72,8 @@ impl Structure { } } - pub unsafe fn into_ptr(self) -> *mut ffi::GstStructure { - let ptr = self.0.as_ptr() as *mut StructureRef as *mut ffi::GstStructure; + pub unsafe fn into_ptr(self) -> *mut gst_sys::GstStructure { + let ptr = self.0.as_ptr() as *mut StructureRef as *mut gst_sys::GstStructure; mem::forget(self); ptr @@ -109,7 +109,7 @@ impl AsMut for Structure { impl Clone for Structure { fn clone(&self) -> Self { unsafe { - let ptr = ffi::gst_structure_copy(&self.0.as_ref().0) as *mut StructureRef; + let ptr = gst_sys::gst_structure_copy(&self.0.as_ref().0) as *mut StructureRef; assert!(!ptr.is_null()); Structure(ptr::NonNull::new_unchecked(ptr), PhantomData) } @@ -118,7 +118,7 @@ impl Clone for Structure { impl Drop for Structure { fn drop(&mut self) { - unsafe { ffi::gst_structure_free(&mut self.0.as_mut().0) } + unsafe { gst_sys::gst_structure_free(&mut self.0.as_mut().0) } } } @@ -176,7 +176,7 @@ impl ToOwned for StructureRef { fn to_owned(&self) -> Structure { unsafe { - let ptr = ffi::gst_structure_copy(&self.0) as *mut StructureRef; + let ptr = gst_sys::gst_structure_copy(&self.0) as *mut StructureRef; assert!(!ptr.is_null()); Structure(ptr::NonNull::new_unchecked(ptr), PhantomData) } @@ -185,46 +185,46 @@ impl ToOwned for StructureRef { impl glib::types::StaticType for Structure { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_structure_get_type()) } + unsafe { from_glib(gst_sys::gst_structure_get_type()) } } } -impl<'a> ToGlibPtr<'a, *const ffi::GstStructure> for Structure { +impl<'a> ToGlibPtr<'a, *const gst_sys::GstStructure> for Structure { type Storage = &'a Self; - fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstStructure, Self> { + fn to_glib_none(&'a self) -> Stash<'a, *const gst_sys::GstStructure, Self> { unsafe { Stash(&self.0.as_ref().0, self) } } - fn to_glib_full(&self) -> *const ffi::GstStructure { - unsafe { ffi::gst_structure_copy(&self.0.as_ref().0) } + fn to_glib_full(&self) -> *const gst_sys::GstStructure { + unsafe { gst_sys::gst_structure_copy(&self.0.as_ref().0) } } } -impl<'a> ToGlibPtr<'a, *mut ffi::GstStructure> for Structure { +impl<'a> ToGlibPtr<'a, *mut gst_sys::GstStructure> for Structure { type Storage = &'a Self; - fn to_glib_none(&'a self) -> Stash<'a, *mut ffi::GstStructure, Self> { + fn to_glib_none(&'a self) -> Stash<'a, *mut gst_sys::GstStructure, Self> { unsafe { Stash(&self.0.as_ref().0 as *const _ as *mut _, self) } } - fn to_glib_full(&self) -> *mut ffi::GstStructure { - unsafe { ffi::gst_structure_copy(&self.0.as_ref().0) } + fn to_glib_full(&self) -> *mut gst_sys::GstStructure { + unsafe { gst_sys::gst_structure_copy(&self.0.as_ref().0) } } } -impl<'a> ToGlibPtrMut<'a, *mut ffi::GstStructure> for Structure { +impl<'a> ToGlibPtrMut<'a, *mut gst_sys::GstStructure> for Structure { type Storage = &'a mut Self; - fn to_glib_none_mut(&'a mut self) -> StashMut<*mut ffi::GstStructure, Self> { + fn to_glib_none_mut(&'a mut self) -> StashMut<*mut gst_sys::GstStructure, Self> { unsafe { StashMut(&mut self.0.as_mut().0, self) } } } -impl FromGlibPtrNone<*const ffi::GstStructure> for Structure { - unsafe fn from_glib_none(ptr: *const ffi::GstStructure) -> Self { +impl FromGlibPtrNone<*const gst_sys::GstStructure> for Structure { + unsafe fn from_glib_none(ptr: *const gst_sys::GstStructure) -> Self { assert!(!ptr.is_null()); - let ptr = ffi::gst_structure_copy(ptr); + let ptr = gst_sys::gst_structure_copy(ptr); assert!(!ptr.is_null()); Structure( ptr::NonNull::new_unchecked(ptr as *mut StructureRef), @@ -233,10 +233,10 @@ impl FromGlibPtrNone<*const ffi::GstStructure> for Structure { } } -impl FromGlibPtrNone<*mut ffi::GstStructure> for Structure { - unsafe fn from_glib_none(ptr: *mut ffi::GstStructure) -> Self { +impl FromGlibPtrNone<*mut gst_sys::GstStructure> for Structure { + unsafe fn from_glib_none(ptr: *mut gst_sys::GstStructure) -> Self { assert!(!ptr.is_null()); - let ptr = ffi::gst_structure_copy(ptr); + let ptr = gst_sys::gst_structure_copy(ptr); assert!(!ptr.is_null()); Structure( ptr::NonNull::new_unchecked(ptr as *mut StructureRef), @@ -245,8 +245,8 @@ impl FromGlibPtrNone<*mut ffi::GstStructure> for Structure { } } -impl FromGlibPtrFull<*const ffi::GstStructure> for Structure { - unsafe fn from_glib_full(ptr: *const ffi::GstStructure) -> Self { +impl FromGlibPtrFull<*const gst_sys::GstStructure> for Structure { + unsafe fn from_glib_full(ptr: *const gst_sys::GstStructure) -> Self { assert!(!ptr.is_null()); Structure( ptr::NonNull::new_unchecked(ptr as *mut StructureRef), @@ -255,8 +255,8 @@ impl FromGlibPtrFull<*const ffi::GstStructure> for Structure { } } -impl FromGlibPtrFull<*mut ffi::GstStructure> for Structure { - unsafe fn from_glib_full(ptr: *mut ffi::GstStructure) -> Self { +impl FromGlibPtrFull<*mut gst_sys::GstStructure> for Structure { + unsafe fn from_glib_full(ptr: *mut gst_sys::GstStructure) -> Self { assert!(!ptr.is_null()); Structure( ptr::NonNull::new_unchecked(ptr as *mut StructureRef), @@ -267,61 +267,63 @@ impl FromGlibPtrFull<*mut ffi::GstStructure> for Structure { impl<'a> glib::value::FromValueOptional<'a> for Structure { unsafe fn from_value_optional(v: &'a glib::Value) -> Option { - let ptr = gobject_ffi::g_value_get_boxed(v.to_glib_none().0); + let ptr = gobject_sys::g_value_get_boxed(v.to_glib_none().0); assert!(!ptr.is_null()); - from_glib_none(ptr as *const ffi::GstStructure) + from_glib_none(ptr as *const gst_sys::GstStructure) } } impl glib::value::SetValue for Structure { unsafe fn set_value(v: &mut glib::Value, s: &Self) { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, s.0.as_ptr() as gpointer); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, s.0.as_ptr() as gpointer); } } impl glib::value::SetValueOptional for Structure { unsafe fn set_value_optional(v: &mut glib::Value, s: Option<&Self>) { if let Some(s) = s { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer); } else { - gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, ptr::null_mut()); + gobject_sys::g_value_set_boxed(v.to_glib_none_mut().0, ptr::null_mut()); } } } impl GlibPtrDefault for Structure { - type GlibType = *mut ffi::GstStructure; + type GlibType = *mut gst_sys::GstStructure; } #[repr(C)] -pub struct StructureRef(ffi::GstStructure); +pub struct StructureRef(gst_sys::GstStructure); unsafe impl Send for StructureRef {} unsafe impl Sync for StructureRef {} impl StructureRef { - pub unsafe fn from_glib_borrow<'a>(ptr: *const ffi::GstStructure) -> &'a StructureRef { + pub unsafe fn from_glib_borrow<'a>(ptr: *const gst_sys::GstStructure) -> &'a StructureRef { assert!(!ptr.is_null()); &*(ptr as *mut StructureRef) } - pub unsafe fn from_glib_borrow_mut<'a>(ptr: *mut ffi::GstStructure) -> &'a mut StructureRef { + pub unsafe fn from_glib_borrow_mut<'a>( + ptr: *mut gst_sys::GstStructure, + ) -> &'a mut StructureRef { assert!(!ptr.is_null()); &mut *(ptr as *mut StructureRef) } - pub unsafe fn as_ptr(&self) -> *const ffi::GstStructure { - self as *const Self as *const ffi::GstStructure + pub unsafe fn as_ptr(&self) -> *const gst_sys::GstStructure { + self as *const Self as *const gst_sys::GstStructure } - pub unsafe fn as_mut_ptr(&self) -> *mut ffi::GstStructure { - self as *const Self as *mut ffi::GstStructure + pub unsafe fn as_mut_ptr(&self) -> *mut gst_sys::GstStructure { + self as *const Self as *mut gst_sys::GstStructure } pub fn to_string(&self) -> String { - unsafe { from_glib_full(ffi::gst_structure_to_string(&self.0)) } + unsafe { from_glib_full(gst_sys::gst_structure_to_string(&self.0)) } } pub fn get<'a, T: FromValueOptional<'a>>(&'a self, name: &str) -> Option { @@ -330,7 +332,7 @@ impl StructureRef { pub fn get_value<'a>(&'a self, name: &str) -> Option<&SendValue> { unsafe { - let value = ffi::gst_structure_get_value(&self.0, name.to_glib_none().0); + let value = gst_sys::gst_structure_get_value(&self.0, name.to_glib_none().0); if value.is_null() { return None; @@ -347,7 +349,7 @@ impl StructureRef { pub fn set_value(&mut self, name: &str, mut value: SendValue) { unsafe { - ffi::gst_structure_take_value( + gst_sys::gst_structure_take_value( &mut self.0, name.to_glib_none().0, value.to_glib_none_mut().0, @@ -358,19 +360,19 @@ impl StructureRef { pub fn get_name(&self) -> &str { unsafe { - CStr::from_ptr(ffi::gst_structure_get_name(&self.0)) + CStr::from_ptr(gst_sys::gst_structure_get_name(&self.0)) .to_str() .unwrap() } } pub fn set_name(&mut self, name: &str) { - unsafe { ffi::gst_structure_set_name(&mut self.0, name.to_glib_none().0) } + unsafe { gst_sys::gst_structure_set_name(&mut self.0, name.to_glib_none().0) } } pub fn has_field(&self, field: &str) -> bool { unsafe { - from_glib(ffi::gst_structure_has_field( + from_glib(gst_sys::gst_structure_has_field( &self.0, field.to_glib_none().0, )) @@ -379,7 +381,7 @@ impl StructureRef { pub fn has_field_with_type(&self, field: &str, type_: glib::Type) -> bool { unsafe { - from_glib(ffi::gst_structure_has_field_typed( + from_glib(gst_sys::gst_structure_has_field_typed( &self.0, field.to_glib_none().0, type_.to_glib(), @@ -389,7 +391,7 @@ impl StructureRef { pub fn remove_field(&mut self, field: &str) { unsafe { - ffi::gst_structure_remove_field(&mut self.0, field.to_glib_none().0); + gst_sys::gst_structure_remove_field(&mut self.0, field.to_glib_none().0); } } @@ -401,7 +403,7 @@ impl StructureRef { pub fn remove_all_fields(&mut self) { unsafe { - ffi::gst_structure_remove_all_fields(&mut self.0); + gst_sys::gst_structure_remove_all_fields(&mut self.0); } } @@ -415,7 +417,7 @@ impl StructureRef { pub fn get_nth_field_name(&self, idx: u32) -> Option<&str> { unsafe { - let field_name = ffi::gst_structure_nth_field_name(&self.0, idx); + let field_name = gst_sys::gst_structure_nth_field_name(&self.0, idx); if field_name.is_null() { return None; } @@ -425,28 +427,28 @@ impl StructureRef { } pub fn n_fields(&self) -> u32 { - unsafe { ffi::gst_structure_n_fields(&self.0) as u32 } + unsafe { gst_sys::gst_structure_n_fields(&self.0) as u32 } } pub fn can_intersect(&self, other: &StructureRef) -> bool { - unsafe { from_glib(ffi::gst_structure_can_intersect(&self.0, &other.0)) } + unsafe { from_glib(gst_sys::gst_structure_can_intersect(&self.0, &other.0)) } } pub fn intersect(&self, other: &StructureRef) -> Option { - unsafe { from_glib_full(ffi::gst_structure_intersect(&self.0, &other.0)) } + unsafe { from_glib_full(gst_sys::gst_structure_intersect(&self.0, &other.0)) } } pub fn is_subset(&self, superset: &StructureRef) -> bool { - unsafe { from_glib(ffi::gst_structure_is_subset(&self.0, &superset.0)) } + unsafe { from_glib(gst_sys::gst_structure_is_subset(&self.0, &superset.0)) } } pub fn fixate(&mut self) { - unsafe { ffi::gst_structure_fixate(&mut self.0) } + unsafe { gst_sys::gst_structure_fixate(&mut self.0) } } pub fn fixate_field(&mut self, name: &str) -> bool { unsafe { - from_glib(ffi::gst_structure_fixate_field( + from_glib(gst_sys::gst_structure_fixate_field( &mut self.0, name.to_glib_none().0, )) @@ -455,7 +457,7 @@ impl StructureRef { pub fn fixate_field_bool(&mut self, name: &str, target: bool) -> bool { unsafe { - from_glib(ffi::gst_structure_fixate_field_boolean( + from_glib(gst_sys::gst_structure_fixate_field_boolean( &mut self.0, name.to_glib_none().0, target.to_glib(), @@ -465,7 +467,7 @@ impl StructureRef { pub fn fixate_field_str(&mut self, name: &str, target: &str) -> bool { unsafe { - from_glib(ffi::gst_structure_fixate_field_string( + from_glib(gst_sys::gst_structure_fixate_field_string( &mut self.0, name.to_glib_none().0, target.to_glib_none().0, @@ -475,7 +477,7 @@ impl StructureRef { pub fn fixate_field_nearest_double(&mut self, name: &str, target: f64) -> bool { unsafe { - from_glib(ffi::gst_structure_fixate_field_nearest_double( + from_glib(gst_sys::gst_structure_fixate_field_nearest_double( &mut self.0, name.to_glib_none().0, target, @@ -492,7 +494,7 @@ impl StructureRef { let target = target.into(); unsafe { - from_glib(ffi::gst_structure_fixate_field_nearest_fraction( + from_glib(gst_sys::gst_structure_fixate_field_nearest_fraction( &mut self.0, name.to_glib_none().0, *target.numer(), @@ -503,7 +505,7 @@ impl StructureRef { pub fn fixate_field_nearest_int(&mut self, name: &str, target: i32) -> bool { unsafe { - from_glib(ffi::gst_structure_fixate_field_nearest_int( + from_glib(gst_sys::gst_structure_fixate_field_nearest_int( &mut self.0, name.to_glib_none().0, target, @@ -526,7 +528,7 @@ impl fmt::Debug for StructureRef { impl PartialEq for StructureRef { fn eq(&self, other: &StructureRef) -> bool { - unsafe { from_glib(ffi::gst_structure_is_equal(&self.0, &other.0)) } + unsafe { from_glib(gst_sys::gst_structure_is_equal(&self.0, &other.0)) } } } diff --git a/gstreamer/src/subclass/bin.rs b/gstreamer/src/subclass/bin.rs index 9d9086498..cfb297c6f 100644 --- a/gstreamer/src/subclass/bin.rs +++ b/gstreamer/src/subclass/bin.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; +use glib_sys; +use gst_sys; use glib::translate::*; @@ -46,7 +46,7 @@ impl BinImplExt for T { fn parent_add_element(&self, bin: &Bin, element: &Element) -> Result<(), LoggableError> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstBinClass; let f = (*parent_class).add_element.ok_or_else(|| { gst_loggable_error!(::CAT_RUST, "Parent function `add_element` is not defined") })?; @@ -61,7 +61,7 @@ impl BinImplExt for T { fn parent_remove_element(&self, bin: &Bin, element: &Element) -> Result<(), LoggableError> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstBinClass; let f = (*parent_class).remove_element.ok_or_else(|| { gst_loggable_error!( ::CAT_RUST, @@ -79,7 +79,7 @@ impl BinImplExt for T { fn parent_handle_message(&self, bin: &Bin, message: Message) { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstBinClass; if let Some(ref f) = (*parent_class).handle_message { f(bin.to_glib_none().0, message.into_ptr()); } @@ -94,7 +94,7 @@ where fn override_vfuncs(&mut self) { <::ElementClass as IsSubclassable>::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstBinClass); + let klass = &mut *(self as *mut Self as *mut gst_sys::GstBinClass); klass.add_element = Some(bin_add_element::); klass.remove_element = Some(bin_remove_element::); klass.handle_message = Some(bin_handle_message::); @@ -103,9 +103,9 @@ where } unsafe extern "C" fn bin_add_element( - ptr: *mut ffi::GstBin, - element: *mut ffi::GstElement, -) -> glib_ffi::gboolean + ptr: *mut gst_sys::GstBin, + element: *mut gst_sys::GstElement, +) -> glib_sys::gboolean where T: BinImpl, T::Instance: PanicPoison, @@ -128,9 +128,9 @@ where } unsafe extern "C" fn bin_remove_element( - ptr: *mut ffi::GstBin, - element: *mut ffi::GstElement, -) -> glib_ffi::gboolean + ptr: *mut gst_sys::GstBin, + element: *mut gst_sys::GstElement, +) -> glib_sys::gboolean where T: BinImpl, T::Instance: PanicPoison, @@ -153,8 +153,8 @@ where } unsafe extern "C" fn bin_handle_message( - ptr: *mut ffi::GstBin, - message: *mut ffi::GstMessage, + ptr: *mut gst_sys::GstBin, + message: *mut gst_sys::GstMessage, ) where T: BinImpl, T::Instance: PanicPoison, diff --git a/gstreamer/src/subclass/child_proxy.rs b/gstreamer/src/subclass/child_proxy.rs index 272d60b4a..7d41d9ab5 100644 --- a/gstreamer/src/subclass/child_proxy.rs +++ b/gstreamer/src/subclass/child_proxy.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; -use gobject_ffi; +use glib_sys; +use gobject_sys; +use gst_sys; use glib; use glib::subclass::prelude::*; @@ -21,9 +21,9 @@ use ChildProxy; pub trait ChildProxyImpl: super::element::ElementImpl + Send + Sync + 'static { fn get_child_by_name(&self, object: &ChildProxy, name: &str) -> Option { unsafe { - let type_ = ffi::gst_child_proxy_get_type(); - let iface = gobject_ffi::g_type_default_interface_ref(type_) - as *mut ffi::GstChildProxyInterface; + let type_ = gst_sys::gst_child_proxy_get_type(); + let iface = gobject_sys::g_type_default_interface_ref(type_) + as *mut gst_sys::GstChildProxyInterface; assert!(!iface.is_null()); let ret = ((*iface).get_child_by_name.as_ref().unwrap())( @@ -31,7 +31,7 @@ pub trait ChildProxyImpl: super::element::ElementImpl + Send + Sync + 'static { name.to_glib_none().0, ); - gobject_ffi::g_type_default_interface_unref(iface as glib_ffi::gpointer); + gobject_sys::g_type_default_interface_unref(iface as glib_sys::gpointer); from_glib_full(ret) } @@ -46,10 +46,10 @@ pub trait ChildProxyImpl: super::element::ElementImpl + Send + Sync + 'static { unsafe impl IsImplementable for ChildProxy { unsafe extern "C" fn interface_init( - iface: glib_ffi::gpointer, - _iface_data: glib_ffi::gpointer, + iface: glib_sys::gpointer, + _iface_data: glib_sys::gpointer, ) { - let child_proxy_iface = &mut *(iface as *mut ffi::GstChildProxyInterface); + let child_proxy_iface = &mut *(iface as *mut gst_sys::GstChildProxyInterface); child_proxy_iface.get_child_by_name = Some(child_proxy_get_child_by_name::); child_proxy_iface.get_child_by_index = Some(child_proxy_get_child_by_index::); @@ -60,9 +60,9 @@ unsafe impl IsImplementable for ChildProx } unsafe extern "C" fn child_proxy_get_child_by_name( - child_proxy: *mut ffi::GstChildProxy, + child_proxy: *mut gst_sys::GstChildProxy, name: *const libc::c_char, -) -> *mut gobject_ffi::GObject +) -> *mut gobject_sys::GObject where T: ChildProxyImpl, { @@ -78,9 +78,9 @@ where } unsafe extern "C" fn child_proxy_get_child_by_index( - child_proxy: *mut ffi::GstChildProxy, + child_proxy: *mut gst_sys::GstChildProxy, index: u32, -) -> *mut gobject_ffi::GObject +) -> *mut gobject_sys::GObject where T: ChildProxyImpl, { @@ -93,7 +93,7 @@ where } unsafe extern "C" fn child_proxy_get_children_count( - child_proxy: *mut ffi::GstChildProxy, + child_proxy: *mut gst_sys::GstChildProxy, ) -> u32 where T: ChildProxyImpl, @@ -106,8 +106,8 @@ where } unsafe extern "C" fn child_proxy_child_added( - child_proxy: *mut ffi::GstChildProxy, - child: *mut gobject_ffi::GObject, + child_proxy: *mut gst_sys::GstChildProxy, + child: *mut gobject_sys::GObject, name: *const libc::c_char, ) where T: ChildProxyImpl, @@ -124,8 +124,8 @@ unsafe extern "C" fn child_proxy_child_added( } unsafe extern "C" fn child_proxy_child_removed( - child_proxy: *mut ffi::GstChildProxy, - child: *mut gobject_ffi::GObject, + child_proxy: *mut gst_sys::GstChildProxy, + child: *mut gobject_sys::GObject, name: *const libc::c_char, ) where T: ChildProxyImpl, diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 3cf85e94d..d5b72004c 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -8,8 +8,8 @@ use libc; -use ffi; -use glib_ffi; +use glib_sys; +use gst_sys; use super::prelude::*; use glib; @@ -117,7 +117,7 @@ where ) -> Result { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; let f = (*parent_class) .change_state @@ -136,7 +136,7 @@ where ) -> Option<::Pad> { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) .request_new_pad @@ -155,7 +155,7 @@ where fn parent_release_pad(&self, element: &::Element, pad: &::Pad) { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) .release_pad @@ -167,7 +167,7 @@ where fn parent_send_event(&self, element: &::Element, event: Event) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) .send_event @@ -179,7 +179,7 @@ where fn parent_query(&self, element: &::Element, query: &mut QueryRef) -> bool { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) .query @@ -191,7 +191,7 @@ where fn parent_set_context(&self, element: &::Element, context: &::Context) { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) .set_context @@ -213,7 +213,7 @@ where ) -> R { unsafe { assert!(element.get_type().is_a(&T::get_type())); - let ptr: *mut ffi::GstElement = element.as_ptr() as *mut _; + let ptr: *mut gst_sys::GstElement = element.as_ptr() as *mut _; let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -233,7 +233,7 @@ where .downcast_ref::<::Element>() .unwrap(); assert!(wrap.get_type().is_a(&T::get_type())); - let ptr: *mut ffi::GstElement = wrap.to_glib_none().0; + let ptr: *mut gst_sys::GstElement = wrap.to_glib_none().0; let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -245,8 +245,8 @@ where pub unsafe trait ElementClassSubclassExt: Sized + 'static { fn add_pad_template(&mut self, pad_template: PadTemplate) { unsafe { - ffi::gst_element_class_add_pad_template( - self as *mut Self as *mut ffi::GstElementClass, + gst_sys::gst_element_class_add_pad_template( + self as *mut Self as *mut gst_sys::GstElementClass, pad_template.to_glib_none().0, ); } @@ -260,8 +260,8 @@ pub unsafe trait ElementClassSubclassExt: Sized + 'static { author: &str, ) { unsafe { - ffi::gst_element_class_set_metadata( - self as *mut Self as *mut ffi::GstElementClass, + gst_sys::gst_element_class_set_metadata( + self as *mut Self as *mut gst_sys::GstElementClass, long_name.to_glib_none().0, classification.to_glib_none().0, description.to_glib_none().0, @@ -281,7 +281,7 @@ where >::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstElementClass); + let klass = &mut *(self as *mut Self as *mut gst_sys::GstElementClass); klass.change_state = Some(element_change_state::); klass.request_new_pad = Some(element_request_new_pad::); klass.release_pad = Some(element_release_pad::); @@ -293,9 +293,9 @@ where } unsafe extern "C" fn element_change_state( - ptr: *mut ffi::GstElement, - transition: ffi::GstStateChange, -) -> ffi::GstStateChangeReturn + ptr: *mut gst_sys::GstElement, + transition: gst_sys::GstStateChange, +) -> gst_sys::GstStateChangeReturn where T: ElementImpl, T::Instance: PanicPoison, @@ -322,11 +322,11 @@ where } unsafe extern "C" fn element_request_new_pad( - ptr: *mut ffi::GstElement, - templ: *mut ffi::GstPadTemplate, + ptr: *mut gst_sys::GstElement, + templ: *mut gst_sys::GstPadTemplate, name: *const libc::c_char, - caps: *const ffi::GstCaps, -) -> *mut ffi::GstPad + caps: *const gst_sys::GstCaps, +) -> *mut gst_sys::GstPad where T: ElementImpl, T::Instance: PanicPoison, @@ -352,7 +352,7 @@ where if let Some(ref pad) = pad { assert_eq!( pad.get_parent(), - Some(::Object::from_glib_borrow(ptr as *mut ffi::GstObject)) + Some(::Object::from_glib_borrow(ptr as *mut gst_sys::GstObject)) ); } @@ -360,8 +360,8 @@ where } unsafe extern "C" fn element_release_pad( - ptr: *mut ffi::GstElement, - pad: *mut ffi::GstPad, + ptr: *mut gst_sys::GstElement, + pad: *mut gst_sys::GstPad, ) where T: ElementImpl, T::Instance: PanicPoison, @@ -377,9 +377,9 @@ unsafe extern "C" fn element_release_pad( } unsafe extern "C" fn element_send_event( - ptr: *mut ffi::GstElement, - event: *mut ffi::GstEvent, -) -> glib_ffi::gboolean + ptr: *mut gst_sys::GstElement, + event: *mut gst_sys::GstEvent, +) -> glib_sys::gboolean where T: ElementImpl, T::Instance: PanicPoison, @@ -396,9 +396,9 @@ where } unsafe extern "C" fn element_query( - ptr: *mut ffi::GstElement, - query: *mut ffi::GstQuery, -) -> glib_ffi::gboolean + ptr: *mut gst_sys::GstElement, + query: *mut gst_sys::GstQuery, +) -> glib_sys::gboolean where T: ElementImpl, T::Instance: PanicPoison, @@ -416,8 +416,8 @@ where } unsafe extern "C" fn element_set_context( - ptr: *mut ffi::GstElement, - context: *mut ffi::GstContext, + ptr: *mut gst_sys::GstElement, + context: *mut gst_sys::GstContext, ) where T: ElementImpl, T::Instance: PanicPoison, diff --git a/gstreamer/src/subclass/ghost_pad.rs b/gstreamer/src/subclass/ghost_pad.rs index d9aca2648..6726e6058 100644 --- a/gstreamer/src/subclass/ghost_pad.rs +++ b/gstreamer/src/subclass/ghost_pad.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use super::prelude::*; use glib::subclass::prelude::*; @@ -19,7 +19,7 @@ unsafe impl IsSubclassable for GhostPadClas fn override_vfuncs(&mut self) { <::PadClass as IsSubclassable>::override_vfuncs(self); unsafe { - let _klass = &mut *(self as *mut Self as *mut ffi::GstGhostPadClass); + let _klass = &mut *(self as *mut Self as *mut gst_sys::GstGhostPadClass); // Nothing to do here } } diff --git a/gstreamer/src/subclass/pad.rs b/gstreamer/src/subclass/pad.rs index 262f892f4..26aa22547 100644 --- a/gstreamer/src/subclass/pad.rs +++ b/gstreamer/src/subclass/pad.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use glib; use glib::translate::*; @@ -36,7 +36,7 @@ impl PadImplExt for T { fn parent_linked(&self, pad: &Pad, peer: &Pad) { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstPadClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstPadClass; (*parent_class) .linked @@ -48,7 +48,7 @@ impl PadImplExt for T { fn parent_unlinked(&self, pad: &Pad, peer: &Pad) { unsafe { let data = self.get_type_data(); - let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstPadClass; + let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstPadClass; (*parent_class) .unlinked @@ -63,15 +63,17 @@ unsafe impl IsSubclassable for PadClass { >::override_vfuncs(self); unsafe { - let klass = &mut *(self as *mut Self as *mut ffi::GstPadClass); + let klass = &mut *(self as *mut Self as *mut gst_sys::GstPadClass); klass.linked = Some(pad_linked::); klass.unlinked = Some(pad_unlinked::); } } } -unsafe extern "C" fn pad_linked(ptr: *mut ffi::GstPad, peer: *mut ffi::GstPad) -where +unsafe extern "C" fn pad_linked( + ptr: *mut gst_sys::GstPad, + peer: *mut gst_sys::GstPad, +) where T: PadImpl, { glib_floating_reference_guard!(ptr); @@ -82,8 +84,10 @@ where imp.linked(&wrap, &from_glib_borrow(peer)) } -unsafe extern "C" fn pad_unlinked(ptr: *mut ffi::GstPad, peer: *mut ffi::GstPad) -where +unsafe extern "C" fn pad_unlinked( + ptr: *mut gst_sys::GstPad, + peer: *mut gst_sys::GstPad, +) where T: PadImpl, { glib_floating_reference_guard!(ptr); diff --git a/gstreamer/src/subclass/pipeline.rs b/gstreamer/src/subclass/pipeline.rs index 062fb2310..cb61bed03 100644 --- a/gstreamer/src/subclass/pipeline.rs +++ b/gstreamer/src/subclass/pipeline.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use super::prelude::*; use glib::subclass::prelude::*; @@ -22,7 +22,7 @@ where fn override_vfuncs(&mut self) { <::BinClass as IsSubclassable>::override_vfuncs(self); unsafe { - let _klass = &mut *(self as *mut Self as *mut ffi::GstPipelineClass); + let _klass = &mut *(self as *mut Self as *mut gst_sys::GstPipelineClass); // Nothing to do here } } diff --git a/gstreamer/src/subclass/plugin.rs b/gstreamer/src/subclass/plugin.rs index d773ed265..2e584f192 100644 --- a/gstreamer/src/subclass/plugin.rs +++ b/gstreamer/src/subclass/plugin.rs @@ -28,12 +28,12 @@ macro_rules! gst_plugin_define( use $crate::glib::translate::{from_glib_borrow, ToGlib, from_glib}; #[repr(C)] - pub struct GstPluginDesc($crate::ffi::GstPluginDesc); + pub struct GstPluginDesc($crate::gst_sys::GstPluginDesc); unsafe impl Sync for GstPluginDesc {} #[no_mangle] #[allow(non_upper_case_globals)] - pub static gst_plugin_desc: GstPluginDesc = GstPluginDesc($crate::ffi::GstPluginDesc { + pub static gst_plugin_desc: GstPluginDesc = GstPluginDesc($crate::gst_sys::GstPluginDesc { major_version: $crate::subclass::plugin::MAJOR_VERSION, minor_version: $crate::subclass::plugin::MINOR_VERSION, name: concat!($name, "\0") as *const str as *const _, @@ -45,13 +45,13 @@ macro_rules! gst_plugin_define( package: concat!($package, "\0") as *const str as *const _, origin: concat!($origin, "\0") as *const str as *const _, release_datetime: concat!($release_datetime, "\0") as *const str as *const _, - _gst_reserved: [0 as $crate::glib_ffi::gpointer; 4], + _gst_reserved: [0 as $crate::glib_sys::gpointer; 4], }); pub fn plugin_register_static() -> Result<(), glib::BoolError> { unsafe { glib_result_from_gboolean!( - $crate::ffi::gst_plugin_register_static( + $crate::gst_sys::gst_plugin_register_static( $crate::subclass::plugin::MAJOR_VERSION, $crate::subclass::plugin::MINOR_VERSION, concat!($name, "\0") as *const str as *const _, @@ -68,17 +68,17 @@ macro_rules! gst_plugin_define( } } - unsafe extern "C" fn plugin_init_trampoline(plugin: *mut $crate::ffi::GstPlugin) -> $crate::glib_ffi::gboolean { + unsafe extern "C" fn plugin_init_trampoline(plugin: *mut $crate::gst_sys::GstPlugin) -> $crate::glib_sys::gboolean { use std::panic::{self, AssertUnwindSafe}; let panic_result = panic::catch_unwind(AssertUnwindSafe(|| super::$plugin_init(&from_glib_borrow(plugin)))); match panic_result { Ok(register_result) => match register_result { - Ok(_) => $crate::glib_ffi::GTRUE, + Ok(_) => $crate::glib_sys::GTRUE, Err(err) => { let cat = $crate::DebugCategory::get("GST_PLUGIN_LOADING").unwrap(); gst_error!(cat, "Failed to register plugin: {}", err); - $crate::glib_ffi::GFALSE + $crate::glib_sys::GFALSE } } Err(err) => { @@ -91,7 +91,7 @@ macro_rules! gst_plugin_define( gst_error!(cat, "Failed to initialize plugin due to panic"); } - $crate::glib_ffi::GFALSE + $crate::glib_sys::GFALSE } } } diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index d963571f7..415bf0c3e 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use glib_ffi; +use glib_sys; +use gst_sys; use glib; use glib::prelude::*; @@ -29,10 +29,10 @@ pub trait URIHandlerImpl: super::element::ElementImpl + Send + Sync + 'static { unsafe impl IsImplementable for URIHandler { unsafe extern "C" fn interface_init( - iface: glib_ffi::gpointer, - _iface_data: glib_ffi::gpointer, + iface: glib_sys::gpointer, + _iface_data: glib_sys::gpointer, ) { - let uri_handler_iface = &mut *(iface as *mut ffi::GstURIHandlerInterface); + let uri_handler_iface = &mut *(iface as *mut gst_sys::GstURIHandlerInterface); // Store the protocols in the interface data for later use let mut data = T::type_data(); @@ -42,7 +42,7 @@ unsafe impl IsImplementable for URIHandle if data.interface_data.is_null() { data.interface_data = Box::into_raw(Box::new(Vec::new())); } - (*(data.interface_data as *mut Vec<(glib_ffi::GType, glib_ffi::gpointer)>)) + (*(data.interface_data as *mut Vec<(glib_sys::GType, glib_sys::gpointer)>)) .push((URIHandler::static_type().to_glib(), protocols as *mut _)); uri_handler_iface.get_type = Some(uri_handler_get_type::); @@ -53,8 +53,8 @@ unsafe impl IsImplementable for URIHandle } unsafe extern "C" fn uri_handler_get_type( - _type_: glib_ffi::GType, -) -> ffi::GstURIType + _type_: glib_sys::GType, +) -> gst_sys::GstURIType where T: URIHandlerImpl, { @@ -62,7 +62,7 @@ where } unsafe extern "C" fn uri_handler_get_protocols( - _type_: glib_ffi::GType, + _type_: glib_sys::GType, ) -> *const *const libc::c_char where T: URIHandlerImpl, @@ -73,7 +73,7 @@ where } unsafe extern "C" fn uri_handler_get_uri( - uri_handler: *mut ffi::GstURIHandler, + uri_handler: *mut gst_sys::GstURIHandler, ) -> *mut libc::c_char where T: URIHandlerImpl, @@ -86,10 +86,10 @@ where } unsafe extern "C" fn uri_handler_set_uri( - uri_handler: *mut ffi::GstURIHandler, + uri_handler: *mut gst_sys::GstURIHandler, uri: *const libc::c_char, - err: *mut *mut glib_ffi::GError, -) -> glib_ffi::gboolean + err: *mut *mut glib_sys::GError, +) -> glib_sys::gboolean where T: URIHandlerImpl, { diff --git a/gstreamer/src/tag_setter.rs b/gstreamer/src/tag_setter.rs index 5a00845ba..1713ee882 100644 --- a/gstreamer/src/tag_setter.rs +++ b/gstreamer/src/tag_setter.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib::object::IsA; use glib::translate::*; use glib::value::ToSendValue; +use gst_sys; use tags::*; use TagMergeMode; use TagSetter; @@ -28,7 +28,7 @@ impl> TagSetterExtManual for O { unsafe { let v = value.to_send_value(); - ffi::gst_tag_setter_add_tag_value( + gst_sys::gst_tag_setter_add_tag_value( self.as_ref().to_glib_none().0, mode.to_glib(), T::tag_name().to_glib_none().0, diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index 742a70efc..7fcd90770 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -11,12 +11,12 @@ use std::fmt; use std::marker::PhantomData; use std::mem; -use ffi; use glib; use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr, ToGlibPtrMut}; use glib::value::{FromValueOptional, SendValue, SetValue, ToSendValue, TypedValue, Value}; use glib::StaticType; -use gobject_ffi; +use gobject_sys; +use gst_sys; use miniobject::*; @@ -42,7 +42,7 @@ macro_rules! impl_tag( lazy_static! { pub(crate) static ref $rust_tag: &'static str = - unsafe { CStr::from_ptr(ffi::$gst_tag).to_str().unwrap() }; + unsafe { CStr::from_ptr(gst_sys::$gst_tag).to_str().unwrap() }; } }; ); @@ -342,15 +342,15 @@ impl_tag!(PrivateData, Sample, TAG_PRIVATE_DATA, GST_TAG_PRIVATE_DATA); gst_define_mini_object_wrapper!( TagList, TagListRef, - ffi::GstTagList, + gst_sys::GstTagList, [Debug, PartialEq, Eq,], - || ffi::gst_tag_list_get_type() + || gst_sys::gst_tag_list_get_type() ); impl TagList { pub fn new() -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_tag_list_new_empty()) } + unsafe { from_glib_full(gst_sys::gst_tag_list_new_empty()) } } } @@ -389,12 +389,12 @@ impl TagListRef { let tag_name = tag_name.to_glib_none(); - let tag_type: glib::Type = from_glib(ffi::gst_tag_get_type(tag_name.0)); + let tag_type: glib::Type = from_glib(gst_sys::gst_tag_get_type(tag_name.0)); if tag_type != v.type_() { return Err(TagError::TypeMismatch); } - ffi::gst_tag_list_add_value( + gst_sys::gst_tag_list_add_value( self.as_mut_ptr(), mode.to_glib(), tag_name.0, @@ -414,7 +414,7 @@ impl TagListRef { unsafe { let mut value: SendValue = mem::zeroed(); - let found: bool = from_glib(ffi::gst_tag_list_copy_value( + let found: bool = from_glib(gst_sys::gst_tag_list_copy_value( value.to_glib_none_mut().0, self.as_ptr(), tag_name.to_glib_none().0, @@ -429,12 +429,12 @@ impl TagListRef { } pub fn n_tags(&self) -> i32 { - unsafe { ffi::gst_tag_list_n_tags(self.as_ptr()) } + unsafe { gst_sys::gst_tag_list_n_tags(self.as_ptr()) } } pub fn nth_tag_name(&self, idx: u32) -> &str { unsafe { - CStr::from_ptr(ffi::gst_tag_list_nth_tag_name(self.as_ptr(), idx)) + CStr::from_ptr(gst_sys::gst_tag_list_nth_tag_name(self.as_ptr(), idx)) .to_str() .unwrap() } @@ -447,8 +447,11 @@ impl TagListRef { pub fn get_index_generic<'a>(&'a self, tag_name: &str, idx: u32) -> Option<&'a SendValue> { unsafe { - let value = - ffi::gst_tag_list_get_value_index(self.as_ptr(), tag_name.to_glib_none().0, idx); + let value = gst_sys::gst_tag_list_get_value_index( + self.as_ptr(), + tag_name.to_glib_none().0, + idx, + ); if value.is_null() { return None; @@ -463,7 +466,7 @@ impl TagListRef { } pub fn get_size_by_name(&self, tag_name: &str) -> u32 { - unsafe { ffi::gst_tag_list_get_tag_size(self.as_ptr(), tag_name.to_glib_none().0) } + unsafe { gst_sys::gst_tag_list_get_tag_size(self.as_ptr(), tag_name.to_glib_none().0) } } pub fn iter_tag<'a, T: Tag<'a>>(&'a self) -> TagIter<'a, T> { @@ -483,16 +486,16 @@ impl TagListRef { } pub fn to_string(&self) -> String { - unsafe { from_glib_full(ffi::gst_tag_list_to_string(self.as_ptr())) } + unsafe { from_glib_full(gst_sys::gst_tag_list_to_string(self.as_ptr())) } } pub fn insert(&mut self, other: &TagListRef, mode: TagMergeMode) { - unsafe { ffi::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.to_glib()) } + unsafe { gst_sys::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.to_glib()) } } pub fn merge(&self, other: &TagListRef, mode: TagMergeMode) -> TagList { unsafe { - from_glib_full(ffi::gst_tag_list_merge( + from_glib_full(gst_sys::gst_tag_list_merge( self.as_ptr(), other.as_ptr(), mode.to_glib(), @@ -501,11 +504,11 @@ impl TagListRef { } pub fn get_scope(&self) -> TagScope { - unsafe { from_glib(ffi::gst_tag_list_get_scope(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_tag_list_get_scope(self.as_ptr())) } } pub fn set_scope(&mut self, scope: TagScope) { - unsafe { ffi::gst_tag_list_set_scope(self.as_mut_ptr(), scope.to_glib()) } + unsafe { gst_sys::gst_tag_list_set_scope(self.as_mut_ptr(), scope.to_glib()) } } } @@ -523,7 +526,12 @@ impl fmt::Display for TagListRef { impl PartialEq for TagListRef { fn eq(&self, other: &TagListRef) -> bool { - unsafe { from_glib(ffi::gst_tag_list_is_equal(self.as_ptr(), other.as_ptr())) } + unsafe { + from_glib(gst_sys::gst_tag_list_is_equal( + self.as_ptr(), + other.as_ptr(), + )) + } } } @@ -777,16 +785,16 @@ impl<'a> DoubleEndedIterator for Iter<'a> { impl<'a> ExactSizeIterator for Iter<'a> {} pub fn tag_exists(name: &str) -> bool { - unsafe { from_glib(ffi::gst_tag_exists(name.to_glib_none().0)) } + unsafe { from_glib(gst_sys::gst_tag_exists(name.to_glib_none().0)) } } pub fn tag_get_type(name: &str) -> glib::Type { - unsafe { from_glib(ffi::gst_tag_get_type(name.to_glib_none().0)) } + unsafe { from_glib(gst_sys::gst_tag_get_type(name.to_glib_none().0)) } } pub fn tag_get_nick(name: &str) -> Option<&'static str> { unsafe { - let ptr = ffi::gst_tag_get_nick(name.to_glib_none().0); + let ptr = gst_sys::gst_tag_get_nick(name.to_glib_none().0); if ptr.is_null() { None @@ -798,7 +806,7 @@ pub fn tag_get_nick(name: &str) -> Option<&'static str> { pub fn tag_get_description(name: &str) -> Option<&'static str> { unsafe { - let ptr = ffi::gst_tag_get_description(name.to_glib_none().0); + let ptr = gst_sys::gst_tag_get_description(name.to_glib_none().0); if ptr.is_null() { None @@ -809,7 +817,7 @@ pub fn tag_get_description(name: &str) -> Option<&'static str> { } pub fn tag_get_flag(name: &str) -> ::TagFlag { - unsafe { from_glib(ffi::gst_tag_get_flag(name.to_glib_none().0)) } + unsafe { from_glib(gst_sys::gst_tag_get_flag(name.to_glib_none().0)) } } pub trait CustomTag<'a>: Tag<'a> { @@ -826,14 +834,14 @@ pub fn register CustomTag<'a>>() { assert!(!tag_exists(T::tag_name())); unsafe extern "C" fn merge_func_trampoline CustomTag<'a>>( - dest: *mut gobject_ffi::GValue, - src: *const gobject_ffi::GValue, + dest: *mut gobject_sys::GValue, + src: *const gobject_sys::GValue, ) { *dest = T::merge_func(&*(src as *const Value)).into_raw(); } unsafe { - ffi::gst_tag_register( + gst_sys::gst_tag_register( T::tag_name().to_glib_none().0, T::FLAG.to_glib(), T::TagType::static_type().to_glib(), @@ -851,7 +859,7 @@ pub fn merge_use_first(src: &Value) -> Value { use glib::translate::Uninitialized; let mut res = Value::uninitialized(); - ffi::gst_tag_merge_use_first(res.to_glib_none_mut().0, src.to_glib_none().0); + gst_sys::gst_tag_merge_use_first(res.to_glib_none_mut().0, src.to_glib_none().0); res } } @@ -863,7 +871,7 @@ pub fn merge_strings_with_comma(src: &Value) -> Value { use glib::translate::Uninitialized; let mut res = Value::uninitialized(); - ffi::gst_tag_merge_strings_with_comma(res.to_glib_none_mut().0, src.to_glib_none().0); + gst_sys::gst_tag_merge_strings_with_comma(res.to_glib_none_mut().0, src.to_glib_none().0); res } } diff --git a/gstreamer/src/tags_serde.rs b/gstreamer/src/tags_serde.rs index c09b6bb26..4e780c2e7 100644 --- a/gstreamer/src/tags_serde.rs +++ b/gstreamer/src/tags_serde.rs @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use glib; use glib::translate::{from_glib, ToGlibPtr}; use glib::{SendValue, ToValue}; +use gst_sys; use serde::de; use serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}; @@ -147,7 +147,7 @@ impl<'de, 'a> Visitor<'de> for TagValuesVisitor<'a> { fn visit_seq>(self, mut seq: A) -> Result<(), A::Error> { let tag_type: glib::Type = unsafe { let tag_name = self.0.to_glib_none(); - from_glib(ffi::gst_tag_get_type(tag_name.0)) + from_glib(gst_sys::gst_tag_get_type(tag_name.0)) }; loop { diff --git a/gstreamer/src/toc.rs b/gstreamer/src/toc.rs index 12592653d..778d981b3 100644 --- a/gstreamer/src/toc.rs +++ b/gstreamer/src/toc.rs @@ -10,7 +10,7 @@ use std::ffi::CStr; use std::fmt; use std::mem; -use ffi; +use gst_sys; use glib; use glib::translate::{ @@ -24,59 +24,60 @@ use TocEntryType; use TocLoopType; use TocScope; -gst_define_mini_object_wrapper!( - Toc, - TocRef, - ffi::GstToc, - [Debug,], - || ffi::gst_toc_get_type() -); +gst_define_mini_object_wrapper!(Toc, TocRef, gst_sys::GstToc, [Debug,], || { + gst_sys::gst_toc_get_type() +}); impl Toc { pub fn new(scope: TocScope) -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gst_toc_new(scope.to_glib())) } + unsafe { from_glib_full(gst_sys::gst_toc_new(scope.to_glib())) } } } impl TocRef { pub fn get_scope(&self) -> TocScope { - unsafe { from_glib(ffi::gst_toc_get_scope(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_toc_get_scope(self.as_ptr())) } } pub fn find_entry(&self, uid: &str) -> Option { - unsafe { from_glib_none(ffi::gst_toc_find_entry(self.as_ptr(), uid.to_glib_none().0)) } + unsafe { + from_glib_none(gst_sys::gst_toc_find_entry( + self.as_ptr(), + uid.to_glib_none().0, + )) + } } pub fn get_entries(&self) -> Vec { - unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_toc_get_entries(self.as_ptr())) } + unsafe { FromGlibPtrContainer::from_glib_none(gst_sys::gst_toc_get_entries(self.as_ptr())) } } pub fn append_entry(&mut self, entry: TocEntry) { unsafe { - ffi::gst_toc_append_entry(self.as_mut_ptr(), entry.into_ptr()); + gst_sys::gst_toc_append_entry(self.as_mut_ptr(), entry.into_ptr()); } } pub fn get_tags(&self) -> Option { - unsafe { from_glib_none(ffi::gst_toc_get_tags(self.as_ptr())) } + unsafe { from_glib_none(gst_sys::gst_toc_get_tags(self.as_ptr())) } } pub fn set_tags(&mut self, tag_list: TagList) { unsafe { - ffi::gst_toc_set_tags(self.as_mut_ptr(), tag_list.into_ptr()); + gst_sys::gst_toc_set_tags(self.as_mut_ptr(), tag_list.into_ptr()); } } pub fn merge_tags(&mut self, tag_list: &TagList, mode: TagMergeMode) { unsafe { - ffi::gst_toc_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib()); + gst_sys::gst_toc_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib()); } } pub fn dump(&self) { unsafe { - ffi::gst_toc_dump(self.as_mut_ptr()); + gst_sys::gst_toc_dump(self.as_mut_ptr()); } } } @@ -91,15 +92,19 @@ impl fmt::Debug for TocRef { } } -gst_define_mini_object_wrapper!(TocEntry, TocEntryRef, ffi::GstTocEntry, [Debug,], || { - ffi::gst_toc_entry_get_type() -}); +gst_define_mini_object_wrapper!( + TocEntry, + TocEntryRef, + gst_sys::GstTocEntry, + [Debug,], + || gst_sys::gst_toc_entry_get_type() +); impl TocEntry { pub fn new(type_: TocEntryType, uid: &str) -> Self { assert_initialized_main_thread!(); unsafe { - from_glib_full(ffi::gst_toc_entry_new( + from_glib_full(gst_sys::gst_toc_entry_new( type_.to_glib(), uid.to_glib_none().0, )) @@ -109,12 +114,12 @@ impl TocEntry { impl TocEntryRef { pub fn get_entry_type(&self) -> TocEntryType { - unsafe { from_glib(ffi::gst_toc_entry_get_entry_type(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_toc_entry_get_entry_type(self.as_ptr())) } } pub fn get_uid(&self) -> &str { unsafe { - CStr::from_ptr(ffi::gst_toc_entry_get_uid(self.as_ptr())) + CStr::from_ptr(gst_sys::gst_toc_entry_get_uid(self.as_ptr())) .to_str() .unwrap() } @@ -122,18 +127,20 @@ impl TocEntryRef { pub fn append_sub_entry(&mut self, subentry: TocEntry) { unsafe { - ffi::gst_toc_entry_append_sub_entry(self.as_mut_ptr(), subentry.into_ptr()); + gst_sys::gst_toc_entry_append_sub_entry(self.as_mut_ptr(), subentry.into_ptr()); } } pub fn get_sub_entries(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::gst_toc_entry_get_sub_entries(self.as_ptr())) + FromGlibPtrContainer::from_glib_none(gst_sys::gst_toc_entry_get_sub_entries( + self.as_ptr(), + )) } } pub fn get_parent(&self) -> Option { - unsafe { from_glib_none(ffi::gst_toc_entry_get_parent(self.as_mut_ptr())) } + unsafe { from_glib_none(gst_sys::gst_toc_entry_get_parent(self.as_mut_ptr())) } } pub fn get_start_stop_times(&self) -> Option<(i64, i64)> { @@ -141,7 +148,7 @@ impl TocEntryRef { let mut start = mem::uninitialized(); let mut stop = mem::uninitialized(); - if from_glib(ffi::gst_toc_entry_get_start_stop_times( + if from_glib(gst_sys::gst_toc_entry_get_start_stop_times( self.as_ptr(), &mut start, &mut stop, @@ -155,39 +162,43 @@ impl TocEntryRef { pub fn set_start_stop_times(&mut self, start: i64, stop: i64) { unsafe { - ffi::gst_toc_entry_set_start_stop_times(self.as_mut_ptr(), start, stop); + gst_sys::gst_toc_entry_set_start_stop_times(self.as_mut_ptr(), start, stop); } } pub fn get_tags(&self) -> Option { - unsafe { from_glib_none(ffi::gst_toc_entry_get_tags(self.as_ptr())) } + unsafe { from_glib_none(gst_sys::gst_toc_entry_get_tags(self.as_ptr())) } } pub fn set_tags(&mut self, tag_list: TagList) { unsafe { - ffi::gst_toc_entry_set_tags(self.as_mut_ptr(), tag_list.into_ptr()); + gst_sys::gst_toc_entry_set_tags(self.as_mut_ptr(), tag_list.into_ptr()); } } pub fn merge_tags(&mut self, tag_list: &TagList, mode: TagMergeMode) { unsafe { - ffi::gst_toc_entry_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib()); + gst_sys::gst_toc_entry_merge_tags( + self.as_mut_ptr(), + tag_list.as_mut_ptr(), + mode.to_glib(), + ); } } pub fn is_alternative(&self) -> bool { - unsafe { from_glib(ffi::gst_toc_entry_is_alternative(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_toc_entry_is_alternative(self.as_ptr())) } } pub fn is_sequence(&self) -> bool { - unsafe { from_glib(ffi::gst_toc_entry_is_sequence(self.as_ptr())) } + unsafe { from_glib(gst_sys::gst_toc_entry_is_sequence(self.as_ptr())) } } pub fn get_loop(&self) -> Option<(TocLoopType, i32)> { unsafe { let mut loop_type = mem::uninitialized(); let mut repeat_count = mem::uninitialized(); - if from_glib(ffi::gst_toc_entry_get_loop( + if from_glib(gst_sys::gst_toc_entry_get_loop( self.as_ptr(), &mut loop_type, &mut repeat_count, @@ -201,7 +212,7 @@ impl TocEntryRef { pub fn set_loop(&mut self, loop_type: TocLoopType, repeat_count: i32) { unsafe { - ffi::gst_toc_entry_set_loop(self.as_mut_ptr(), loop_type.to_glib(), repeat_count); + gst_sys::gst_toc_entry_set_loop(self.as_mut_ptr(), loop_type.to_glib(), repeat_count); } } } diff --git a/gstreamer/src/typefind.rs b/gstreamer/src/typefind.rs index 16e478963..5042500bb 100644 --- a/gstreamer/src/typefind.rs +++ b/gstreamer/src/typefind.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use gst_sys; use Caps; use Plugin; use TypeFindFactory; @@ -14,14 +14,14 @@ use TypeFindProbability; use glib; use glib::translate::*; -use glib_ffi; +use glib_sys; use std::marker::PhantomData; use std::ptr; use std::slice; #[repr(C)] #[derive(Debug)] -pub struct TypeFind<'a>(ffi::GstTypeFind, PhantomData<&'a ()>); +pub struct TypeFind<'a>(gst_sys::GstTypeFind, PhantomData<&'a ()>); pub trait TypeFindImpl { fn peek(&mut self, offset: i64, size: u32) -> Option<&[u8]>; @@ -58,7 +58,7 @@ impl<'a> TypeFind<'a> { let func: Box = Box::new(func); let func = Box::into_raw(func); - let res = ffi::gst_type_find_register( + let res = gst_sys::gst_type_find_register( plugin.to_glib_none().0, name.to_glib_none().0, rank, @@ -75,7 +75,7 @@ impl<'a> TypeFind<'a> { pub fn peek(&mut self, offset: i64, size: u32) -> Option<&[u8]> { unsafe { - let data = ffi::gst_type_find_peek(&mut self.0, offset, size); + let data = gst_sys::gst_type_find_peek(&mut self.0, offset, size); if data.is_null() { None } else { @@ -86,7 +86,7 @@ impl<'a> TypeFind<'a> { pub fn suggest(&mut self, probability: TypeFindProbability, caps: &Caps) { unsafe { - ffi::gst_type_find_suggest( + gst_sys::gst_type_find_suggest( &mut self.0, probability.to_glib() as u32, caps.to_glib_none().0, @@ -100,8 +100,8 @@ unsafe impl<'a> Send for TypeFind<'a> {} impl TypeFindFactory { pub fn call_function(&self, find: &mut TypeFindImpl) { unsafe { - let find_ptr = &find as *const &mut TypeFindImpl as glib_ffi::gpointer; - let mut find = ffi::GstTypeFind { + let find_ptr = &find as *const &mut TypeFindImpl as glib_sys::gpointer; + let mut find = gst_sys::GstTypeFind { peek: Some(type_find_peek), suggest: Some(type_find_suggest), data: find_ptr, @@ -109,26 +109,26 @@ impl TypeFindFactory { _gst_reserved: [ptr::null_mut(); 4], }; - ffi::gst_type_find_factory_call_function(self.to_glib_none().0, &mut find) + gst_sys::gst_type_find_factory_call_function(self.to_glib_none().0, &mut find) } } } unsafe extern "C" fn type_find_trampoline( - find: *mut ffi::GstTypeFind, - user_data: glib_ffi::gpointer, + find: *mut gst_sys::GstTypeFind, + user_data: glib_sys::gpointer, ) { let func: &F = &*(user_data as *const F); func(&mut *(find as *mut TypeFind)); } unsafe extern "C" fn type_find_closure_drop( - data: glib_ffi::gpointer, + data: glib_sys::gpointer, ) { Box::::from_raw(data as *mut _); } -unsafe extern "C" fn type_find_peek(data: glib_ffi::gpointer, offset: i64, size: u32) -> *const u8 { +unsafe extern "C" fn type_find_peek(data: glib_sys::gpointer, offset: i64, size: u32) -> *const u8 { let find: &mut &mut TypeFindImpl = &mut *(data as *mut &mut TypeFindImpl); match find.peek(offset, size) { None => ptr::null(), @@ -137,15 +137,15 @@ unsafe extern "C" fn type_find_peek(data: glib_ffi::gpointer, offset: i64, size: } unsafe extern "C" fn type_find_suggest( - data: glib_ffi::gpointer, + data: glib_sys::gpointer, probability: u32, - caps: *mut ffi::GstCaps, + caps: *mut gst_sys::GstCaps, ) { let find: &mut &mut TypeFindImpl = &mut *(data as *mut &mut TypeFindImpl); find.suggest(from_glib(probability as i32), &from_glib_borrow(caps)); } -unsafe extern "C" fn type_find_get_length(data: glib_ffi::gpointer) -> u64 { +unsafe extern "C" fn type_find_get_length(data: glib_sys::gpointer) -> u64 { use std::u64; let find: &mut &mut TypeFindImpl = &mut *(data as *mut &mut TypeFindImpl); diff --git a/gstreamer/src/utils.rs b/gstreamer/src/utils.rs index 6ee68c29a..dca8cf691 100644 --- a/gstreamer/src/utils.rs +++ b/gstreamer/src/utils.rs @@ -7,15 +7,15 @@ // except according to those terms. use glib::translate::mut_override; -use glib_ffi; +use glib_sys; -pub struct MutexGuard<'a>(&'a glib_ffi::GMutex); +pub struct MutexGuard<'a>(&'a glib_sys::GMutex); impl<'a> MutexGuard<'a> { #[allow(clippy::trivially_copy_pass_by_ref)] - pub fn lock(mutex: &'a glib_ffi::GMutex) -> Self { + pub fn lock(mutex: &'a glib_sys::GMutex) -> Self { unsafe { - glib_ffi::g_mutex_lock(mut_override(mutex)); + glib_sys::g_mutex_lock(mut_override(mutex)); } MutexGuard(mutex) } @@ -24,7 +24,7 @@ impl<'a> MutexGuard<'a> { impl<'a> Drop for MutexGuard<'a> { fn drop(&mut self) { unsafe { - glib_ffi::g_mutex_unlock(mut_override(self.0)); + glib_sys::g_mutex_unlock(mut_override(self.0)); } } } diff --git a/gstreamer/src/value.rs b/gstreamer/src/value.rs index 8734a9ebb..9e025f53b 100644 --- a/gstreamer/src/value.rs +++ b/gstreamer/src/value.rs @@ -17,8 +17,8 @@ use glib; use glib::translate::{from_glib, from_glib_full, ToGlibPtr, ToGlibPtrMut, Uninitialized}; use glib::value::{FromValue, FromValueOptional, SetValue, ToSendValue, Value}; -use ffi; -use glib_ffi; +use glib_sys; +use gst_sys; #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] pub struct Fraction(pub Rational32); @@ -190,14 +190,14 @@ impl From for Rational32 { impl glib::types::StaticType for Fraction { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_fraction_get_type()) } + unsafe { from_glib(gst_sys::gst_fraction_get_type()) } } } impl<'a> FromValue<'a> for Fraction { unsafe fn from_value(v: &'a Value) -> Fraction { - let n = ffi::gst_value_get_fraction_numerator(v.to_glib_none().0); - let d = ffi::gst_value_get_fraction_denominator(v.to_glib_none().0); + let n = gst_sys::gst_value_get_fraction_numerator(v.to_glib_none().0); + let d = gst_sys::gst_value_get_fraction_denominator(v.to_glib_none().0); Fraction::new(n, d) } @@ -211,7 +211,7 @@ impl<'a> FromValueOptional<'a> for Fraction { impl SetValue for Fraction { unsafe fn set_value(v: &mut Value, f: &Self) { - ffi::gst_value_set_fraction(v.to_glib_none_mut().0, *f.numer(), *f.denom()); + gst_sys::gst_value_set_fraction(v.to_glib_none_mut().0, *f.numer(), *f.denom()); } } @@ -299,15 +299,15 @@ impl From<(i64, i64, i64)> for IntRange { impl glib::types::StaticType for IntRange { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_int_range_get_type()) } + unsafe { from_glib(gst_sys::gst_int_range_get_type()) } } } impl<'a> FromValue<'a> for IntRange { unsafe fn from_value(v: &'a Value) -> Self { - let min = ffi::gst_value_get_int_range_min(v.to_glib_none().0); - let max = ffi::gst_value_get_int_range_max(v.to_glib_none().0); - let step = ffi::gst_value_get_int_range_step(v.to_glib_none().0); + let min = gst_sys::gst_value_get_int_range_min(v.to_glib_none().0); + let max = gst_sys::gst_value_get_int_range_max(v.to_glib_none().0); + let step = gst_sys::gst_value_get_int_range_step(v.to_glib_none().0); Self::new_with_step(min, max, step) } @@ -321,21 +321,21 @@ impl<'a> FromValueOptional<'a> for IntRange { impl SetValue for IntRange { unsafe fn set_value(v: &mut Value, r: &Self) { - ffi::gst_value_set_int_range_step(v.to_glib_none_mut().0, r.min(), r.max(), r.step()); + gst_sys::gst_value_set_int_range_step(v.to_glib_none_mut().0, r.min(), r.max(), r.step()); } } impl glib::types::StaticType for IntRange { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_int64_range_get_type()) } + unsafe { from_glib(gst_sys::gst_int64_range_get_type()) } } } impl<'a> FromValue<'a> for IntRange { unsafe fn from_value(v: &'a Value) -> Self { - let min = ffi::gst_value_get_int64_range_min(v.to_glib_none().0); - let max = ffi::gst_value_get_int64_range_max(v.to_glib_none().0); - let step = ffi::gst_value_get_int64_range_step(v.to_glib_none().0); + let min = gst_sys::gst_value_get_int64_range_min(v.to_glib_none().0); + let max = gst_sys::gst_value_get_int64_range_max(v.to_glib_none().0); + let step = gst_sys::gst_value_get_int64_range_step(v.to_glib_none().0); Self::new_with_step(min, max, step) } @@ -349,7 +349,7 @@ impl<'a> FromValueOptional<'a> for IntRange { impl SetValue for IntRange { unsafe fn set_value(v: &mut Value, r: &Self) { - ffi::gst_value_set_int64_range_step(v.to_glib_none_mut().0, r.min(), r.max(), r.step()); + gst_sys::gst_value_set_int64_range_step(v.to_glib_none_mut().0, r.min(), r.max(), r.step()); } } @@ -391,19 +391,19 @@ impl From<(Fraction, Fraction)> for FractionRange { impl glib::types::StaticType for FractionRange { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_fraction_range_get_type()) } + unsafe { from_glib(gst_sys::gst_fraction_range_get_type()) } } } impl<'a> FromValue<'a> for FractionRange { unsafe fn from_value(v: &'a Value) -> Self { - let min = ffi::gst_value_get_fraction_range_min(v.to_glib_none().0); - let max = ffi::gst_value_get_fraction_range_max(v.to_glib_none().0); + let min = gst_sys::gst_value_get_fraction_range_min(v.to_glib_none().0); + let max = gst_sys::gst_value_get_fraction_range_max(v.to_glib_none().0); - let min_n = ffi::gst_value_get_fraction_numerator(min); - let min_d = ffi::gst_value_get_fraction_denominator(min); - let max_n = ffi::gst_value_get_fraction_numerator(max); - let max_d = ffi::gst_value_get_fraction_denominator(max); + let min_n = gst_sys::gst_value_get_fraction_numerator(min); + let min_d = gst_sys::gst_value_get_fraction_denominator(min); + let max_n = gst_sys::gst_value_get_fraction_numerator(max); + let max_d = gst_sys::gst_value_get_fraction_denominator(max); Self::new((min_n, min_d), (max_n, max_d)) } @@ -417,7 +417,7 @@ impl<'a> FromValueOptional<'a> for FractionRange { impl SetValue for FractionRange { unsafe fn set_value(v: &mut Value, r: &Self) { - ffi::gst_value_set_fraction_range_full( + gst_sys::gst_value_set_fraction_range_full( v.to_glib_none_mut().0, *r.min().numer(), *r.min().denom(), @@ -493,13 +493,13 @@ impl From for Bitmask { impl glib::types::StaticType for Bitmask { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_bitmask_get_type()) } + unsafe { from_glib(gst_sys::gst_bitmask_get_type()) } } } impl<'a> FromValue<'a> for Bitmask { unsafe fn from_value(v: &'a Value) -> Self { - let v = ffi::gst_value_get_bitmask(v.to_glib_none().0); + let v = gst_sys::gst_value_get_bitmask(v.to_glib_none().0); Self::new(v) } } @@ -512,7 +512,7 @@ impl<'a> FromValueOptional<'a> for Bitmask { impl SetValue for Bitmask { unsafe fn set_value(v: &mut Value, r: &Self) { - ffi::gst_value_set_bitmask(v.to_glib_none_mut().0, r.0); + gst_sys::gst_value_set_bitmask(v.to_glib_none_mut().0, r.0); } } @@ -561,7 +561,7 @@ impl<'a> From<&'a [glib::SendValue]> for Array<'a> { impl<'a> FromValue<'a> for Array<'a> { unsafe fn from_value(v: &'a Value) -> Self { - let arr = (*v.to_glib_none().0).data[0].v_pointer as *const glib_ffi::GArray; + let arr = (*v.to_glib_none().0).data[0].v_pointer as *const glib_sys::GArray; if arr.is_null() { Array(Cow::Borrowed(&[])) } else { @@ -583,14 +583,14 @@ impl<'a> FromValueOptional<'a> for Array<'a> { impl<'a> SetValue for Array<'a> { unsafe fn set_value(v: &mut Value, a: &Self) { for value in a.as_slice() { - ffi::gst_value_array_append_value(v.to_glib_none_mut().0, value.to_glib_none().0); + gst_sys::gst_value_array_append_value(v.to_glib_none_mut().0, value.to_glib_none().0); } } } impl<'a> glib::types::StaticType for Array<'a> { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_value_array_get_type()) } + unsafe { from_glib(gst_sys::gst_value_array_get_type()) } } } @@ -639,7 +639,7 @@ impl<'a> From<&'a [glib::SendValue]> for List<'a> { impl<'a> FromValue<'a> for List<'a> { unsafe fn from_value(v: &'a Value) -> Self { - let arr = (*v.to_glib_none().0).data[0].v_pointer as *const glib_ffi::GArray; + let arr = (*v.to_glib_none().0).data[0].v_pointer as *const glib_sys::GArray; if arr.is_null() { List(Cow::Borrowed(&[])) } else { @@ -661,14 +661,14 @@ impl<'a> FromValueOptional<'a> for List<'a> { impl<'a> SetValue for List<'a> { unsafe fn set_value(v: &mut Value, a: &Self) { for value in a.as_slice() { - ffi::gst_value_list_append_value(v.to_glib_none_mut().0, value.to_glib_none().0); + gst_sys::gst_value_list_append_value(v.to_glib_none_mut().0, value.to_glib_none().0); } } } impl<'a> glib::types::StaticType for List<'a> { fn static_type() -> glib::types::Type { - unsafe { from_glib(ffi::gst_value_list_get_type()) } + unsafe { from_glib(gst_sys::gst_value_list_get_type()) } } } @@ -692,7 +692,7 @@ pub trait GstValueExt: Sized { impl GstValueExt for glib::Value { fn can_compare(&self, other: &Self) -> bool { unsafe { - from_glib(ffi::gst_value_can_compare( + from_glib(gst_sys::gst_value_can_compare( self.to_glib_none().0, other.to_glib_none().0, )) @@ -701,12 +701,12 @@ impl GstValueExt for glib::Value { fn compare(&self, other: &Self) -> Option { unsafe { - let val = ffi::gst_value_compare(self.to_glib_none().0, other.to_glib_none().0); + let val = gst_sys::gst_value_compare(self.to_glib_none().0, other.to_glib_none().0); match val { - ffi::GST_VALUE_LESS_THAN => Some(cmp::Ordering::Less), - ffi::GST_VALUE_EQUAL => Some(cmp::Ordering::Equal), - ffi::GST_VALUE_GREATER_THAN => Some(cmp::Ordering::Greater), + gst_sys::GST_VALUE_LESS_THAN => Some(cmp::Ordering::Less), + gst_sys::GST_VALUE_EQUAL => Some(cmp::Ordering::Equal), + gst_sys::GST_VALUE_GREATER_THAN => Some(cmp::Ordering::Greater), _ => None, } } @@ -718,7 +718,7 @@ impl GstValueExt for glib::Value { fn can_intersect(&self, other: &Self) -> bool { unsafe { - from_glib(ffi::gst_value_can_intersect( + from_glib(gst_sys::gst_value_can_intersect( self.to_glib_none().0, other.to_glib_none().0, )) @@ -728,7 +728,7 @@ impl GstValueExt for glib::Value { fn intersect(&self, other: &Self) -> Option { unsafe { let mut value = glib::Value::uninitialized(); - let ret: bool = from_glib(ffi::gst_value_intersect( + let ret: bool = from_glib(gst_sys::gst_value_intersect( value.to_glib_none_mut().0, self.to_glib_none().0, other.to_glib_none().0, @@ -743,7 +743,7 @@ impl GstValueExt for glib::Value { fn can_subtract(&self, other: &Self) -> bool { unsafe { - from_glib(ffi::gst_value_can_subtract( + from_glib(gst_sys::gst_value_can_subtract( self.to_glib_none().0, other.to_glib_none().0, )) @@ -753,7 +753,7 @@ impl GstValueExt for glib::Value { fn subtract(&self, other: &Self) -> Option { unsafe { let mut value = glib::Value::uninitialized(); - let ret: bool = from_glib(ffi::gst_value_subtract( + let ret: bool = from_glib(gst_sys::gst_value_subtract( value.to_glib_none_mut().0, self.to_glib_none().0, other.to_glib_none().0, @@ -768,7 +768,7 @@ impl GstValueExt for glib::Value { fn can_union(&self, other: &Self) -> bool { unsafe { - from_glib(ffi::gst_value_can_union( + from_glib(gst_sys::gst_value_can_union( self.to_glib_none().0, other.to_glib_none().0, )) @@ -778,7 +778,7 @@ impl GstValueExt for glib::Value { fn union(&self, other: &Self) -> Option { unsafe { let mut value = glib::Value::uninitialized(); - let ret: bool = from_glib(ffi::gst_value_union( + let ret: bool = from_glib(gst_sys::gst_value_union( value.to_glib_none_mut().0, self.to_glib_none().0, other.to_glib_none().0, @@ -794,7 +794,7 @@ impl GstValueExt for glib::Value { fn fixate(&self) -> Option { unsafe { let mut value = glib::Value::uninitialized(); - let ret: bool = from_glib(ffi::gst_value_fixate( + let ret: bool = from_glib(gst_sys::gst_value_fixate( value.to_glib_none_mut().0, self.to_glib_none().0, )); @@ -807,12 +807,12 @@ impl GstValueExt for glib::Value { } fn is_fixed(&self) -> bool { - unsafe { from_glib(ffi::gst_value_is_fixed(self.to_glib_none().0)) } + unsafe { from_glib(gst_sys::gst_value_is_fixed(self.to_glib_none().0)) } } fn is_subset(&self, superset: &Self) -> bool { unsafe { - from_glib(ffi::gst_value_is_subset( + from_glib(gst_sys::gst_value_is_subset( self.to_glib_none().0, superset.to_glib_none().0, )) @@ -820,7 +820,7 @@ impl GstValueExt for glib::Value { } fn serialize(&self) -> Option { - unsafe { from_glib_full(ffi::gst_value_serialize(self.to_glib_none().0)) } + unsafe { from_glib_full(gst_sys::gst_value_serialize(self.to_glib_none().0)) } } fn deserialize<'a, T: Into<&'a str>>(s: T) -> Option { @@ -830,7 +830,7 @@ impl GstValueExt for glib::Value { unsafe { let mut value = glib::Value::uninitialized(); - let ret: bool = from_glib(ffi::gst_value_deserialize( + let ret: bool = from_glib(gst_sys::gst_value_deserialize( value.to_glib_none_mut().0, s.to_glib_none().0, ));