Update manual code

This commit is contained in:
Sebastian Dröge 2019-03-19 09:58:20 +02:00
parent 24305a19e8
commit e7898c1b24
159 changed files with 3387 additions and 2859 deletions

View file

@ -14,7 +14,7 @@ extern crate failure_derive;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_rtsp as gst_rtsp; extern crate gstreamer_rtsp as gst_rtsp;
extern crate gstreamer_rtsp_server as gst_rtsp_server; 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 failure::Error;
use std::env; use std::env;
@ -93,7 +93,7 @@ fn main_loop() -> Result<(), Error> {
// This declares that the user "user" (once authenticated) has a role that // This declares that the user "user" (once authenticated) has a role that
// allows them to access and construct media factories. // allows them to access and construct media factories.
unsafe { unsafe {
ffi::gst_rtsp_media_factory_add_role( gst_rtsp_server_sys::gst_rtsp_media_factory_add_role(
factory.to_glib_none().0, factory.to_glib_none().0,
"user".to_glib_none().0, "user".to_glib_none().0,
RTSP_PERM_MEDIA_FACTORY_ACCESS.to_glib_none().0, RTSP_PERM_MEDIA_FACTORY_ACCESS.to_glib_none().0,

View file

@ -6,14 +6,14 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::object::ObjectType; use glib::object::ObjectType;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::translate::*; use glib::translate::*;
use glib_ffi::gpointer; use glib_sys::gpointer;
use gst; use gst;
use gst_ffi; use gst_app_sys;
use gst_sys;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::cell::RefCell; use std::cell::RefCell;
use std::mem::transmute; use std::mem::transmute;
@ -29,7 +29,7 @@ pub struct AppSinkCallbacks {
new_sample: Option< new_sample: Option<
RefCell<Box<FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static>>, RefCell<Box<FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static>>,
>, >,
callbacks: ffi::GstAppSinkCallbacks, callbacks: gst_app_sys::GstAppSinkCallbacks,
} }
unsafe impl Send for AppSinkCallbacks {} unsafe impl Send for AppSinkCallbacks {}
@ -99,7 +99,7 @@ impl AppSinkCallbacksBuilder {
eos: self.eos, eos: self.eos,
new_preroll: self.new_preroll, new_preroll: self.new_preroll,
new_sample: self.new_sample, new_sample: self.new_sample,
callbacks: ffi::GstAppSinkCallbacks { callbacks: gst_app_sys::GstAppSinkCallbacks {
eos: if have_eos { Some(trampoline_eos) } else { None }, eos: if have_eos { Some(trampoline_eos) } else { None },
new_preroll: if have_new_preroll { new_preroll: if have_new_preroll {
Some(trampoline_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); let callbacks = &*(callbacks as *const AppSinkCallbacks);
if let Some(ref eos) = callbacks.eos { 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( unsafe extern "C" fn trampoline_new_preroll(
appsink: *mut ffi::GstAppSink, appsink: *mut gst_app_sys::GstAppSink,
callbacks: gpointer, callbacks: gpointer,
) -> gst_ffi::GstFlowReturn { ) -> gst_sys::GstFlowReturn {
let callbacks = &*(callbacks as *const AppSinkCallbacks); let callbacks = &*(callbacks as *const AppSinkCallbacks);
let ret = if let Some(ref new_preroll) = callbacks.new_preroll { 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( unsafe extern "C" fn trampoline_new_sample(
appsink: *mut ffi::GstAppSink, appsink: *mut gst_app_sys::GstAppSink,
callbacks: gpointer, callbacks: gpointer,
) -> gst_ffi::GstFlowReturn { ) -> gst_sys::GstFlowReturn {
let callbacks = &*(callbacks as *const AppSinkCallbacks); let callbacks = &*(callbacks as *const AppSinkCallbacks);
let ret = if let Some(ref new_sample) = callbacks.new_sample { 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 { impl AppSink {
pub fn set_callbacks(&self, callbacks: AppSinkCallbacks) { pub fn set_callbacks(&self, callbacks: AppSinkCallbacks) {
unsafe { unsafe {
ffi::gst_app_sink_set_callbacks( gst_app_sys::gst_app_sink_set_callbacks(
self.to_glib_none().0, self.to_glib_none().0,
mut_override(&callbacks.callbacks), mut_override(&callbacks.callbacks),
Box::into_raw(Box::new(callbacks)) as *mut _, Box::into_raw(Box::new(callbacks)) as *mut _,
@ -214,9 +214,9 @@ impl AppSink {
unsafe extern "C" fn new_sample_trampoline< unsafe extern "C" fn new_sample_trampoline<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static, F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
>( >(
this: *mut ffi::GstAppSink, this: *mut gst_app_sys::GstAppSink,
f: glib_ffi::gpointer, f: glib_sys::gpointer,
) -> gst_ffi::GstFlowReturn { ) -> gst_sys::GstFlowReturn {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into();
ret.to_glib() ret.to_glib()
@ -225,9 +225,9 @@ unsafe extern "C" fn new_sample_trampoline<
unsafe extern "C" fn new_preroll_trampoline< unsafe extern "C" fn new_preroll_trampoline<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static, F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
>( >(
this: *mut ffi::GstAppSink, this: *mut gst_app_sys::GstAppSink,
f: glib_ffi::gpointer, f: glib_sys::gpointer,
) -> gst_ffi::GstFlowReturn { ) -> gst_sys::GstFlowReturn {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into(); let ret: gst::FlowReturn = f(&from_glib_borrow(this)).into();
ret.to_glib() ret.to_glib()

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib_ffi::{gboolean, gpointer}; use glib_sys::{gboolean, gpointer};
use gst; use gst;
use gst_app_sys;
use std::cell::RefCell; use std::cell::RefCell;
use std::mem; use std::mem;
use std::ptr; use std::ptr;
@ -20,7 +20,7 @@ pub struct AppSrcCallbacks {
need_data: Option<RefCell<Box<FnMut(&AppSrc, u32) + Send + 'static>>>, need_data: Option<RefCell<Box<FnMut(&AppSrc, u32) + Send + 'static>>>,
enough_data: Option<Box<Fn(&AppSrc) + Send + Sync + 'static>>, enough_data: Option<Box<Fn(&AppSrc) + Send + Sync + 'static>>,
seek_data: Option<Box<Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>>, seek_data: Option<Box<Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>>,
callbacks: ffi::GstAppSrcCallbacks, callbacks: gst_app_sys::GstAppSrcCallbacks,
} }
unsafe impl Send for AppSrcCallbacks {} unsafe impl Send for AppSrcCallbacks {}
@ -80,7 +80,7 @@ impl AppSrcCallbacksBuilder {
need_data: self.need_data, need_data: self.need_data,
enough_data: self.enough_data, enough_data: self.enough_data,
seek_data: self.seek_data, seek_data: self.seek_data,
callbacks: ffi::GstAppSrcCallbacks { callbacks: gst_app_sys::GstAppSrcCallbacks {
need_data: if have_need_data { need_data: if have_need_data {
Some(trampoline_need_data) Some(trampoline_need_data)
} else { } else {
@ -108,7 +108,7 @@ impl AppSrcCallbacksBuilder {
} }
unsafe extern "C" fn trampoline_need_data( unsafe extern "C" fn trampoline_need_data(
appsrc: *mut ffi::GstAppSrc, appsrc: *mut gst_app_sys::GstAppSrc,
length: u32, length: u32,
callbacks: gpointer, 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); let callbacks = &*(callbacks as *const AppSrcCallbacks);
if let Some(ref enough_data) = callbacks.enough_data { 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( unsafe extern "C" fn trampoline_seek_data(
appsrc: *mut ffi::GstAppSrc, appsrc: *mut gst_app_sys::GstAppSrc,
offset: u64, offset: u64,
callbacks: gpointer, callbacks: gpointer,
) -> gboolean { ) -> gboolean {
@ -149,14 +152,17 @@ unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
impl AppSrc { impl AppSrc {
pub fn end_of_stream(&self) -> Result<gst::FlowSuccess, gst::FlowError> { pub fn end_of_stream(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = let ret: gst::FlowReturn = unsafe {
unsafe { from_glib(ffi::gst_app_src_end_of_stream(self.to_glib_none().0)) }; from_glib(gst_app_sys::gst_app_src_end_of_stream(
self.to_glib_none().0,
))
};
ret.into_result() ret.into_result()
} }
pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.to_glib_none().0,
buffer.into_ptr(), buffer.into_ptr(),
)) ))
@ -170,7 +176,7 @@ impl AppSrc {
list: gst::BufferList, list: gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.to_glib_none().0,
list.into_ptr(), list.into_ptr(),
)) ))
@ -180,7 +186,7 @@ impl AppSrc {
pub fn push_sample(&self, sample: &gst::Sample) -> Result<gst::FlowSuccess, gst::FlowError> { pub fn push_sample(&self, sample: &gst::Sample) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.to_glib_none().0,
sample.to_glib_none().0, sample.to_glib_none().0,
)) ))
@ -190,7 +196,7 @@ impl AppSrc {
pub fn set_callbacks(&self, callbacks: AppSrcCallbacks) { pub fn set_callbacks(&self, callbacks: AppSrcCallbacks) {
unsafe { unsafe {
ffi::gst_app_src_set_callbacks( gst_app_sys::gst_app_src_set_callbacks(
self.to_glib_none().0, self.to_glib_none().0,
mut_override(&callbacks.callbacks), mut_override(&callbacks.callbacks),
Box::into_raw(Box::new(callbacks)) as *mut _, 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) { pub fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) {
unsafe { 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 { unsafe {
let mut min = mem::uninitialized(); let mut min = mem::uninitialized();
let mut max = 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)) (from_glib(min), from_glib(max))
} }
} }

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use ffi; use gst_app_sys;
use glib::translate::*; use glib::translate::*;

View file

@ -8,13 +8,13 @@
extern crate libc; extern crate libc;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; 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 as gst_base;
extern crate gstreamer_base_sys as gst_base_ffi; extern crate gstreamer_base_sys as gst_base_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_audio_sys;
use AudioChannelPosition; use AudioChannelPosition;
use std::mem; use std::mem;
@ -25,7 +25,7 @@ impl AudioChannelPosition {
return 0; return 0;
} }
unsafe { unsafe {
let val = mem::transmute::<ffi::GstAudioChannelPosition, u32>(pos); let val = mem::transmute::<gst_audio_sys::GstAudioChannelPosition, u32>(pos);
1 << val 1 << val
} }
} }
@ -38,9 +38,10 @@ impl AudioChannelPosition {
return None; return None;
} }
let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { let positions_raw: [gst_audio_sys::GstAudioChannelPosition; 64] =
array_init::array_init_copy(|i| {
if i >= len as usize { if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
positions[i].to_glib() positions[i].to_glib()
} }
@ -48,7 +49,7 @@ impl AudioChannelPosition {
unsafe { unsafe {
let mut mask = mem::uninitialized(); 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 _, positions_raw.as_ptr() as *mut _,
len as i32, len as i32,
force_order.to_glib(), force_order.to_glib(),
@ -73,10 +74,10 @@ impl AudioChannelPosition {
} }
let len = positions.len(); let len = positions.len();
let mut positions_raw: [ffi::GstAudioChannelPosition; 64] = let mut positions_raw: [gst_audio_sys::GstAudioChannelPosition; 64] =
[ffi::GST_AUDIO_CHANNEL_POSITION_INVALID; 64]; [gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID; 64];
let valid: bool = unsafe { 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, len as i32,
mask, mask,
positions_raw.as_mut_ptr(), positions_raw.as_mut_ptr(),
@ -105,17 +106,17 @@ impl AudioChannelPosition {
} }
let len = positions.len(); 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| { array_init::array_init_copy(|i| {
if i >= len as usize { if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
positions[i].to_glib() positions[i].to_glib()
} }
}); });
let valid: bool = unsafe { 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(), positions_raw.as_mut_ptr(),
len as i32, len as i32,
)) ))
@ -136,7 +137,7 @@ impl AudioChannelPosition {
pub fn get_fallback_mask(channels: u32) -> u64 { pub fn get_fallback_mask(channels: u32) -> u64 {
assert_initialized_main_thread!(); 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( pub fn check_valid_channel_positions(
@ -150,16 +151,17 @@ impl AudioChannelPosition {
} }
let len = positions.len(); let len = positions.len();
let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(|i| { let positions_raw: [gst_audio_sys::GstAudioChannelPosition; 64] =
array_init::array_init_copy(|i| {
if i >= len as usize { if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
positions[i].to_glib() positions[i].to_glib()
} }
}); });
unsafe { 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 _, positions_raw.as_ptr() as *mut _,
len as i32, len as i32,
force_order.to_glib(), force_order.to_glib(),
@ -184,24 +186,24 @@ pub fn buffer_reorder_channels(
let from_len = from.len(); let from_len = from.len();
let to_len = to.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 { if i >= from_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
from[i].to_glib() 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 { if i >= to_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
to[i].to_glib() to[i].to_glib()
} }
}); });
let valid: bool = unsafe { 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(), buffer.as_mut_ptr(),
format.to_glib(), format.to_glib(),
channels as i32, channels as i32,
@ -233,24 +235,24 @@ pub fn reorder_channels(
let from_len = from.len(); let from_len = from.len();
let to_len = to.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 { if i >= from_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
from[i].to_glib() 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 { if i >= to_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
to[i].to_glib() to[i].to_glib()
} }
}); });
let valid: bool = unsafe { 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.as_mut_ptr() as *mut _,
data.len(), data.len(),
format.to_glib(), format.to_glib(),
@ -281,17 +283,17 @@ pub fn get_channel_reorder_map(
let from_len = from.len(); let from_len = from.len();
let to_len = to.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 { if i >= from_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
from[i].to_glib() 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 { if i >= to_len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
to[i].to_glib() to[i].to_glib()
} }
@ -299,7 +301,7 @@ pub fn get_channel_reorder_map(
let mut reorder_map_raw = [0i32, 64]; let mut reorder_map_raw = [0i32, 64];
let valid: bool = unsafe { 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_len as i32,
from_raw.as_ptr() as *mut _, from_raw.as_ptr() as *mut _,
to_raw.as_ptr() as *mut _, to_raw.as_ptr() as *mut _,

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_audio_sys;
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt; use std::fmt;
@ -24,7 +24,7 @@ impl ::AudioFormat {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
from_glib(ffi::gst_audio_format_build_integer( from_glib(gst_audio_sys::gst_audio_format_build_integer(
sign.to_glib(), sign.to_glib(),
endianness.to_glib(), endianness.to_glib(),
width, width,
@ -36,7 +36,11 @@ impl ::AudioFormat {
pub fn from_string(s: &str) -> ::AudioFormat { pub fn from_string(s: &str) -> ::AudioFormat {
assert_initialized_main_thread!(); 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 { pub fn to_string<'a>(self) -> &'a str {
@ -45,7 +49,7 @@ impl ::AudioFormat {
} }
unsafe { 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() .to_str()
.unwrap() .unwrap()
} }

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gobject_sys;
use gobject_ffi; use gst_audio_sys;
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt; 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 { impl AudioFormatInfo {
pub fn from_format(format: ::AudioFormat) -> AudioFormatInfo { pub fn from_format(format: ::AudioFormat) -> AudioFormatInfo {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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()); assert!(!info.is_null());
AudioFormatInfo(&*info) AudioFormatInfo(&*info)
@ -178,7 +178,11 @@ impl AudioFormatInfo {
} }
unsafe { 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 { impl glib::types::StaticType for AudioFormatInfo {
fn static_type() -> glib::types::Type { 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)] #[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for AudioFormatInfo { impl<'a> glib::value::FromValueOptional<'a> for AudioFormatInfo {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> { unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<AudioFormatInfo>::from_glib_none(gobject_ffi::g_value_get_boxed( Option::<AudioFormatInfo>::from_glib_none(gobject_sys::g_value_get_boxed(
value.to_glib_none().0, value.to_glib_none().0,
) as *mut ffi::GstAudioFormatInfo) )
as *mut gst_audio_sys::GstAudioFormatInfo)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::value::SetValue for AudioFormatInfo { impl glib::value::SetValue for AudioFormatInfo {
unsafe fn set_value(value: &mut glib::Value, this: &Self) { 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, value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(this).0 glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioFormatInfo>::to_glib_none(
as glib_ffi::gpointer, this,
)
.0 as glib_sys::gpointer,
) )
} }
} }
@ -272,36 +279,42 @@ impl glib::value::SetValue for AudioFormatInfo {
#[doc(hidden)] #[doc(hidden)]
impl glib::value::SetValueOptional for AudioFormatInfo { impl glib::value::SetValueOptional for AudioFormatInfo {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { 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, value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(&this).0 glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioFormatInfo>::to_glib_none(
as glib_ffi::gpointer, &this,
)
.0 as glib_sys::gpointer,
) )
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::GlibPtrDefault for AudioFormatInfo { impl glib::translate::GlibPtrDefault for AudioFormatInfo {
type GlibType = *mut ffi::GstAudioFormatInfo; type GlibType = *mut gst_audio_sys::GstAudioFormatInfo;
} }
#[doc(hidden)] #[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; 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) 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!() unimplemented!()
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*mut ffi::GstAudioFormatInfo> for AudioFormatInfo { impl glib::translate::FromGlibPtrNone<*mut gst_audio_sys::GstAudioFormatInfo> for AudioFormatInfo {
#[inline] #[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) AudioFormatInfo(&*ptr)
} }
} }

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gobject_sys;
use gobject_ffi; use gst_audio_sys;
use glib; use glib;
use glib::translate::{ use glib::translate::{
@ -23,7 +23,7 @@ use std::ptr;
use array_init; use array_init;
pub struct AudioInfo(ffi::GstAudioInfo, [::AudioChannelPosition; 64]); pub struct AudioInfo(gst_audio_sys::GstAudioInfo, [::AudioChannelPosition; 64]);
impl fmt::Debug for AudioInfo { impl fmt::Debug for AudioInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
@ -57,16 +57,17 @@ impl<'a> AudioInfoBuilder<'a> {
return None; return None;
} }
let positions: [ffi::GstAudioChannelPosition; 64] = let positions: [gst_audio_sys::GstAudioChannelPosition; 64] =
array_init::array_init_copy(|i| { array_init::array_init_copy(|i| {
if i >= self.channels as usize { if i >= self.channels as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID
} else { } else {
p[i].to_glib() p[i].to_glib()
} }
}); });
let valid: bool = from_glib(ffi::gst_audio_check_valid_channel_positions( let valid: bool =
from_glib(gst_audio_sys::gst_audio_check_valid_channel_positions(
positions.as_ptr() as *mut _, positions.as_ptr() as *mut _,
self.channels as i32, self.channels as i32,
true.to_glib(), true.to_glib(),
@ -85,7 +86,7 @@ impl<'a> AudioInfoBuilder<'a> {
.map(|p| p.as_ptr()) .map(|p| p.as_ptr())
.unwrap_or(ptr::null()); .unwrap_or(ptr::null());
ffi::gst_audio_info_set_format( gst_audio_sys::gst_audio_info_set_format(
&mut info, &mut info,
self.format.to_glib(), self.format.to_glib(),
self.rate as i32, self.rate as i32,
@ -152,7 +153,10 @@ impl AudioInfo {
unsafe { unsafe {
let mut info = mem::uninitialized(); 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])); let positions = array_init::array_init_copy(|i| from_glib(info.position[i]));
Some(AudioInfo(info, positions)) Some(AudioInfo(info, positions))
} else { } else {
@ -162,7 +166,7 @@ impl AudioInfo {
} }
pub fn to_caps(&self) -> Option<gst::Caps> { pub fn to_caps(&self) -> Option<gst::Caps> {
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<V: Into<gst::GenericFormattedValue>, U: gst::SpecificFormattedValue>( pub fn convert<V: Into<gst::GenericFormattedValue>, U: gst::SpecificFormattedValue>(
@ -174,7 +178,7 @@ impl AudioInfo {
let src_val = src_val.into(); let src_val = src_val.into();
unsafe { unsafe {
let mut dest_val = mem::uninitialized(); 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, &self.0,
src_val.get_format().to_glib(), src_val.get_format().to_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
@ -198,7 +202,7 @@ impl AudioInfo {
let src_val = src_val.into(); let src_val = src_val.into();
unsafe { unsafe {
let mut dest_val = mem::uninitialized(); 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, &self.0,
src_val.get_format().to_glib(), src_val.get_format().to_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
@ -297,7 +301,7 @@ impl Clone for AudioInfo {
impl PartialEq for AudioInfo { impl PartialEq for AudioInfo {
fn eq(&self, other: &Self) -> bool { 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 { impl glib::types::StaticType for AudioInfo {
fn static_type() -> glib::types::Type { 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)] #[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for AudioInfo { impl<'a> glib::value::FromValueOptional<'a> for AudioInfo {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> { unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<AudioInfo>::from_glib_none( Option::<AudioInfo>::from_glib_none(gobject_sys::g_value_get_boxed(value.to_glib_none().0)
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstAudioInfo as *mut gst_audio_sys::GstAudioInfo)
)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::value::SetValue for AudioInfo { impl glib::value::SetValue for AudioInfo {
unsafe fn set_value(value: &mut glib::Value, this: &Self) { 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, value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(this).0 glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioInfo>::to_glib_none(this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }
@ -335,10 +338,10 @@ impl glib::value::SetValue for AudioInfo {
#[doc(hidden)] #[doc(hidden)]
impl glib::value::SetValueOptional for AudioInfo { impl glib::value::SetValueOptional for AudioInfo {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { 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, value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(&this).0 glib::translate::ToGlibPtr::<*const gst_audio_sys::GstAudioInfo>::to_glib_none(&this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }
@ -352,26 +355,28 @@ impl glib::translate::Uninitialized for AudioInfo {
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::GlibPtrDefault for AudioInfo { impl glib::translate::GlibPtrDefault for AudioInfo {
type GlibType = *mut ffi::GstAudioInfo; type GlibType = *mut gst_audio_sys::GstAudioInfo;
} }
#[doc(hidden)] #[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; 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) 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!() unimplemented!()
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*mut ffi::GstAudioInfo> for AudioInfo { impl glib::translate::FromGlibPtrNone<*mut gst_audio_sys::GstAudioInfo> for AudioInfo {
#[inline] #[inline]
unsafe fn from_glib_none(ptr: *mut ffi::GstAudioInfo) -> Self { unsafe fn from_glib_none(ptr: *mut gst_audio_sys::GstAudioInfo) -> Self {
AudioInfo( AudioInfo(
ptr::read(ptr), ptr::read(ptr),
array_init::array_init_copy(|i| from_glib((*ptr).position[i])), 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)] #[doc(hidden)]
impl glib::translate::FromGlibPtrFull<*mut ffi::GstAudioInfo> for AudioInfo { impl glib::translate::FromGlibPtrFull<*mut gst_audio_sys::GstAudioInfo> for AudioInfo {
#[inline] #[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); let info = from_glib_none(ptr);
glib_ffi::g_free(ptr as *mut _); glib_sys::g_free(ptr as *mut _);
info info
} }
} }

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_audio_sys;
use AudioStreamAlign; use AudioStreamAlign;
use glib::translate::*; use glib::translate::*;
@ -25,7 +25,7 @@ impl AudioStreamAlign {
let mut out_timestamp = mem::uninitialized(); let mut out_timestamp = mem::uninitialized();
let mut out_duration = mem::uninitialized(); let mut out_duration = mem::uninitialized();
let mut out_sample_position = 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, self.to_glib_none_mut().0,
discont.to_glib(), discont.to_glib(),
timestamp.to_glib(), timestamp.to_glib(),

View file

@ -12,15 +12,15 @@ extern crate bitflags;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_audio_sys as ffi; extern crate gstreamer_audio_sys as gst_audio_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };
@ -60,7 +60,7 @@ pub fn audio_buffer_clip(
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_audio_buffer_clip( from_glib_full(gst_audio_sys::gst_audio_buffer_clip(
buffer.into_ptr(), buffer.into_ptr(),
segment.to_glib_none().0, segment.to_glib_none().0,
rate as i32, rate as i32,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_base_sys;
use std::io; use std::io;
use std::ops; use std::ops;
use Adapter; use Adapter;
@ -17,7 +17,7 @@ impl Adapter {
pub fn copy(&self, offset: usize, dest: &mut [u8]) { pub fn copy(&self, offset: usize, dest: &mut [u8]) {
unsafe { unsafe {
let size = dest.len(); let size = dest.len();
ffi::gst_adapter_copy( gst_base_sys::gst_adapter_copy(
self.to_glib_none().0, self.to_glib_none().0,
dest.as_mut_ptr() as *mut _, dest.as_mut_ptr() as *mut _,
offset, offset,
@ -28,7 +28,7 @@ impl Adapter {
pub fn push(&self, buf: gst::Buffer) { pub fn push(&self, buf: gst::Buffer) {
unsafe { 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; use std::slice;
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -206,7 +206,7 @@ pub struct UniqueAdapterMap<'a>(&'a UniqueAdapter, &'a [u8]);
impl<'a> Drop for UniqueAdapterMap<'a> { impl<'a> Drop for UniqueAdapterMap<'a> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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);
} }
} }
} }

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib::IsA; use glib::IsA;
use gst; use gst;
use gst_base_sys;
use Aggregator; use Aggregator;
pub trait AggregatorExtManual: 'static { pub trait AggregatorExtManual: 'static {
@ -19,7 +19,7 @@ pub trait AggregatorExtManual: 'static {
impl<O: IsA<Aggregator>> AggregatorExtManual for O { impl<O: IsA<Aggregator>> AggregatorExtManual for O {
fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.as_ref().to_glib_none().0,
buffer.into_ptr(), buffer.into_ptr(),
)) ))

View file

@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi; use gst_base_sys;
use gst_sys;
use AggregatorPad; use AggregatorPad;
pub trait AggregatorPadExtManual: 'static { pub trait AggregatorPadExtManual: 'static {
@ -20,9 +20,9 @@ pub trait AggregatorPadExtManual: 'static {
impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O { impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {
fn get_segment(&self) -> gst::Segment { fn get_segment(&self) -> gst::Segment {
unsafe { 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); ::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)
} }
} }
} }

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use ffi; use gst_base_sys;
use glib::translate::*; use glib::translate::*;

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use ffi; use gst_base_sys;
use glib::translate::*; use glib::translate::*;

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_base_sys;
use std::mem; use std::mem;
use BaseSink; use BaseSink;
@ -27,7 +27,7 @@ pub trait BaseSinkExtManual: 'static {
impl<O: IsA<BaseSink>> BaseSinkExtManual for O { impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
fn get_segment(&self) -> gst::Segment { fn get_segment(&self) -> gst::Segment {
unsafe { 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); ::utils::MutexGuard::lock(&sink.element.object.lock);
from_glib_none(&sink.segment as *const _) from_glib_none(&sink.segment as *const _)
} }
@ -39,7 +39,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) { ) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) {
unsafe { unsafe {
let mut jitter = mem::uninitialized(); 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, self.as_ref().to_glib_none().0,
time.to_glib(), time.to_glib(),
&mut jitter, &mut jitter,
@ -50,7 +50,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError> { fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
}; };

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_base_sys;
use BaseSrc; use BaseSrc;
pub trait BaseSrcExtManual: 'static { pub trait BaseSrcExtManual: 'static {
@ -25,7 +25,7 @@ pub trait BaseSrcExtManual: 'static {
impl<O: IsA<BaseSrc>> BaseSrcExtManual for O { impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
fn get_segment(&self) -> gst::Segment { fn get_segment(&self) -> gst::Segment {
unsafe { 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); ::utils::MutexGuard::lock(&src.element.object.lock);
from_glib_none(&src.segment as *const _) from_glib_none(&src.segment as *const _)
} }
@ -34,19 +34,25 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
fn start_complete(&self, ret: Result<gst::FlowSuccess, gst::FlowError>) { fn start_complete(&self, ret: Result<gst::FlowSuccess, gst::FlowError>) {
let ret: gst::FlowReturn = ret.into(); let ret: gst::FlowReturn = ret.into();
unsafe { 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<gst::FlowSuccess, gst::FlowError> { fn start_wait(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = let ret: gst::FlowReturn = unsafe {
unsafe { from_glib(ffi::gst_base_src_start_wait(self.as_ref().to_glib_none().0)) }; from_glib(gst_base_sys::gst_base_src_start_wait(
self.as_ref().to_glib_none().0,
))
};
ret.into_result() ret.into_result()
} }
fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError> { fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
}; };

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_base_sys;
use BaseTransform; use BaseTransform;
pub trait BaseTransformExtManual: 'static { pub trait BaseTransformExtManual: 'static {
@ -19,7 +19,7 @@ pub trait BaseTransformExtManual: 'static {
impl<O: IsA<BaseTransform>> BaseTransformExtManual for O { impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
fn get_segment(&self) -> gst::Segment { fn get_segment(&self) -> gst::Segment {
unsafe { 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); ::utils::MutexGuard::lock(&trans.element.object.lock);
from_glib_none(&trans.segment as *const _) from_glib_none(&trans.segment as *const _)
} }

View file

@ -6,50 +6,56 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gobject_ffi; use gobject_sys;
use gst; use gst;
use gst_base_sys;
glib_wrapper! { glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FlowCombiner(Shared<ffi::GstFlowCombiner>); pub struct FlowCombiner(Shared<gst_base_sys::GstFlowCombiner>);
match fn { match fn {
ref => |ptr| gobject_ffi::g_boxed_copy(ffi::gst_flow_combiner_get_type(), ptr as *mut _), ref => |ptr| gobject_sys::g_boxed_copy(gst_base_sys::gst_flow_combiner_get_type(), ptr as *mut _),
unref => |ptr| gobject_ffi::g_boxed_free(ffi::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 => || ffi::gst_flow_combiner_get_type(), get_type => || gst_base_sys::gst_flow_combiner_get_type(),
} }
} }
impl FlowCombiner { impl FlowCombiner {
pub fn new() -> FlowCombiner { pub fn new() -> FlowCombiner {
assert_initialized_main_thread!(); 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<P: IsA<gst::Pad>>(&self, pad: &P) { pub fn add_pad<P: IsA<gst::Pad>>(&self, pad: &P) {
unsafe { 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) { pub fn clear(&self) {
unsafe { 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<P: IsA<gst::Pad>>(&self, pad: &P) { pub fn remove_pad<P: IsA<gst::Pad>>(&self, pad: &P) {
unsafe { 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) { pub fn reset(&self) {
unsafe { 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<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let fret: gst::FlowReturn = fret.into(); let fret: gst::FlowReturn = fret.into();
let ret: gst::FlowReturn = unsafe { 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, self.to_glib_none().0,
fret.to_glib(), fret.to_glib(),
)) ))
@ -74,7 +80,7 @@ impl FlowCombiner {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let fret: gst::FlowReturn = fret.into(); let fret: gst::FlowReturn = fret.into();
let ret: gst::FlowReturn = unsafe { 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, self.to_glib_none().0,
pad.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0,
fret.to_glib(), fret.to_glib(),

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_base_sys;
use std::mem; use std::mem;
pub fn type_find_helper_for_data< pub fn type_find_helper_for_data<
@ -27,7 +27,7 @@ pub fn type_find_helper_for_data<
let mut prob = mem::uninitialized(); let mut prob = mem::uninitialized();
let data = data.as_ref(); let data = data.as_ref();
let (ptr, len) = (data.as_ptr(), data.len()); 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, obj.map(|p| p.as_ref()).to_glib_none().0,
mut_override(ptr), mut_override(ptr),
len, len,

View file

@ -6,12 +6,12 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
#[cfg_attr(feature = "subclassing", macro_use)] #[cfg_attr(feature = "subclassing", macro_use)]
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_base_sys as ffi; extern crate gstreamer_base_sys as gst_base_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
extern crate libc; extern crate libc;
@ -20,7 +20,7 @@ extern crate glib;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

View file

@ -8,9 +8,9 @@
use libc; use libc;
use ffi; use glib_sys;
use glib_ffi; use gst_base_sys;
use gst_ffi; use gst_sys;
use glib::translate::*; use glib::translate::*;
use prelude::*; use prelude::*;
@ -211,7 +211,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> { fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.flush .flush
.map(|f| from_glib(f(aggregator.to_glib_none().0))) .map(|f| from_glib(f(aggregator.to_glib_none().0)))
@ -228,7 +229,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> Option<gst::Buffer> { ) -> Option<gst::Buffer> {
unsafe { unsafe {
let data = self.get_type_data(); 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 { match (*parent_class).clip {
None => Some(buffer), None => Some(buffer),
Some(ref func) => from_glib_full(func( Some(ref func) => from_glib_full(func(
@ -247,7 +249,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.finish_buffer .finish_buffer
.expect("Missing parent function `finish_buffer`"); .expect("Missing parent function `finish_buffer`");
@ -264,7 +267,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.sink_event .sink_event
.expect("Missing parent function `sink_event`"); .expect("Missing parent function `sink_event`");
@ -284,7 +288,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.sink_query .sink_query
.expect("Missing parent function `sink_query`"); .expect("Missing parent function `sink_query`");
@ -299,7 +304,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool { fn parent_src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.src_event .src_event
.expect("Missing parent function `src_event`"); .expect("Missing parent function `src_event`");
@ -310,7 +316,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool { fn parent_src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.src_query .src_query
.expect("Missing parent function `src_query`"); .expect("Missing parent function `src_query`");
@ -326,7 +333,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> Result<(), gst::LoggableError> { ) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = self.get_type_data(); 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 { match (*parent_class).src_activate {
None => Ok(()), None => Ok(()),
Some(f) => gst_result_from_gboolean!( Some(f) => gst_result_from_gboolean!(
@ -349,7 +357,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.aggregate .aggregate
.expect("Missing parent function `aggregate`"); .expect("Missing parent function `aggregate`");
@ -361,7 +370,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> { fn parent_start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.start .start
.map(|f| { .map(|f| {
@ -381,7 +391,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> { fn parent_stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.stop .stop
.map(|f| { .map(|f| {
@ -401,7 +412,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime { fn parent_get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.get_next_time .get_next_time
.map(|f| from_glib(f(aggregator.to_glib_none().0))) .map(|f| from_glib(f(aggregator.to_glib_none().0)))
@ -418,7 +430,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> Option<AggregatorPad> { ) -> Option<AggregatorPad> {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.create_new_pad .create_new_pad
.expect("Missing parent function `create_new_pad`"); .expect("Missing parent function `create_new_pad`");
@ -438,7 +451,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> Result<gst::Caps, gst::FlowError> { ) -> Result<gst::Caps, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.update_src_caps .update_src_caps
.expect("Missing parent function `update_src_caps`"); .expect("Missing parent function `update_src_caps`");
@ -456,7 +470,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
fn parent_fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps { fn parent_fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps {
unsafe { unsafe {
let data = self.get_type_data(); 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) let f = (*parent_class)
.fixate_src_caps .fixate_src_caps
@ -472,7 +487,8 @@ impl<T: AggregatorImpl + ObjectImpl> AggregatorImplExt for T {
) -> Result<(), gst::LoggableError> { ) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.negotiated_src_caps .negotiated_src_caps
.map(|f| { .map(|f| {
@ -494,7 +510,7 @@ where
fn override_vfuncs(&mut self) { fn override_vfuncs(&mut self) {
<gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self); <gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self);
unsafe { 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::<T>); klass.flush = Some(aggregator_flush::<T>);
klass.clip = Some(aggregator_clip::<T>); klass.clip = Some(aggregator_clip::<T>);
klass.finish_buffer = Some(aggregator_finish_buffer::<T>); klass.finish_buffer = Some(aggregator_finish_buffer::<T>);
@ -516,8 +532,8 @@ where
} }
unsafe extern "C" fn aggregator_flush<T: ObjectSubclass>( unsafe extern "C" fn aggregator_flush<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -534,10 +550,10 @@ where
} }
unsafe extern "C" fn aggregator_clip<T: ObjectSubclass>( unsafe extern "C" fn aggregator_clip<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad, aggregator_pad: *mut gst_base_sys::GstAggregatorPad,
buffer: *mut gst_ffi::GstBuffer, buffer: *mut gst_sys::GstBuffer,
) -> *mut gst_ffi::GstBuffer ) -> *mut gst_sys::GstBuffer
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -559,9 +575,9 @@ where
} }
unsafe extern "C" fn aggregator_finish_buffer<T: ObjectSubclass>( unsafe extern "C" fn aggregator_finish_buffer<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
buffer: *mut gst_ffi::GstBuffer, buffer: *mut gst_sys::GstBuffer,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -578,10 +594,10 @@ where
} }
unsafe extern "C" fn aggregator_sink_event<T: ObjectSubclass>( unsafe extern "C" fn aggregator_sink_event<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad, aggregator_pad: *mut gst_base_sys::GstAggregatorPad,
event: *mut gst_ffi::GstEvent, event: *mut gst_sys::GstEvent,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -602,10 +618,10 @@ where
} }
unsafe extern "C" fn aggregator_sink_query<T: ObjectSubclass>( unsafe extern "C" fn aggregator_sink_query<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
aggregator_pad: *mut ffi::GstAggregatorPad, aggregator_pad: *mut gst_base_sys::GstAggregatorPad,
query: *mut gst_ffi::GstQuery, query: *mut gst_sys::GstQuery,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -626,9 +642,9 @@ where
} }
unsafe extern "C" fn aggregator_src_event<T: ObjectSubclass>( unsafe extern "C" fn aggregator_src_event<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
event: *mut gst_ffi::GstEvent, event: *mut gst_sys::GstEvent,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -645,9 +661,9 @@ where
} }
unsafe extern "C" fn aggregator_src_query<T: ObjectSubclass>( unsafe extern "C" fn aggregator_src_query<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
query: *mut gst_ffi::GstQuery, query: *mut gst_sys::GstQuery,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -664,10 +680,10 @@ where
} }
unsafe extern "C" fn aggregator_src_activate<T: ObjectSubclass>( unsafe extern "C" fn aggregator_src_activate<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
mode: gst_ffi::GstPadMode, mode: gst_sys::GstPadMode,
active: glib_ffi::gboolean, active: glib_sys::gboolean,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -690,9 +706,9 @@ where
} }
unsafe extern "C" fn aggregator_aggregate<T: ObjectSubclass>( unsafe extern "C" fn aggregator_aggregate<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
timeout: glib_ffi::gboolean, timeout: glib_sys::gboolean,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -709,8 +725,8 @@ where
} }
unsafe extern "C" fn aggregator_start<T: ObjectSubclass>( unsafe extern "C" fn aggregator_start<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -733,8 +749,8 @@ where
} }
unsafe extern "C" fn aggregator_stop<T: ObjectSubclass>( unsafe extern "C" fn aggregator_stop<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -757,8 +773,8 @@ where
} }
unsafe extern "C" fn aggregator_get_next_time<T: ObjectSubclass>( unsafe extern "C" fn aggregator_get_next_time<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
) -> gst_ffi::GstClockTime ) -> gst_sys::GstClockTime
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -775,11 +791,11 @@ where
} }
unsafe extern "C" fn aggregator_create_new_pad<T: ObjectSubclass>( unsafe extern "C" fn aggregator_create_new_pad<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
templ: *mut gst_ffi::GstPadTemplate, templ: *mut gst_sys::GstPadTemplate,
req_name: *const libc::c_char, req_name: *const libc::c_char,
caps: *const gst_ffi::GstCaps, caps: *const gst_sys::GstCaps,
) -> *mut ffi::GstAggregatorPad ) -> *mut gst_base_sys::GstAggregatorPad
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -817,10 +833,10 @@ where
} }
unsafe extern "C" fn aggregator_update_src_caps<T: ObjectSubclass>( unsafe extern "C" fn aggregator_update_src_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
res: *mut *mut gst_ffi::GstCaps, res: *mut *mut gst_sys::GstCaps,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -845,9 +861,9 @@ where
} }
unsafe extern "C" fn aggregator_fixate_src_caps<T: ObjectSubclass>( unsafe extern "C" fn aggregator_fixate_src_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
) -> *mut gst_ffi::GstCaps ) -> *mut gst_sys::GstCaps
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -864,9 +880,9 @@ where
} }
unsafe extern "C" fn aggregator_negotiated_src_caps<T: ObjectSubclass>( unsafe extern "C" fn aggregator_negotiated_src_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregator, ptr: *mut gst_base_sys::GstAggregator,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorImpl, T: AggregatorImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gst_base_sys;
use gst_ffi; use gst_sys;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
@ -63,7 +63,8 @@ impl<T: AggregatorPadImpl + ObjectImpl> AggregatorPadImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.flush .flush
.map(|f| { .map(|f| {
@ -85,7 +86,8 @@ impl<T: AggregatorPadImpl + ObjectImpl> AggregatorPadImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.skip_buffer .skip_buffer
.map(|f| { .map(|f| {
@ -103,7 +105,7 @@ unsafe impl<T: ObjectSubclass + AggregatorPadImpl> IsSubclassable<T> for Aggrega
fn override_vfuncs(&mut self) { fn override_vfuncs(&mut self) {
<gst::PadClass as IsSubclassable<T>>::override_vfuncs(self); <gst::PadClass as IsSubclassable<T>>::override_vfuncs(self);
unsafe { 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::<T>); klass.flush = Some(aggregator_pad_flush::<T>);
klass.skip_buffer = Some(aggregator_pad_skip_buffer::<T>); klass.skip_buffer = Some(aggregator_pad_skip_buffer::<T>);
} }
@ -111,9 +113,9 @@ unsafe impl<T: ObjectSubclass + AggregatorPadImpl> IsSubclassable<T> for Aggrega
} }
unsafe extern "C" fn aggregator_pad_flush<T: ObjectSubclass>( unsafe extern "C" fn aggregator_pad_flush<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregatorPad, ptr: *mut gst_base_sys::GstAggregatorPad,
aggregator: *mut ffi::GstAggregator, aggregator: *mut gst_base_sys::GstAggregator,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: AggregatorPadImpl, T: AggregatorPadImpl,
{ {
@ -127,10 +129,10 @@ where
} }
unsafe extern "C" fn aggregator_pad_skip_buffer<T: ObjectSubclass>( unsafe extern "C" fn aggregator_pad_skip_buffer<T: ObjectSubclass>(
ptr: *mut ffi::GstAggregatorPad, ptr: *mut gst_base_sys::GstAggregatorPad,
aggregator: *mut ffi::GstAggregator, aggregator: *mut gst_base_sys::GstAggregator,
buffer: *mut gst_ffi::GstBuffer, buffer: *mut gst_sys::GstBuffer,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: AggregatorPadImpl, T: AggregatorPadImpl,
{ {

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gst_base_sys;
use gst_ffi; use gst_sys;
use glib::translate::*; use glib::translate::*;
use prelude::*; use prelude::*;
@ -146,7 +146,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
fn parent_start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { fn parent_start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.start .start
.map(|f| { .map(|f| {
@ -166,7 +167,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
fn parent_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { fn parent_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.stop .stop
.map(|f| { .map(|f| {
@ -190,7 +192,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.render .render
.map(|f| { .map(|f| {
@ -208,7 +211,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.prepare .prepare
.map(|f| from_glib(f(element.to_glib_none().0, buffer.as_mut_ptr()))) .map(|f| from_glib(f(element.to_glib_none().0, buffer.as_mut_ptr())))
@ -224,7 +228,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.render_list .render_list
.map(|f| { .map(|f| {
@ -247,7 +252,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.prepare_list .prepare_list
.map(|f| { .map(|f| {
@ -266,7 +272,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
fn parent_query(&self, element: &BaseSink, query: &mut gst::QueryRef) -> bool { fn parent_query(&self, element: &BaseSink, query: &mut gst::QueryRef) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.query .query
.map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr()))) .map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr())))
@ -277,7 +284,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
fn parent_event(&self, element: &BaseSink, event: gst::Event) -> bool { fn parent_event(&self, element: &BaseSink, event: gst::Event) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.event .event
.map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr()))) .map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr())))
@ -292,7 +300,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
) -> Option<gst::Caps> { ) -> Option<gst::Caps> {
unsafe { unsafe {
let data = self.get_type_data(); 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 { let filter_ptr = if let Some(filter) = filter {
filter.as_mut_ptr() filter.as_mut_ptr()
} else { } else {
@ -313,7 +322,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
) -> Result<(), gst::LoggableError> { ) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.set_caps .set_caps
.map(|f| { .map(|f| {
@ -330,7 +340,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
fn parent_fixate(&self, element: &BaseSink, caps: gst::Caps) -> gst::Caps { fn parent_fixate(&self, element: &BaseSink, caps: gst::Caps) -> gst::Caps {
unsafe { unsafe {
let data = self.get_type_data(); 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 { match (*parent_class).fixate {
Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())), Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())),
@ -342,7 +353,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
fn parent_unlock(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { fn parent_unlock(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.unlock .unlock
.map(|f| { .map(|f| {
@ -362,7 +374,8 @@ impl<T: BaseSinkImpl + ObjectImpl> BaseSinkImplExt for T {
fn parent_unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { fn parent_unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.unlock_stop .unlock_stop
.map(|f| { .map(|f| {
@ -387,7 +400,7 @@ where
fn override_vfuncs(&mut self) { fn override_vfuncs(&mut self) {
<gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self); <gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self);
unsafe { 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::<T>); klass.start = Some(base_sink_start::<T>);
klass.stop = Some(base_sink_stop::<T>); klass.stop = Some(base_sink_stop::<T>);
klass.render = Some(base_sink_render::<T>); klass.render = Some(base_sink_render::<T>);
@ -406,8 +419,8 @@ where
} }
unsafe extern "C" fn base_sink_start<T: ObjectSubclass>( unsafe extern "C" fn base_sink_start<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -430,8 +443,8 @@ where
} }
unsafe extern "C" fn base_sink_stop<T: ObjectSubclass>( unsafe extern "C" fn base_sink_stop<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -454,9 +467,9 @@ where
} }
unsafe extern "C" fn base_sink_render<T: ObjectSubclass>( unsafe extern "C" fn base_sink_render<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
buffer: *mut gst_ffi::GstBuffer, buffer: *mut gst_sys::GstBuffer,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -474,9 +487,9 @@ where
} }
unsafe extern "C" fn base_sink_prepare<T: ObjectSubclass>( unsafe extern "C" fn base_sink_prepare<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
buffer: *mut gst_ffi::GstBuffer, buffer: *mut gst_sys::GstBuffer,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -494,9 +507,9 @@ where
} }
unsafe extern "C" fn base_sink_render_list<T: ObjectSubclass>( unsafe extern "C" fn base_sink_render_list<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
list: *mut gst_ffi::GstBufferList, list: *mut gst_sys::GstBufferList,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -514,9 +527,9 @@ where
} }
unsafe extern "C" fn base_sink_prepare_list<T: ObjectSubclass>( unsafe extern "C" fn base_sink_prepare_list<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
list: *mut gst_ffi::GstBufferList, list: *mut gst_sys::GstBufferList,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -534,9 +547,9 @@ where
} }
unsafe extern "C" fn base_sink_query<T: ObjectSubclass>( unsafe extern "C" fn base_sink_query<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
query_ptr: *mut gst_ffi::GstQuery, query_ptr: *mut gst_sys::GstQuery,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -554,9 +567,9 @@ where
} }
unsafe extern "C" fn base_sink_event<T: ObjectSubclass>( unsafe extern "C" fn base_sink_event<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
event_ptr: *mut gst_ffi::GstEvent, event_ptr: *mut gst_sys::GstEvent,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -573,9 +586,9 @@ where
} }
unsafe extern "C" fn base_sink_get_caps<T: ObjectSubclass>( unsafe extern "C" fn base_sink_get_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
filter: *mut gst_ffi::GstCaps, filter: *mut gst_sys::GstCaps,
) -> *mut gst_ffi::GstCaps ) -> *mut gst_sys::GstCaps
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -598,9 +611,9 @@ where
} }
unsafe extern "C" fn base_sink_set_caps<T: ObjectSubclass>( unsafe extern "C" fn base_sink_set_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -624,9 +637,9 @@ where
} }
unsafe extern "C" fn base_sink_fixate<T: ObjectSubclass>( unsafe extern "C" fn base_sink_fixate<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
) -> *mut gst_ffi::GstCaps ) -> *mut gst_sys::GstCaps
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -644,8 +657,8 @@ where
} }
unsafe extern "C" fn base_sink_unlock<T: ObjectSubclass>( unsafe extern "C" fn base_sink_unlock<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -668,8 +681,8 @@ where
} }
unsafe extern "C" fn base_sink_unlock_stop<T: ObjectSubclass>( unsafe extern "C" fn base_sink_unlock_stop<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSink, ptr: *mut gst_base_sys::GstBaseSink,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSinkImpl, T: BaseSinkImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gst_base_sys;
use gst_ffi; use gst_sys;
use glib::translate::*; use glib::translate::*;
use prelude::*; use prelude::*;
@ -150,7 +150,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { fn parent_start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.start .start
.map(|f| { .map(|f| {
@ -170,7 +171,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { fn parent_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.stop .stop
.map(|f| { .map(|f| {
@ -190,7 +192,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_is_seekable(&self, element: &BaseSrc) -> bool { fn parent_is_seekable(&self, element: &BaseSrc) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.is_seekable .is_seekable
.map(|f| from_glib(f(element.to_glib_none().0))) .map(|f| from_glib(f(element.to_glib_none().0)))
@ -201,7 +204,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_get_size(&self, element: &BaseSrc) -> Option<u64> { fn parent_get_size(&self, element: &BaseSrc) -> Option<u64> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.get_size .get_size
.map(|f| { .map(|f| {
@ -225,7 +229,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.fill .fill
.map(|f| { .map(|f| {
@ -249,14 +254,15 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
) -> Result<gst::Buffer, gst::FlowError> { ) -> Result<gst::Buffer, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.create .create
.map(|f| { .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 // FIXME: Wrong signature in -sys bindings
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // 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 = let ret: gst::FlowReturn =
from_glib(f(element.to_glib_none().0, offset, length, buffer_ref)); from_glib(f(element.to_glib_none().0, offset, length, buffer_ref));
@ -269,7 +275,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_do_seek(&self, element: &BaseSrc, segment: &mut gst::Segment) -> bool { fn parent_do_seek(&self, element: &BaseSrc, segment: &mut gst::Segment) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.do_seek .do_seek
.map(|f| from_glib(f(element.to_glib_none().0, segment.to_glib_none_mut().0))) .map(|f| from_glib(f(element.to_glib_none().0, segment.to_glib_none_mut().0)))
@ -280,7 +287,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_query(&self, element: &BaseSrc, query: &mut gst::QueryRef) -> bool { fn parent_query(&self, element: &BaseSrc, query: &mut gst::QueryRef) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.query .query
.map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr()))) .map(|f| from_glib(f(element.to_glib_none().0, query.as_mut_ptr())))
@ -291,7 +299,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_event(&self, element: &BaseSrc, event: &gst::Event) -> bool { fn parent_event(&self, element: &BaseSrc, event: &gst::Event) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.event .event
.map(|f| from_glib(f(element.to_glib_none().0, event.to_glib_none().0))) .map(|f| from_glib(f(element.to_glib_none().0, event.to_glib_none().0)))
@ -306,7 +315,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
) -> Option<gst::Caps> { ) -> Option<gst::Caps> {
unsafe { unsafe {
let data = self.get_type_data(); 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 { let filter_ptr = if let Some(filter) = filter {
filter.as_mut_ptr() filter.as_mut_ptr()
} else { } else {
@ -323,7 +333,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_negotiate(&self, element: &BaseSrc) -> Result<(), gst::LoggableError> { fn parent_negotiate(&self, element: &BaseSrc) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.negotiate .negotiate
.map(|f| { .map(|f| {
@ -344,7 +355,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
) -> Result<(), gst::LoggableError> { ) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.set_caps .set_caps
.map(|f| { .map(|f| {
@ -361,7 +373,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_fixate(&self, element: &BaseSrc, caps: gst::Caps) -> gst::Caps { fn parent_fixate(&self, element: &BaseSrc, caps: gst::Caps) -> gst::Caps {
unsafe { unsafe {
let data = self.get_type_data(); 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 { match (*parent_class).fixate {
Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())), Some(fixate) => from_glib_full(fixate(element.to_glib_none().0, caps.into_ptr())),
@ -373,7 +386,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_unlock(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { fn parent_unlock(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.unlock .unlock
.map(|f| { .map(|f| {
@ -393,7 +407,8 @@ impl<T: BaseSrcImpl + ObjectImpl> BaseSrcImplExt for T {
fn parent_unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { fn parent_unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.unlock_stop .unlock_stop
.map(|f| { .map(|f| {
@ -418,7 +433,7 @@ where
fn override_vfuncs(&mut self) { fn override_vfuncs(&mut self) {
<gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self); <gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self);
unsafe { 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::<T>); klass.start = Some(base_src_start::<T>);
klass.stop = Some(base_src_stop::<T>); klass.stop = Some(base_src_stop::<T>);
klass.is_seekable = Some(base_src_is_seekable::<T>); klass.is_seekable = Some(base_src_is_seekable::<T>);
@ -439,8 +454,8 @@ where
} }
unsafe extern "C" fn base_src_start<T: ObjectSubclass>( unsafe extern "C" fn base_src_start<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -463,8 +478,8 @@ where
} }
unsafe extern "C" fn base_src_stop<T: ObjectSubclass>( unsafe extern "C" fn base_src_stop<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -487,8 +502,8 @@ where
} }
unsafe extern "C" fn base_src_is_seekable<T: ObjectSubclass>( unsafe extern "C" fn base_src_is_seekable<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -505,9 +520,9 @@ where
} }
unsafe extern "C" fn base_src_get_size<T: ObjectSubclass>( unsafe extern "C" fn base_src_get_size<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
size: *mut u64, size: *mut u64,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -530,11 +545,11 @@ where
} }
unsafe extern "C" fn base_src_fill<T: ObjectSubclass>( unsafe extern "C" fn base_src_fill<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
offset: u64, offset: u64,
length: u32, length: u32,
buffer: *mut gst_ffi::GstBuffer, buffer: *mut gst_sys::GstBuffer,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -552,11 +567,11 @@ where
} }
unsafe extern "C" fn base_src_create<T: ObjectSubclass>( unsafe extern "C" fn base_src_create<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
offset: u64, offset: u64,
length: u32, length: u32,
buffer_ptr: *mut gst_ffi::GstBuffer, buffer_ptr: *mut gst_sys::GstBuffer,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -567,7 +582,7 @@ where
let wrap: BaseSrc = from_glib_borrow(ptr); let wrap: BaseSrc = from_glib_borrow(ptr);
// FIXME: Wrong signature in -sys bindings // FIXME: Wrong signature in -sys bindings
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // 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, { gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.create(&wrap, offset, length) { match imp.create(&wrap, offset, length) {
@ -582,9 +597,9 @@ where
} }
unsafe extern "C" fn base_src_do_seek<T: ObjectSubclass>( unsafe extern "C" fn base_src_do_seek<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
segment: *mut gst_ffi::GstSegment, segment: *mut gst_sys::GstSegment,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -601,9 +616,9 @@ where
} }
unsafe extern "C" fn base_src_query<T: ObjectSubclass>( unsafe extern "C" fn base_src_query<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
query_ptr: *mut gst_ffi::GstQuery, query_ptr: *mut gst_sys::GstQuery,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -621,9 +636,9 @@ where
} }
unsafe extern "C" fn base_src_event<T: ObjectSubclass>( unsafe extern "C" fn base_src_event<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
event_ptr: *mut gst_ffi::GstEvent, event_ptr: *mut gst_sys::GstEvent,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -640,9 +655,9 @@ where
} }
unsafe extern "C" fn base_src_get_caps<T: ObjectSubclass>( unsafe extern "C" fn base_src_get_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
filter: *mut gst_ffi::GstCaps, filter: *mut gst_sys::GstCaps,
) -> *mut gst_ffi::GstCaps ) -> *mut gst_sys::GstCaps
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -665,8 +680,8 @@ where
} }
unsafe extern "C" fn base_src_negotiate<T: ObjectSubclass>( unsafe extern "C" fn base_src_negotiate<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -689,9 +704,9 @@ where
} }
unsafe extern "C" fn base_src_set_caps<T: ObjectSubclass>( unsafe extern "C" fn base_src_set_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -715,9 +730,9 @@ where
} }
unsafe extern "C" fn base_src_fixate<T: ObjectSubclass>( unsafe extern "C" fn base_src_fixate<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
) -> *mut gst_ffi::GstCaps ) -> *mut gst_sys::GstCaps
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -735,8 +750,8 @@ where
} }
unsafe extern "C" fn base_src_unlock<T: ObjectSubclass>( unsafe extern "C" fn base_src_unlock<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -759,8 +774,8 @@ where
} }
unsafe extern "C" fn base_src_unlock_stop<T: ObjectSubclass>( unsafe extern "C" fn base_src_unlock_stop<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseSrc, ptr: *mut gst_base_sys::GstBaseSrc,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseSrcImpl, T: BaseSrcImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gst_base_sys;
use gst_ffi; use gst_sys;
use glib::translate::*; use glib::translate::*;
use prelude::*; use prelude::*;
@ -201,7 +201,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
fn parent_start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> { fn parent_start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.start .start
.map(|f| { .map(|f| {
@ -221,7 +222,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
fn parent_stop(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> { fn parent_stop(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.stop .stop
.map(|f| { .map(|f| {
@ -247,7 +249,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> Option<gst::Caps> { ) -> Option<gst::Caps> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.transform_caps .transform_caps
.map(|f| { .map(|f| {
@ -271,7 +274,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> gst::Caps { ) -> gst::Caps {
unsafe { unsafe {
let data = self.get_type_data(); 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 { match (*parent_class).fixate_caps {
Some(f) => from_glib_full(f( Some(f) => from_glib_full(f(
element.to_glib_none().0, element.to_glib_none().0,
@ -292,7 +296,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.set_caps .set_caps
.map(|f| { .map(|f| {
@ -314,7 +319,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.accept_caps .accept_caps
.map(|f| { .map(|f| {
@ -336,7 +342,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.query .query
.map(|f| { .map(|f| {
@ -360,7 +367,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> Option<usize> { ) -> Option<usize> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.transform_size .transform_size
.map(|f| { .map(|f| {
@ -386,7 +394,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
fn parent_get_unit_size(&self, element: &BaseTransform, caps: &gst::Caps) -> Option<usize> { fn parent_get_unit_size(&self, element: &BaseTransform, caps: &gst::Caps) -> Option<usize> {
unsafe { unsafe {
let data = self.get_type_data(); 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(|| { let f = (*parent_class).get_unit_size.unwrap_or_else(|| {
if !element.is_in_place() { if !element.is_in_place() {
unimplemented!(concat!( unimplemented!(concat!(
@ -417,7 +426,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
fn parent_sink_event(&self, element: &BaseTransform, event: gst::Event) -> bool { fn parent_sink_event(&self, element: &BaseTransform, event: gst::Event) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.sink_event .sink_event
.map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr()))) .map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr())))
@ -428,7 +438,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
fn parent_src_event(&self, element: &BaseTransform, event: gst::Event) -> bool { fn parent_src_event(&self, element: &BaseTransform, event: gst::Event) -> bool {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.src_event .src_event
.map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr()))) .map(|f| from_glib(f(element.to_glib_none().0, event.into_ptr())))
@ -444,7 +455,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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) (*parent_class)
.transform .transform
.map(|f| { .map(|f| {
@ -475,7 +487,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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(|| { let f = (*parent_class).transform_ip.unwrap_or_else(|| {
if element.is_in_place() { if element.is_in_place() {
panic!(concat!( panic!(concat!(
@ -502,7 +515,8 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); 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(|| { let f = (*parent_class).transform_ip.unwrap_or_else(|| {
if element.is_in_place() { if element.is_in_place() {
panic!(concat!( panic!(concat!(
@ -537,7 +551,7 @@ where
fn override_vfuncs(&mut self) { fn override_vfuncs(&mut self) {
<gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self); <gst::ElementClass as IsSubclassable<T>>::override_vfuncs(self);
unsafe { 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::<T>); klass.start = Some(base_transform_start::<T>);
klass.stop = Some(base_transform_stop::<T>); klass.stop = Some(base_transform_stop::<T>);
klass.transform_caps = Some(base_transform_transform_caps::<T>); klass.transform_caps = Some(base_transform_transform_caps::<T>);
@ -564,7 +578,7 @@ pub unsafe trait BaseTransformClassSubclassExt: Sized + 'static {
<T as ObjectSubclass>::Instance: PanicPoison, <T as ObjectSubclass>::Instance: PanicPoison,
{ {
unsafe { 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.passthrough_on_same_caps = passthrough_on_same_caps.to_glib();
klass.transform_ip_on_passthrough = transform_ip_on_passthrough.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<T: ObjectSubclass>( unsafe extern "C" fn base_transform_start<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -617,8 +631,8 @@ where
} }
unsafe extern "C" fn base_transform_stop<T: ObjectSubclass>( unsafe extern "C" fn base_transform_stop<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -641,11 +655,11 @@ where
} }
unsafe extern "C" fn base_transform_transform_caps<T: ObjectSubclass>( unsafe extern "C" fn base_transform_transform_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
direction: gst_ffi::GstPadDirection, direction: gst_sys::GstPadDirection,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
filter: *mut gst_ffi::GstCaps, filter: *mut gst_sys::GstCaps,
) -> *mut gst_ffi::GstCaps ) -> *mut gst_sys::GstCaps
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -674,11 +688,11 @@ where
} }
unsafe extern "C" fn base_transform_fixate_caps<T: ObjectSubclass>( unsafe extern "C" fn base_transform_fixate_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
direction: gst_ffi::GstPadDirection, direction: gst_sys::GstPadDirection,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
othercaps: *mut gst_ffi::GstCaps, othercaps: *mut gst_sys::GstCaps,
) -> *mut gst_ffi::GstCaps ) -> *mut gst_sys::GstCaps
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -700,10 +714,10 @@ where
} }
unsafe extern "C" fn base_transform_set_caps<T: ObjectSubclass>( unsafe extern "C" fn base_transform_set_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
incaps: *mut gst_ffi::GstCaps, incaps: *mut gst_sys::GstCaps,
outcaps: *mut gst_ffi::GstCaps, outcaps: *mut gst_sys::GstCaps,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -720,10 +734,10 @@ where
} }
unsafe extern "C" fn base_transform_accept_caps<T: ObjectSubclass>( unsafe extern "C" fn base_transform_accept_caps<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
direction: gst_ffi::GstPadDirection, direction: gst_sys::GstPadDirection,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -740,10 +754,10 @@ where
} }
unsafe extern "C" fn base_transform_query<T: ObjectSubclass>( unsafe extern "C" fn base_transform_query<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
direction: gst_ffi::GstPadDirection, direction: gst_sys::GstPadDirection,
query: *mut gst_ffi::GstQuery, query: *mut gst_sys::GstQuery,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -765,13 +779,13 @@ where
} }
unsafe extern "C" fn base_transform_transform_size<T: ObjectSubclass>( unsafe extern "C" fn base_transform_transform_size<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
direction: gst_ffi::GstPadDirection, direction: gst_sys::GstPadDirection,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
size: usize, size: usize,
othercaps: *mut gst_ffi::GstCaps, othercaps: *mut gst_sys::GstCaps,
othersize: *mut usize, othersize: *mut usize,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -800,10 +814,10 @@ where
} }
unsafe extern "C" fn base_transform_get_unit_size<T: ObjectSubclass>( unsafe extern "C" fn base_transform_get_unit_size<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
caps: *mut gst_ffi::GstCaps, caps: *mut gst_sys::GstCaps,
size: *mut usize, size: *mut usize,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -826,9 +840,9 @@ where
} }
unsafe extern "C" fn base_transform_sink_event<T: ObjectSubclass>( unsafe extern "C" fn base_transform_sink_event<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
event: *mut gst_ffi::GstEvent, event: *mut gst_sys::GstEvent,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -845,9 +859,9 @@ where
} }
unsafe extern "C" fn base_transform_src_event<T: ObjectSubclass>( unsafe extern "C" fn base_transform_src_event<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
event: *mut gst_ffi::GstEvent, event: *mut gst_sys::GstEvent,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -864,10 +878,10 @@ where
} }
unsafe extern "C" fn base_transform_transform<T: ObjectSubclass>( unsafe extern "C" fn base_transform_transform<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
inbuf: *mut gst_ffi::GstBuffer, inbuf: *mut gst_sys::GstBuffer,
outbuf: *mut gst_ffi::GstBuffer, outbuf: *mut gst_sys::GstBuffer,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -889,9 +903,9 @@ where
} }
unsafe extern "C" fn base_transform_transform_ip<T: ObjectSubclass>( unsafe extern "C" fn base_transform_transform_ip<T: ObjectSubclass>(
ptr: *mut ffi::GstBaseTransform, ptr: *mut gst_base_sys::GstBaseTransform,
buf: *mut *mut gst_ffi::GstBuffer, buf: *mut *mut gst_sys::GstBuffer,
) -> gst_ffi::GstFlowReturn ) -> gst_sys::GstFlowReturn
where where
T: BaseTransformImpl, T: BaseTransformImpl,
T::Instance: PanicPoison, T::Instance: PanicPoison,
@ -902,10 +916,10 @@ where
let wrap: BaseTransform = from_glib_borrow(ptr); let wrap: BaseTransform = from_glib_borrow(ptr);
// FIXME: Wrong signature in FFI // 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, { 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)) imp.transform_ip_passthrough(&wrap, gst::BufferRef::from_ptr(buf))
.into() .into()
} else { } else {

View file

@ -7,15 +7,15 @@
// except according to those terms. // except according to those terms.
use glib::translate::mut_override; 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> { impl<'a> MutexGuard<'a> {
#[allow(clippy::trivially_copy_pass_by_ref)] #[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 { unsafe {
glib_ffi::g_mutex_lock(mut_override(mutex)); glib_sys::g_mutex_lock(mut_override(mutex));
} }
MutexGuard(mutex) MutexGuard(mutex)
} }
@ -24,7 +24,7 @@ impl<'a> MutexGuard<'a> {
impl<'a> Drop for MutexGuard<'a> { impl<'a> Drop for MutexGuard<'a> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
glib_ffi::g_mutex_unlock(mut_override(self.0)); glib_sys::g_mutex_unlock(mut_override(self.0));
} }
} }
} }

View file

@ -6,14 +6,14 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_sys;
use gobject_ffi; use gobject_sys;
use gst; use gst;
use gst::prelude::*; use gst::prelude::*;
use gst_check_sys;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::mem; use std::mem;
use std::ops; use std::ops;
@ -22,12 +22,15 @@ use std::ptr;
use TestClock; use TestClock;
#[derive(Debug)] #[derive(Debug)]
pub struct Harness(ptr::NonNull<ffi::GstHarness>, PhantomData<ffi::GstHarness>); pub struct Harness(
ptr::NonNull<gst_check_sys::GstHarness>,
PhantomData<gst_check_sys::GstHarness>,
);
impl Drop for Harness { impl Drop for Harness {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { unsafe {
ffi::gst_harness_add_element_full( gst_check_sys::gst_harness_add_element_full(
self.0.as_ptr(), self.0.as_ptr(),
element.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0,
hsrc.to_glib_none().0 as *mut _, hsrc.to_glib_none().0 as *mut _,
@ -73,7 +76,7 @@ impl Harness {
pub fn add_element_sink_pad<P: IsA<gst::Pad>>(&mut self, sinkpad: &P) { pub fn add_element_sink_pad<P: IsA<gst::Pad>>(&mut self, sinkpad: &P) {
unsafe { unsafe {
ffi::gst_harness_add_element_sink_pad( gst_check_sys::gst_harness_add_element_sink_pad(
self.0.as_ptr(), self.0.as_ptr(),
sinkpad.as_ref().to_glib_none().0, sinkpad.as_ref().to_glib_none().0,
); );
@ -82,13 +85,16 @@ impl Harness {
pub fn add_element_src_pad<P: IsA<gst::Pad>>(&mut self, srcpad: &P) { pub fn add_element_src_pad<P: IsA<gst::Pad>>(&mut self, srcpad: &P) {
unsafe { 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) { pub fn add_parse(&mut self, launchline: &str) {
unsafe { 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(); let params = params.into();
unsafe { unsafe {
let params = params.map(|p| p.as_ptr()).unwrap_or(ptr::null_mut()); 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) { pub fn add_sink(&mut self, sink_element_name: &str) {
unsafe { 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) { pub fn add_sink_harness(&mut self, sink_harness: Harness) {
unsafe { 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); mem::forget(sink_harness);
} }
@ -137,13 +150,13 @@ impl Harness {
pub fn add_sink_parse(&mut self, launchline: &str) { pub fn add_sink_parse(&mut self, launchline: &str) {
unsafe { 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) { pub fn add_src(&mut self, src_element_name: &str, has_clock_wait: bool) {
unsafe { unsafe {
ffi::gst_harness_add_src( gst_check_sys::gst_harness_add_src(
self.0.as_ptr(), self.0.as_ptr(),
src_element_name.to_glib_none().0, src_element_name.to_glib_none().0,
has_clock_wait.to_glib(), 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) { pub fn add_src_harness(&mut self, src_harness: Harness, has_clock_wait: bool) {
unsafe { unsafe {
ffi::gst_harness_add_src_harness( gst_check_sys::gst_harness_add_src_harness(
self.0.as_ptr(), self.0.as_ptr(),
src_harness.0.as_ptr(), src_harness.0.as_ptr(),
has_clock_wait.to_glib(), has_clock_wait.to_glib(),
@ -165,7 +178,7 @@ impl Harness {
pub fn add_src_parse(&mut self, launchline: &str, has_clock_wait: bool) { pub fn add_src_parse(&mut self, launchline: &str, has_clock_wait: bool) {
unsafe { unsafe {
ffi::gst_harness_add_src_parse( gst_check_sys::gst_harness_add_src_parse(
self.0.as_ptr(), self.0.as_ptr(),
launchline.to_glib_none().0, launchline.to_glib_none().0,
has_clock_wait.to_glib(), has_clock_wait.to_glib(),
@ -174,17 +187,17 @@ impl Harness {
} }
pub fn buffers_in_queue(&self) -> u32 { 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 { 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> { pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> Result<(), glib::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!( 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", "Failed to crank multiple clock waits",
) )
} }
@ -193,43 +206,51 @@ impl Harness {
pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> { pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!( 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", "Failed to crank single clock wait",
) )
} }
} }
pub fn create_buffer(&mut self, size: usize) -> Option<gst::Buffer> { pub fn create_buffer(&mut self, size: usize) -> Option<gst::Buffer> {
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<P: AsRef<path::Path>>(&mut self, filename: P) { pub fn dump_to_file<P: AsRef<path::Path>>(&mut self, filename: P) {
let filename = filename.as_ref(); let filename = filename.as_ref();
unsafe { 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 { 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 { 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<gst::Element> { pub fn find_element(&mut self, element_name: &str) -> Option<gst::Element> {
unsafe { unsafe {
// Work around https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/31 // 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() { if ptr.is_null() {
return None; return None;
} }
// Clear floating flag if it is set // Clear floating flag if it is set
if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE {
gobject_ffi::g_object_ref_sink(ptr as *mut _); gobject_sys::g_object_ref_sink(ptr as *mut _);
} }
from_glib_full(ptr) 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) { //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) { //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 { 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<TestClock> { pub fn get_testclock(&self) -> Option<TestClock> {
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) { pub fn play(&mut self) {
unsafe { 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<gst::Buffer> { pub fn pull(&mut self) -> Option<gst::Buffer> {
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<gst::Event> { pub fn pull_event(&mut self) -> Option<gst::Event> {
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<gst::Event> { pub fn pull_upstream_event(&mut self) -> Option<gst::Event> {
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<gst::FlowSuccess, gst::FlowError> { pub fn push(&mut self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = let ret: gst::FlowReturn = unsafe {
unsafe { from_glib(ffi::gst_harness_push(self.0.as_ptr(), buffer.into_ptr())) }; from_glib(gst_check_sys::gst_harness_push(
self.0.as_ptr(),
buffer.into_ptr(),
))
};
ret.into_result() ret.into_result()
} }
pub fn push_and_pull(&mut self, buffer: gst::Buffer) -> Option<gst::Buffer> { pub fn push_and_pull(&mut self, buffer: gst::Buffer) -> Option<gst::Buffer> {
unsafe { 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(), self.0.as_ptr(),
buffer.into_ptr(), buffer.into_ptr(),
)) ))
@ -287,7 +320,7 @@ impl Harness {
pub fn push_event(&mut self, event: gst::Event) -> bool { pub fn push_event(&mut self, event: gst::Event) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_harness_push_event( from_glib(gst_check_sys::gst_harness_push_event(
self.0.as_ptr(), self.0.as_ptr(),
event.into_ptr(), event.into_ptr(),
)) ))
@ -296,19 +329,19 @@ impl Harness {
pub fn push_from_src(&mut self) -> Result<gst::FlowSuccess, gst::FlowError> { pub fn push_from_src(&mut self) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = 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() ret.into_result()
} }
pub fn push_to_sink(&mut self) -> Result<gst::FlowSuccess, gst::FlowError> { pub fn push_to_sink(&mut self) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = 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() ret.into_result()
} }
pub fn push_upstream_event(&mut self, event: gst::Event) -> bool { pub fn push_upstream_event(&mut self, event: gst::Event) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_harness_push_upstream_event( from_glib(gst_check_sys::gst_harness_push_upstream_event(
self.0.as_ptr(), self.0.as_ptr(),
event.into_ptr(), event.into_ptr(),
)) ))
@ -316,28 +349,28 @@ impl Harness {
} }
pub fn query_latency(&self) -> gst::ClockTime { 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) { //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) { pub fn set_blocking_push_mode(&mut self) {
unsafe { 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) { pub fn set_caps(&mut self, in_: gst::Caps, out: gst::Caps) {
unsafe { 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) { pub fn set_caps_str(&mut self, in_: &str, out: &str) {
unsafe { unsafe {
ffi::gst_harness_set_caps_str( gst_check_sys::gst_harness_set_caps_str(
self.0.as_ptr(), self.0.as_ptr(),
in_.to_glib_none().0, in_.to_glib_none().0,
out.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) { pub fn set_drop_buffers(&mut self, drop_buffers: bool) {
unsafe { 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) { pub fn set_forwarding(&mut self, forwarding: bool) {
unsafe { 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<Option<&'a /*Ignored*/gst::Allocator>>, Q: Into<Option<&'b /*Ignored*/gst::AllocationParams>>>(&mut self, allocator: P, params: Q) { //pub fn set_propose_allocator<'a, 'b, P: Into<Option<&'a /*Ignored*/gst::Allocator>>, Q: Into<Option<&'b /*Ignored*/gst::AllocationParams>>>(&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) { pub fn set_sink_caps(&mut self, caps: gst::Caps) {
unsafe { 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) { pub fn set_sink_caps_str(&mut self, str: &str) {
unsafe { 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) { pub fn set_src_caps(&mut self, caps: gst::Caps) {
unsafe { 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) { pub fn set_src_caps_str(&mut self, str: &str) {
unsafe { 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> { pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!( 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", "Failed to set time",
) )
} }
@ -396,13 +429,13 @@ impl Harness {
pub fn set_upstream_latency(&mut self, latency: gst::ClockTime) { pub fn set_upstream_latency(&mut self, latency: gst::ClockTime) {
unsafe { 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<gst::FlowSuccess, gst::FlowError> { pub fn sink_push_many(&mut self, pushes: u32) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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(), self.0.as_ptr(),
pushes as i32, pushes as i32,
)) ))
@ -416,7 +449,7 @@ impl Harness {
pushes: u32, pushes: u32,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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(), self.0.as_ptr(),
cranks as i32, cranks as i32,
pushes as i32, pushes as i32,
@ -426,88 +459,100 @@ impl Harness {
} }
pub fn src_push_event(&mut self) -> bool { 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<Option<&'a /*Ignored*/glib::Func>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&mut self, init: P, callback: /*Unknown conversion*//*Unimplemented*/Func, data: Q, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> { //pub fn stress_custom_start<'a, P: Into<Option<&'a /*Ignored*/glib::Func>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&mut self, init: P, callback: /*Unknown conversion*//*Unimplemented*/Func, data: Q, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
// 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<HarnessThread> { //pub fn stress_property_start_full(&mut self, name: &str, value: /*Ignored*/&glib::Value, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
// 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<HarnessThread> { //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<HarnessThread> {
// 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<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&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<HarnessThread> { //pub fn stress_push_buffer_with_cb_start_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&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<HarnessThread> {
// 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<HarnessThread> { //pub fn stress_push_event_start_full(&mut self, event: &mut gst::Event, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
// 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<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&mut self, func: /*Unknown conversion*//*Unimplemented*/HarnessPrepareEventFunc, data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> { //pub fn stress_push_event_with_cb_start_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&mut self, func: /*Unknown conversion*//*Unimplemented*/HarnessPrepareEventFunc, data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
// 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<HarnessThread> { //pub fn stress_push_upstream_event_start_full(&mut self, event: &mut gst::Event, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
// 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<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&mut self, func: /*Unknown conversion*//*Unimplemented*/HarnessPrepareEventFunc, data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> { //pub fn stress_push_upstream_event_with_cb_start_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&mut self, func: /*Unknown conversion*//*Unimplemented*/HarnessPrepareEventFunc, data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
// 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<HarnessThread> { //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<HarnessThread> {
// 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<HarnessThread> { //pub fn stress_statechange_start_full(&mut self, sleep: libc::c_ulong) -> /*Ignored*/Option<HarnessThread> {
// 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"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn take_all_data_as_buffer(&mut self) -> Option<gst::Buffer> { pub fn take_all_data_as_buffer(&mut self) -> Option<gst::Buffer> {
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"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn take_all_data_as_bytes(&mut self) -> Option<glib::Bytes> { pub fn take_all_data_as_bytes(&mut self) -> Option<glib::Bytes> {
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<gst::Buffer> { pub fn try_pull(&mut self) -> Option<gst::Buffer> {
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<gst::Event> { pub fn try_pull_event(&mut self) -> Option<gst::Event> {
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<gst::Event> { pub fn try_pull_upstream_event(&mut self) -> Option<gst::Event> {
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 { 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 { 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) { pub fn use_systemclock(&mut self) {
unsafe { 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) { pub fn use_testclock(&mut self) {
unsafe { 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> { ) -> Result<(), glib::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!( 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", "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()); assert!(!ptr.is_null());
Harness(ptr::NonNull::new_unchecked(ptr), PhantomData) Harness(ptr::NonNull::new_unchecked(ptr), PhantomData)
@ -532,12 +577,16 @@ impl Harness {
pub fn new(element_name: &str) -> Harness { pub fn new(element_name: &str) -> Harness {
assert_initialized_main_thread!(); 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 { pub fn new_empty() -> Harness {
assert_initialized_main_thread!(); 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< 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.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { 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, element.as_ref().to_glib_none().0,
hsrc.to_glib_none().0 as *mut _, hsrc.to_glib_none().0 as *mut _,
element_sinkpad_name.0, element_sinkpad_name.0,
@ -577,7 +626,11 @@ impl Harness {
pub fn new_parse(launchline: &str) -> Harness { pub fn new_parse(launchline: &str) -> Harness {
assert_initialized_main_thread!(); 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< 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.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { 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.as_ref().to_glib_none().0,
element_sinkpad_name.0, element_sinkpad_name.0,
element_srcpad_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.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { 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_name.to_glib_none().0,
element_sinkpad_name.0, element_sinkpad_name.0,
element_srcpad_name.0, element_srcpad_name.0,
@ -638,7 +691,7 @@ impl Harness {
let hsrc = hsrc.into(); let hsrc = hsrc.into();
let hsink = hsink.into(); let hsink = hsink.into();
unsafe { 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, element_name.to_glib_none().0,
hsrc.to_glib_none().0 as *mut _, hsrc.to_glib_none().0 as *mut _,
hsink.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 { //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<gst::Element> { pub fn get_element(&self) -> Option<gst::Element> {
@ -660,8 +713,8 @@ impl Harness {
} }
// Clear floating flag if it is set // Clear floating flag if it is set
if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE {
gobject_ffi::g_object_ref_sink(ptr as *mut _); gobject_sys::g_object_ref_sink(ptr as *mut _);
} }
from_glib_none(ptr) from_glib_none(ptr)
@ -678,8 +731,8 @@ impl Harness {
} }
// Clear floating flag if it is set // Clear floating flag if it is set
if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE {
gobject_ffi::g_object_ref_sink(ptr as *mut _); gobject_sys::g_object_ref_sink(ptr as *mut _);
} }
from_glib_none(ptr) from_glib_none(ptr)
@ -696,8 +749,8 @@ impl Harness {
} }
// Clear floating flag if it is set // Clear floating flag if it is set
if gobject_ffi::g_object_is_floating(ptr as *mut _) != glib_ffi::GFALSE { if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE {
gobject_ffi::g_object_ref_sink(ptr as *mut _); gobject_sys::g_object_ref_sink(ptr as *mut _);
} }
from_glib_none(ptr) from_glib_none(ptr)
@ -774,7 +827,7 @@ impl Harness {
} }
#[derive(Debug)] #[derive(Debug)]
pub struct Ref<'a>(Option<Harness>, PhantomData<&'a ffi::GstHarness>); pub struct Ref<'a>(Option<Harness>, PhantomData<&'a gst_check_sys::GstHarness>);
impl<'a> ops::Deref for Ref<'a> { impl<'a> ops::Deref for Ref<'a> {
type Target = Harness; type Target = Harness;
@ -792,7 +845,10 @@ impl<'a> Drop for Ref<'a> {
} }
#[derive(Debug)] #[derive(Debug)]
pub struct RefMut<'a>(Option<Harness>, PhantomData<&'a mut ffi::GstHarness>); pub struct RefMut<'a>(
Option<Harness>,
PhantomData<&'a mut gst_check_sys::GstHarness>,
);
impl<'a> ops::Deref for RefMut<'a> { impl<'a> ops::Deref for RefMut<'a> {
type Target = Harness; type Target = Harness;

View file

@ -6,18 +6,18 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_check_sys as ffi; extern crate gstreamer_check_sys as gst_check_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

View file

@ -6,16 +6,16 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_check_sys;
use std::ptr; use std::ptr;
use TestClock; use TestClock;
impl TestClock { impl TestClock {
pub fn has_id(&self, id: &gst::ClockId) -> bool { pub fn has_id(&self, id: &gst::ClockId) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_test_clock_has_id( from_glib(gst_check_sys::gst_test_clock_has_id(
self.to_glib_none().0, self.to_glib_none().0,
id.to_glib_none().0, id.to_glib_none().0,
)) ))
@ -25,7 +25,7 @@ impl TestClock {
pub fn peek_next_pending_id(&self) -> Option<gst::ClockId> { pub fn peek_next_pending_id(&self) -> Option<gst::ClockId> {
unsafe { unsafe {
let mut id = ptr::null_mut(); 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, self.to_glib_none().0,
&mut id, &mut id,
)); ));
@ -39,7 +39,7 @@ impl TestClock {
pub fn process_id_list(&self, pending_list: &[&gst::ClockId]) -> u32 { pub fn process_id_list(&self, pending_list: &[&gst::ClockId]) -> u32 {
unsafe { unsafe {
ffi::gst_test_clock_process_id_list( gst_check_sys::gst_test_clock_process_id_list(
self.to_glib_none().0, self.to_glib_none().0,
pending_list.to_glib_none().0, pending_list.to_glib_none().0,
) )
@ -48,7 +48,7 @@ impl TestClock {
pub fn process_next_clock_id(&self) -> Option<gst::ClockId> { pub fn process_next_clock_id(&self) -> Option<gst::ClockId> {
unsafe { 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, self.to_glib_none().0,
)) ))
} }
@ -57,7 +57,7 @@ impl TestClock {
pub fn wait_for_multiple_pending_ids(&self, count: u32) -> Vec<gst::ClockId> { pub fn wait_for_multiple_pending_ids(&self, count: u32) -> Vec<gst::ClockId> {
unsafe { unsafe {
let mut pending_list = ptr::null_mut(); 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, self.to_glib_none().0,
count, count,
&mut pending_list, &mut pending_list,
@ -69,7 +69,7 @@ impl TestClock {
pub fn wait_for_next_pending_id(&self) -> gst::ClockId { pub fn wait_for_next_pending_id(&self) -> gst::ClockId {
unsafe { unsafe {
let mut id = ptr::null_mut(); 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) from_glib_full(id)
} }
} }

View file

@ -10,16 +10,16 @@ extern crate libc;
use std::sync::{Once, ONCE_INIT}; use std::sync::{Once, ONCE_INIT};
extern crate gio_sys as gio_ffi; extern crate gio_sys;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base; extern crate gstreamer_base as gst_base;
extern crate gstreamer_base_sys as gst_base_ffi; extern crate gstreamer_base_sys as gst_base_sys;
extern crate gstreamer_editing_services_sys as ffi; extern crate gstreamer_editing_services_sys as ges_sys;
extern crate gstreamer_pbutils as gst_pbutils; extern crate gstreamer_pbutils as gst_pbutils;
extern crate gstreamer_pbutils_sys as gst_pbutils_ffi; extern crate gstreamer_pbutils_sys as gst_pbutils_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
use glib::translate::from_glib; use glib::translate::from_glib;
@ -39,7 +39,7 @@ pub fn init() -> Result<(), BoolError> {
} }
unsafe { unsafe {
if from_glib(ffi::ges_init()) { if from_glib(ges_sys::ges_init()) {
Ok(()) Ok(())
} else { } else {
Err(glib_bool_error!("Could not initialize GES.")) Err(glib_bool_error!("Could not initialize GES."))
@ -48,16 +48,16 @@ pub fn init() -> Result<(), BoolError> {
} }
pub unsafe fn deinit() { pub unsafe fn deinit() {
ffi::ges_deinit(); ges_sys::ges_deinit();
} }
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
::GES_INIT.call_once(|| { ::GES_INIT.call_once(|| {
unsafe { ::ffi::ges_init() }; unsafe { ::ges_sys::ges_init() };
}); });
}; };
} }

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use ges_sys;
use glib; use glib;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
@ -21,7 +21,7 @@ pub trait TimelineElementExtManual: 'static {
impl<O: IsA<TimelineElement>> TimelineElementExtManual for O { impl<O: IsA<TimelineElement>> TimelineElementExtManual for O {
fn get_child_property(&self, name: &str) -> Option<glib::Value> { fn get_child_property(&self, name: &str) -> Option<glib::Value> {
unsafe { 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, self.as_ref().to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
ptr::null_mut(), ptr::null_mut(),
@ -32,7 +32,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExtManual for O {
} }
let mut value = glib::Value::uninitialized(); 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, self.as_ref().to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
value.to_glib_none_mut().0, value.to_glib_none_mut().0,
@ -43,7 +43,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExtManual for O {
fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError> { fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError> {
unsafe { 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, self.as_ref().to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
ptr::null_mut(), ptr::null_mut(),
@ -54,7 +54,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExtManual for O {
} }
let value = value.to_value(); 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, self.as_ref().to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
value.to_glib_none().0, value.to_glib_none().0,

View file

@ -6,13 +6,13 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use gst::CapsFeatures; use gst::CapsFeatures;
use gst_gl_sys;
use std::ffi::CStr; use std::ffi::CStr;
lazy_static! { lazy_static! {
pub static ref CAPS_FEATURE_MEMORY_GL_MEMORY: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib::IsA; use glib::IsA;
use gst::{ContextRef, MiniObject}; use gst::{ContextRef, MiniObject};
use gst_gl_sys;
use std::ptr; use std::ptr;
use GLDisplay; use GLDisplay;
@ -22,7 +22,7 @@ impl ContextGLExt for ContextRef {
fn get_gl_display(&self) -> Option<GLDisplay> { fn get_gl_display(&self) -> Option<GLDisplay> {
unsafe { unsafe {
let mut display = ptr::null_mut(); 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(), self.as_mut_ptr(),
&mut display, &mut display,
)) { )) {
@ -35,7 +35,10 @@ impl ContextGLExt for ContextRef {
fn set_gl_display<T: IsA<GLDisplay>>(&self, display: &T) { fn set_gl_display<T: IsA<GLDisplay>>(&self, display: &T) {
unsafe { 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,
);
} }
} }
} }

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib::IsA; use glib::IsA;
use gst_gl_sys;
use libc::uintptr_t; use libc::uintptr_t;
use GLContext; use GLContext;
use GLDisplay; use GLDisplay;
@ -22,7 +22,7 @@ impl GLContext {
context_type: GLPlatform, context_type: GLPlatform,
available_apis: GLAPI, available_apis: GLAPI,
) -> Option<GLContext> { ) -> Option<GLContext> {
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, display.as_ref().to_glib_none().0,
handle, handle,
context_type.to_glib(), context_type.to_glib(),
@ -31,7 +31,9 @@ impl GLContext {
} }
pub fn get_current_gl_context(context_type: GLPlatform) -> uintptr_t { 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( pub fn get_proc_address_with_platform(
@ -40,7 +42,7 @@ impl GLContext {
name: &str, name: &str,
) -> uintptr_t { ) -> uintptr_t {
unsafe { 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(), context_type.to_glib(),
gl_api.to_glib(), gl_api.to_glib(),
name.to_glib_none().0, name.to_glib_none().0,
@ -57,12 +59,14 @@ pub trait GLContextExtManual: 'static {
impl<O: IsA<GLContext>> GLContextExtManual for O { impl<O: IsA<GLContext>> GLContextExtManual for O {
fn get_gl_context(&self) -> uintptr_t { 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 { fn get_proc_address(&self, name: &str) -> uintptr_t {
unsafe { unsafe {
ffi::gst_gl_context_get_proc_address( gst_gl_sys::gst_gl_context_get_proc_address(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,
) as uintptr_t ) as uintptr_t

View file

@ -6,12 +6,12 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_gl_sys;
use std::ffi::CStr; use std::ffi::CStr;
lazy_static! { lazy_static! {
pub static ref GL_DISPLAY_CONTEXT_TYPE: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };

View file

@ -6,21 +6,21 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib_ffi::gpointer; use glib_sys::gpointer;
use gst_gl_sys;
use libc::uintptr_t; use libc::uintptr_t;
use GLDisplayEGL; use GLDisplayEGL;
use GLDisplayType; use GLDisplayType;
impl GLDisplayEGL { impl GLDisplayEGL {
pub unsafe fn new_with_egl_display(display: uintptr_t) -> Option<GLDisplayEGL> { pub unsafe fn new_with_egl_display(display: uintptr_t) -> Option<GLDisplayEGL> {
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, display as gpointer,
)) ))
} }
pub unsafe fn get_from_native(display_type: GLDisplayType, display: uintptr_t) -> 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)
} }
} }

View file

@ -6,15 +6,15 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib_ffi::gpointer; use glib_sys::gpointer;
use gst_gl_sys;
use libc::uintptr_t; use libc::uintptr_t;
use GLDisplayWayland; use GLDisplayWayland;
impl GLDisplayWayland { impl GLDisplayWayland {
pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayWayland> { pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayWayland> {
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, display as gpointer,
)) ))
} }

View file

@ -6,15 +6,15 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib_ffi::gpointer; use glib_sys::gpointer;
use gst_gl_sys;
use libc::uintptr_t; use libc::uintptr_t;
use GLDisplayX11; use GLDisplayX11;
impl GLDisplayX11 { impl GLDisplayX11 {
pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayX11> { pub unsafe fn new_with_display(display: uintptr_t) -> Option<GLDisplayX11> {
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, display as gpointer,
)) ))
} }

View file

@ -1,15 +1,15 @@
use std::fmt; use std::fmt;
use ffi;
use glib; use glib;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst::prelude::*; use gst::prelude::*;
use gst_gl_sys;
use GLContext; use GLContext;
#[repr(C)] #[repr(C)]
pub struct GLSyncMeta(ffi::GstGLSyncMeta); pub struct GLSyncMeta(gst_gl_sys::GstGLSyncMeta);
impl GLSyncMeta { impl GLSyncMeta {
pub fn add<'a, C: IsA<GLContext>>( pub fn add<'a, C: IsA<GLContext>>(
@ -17,7 +17,7 @@ impl GLSyncMeta {
context: &C, context: &C,
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
unsafe { 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, context.as_ref().to_glib_none().0,
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
); );
@ -31,7 +31,7 @@ impl GLSyncMeta {
pub fn set_sync_point<C: IsA<GLContext>>(&self, context: &C) { pub fn set_sync_point<C: IsA<GLContext>>(&self, context: &C) {
unsafe { 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 _, &self.0 as *const _ as *mut _,
context.as_ref().to_glib_none().0, context.as_ref().to_glib_none().0,
); );
@ -40,7 +40,7 @@ impl GLSyncMeta {
pub fn wait<C: IsA<GLContext>>(&self, context: &C) { pub fn wait<C: IsA<GLContext>>(&self, context: &C) {
unsafe { unsafe {
ffi::gst_gl_sync_meta_wait( gst_gl_sys::gst_gl_sync_meta_wait(
&self.0 as *const _ as *mut _, &self.0 as *const _ as *mut _,
context.as_ref().to_glib_none().0, context.as_ref().to_glib_none().0,
); );
@ -49,7 +49,7 @@ impl GLSyncMeta {
pub fn wait_cpu<C: IsA<GLContext>>(&self, context: &C) { pub fn wait_cpu<C: IsA<GLContext>>(&self, context: &C) {
unsafe { unsafe {
ffi::gst_gl_sync_meta_wait_cpu( gst_gl_sys::gst_gl_sync_meta_wait_cpu(
&self.0 as *const _ as *mut _, &self.0 as *const _ as *mut _,
context.as_ref().to_glib_none().0, context.as_ref().to_glib_none().0,
); );
@ -58,10 +58,10 @@ impl GLSyncMeta {
} }
unsafe impl MetaAPI for GLSyncMeta { unsafe impl MetaAPI for GLSyncMeta {
type GstType = ffi::GstGLSyncMeta; type GstType = gst_gl_sys::GstGLSyncMeta;
fn get_meta_api() -> glib::Type { 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()) }
} }
} }

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gst_gl_sys;
use gst_ffi; use gst_sys;
use gst_video_ffi; use gst_video_sys;
use glib::translate::{from_glib, ToGlibPtr}; use glib::translate::{from_glib, ToGlibPtr};
use gst; use gst;
@ -75,13 +75,13 @@ impl<'a> VideoFrameGLExt for VideoFrameRef<&'a gst::BufferRef> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.to_glib_none().0, buffer.to_glib_none().0,
gst_video_ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
| gst_ffi::GST_MAP_READ | gst_sys::GST_MAP_READ
| ffi::GST_MAP_GL as u32, | gst_gl_sys::GST_MAP_GL as u32,
)); ));
if !res { if !res {
@ -112,13 +112,13 @@ impl<'a> VideoFrameGLExt for VideoFrameRef<&'a gst::BufferRef> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
gst_video_ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
| gst_ffi::GST_MAP_READ | gst_sys::GST_MAP_READ
| ffi::GST_MAP_GL as u32, | gst_gl_sys::GST_MAP_GL as u32,
)); ));
if !res { if !res {
@ -151,10 +151,10 @@ impl<'a> VideoFrameGLExt for VideoFrameRef<&'a gst::BufferRef> {
fn buffer_n_gl_memory(buffer: &gst::BufferRef) -> Option<u32> { fn buffer_n_gl_memory(buffer: &gst::BufferRef) -> Option<u32> {
unsafe { unsafe {
let buf = buffer.as_mut_ptr(); 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 { for i in 0..num - 1 {
let mem = gst_ffi::gst_buffer_peek_memory(buf, i); let mem = gst_sys::gst_buffer_peek_memory(buf, i);
if ffi::gst_is_gl_memory(mem) != glib_ffi::GTRUE { if gst_gl_sys::gst_is_gl_memory(mem) != glib_sys::GTRUE {
return None; return None;
} }
} }

View file

@ -15,18 +15,18 @@ extern crate lazy_static;
extern crate libc; extern crate libc;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base; extern crate gstreamer_base as gst_base;
extern crate gstreamer_gl_sys as ffi; extern crate gstreamer_gl_sys as gst_gl_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
extern crate gstreamer_video as gst_video; 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 { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use ffi; use gst_net_sys;
use glib::translate::*; use glib::translate::*;

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use ffi; use gst_net_sys;
use glib::translate::*; use glib::translate::*;

View file

@ -7,18 +7,18 @@
// except according to those terms. // except according to those terms.
extern crate gio; extern crate gio;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_net_sys as ffi; extern crate gstreamer_net_sys as gst_net_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

View file

@ -1,14 +1,14 @@
use std::fmt; use std::fmt;
use ffi;
use gio; use gio;
use glib; use glib;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst::prelude::*; use gst::prelude::*;
use gst_net_sys;
#[repr(C)] #[repr(C)]
pub struct NetAddressMeta(ffi::GstNetAddressMeta); pub struct NetAddressMeta(gst_net_sys::GstNetAddressMeta);
impl NetAddressMeta { impl NetAddressMeta {
pub fn add<'a, A: IsA<gio::SocketAddress>>( pub fn add<'a, A: IsA<gio::SocketAddress>>(
@ -16,7 +16,7 @@ impl NetAddressMeta {
addr: &A, addr: &A,
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
unsafe { 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(), buffer.as_mut_ptr(),
addr.as_ref().to_glib_none().0, addr.as_ref().to_glib_none().0,
); );
@ -31,17 +31,17 @@ impl NetAddressMeta {
pub fn set_addr<T: IsA<gio::SocketAddress>>(&mut self, addr: &T) { pub fn set_addr<T: IsA<gio::SocketAddress>>(&mut self, addr: &T) {
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
unsafe { 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(); self.0.addr = addr.as_ref().to_glib_full();
} }
} }
} }
unsafe impl MetaAPI for NetAddressMeta { unsafe impl MetaAPI for NetAddressMeta {
type GstType = ffi::GstNetAddressMeta; type GstType = gst_net_sys::GstNetAddressMeta;
fn get_meta_api() -> glib::Type { 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()) }
} }
} }

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_net_sys;
use NetClientClock; use NetClientClock;
use glib::object::Cast; use glib::object::Cast;
@ -26,7 +26,7 @@ impl NetClientClock {
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {
unsafe { 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, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,
@ -37,7 +37,7 @@ impl NetClientClock {
} else { } else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
unsafe { 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, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_net_sys;
use NetTimeProvider; use NetTimeProvider;
use glib::translate::*; use glib::translate::*;
@ -26,7 +26,7 @@ impl NetTimeProvider {
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {
unsafe { 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, clock.as_ref().to_glib_none().0,
address.0, address.0,
port, port,
@ -35,7 +35,7 @@ impl NetTimeProvider {
} else { } else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
unsafe { 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, clock.as_ref().to_glib_none().0,
address.0, address.0,
port, port,

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_net_sys;
use NtpClock; use NtpClock;
use glib::object::Cast; use glib::object::Cast;
@ -26,7 +26,7 @@ impl NtpClock {
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {
unsafe { 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, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,
@ -37,7 +37,7 @@ impl NtpClock {
} else { } else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
unsafe { 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, name.0,
remote_address.to_glib_none().0, remote_address.to_glib_none().0,
remote_port, remote_port,

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_net_sys;
use PtpClock; use PtpClock;
use glib::object::Cast; use glib::object::Cast;
@ -21,12 +21,14 @@ impl PtpClock {
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {
unsafe { 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 { } else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
unsafe { 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()
} }
} }
} }

View file

@ -18,9 +18,9 @@ use glib::translate::*;
use glib::IsA; use glib::IsA;
use glib::Value; use glib::Value;
use ffi; use glib_sys;
use glib_ffi; use gobject_sys;
use gobject_ffi; use gst_pbutils_sys;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
@ -28,7 +28,7 @@ use std::mem::transmute;
impl Discoverer { impl Discoverer {
pub fn set_property_timeout(&self, timeout: gst::ClockTime) { pub fn set_property_timeout(&self, timeout: gst::ClockTime) {
unsafe { unsafe {
gobject_ffi::g_object_set_property( gobject_sys::g_object_set_property(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
"timeout".to_glib_none().0, "timeout".to_glib_none().0,
Value::from(&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 { pub fn get_property_timeout(&self) -> gst::ClockTime {
let mut value = Value::from(&0u64); let mut value = Value::from(&0u64);
unsafe { unsafe {
gobject_ffi::g_object_get_property( gobject_sys::g_object_get_property(
self.as_ptr() as *mut _, self.as_ptr() as *mut _,
"timeout".to_glib_none().0, "timeout".to_glib_none().0,
value.to_glib_none_mut().0, value.to_glib_none_mut().0,
@ -65,9 +65,9 @@ impl Discoverer {
} }
unsafe extern "C" fn notify_timeout_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( unsafe extern "C" fn notify_timeout_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut ffi::GstDiscoverer, this: *mut gst_pbutils_sys::GstDiscoverer,
_param_spec: glib_ffi::gpointer, _param_spec: glib_sys::gpointer,
f: glib_ffi::gpointer, f: glib_sys::gpointer,
) where ) where
P: IsA<Discoverer>, P: IsA<Discoverer>,
{ {

View file

@ -9,16 +9,19 @@
use DiscovererVideoInfo; use DiscovererVideoInfo;
use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_pbutils_sys;
impl DiscovererVideoInfo { impl DiscovererVideoInfo {
pub fn get_framerate(&self) -> gst::Fraction { pub fn get_framerate(&self) -> gst::Fraction {
unsafe { unsafe {
gst::Fraction::new( gst::Fraction::new(
ffi::gst_discoverer_video_info_get_framerate_num(self.to_glib_none().0) as i32, gst_pbutils_sys::gst_discoverer_video_info_get_framerate_num(self.to_glib_none().0)
ffi::gst_discoverer_video_info_get_framerate_denom(self.to_glib_none().0) as i32, 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 { pub fn get_par(&self) -> gst::Fraction {
unsafe { unsafe {
gst::Fraction::new( gst::Fraction::new(
ffi::gst_discoverer_video_info_get_par_num(self.to_glib_none().0) as i32, gst_pbutils_sys::gst_discoverer_video_info_get_par_num(self.to_glib_none().0)
ffi::gst_discoverer_video_info_get_par_denom(self.to_glib_none().0) as i32, as i32,
gst_pbutils_sys::gst_discoverer_video_info_get_par_denom(self.to_glib_none().0)
as i32,
) )
} }
} }

View file

@ -7,10 +7,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use gst; use gst;
use gst_ffi; use gst_pbutils_sys;
use gst_sys;
use std::error; use std::error;
use std::fmt; use std::fmt;
@ -46,7 +46,7 @@ trait EncodingProfileBuilderCommon {
impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O { impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
fn set_allow_dynamic_output(&self, allow_dynamic_output: bool) { fn set_allow_dynamic_output(&self, allow_dynamic_output: bool) {
unsafe { 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, self.as_ref().to_glib_none().0,
allow_dynamic_output.to_glib(), allow_dynamic_output.to_glib(),
); );
@ -57,7 +57,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
let description = description.into(); let description = description.into();
let description = description.to_glib_none(); let description = description.to_glib_none();
unsafe { unsafe {
ffi::gst_encoding_profile_set_description( gst_pbutils_sys::gst_encoding_profile_set_description(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
description.0, description.0,
); );
@ -66,7 +66,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
fn set_enabled(&self, enabled: bool) { fn set_enabled(&self, enabled: bool) {
unsafe { unsafe {
ffi::gst_encoding_profile_set_enabled( gst_pbutils_sys::gst_encoding_profile_set_enabled(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
enabled.to_glib(), enabled.to_glib(),
); );
@ -75,7 +75,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
fn set_format(&self, format: &gst::Caps) { fn set_format(&self, format: &gst::Caps) {
unsafe { unsafe {
ffi::gst_encoding_profile_set_format( gst_pbutils_sys::gst_encoding_profile_set_format(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
format.to_glib_none().0, format.to_glib_none().0,
); );
@ -86,13 +86,16 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
let name = name.into(); let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
unsafe { 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) { fn set_presence(&self, presence: u32) {
unsafe { 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<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
let preset = preset.into(); let preset = preset.into();
let preset = preset.to_glib_none(); let preset = preset.to_glib_none();
unsafe { 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<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
let preset_name = preset_name.into(); let preset_name = preset_name.into();
let preset_name = preset_name.to_glib_none(); let preset_name = preset_name.to_glib_none();
unsafe { unsafe {
ffi::gst_encoding_profile_set_preset_name( gst_pbutils_sys::gst_encoding_profile_set_preset_name(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
preset_name.0, preset_name.0,
); );
@ -120,10 +126,13 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
unsafe { unsafe {
let restriction = match restriction { let restriction = match restriction {
Some(restriction) => restriction.to_glib_full(), 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.into();
let restriction = restriction.to_glib_none(); let restriction = restriction.to_glib_none();
unsafe { 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, format.to_glib_none().0,
preset.0, preset.0,
restriction.0, restriction.0,
@ -164,7 +173,7 @@ impl EncodingVideoProfile {
let restriction = restriction.into(); let restriction = restriction.into();
let restriction = restriction.to_glib_none(); let restriction = restriction.to_glib_none();
unsafe { 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, format.to_glib_none().0,
preset.0, preset.0,
restriction.0, restriction.0,
@ -175,13 +184,13 @@ impl EncodingVideoProfile {
fn set_pass(&self, pass: u32) { fn set_pass(&self, pass: u32) {
unsafe { 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) { fn set_variableframerate(&self, variableframerate: bool) {
unsafe { unsafe {
ffi::gst_encoding_video_profile_set_variableframerate( gst_pbutils_sys::gst_encoding_video_profile_set_variableframerate(
self.to_glib_none().0, self.to_glib_none().0,
variableframerate.to_glib(), variableframerate.to_glib(),
); );
@ -211,7 +220,7 @@ impl EncodingContainerProfile {
let preset = preset.into(); let preset = preset.into();
let preset = preset.to_glib_none(); let preset = preset.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_container_profile_new( from_glib_full(gst_pbutils_sys::gst_encoding_container_profile_new(
name.0, name.0,
description.0, description.0,
format.to_glib_none().0, format.to_glib_none().0,
@ -226,7 +235,7 @@ impl EncodingContainerProfile {
) -> Result<(), glib::error::BoolError> { ) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!( 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, self.to_glib_none().0,
profile.as_ref().to_glib_full(), profile.as_ref().to_glib_full(),
), ),

View file

@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst::MiniObject; use gst::MiniObject;
use gst_pbutils_sys;
use std::ptr; use std::ptr;
pub unsafe trait CodecTag<'a>: gst::Tag<'a, TagType = &'a str> {} 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(); let codec_tag = T::tag_name();
unsafe { unsafe {
glib_result_from_gboolean!( 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(), taglist.as_mut_ptr(),
codec_tag.to_glib_none().0, codec_tag.to_glib_none().0,
caps.as_ptr(), caps.as_ptr(),
@ -46,7 +46,7 @@ pub fn pb_utils_add_codec_description_to_tag_list(
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
glib_result_from_gboolean!( 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(), taglist.as_mut_ptr(),
ptr::null_mut(), ptr::null_mut(),
caps.as_ptr(), 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<String> { pub fn pb_utils_get_encoder_description(caps: &gst::CapsRef) -> Option<String> {
assert_initialized_main_thread!(); 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<String> { pub fn pb_utils_get_decoder_description(caps: &gst::CapsRef) -> Option<String> {
assert_initialized_main_thread!(); 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<String> { pub fn pb_utils_get_codec_description(caps: &gst::CapsRef) -> Option<String> {
assert_initialized_main_thread!(); 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(),
))
}
} }

View file

@ -14,21 +14,21 @@ use std::sync::{Once, ONCE_INIT};
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_pbutils_sys as ffi; extern crate gstreamer_pbutils_sys as gst_pbutils_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
static PBUTILS_INIT: Once = ONCE_INIT; static PBUTILS_INIT: Once = ONCE_INIT;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
::PBUTILS_INIT.call_once(|| { ::PBUTILS_INIT.call_once(|| {
unsafe { ::ffi::gst_pb_utils_init() }; unsafe { ::gst_pbutils_sys::gst_pb_utils_init() };
}); });
}; };
} }

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use ffi; use gst_player_sys;
use glib::translate::*; use glib::translate::*;

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi; use gst_player_sys;
use gst_sys;
use std::mem; use std::mem;
use std::ops; use std::ops;
@ -46,13 +46,15 @@ impl AsMut<gst::StructureRef> for PlayerConfig {
impl PlayerConfig { impl PlayerConfig {
pub fn get_position_update_interval(&self) -> u32 { pub fn get_position_update_interval(&self) -> u32 {
assert_initialized_main_thread!(); 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 { pub fn get_seek_accurate(&self) -> bool {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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, self.0.to_glib_none().0,
)) ))
} }
@ -61,7 +63,7 @@ impl PlayerConfig {
pub fn get_user_agent(&self) -> Option<String> { pub fn get_user_agent(&self) -> Option<String> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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, self.0.to_glib_none().0,
)) ))
} }
@ -70,7 +72,7 @@ impl PlayerConfig {
pub fn set_position_update_interval(&mut self, interval: u32) { pub fn set_position_update_interval(&mut self, interval: u32) {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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, self.0.to_glib_none_mut().0,
interval, interval,
); );
@ -87,22 +89,22 @@ impl PlayerConfig {
pub fn set_user_agent(&mut self, agent: &str) { pub fn set_user_agent(&mut self, agent: &str) {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
ffi::gst_player_config_set_user_agent( gst_player_sys::gst_player_config_set_user_agent(
self.0.to_glib_none_mut().0, self.0.to_glib_none_mut().0,
agent.to_glib_none().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; let ptr = self.0.to_glib_none_mut().0;
mem::forget(self); mem::forget(self);
ptr ptr
} }
} }
impl FromGlibPtrFull<*mut gst_ffi::GstStructure> for PlayerConfig { impl FromGlibPtrFull<*mut gst_sys::GstStructure> for PlayerConfig {
unsafe fn from_glib_full(ptr: *mut gst_ffi::GstStructure) -> Self { unsafe fn from_glib_full(ptr: *mut gst_sys::GstStructure) -> Self {
PlayerConfig(from_glib_full(ptr)) PlayerConfig(from_glib_full(ptr))
} }
} }

View file

@ -8,11 +8,11 @@
extern crate libc; extern crate libc;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_player_sys as ffi; extern crate gstreamer_player_sys as gst_player_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
extern crate gstreamer_video as gst_video; extern crate gstreamer_video as gst_video;
#[macro_use] #[macro_use]

View file

@ -6,14 +6,14 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use glib::object::ObjectType; use glib::object::ObjectType;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_sys;
use gst; use gst;
use gst_player_sys;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
use Player; use Player;
@ -31,22 +31,32 @@ impl Player {
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { 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 { } else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 in // 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 // 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 { 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> { pub fn set_config(&self, config: ::PlayerConfig) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!( 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", "Failed to set config",
) )
} }
@ -104,9 +114,9 @@ impl Player {
unsafe extern "C" fn duration_changed_trampoline< unsafe extern "C" fn duration_changed_trampoline<
F: Fn(&Player, gst::ClockTime) + Send + 'static, F: Fn(&Player, gst::ClockTime) + Send + 'static,
>( >(
this: *mut ffi::GstPlayer, this: *mut gst_player_sys::GstPlayer,
object: u64, object: u64,
f: glib_ffi::gpointer, f: glib_sys::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&from_glib_borrow(this), gst::ClockTime(Some(object))) 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< unsafe extern "C" fn position_updated_trampoline<
F: Fn(&Player, gst::ClockTime) + Send + 'static, F: Fn(&Player, gst::ClockTime) + Send + 'static,
>( >(
this: *mut ffi::GstPlayer, this: *mut gst_player_sys::GstPlayer,
object: u64, object: u64,
f: glib_ffi::gpointer, f: glib_sys::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&from_glib_borrow(this), gst::ClockTime(Some(object))) f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
} }
unsafe extern "C" fn seek_done_trampoline<F: Fn(&Player, gst::ClockTime) + Send + 'static>( unsafe extern "C" fn seek_done_trampoline<F: Fn(&Player, gst::ClockTime) + Send + 'static>(
this: *mut ffi::GstPlayer, this: *mut gst_player_sys::GstPlayer,
object: u64, object: u64,
f: glib_ffi::gpointer, f: glib_sys::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&from_glib_borrow(this), gst::ClockTime(Some(object))) f(&from_glib_borrow(this), gst::ClockTime(Some(object)))

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use glib::translate::*; use glib::translate::*;
use gst_player_sys;
use PlayerGMainContextSignalDispatcher; use PlayerGMainContextSignalDispatcher;
impl PlayerGMainContextSignalDispatcher { impl PlayerGMainContextSignalDispatcher {
@ -19,10 +19,11 @@ impl PlayerGMainContextSignalDispatcher {
let application_context = application_context.into(); let application_context = application_context.into();
let application_context = application_context.to_glib_none(); let application_context = application_context.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::gst_player_g_main_context_signal_dispatcher_new( from_glib_full(
gst_player_sys::gst_player_g_main_context_signal_dispatcher_new(
application_context.0, application_context.0,
) as *mut gst_player_sys::GstPlayerGMainContextSignalDispatcher,
) )
as *mut ffi::GstPlayerGMainContextSignalDispatcher)
} }
} }
} }

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_player_sys;
use std::mem; use std::mem;
use PlayerVideoInfo; use PlayerVideoInfo;
@ -17,7 +17,11 @@ impl PlayerVideoInfo {
unsafe { unsafe {
let mut fps_n = mem::uninitialized(); let mut fps_n = mem::uninitialized();
let mut fps_d = 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() (fps_n as i32, fps_d as i32).into()
} }
} }
@ -26,7 +30,7 @@ impl PlayerVideoInfo {
unsafe { unsafe {
let mut par_n = mem::uninitialized(); let mut par_n = mem::uninitialized();
let mut par_d = 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, self.to_glib_none().0,
&mut par_n, &mut par_n,
&mut par_d, &mut par_d,

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use glib::IsA; use glib::IsA;
use gst; use gst;
use gst_player_sys;
use PlayerVideoOverlayVideoRenderer; use PlayerVideoOverlayVideoRenderer;
use std::ptr; use std::ptr;
@ -20,9 +20,9 @@ impl PlayerVideoOverlayVideoRenderer {
pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer { pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
from_glib_full( from_glib_full(gst_player_sys::gst_player_video_overlay_video_renderer_new(
ffi::gst_player_video_overlay_video_renderer_new(window_handle as *mut _) as *mut _, window_handle as *mut _,
) ) as *mut _)
} }
pub unsafe fn new_with_handle_and_sink<P: IsA<gst::Element>>( pub unsafe fn new_with_handle_and_sink<P: IsA<gst::Element>>(
@ -31,30 +31,35 @@ impl PlayerVideoOverlayVideoRenderer {
) -> PlayerVideoOverlayVideoRenderer { ) -> PlayerVideoOverlayVideoRenderer {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink( from_glib_full(
gst_player_sys::gst_player_video_overlay_video_renderer_new_with_sink(
window_handle as *mut _, window_handle as *mut _,
video_sink.as_ref().to_glib_none().0, video_sink.as_ref().to_glib_none().0,
) as *mut _) ) as *mut _,
)
} }
pub fn new_with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer { pub fn new_with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink( from_glib_full(
gst_player_sys::gst_player_video_overlay_video_renderer_new_with_sink(
ptr::null_mut(), ptr::null_mut(),
video_sink.as_ref().to_glib_none().0, video_sink.as_ref().to_glib_none().0,
) as *mut _) ) as *mut _,
)
} }
} }
pub unsafe fn get_window_handle(&self) -> uintptr_t { pub unsafe fn get_window_handle(&self) -> uintptr_t {
ffi::gst_player_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0) gst_player_sys::gst_player_video_overlay_video_renderer_get_window_handle(
as uintptr_t self.to_glib_none().0,
) as uintptr_t
} }
pub unsafe fn set_window_handle(&self, window_handle: 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, self.to_glib_none().0,
window_handle as *mut _, window_handle as *mut _,
) )

View file

@ -13,24 +13,24 @@ extern crate lazy_static;
extern crate libc; extern crate libc;
extern crate gio; extern crate gio;
extern crate gio_sys as gio_ffi; extern crate gio_sys as gio_sys;
use std::ffi::CStr; use std::ffi::CStr;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
#[macro_use] #[macro_use]
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_net as gst_net; 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 as gst_rtsp;
extern crate gstreamer_rtsp_server_sys as ffi; extern crate gstreamer_rtsp_server_sys as gst_rtsp_server_sys;
extern crate gstreamer_rtsp_sys as gst_rtsp_ffi; extern crate gstreamer_rtsp_sys as gst_rtsp_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };
@ -73,57 +73,57 @@ pub use rtsp_token::*;
lazy_static! { lazy_static! {
pub static ref RTSP_ADDRESS_POOL_ANY_IPV4: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_ADDRESS_POOL_ANY_IPV6: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_AUTH_CHECK_CONNECT: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_AUTH_CHECK_URL: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_PERM_MEDIA_FACTORY_ACCESS: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_PERM_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_TOKEN_MEDIA_FACTORY_ROLE: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };
pub static ref RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe { 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() .to_str()
.unwrap() .unwrap()
}; };

View file

@ -1,6 +1,6 @@
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst_rtsp_server_sys;
use std::ptr; use std::ptr;
use RTSPAddress; use RTSPAddress;
use RTSPAddressPool; use RTSPAddressPool;
@ -26,7 +26,7 @@ impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {
) -> Result<RTSPAddress, RTSPAddressPoolResult> { ) -> Result<RTSPAddress, RTSPAddressPoolResult> {
unsafe { unsafe {
let mut address = ptr::null_mut(); 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, self.as_ref().to_glib_none().0,
ip_address.to_glib_none().0, ip_address.to_glib_none().0,
port, port,

View file

@ -1,9 +1,9 @@
use ffi;
use glib::object::Cast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::translate::*; use glib::translate::*;
use gst_rtsp_server_sys;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
@ -34,7 +34,7 @@ impl<O: IsA<RTSPAuth>> RTSPAuthExtManual for O {
fn set_default_token<'a, P: Into<Option<&'a mut RTSPToken>>>(&self, token: P) { fn set_default_token<'a, P: Into<Option<&'a mut RTSPToken>>>(&self, token: P) {
let mut token = token.into(); let mut token = token.into();
unsafe { 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, self.as_ref().to_glib_none().0,
token.to_glib_none_mut().0, token.to_glib_none_mut().0,
); );
@ -79,12 +79,12 @@ unsafe extern "C" fn accept_certificate_trampoline<
+ Sync + Sync
+ 'static, + 'static,
>( >(
this: *mut ffi::GstRTSPAuth, this: *mut gst_rtsp_server_sys::GstRTSPAuth,
connection: *mut gio_ffi::GTlsConnection, connection: *mut gio_sys::GTlsConnection,
peer_cert: *mut gio_ffi::GTlsCertificate, peer_cert: *mut gio_sys::GTlsCertificate,
errors: gio_ffi::GTlsCertificateFlags, errors: gio_sys::GTlsCertificateFlags,
f: glib_ffi::gpointer, f: glib_sys::gpointer,
) -> glib_ffi::gboolean ) -> glib_sys::gboolean
where where
P: IsA<RTSPAuth>, P: IsA<RTSPAuth>,
{ {

View file

@ -1,8 +1,8 @@
use ffi;
use glib; use glib;
use glib::object::IsA; use glib::object::IsA;
use glib::source::SourceId; use glib::source::SourceId;
use glib::translate::*; use glib::translate::*;
use gst_rtsp_server_sys;
use RTSPClient; use RTSPClient;
pub trait RTSPClientExtManual: 'static { pub trait RTSPClientExtManual: 'static {
@ -13,7 +13,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExtManual for O {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId { fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId {
let context = context.into(); let context = context.into();
unsafe { 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, self.as_ref().to_glib_none().0,
context.to_glib_none().0, context.to_glib_none().0,
)) ))

View file

@ -6,17 +6,17 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use gst_rtsp_server_sys;
use std::ptr; use std::ptr;
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub struct RTSPContext(ptr::NonNull<ffi::GstRTSPContext>); pub struct RTSPContext(ptr::NonNull<gst_rtsp_server_sys::GstRTSPContext>);
impl RTSPContext { impl RTSPContext {
pub fn with_current_context<F: FnOnce(&RTSPContext) -> T, T>(func: F) -> Option<T> { pub fn with_current_context<F: FnOnce(&RTSPContext) -> T, T>(func: F) -> Option<T> {
unsafe { unsafe {
let ptr = ffi::gst_rtsp_context_get_current(); let ptr = gst_rtsp_server_sys::gst_rtsp_context_get_current();
if ptr.is_null() { if ptr.is_null() {
return None; return None;
} }
@ -30,9 +30,9 @@ impl RTSPContext {
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext { impl glib::translate::FromGlibPtrBorrow<*mut gst_rtsp_server_sys::GstRTSPContext> for RTSPContext {
#[inline] #[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()); assert!(!ptr.is_null());
RTSPContext(ptr::NonNull::new_unchecked(ptr)) RTSPContext(ptr::NonNull::new_unchecked(ptr))
} }

View file

@ -8,13 +8,13 @@
use RTSPMediaFactory; use RTSPMediaFactory;
#[cfg(any(feature = "v1_14", feature = "dox"))]
use ffi;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
use glib::translate::*; use glib::translate::*;
use glib::IsA; use glib::IsA;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
use gst; use gst;
#[cfg(any(feature = "v1_14", feature = "dox"))]
use gst_rtsp_server_sys;
pub trait RTSPMediaFactoryExtManual: 'static { pub trait RTSPMediaFactoryExtManual: 'static {
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
@ -25,7 +25,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExtManual for O {
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn add_role_from_structure(&self, structure: &gst::StructureRef) { fn add_role_from_structure(&self, structure: &gst::StructureRef) {
unsafe { 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, self.as_ref().to_glib_none().0,
structure.as_mut_ptr(), structure.as_mut_ptr(),
); );

View file

@ -1,8 +1,8 @@
use ffi;
use glib; use glib;
use glib::object::IsA; use glib::object::IsA;
use glib::source::SourceId; use glib::source::SourceId;
use glib::translate::*; use glib::translate::*;
use gst_rtsp_server_sys;
use RTSPServer; use RTSPServer;
pub trait RTSPServerExtManual: 'static { pub trait RTSPServerExtManual: 'static {
@ -13,7 +13,7 @@ impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId { fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId {
let context = context.into(); let context = context.into();
unsafe { 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, self.as_ref().to_glib_none().0,
context.to_glib_none().0, context.to_glib_none().0,
)) ))

View file

@ -1,16 +1,16 @@
use ffi;
use glib; use glib;
use glib::object::IsA; use glib::object::IsA;
use glib::source::{Continue, Priority}; use glib::source::{Continue, Priority};
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_sys;
use glib_ffi::{gboolean, gpointer}; use glib_sys::{gboolean, gpointer};
use gst_rtsp_server_sys;
use std::cell::RefCell; use std::cell::RefCell;
use std::mem::transmute; use std::mem::transmute;
use RTSPSessionPool; use RTSPSessionPool;
unsafe extern "C" fn trampoline_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>( unsafe extern "C" fn trampoline_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(
pool: *mut ffi::GstRTSPSessionPool, pool: *mut gst_rtsp_server_sys::GstRTSPSessionPool,
func: gpointer, func: gpointer,
) -> gboolean { ) -> gboolean {
let func: &RefCell<F> = &*(func as *const RefCell<F>); let func: &RefCell<F> = &*(func as *const RefCell<F>);
@ -54,18 +54,20 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
{ {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
let source = ffi::gst_rtsp_session_pool_create_watch(self.as_ref().to_glib_none().0); let source = gst_rtsp_server_sys::gst_rtsp_session_pool_create_watch(
glib_ffi::g_source_set_callback( self.as_ref().to_glib_none().0,
);
glib_sys::g_source_set_callback(
source, source,
Some(transmute(trampoline_watch::<F> as usize)), Some(transmute(trampoline_watch::<F> as usize)),
into_raw_watch(func), into_raw_watch(func),
Some(destroy_closure_watch::<F>), Some(destroy_closure_watch::<F>),
); );
glib_ffi::g_source_set_priority(source, priority.to_glib()); glib_sys::g_source_set_priority(source, priority.to_glib());
let name = name.into(); let name = name.into();
if let Some(name) = name { 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) from_glib_full(source)

View file

@ -1,7 +1,7 @@
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_rtsp_server_sys;
use RTSPStream; use RTSPStream;
pub trait RTSPStreamExtManual: 'static { pub trait RTSPStreamExtManual: 'static {
@ -13,7 +13,7 @@ pub trait RTSPStreamExtManual: 'static {
impl<O: IsA<RTSPStream>> RTSPStreamExtManual for O { impl<O: IsA<RTSPStream>> RTSPStreamExtManual for O {
fn recv_rtcp(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { fn recv_rtcp(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.as_ref().to_glib_none().0,
buffer.to_glib_full(), buffer.to_glib_full(),
)) ))
@ -23,7 +23,7 @@ impl<O: IsA<RTSPStream>> RTSPStreamExtManual for O {
fn recv_rtp(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { fn recv_rtp(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.as_ref().to_glib_none().0,
buffer.to_glib_full(), buffer.to_glib_full(),
)) ))

View file

@ -1,7 +1,7 @@
use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_rtsp_server_sys;
use RTSPStreamTransport; use RTSPStreamTransport;
pub trait RTSPStreamTransportExtManual: 'static { pub trait RTSPStreamTransportExtManual: 'static {
@ -19,7 +19,7 @@ impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExtManual for O {
buffer: &gst::Buffer, buffer: &gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { 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, self.as_ref().to_glib_none().0,
channel, channel,
buffer.to_glib_full(), buffer.to_glib_full(),

View file

@ -1,20 +1,24 @@
use ffi;
use glib; use glib;
use glib::translate::*; use glib::translate::*;
use glib::value::ToSendValue; use glib::value::ToSendValue;
use gst; use gst;
use gst::miniobject::*; use gst::miniobject::*;
use gst_rtsp_server_sys;
use std::fmt; use std::fmt;
gst_define_mini_object_wrapper!(RTSPToken, RTSPTokenRef, ffi::GstRTSPToken, [Debug,], || { gst_define_mini_object_wrapper!(
ffi::gst_rtsp_token_get_type() RTSPToken,
}); RTSPTokenRef,
gst_rtsp_server_sys::GstRTSPToken,
[Debug,],
|| gst_rtsp_server_sys::gst_rtsp_token_get_type()
);
impl RTSPToken { impl RTSPToken {
pub fn new_empty() -> Self { pub fn new_empty() -> Self {
assert_initialized_main_thread!(); 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 { pub fn new(values: &[(&str, &ToSendValue)]) -> Self {
@ -36,7 +40,7 @@ impl RTSPToken {
impl RTSPTokenRef { impl RTSPTokenRef {
pub fn get_string(&self, field: &str) -> Option<String> { pub fn get_string(&self, field: &str) -> Option<String> {
unsafe { 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(), self.as_mut_ptr(),
field.to_glib_none().0, field.to_glib_none().0,
)) ))
@ -44,12 +48,16 @@ impl RTSPTokenRef {
} }
pub fn get_structure(&self) -> Option<gst::Structure> { pub fn get_structure(&self) -> Option<gst::Structure> {
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 { pub fn is_allowed(&self, field: &str) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_token_is_allowed( from_glib(gst_rtsp_server_sys::gst_rtsp_token_is_allowed(
self.as_mut_ptr(), self.as_mut_ptr(),
field.to_glib_none().0, field.to_glib_none().0,
)) ))
@ -58,7 +66,8 @@ impl RTSPTokenRef {
pub fn get_mut_structure(&mut self) -> Option<&mut gst::StructureRef> { pub fn get_mut_structure(&mut self) -> Option<&mut gst::StructureRef> {
unsafe { 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() { if structure.is_null() {
None None
} else { } else {

View file

@ -12,17 +12,17 @@ extern crate libc;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; 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 as gst_sdp;
extern crate gstreamer_sdp_sys as gst_sdp_ffi; extern crate gstreamer_sdp_sys as gst_sdp_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

View file

@ -11,15 +11,15 @@ extern crate libc;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_sdp_sys as ffi; extern crate gstreamer_sdp_sys as gst_sdp_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

View file

@ -10,18 +10,22 @@ use std::ffi::CStr;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use ffi;
use glib::translate::*; use glib::translate::*;
use gst_sdp_sys;
#[repr(C)] #[repr(C)]
pub struct SDPAttribute(pub(crate) ffi::GstSDPAttribute); pub struct SDPAttribute(pub(crate) gst_sdp_sys::GstSDPAttribute);
impl SDPAttribute { impl SDPAttribute {
pub fn new(key: &str, value: Option<&str>) -> Self { pub fn new(key: &str, value: Option<&str>) -> Self {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut attr = mem::zeroed(); 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) SDPAttribute(attr)
} }
} }
@ -52,7 +56,7 @@ impl Clone for SDPAttribute {
impl Drop for SDPAttribute { impl Drop for SDPAttribute {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ffi::gst_sdp_attribute_clear(&mut self.0); gst_sdp_sys::gst_sdp_attribute_clear(&mut self.0);
} }
} }
} }

View file

@ -10,18 +10,18 @@ use std::ffi::CStr;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use ffi;
use glib::translate::*; use glib::translate::*;
use gst_sdp_sys;
#[repr(C)] #[repr(C)]
pub struct SDPBandwidth(pub(crate) ffi::GstSDPBandwidth); pub struct SDPBandwidth(pub(crate) gst_sdp_sys::GstSDPBandwidth);
impl SDPBandwidth { impl SDPBandwidth {
pub fn new(bwtype: &str, bandwidth: u32) -> Self { pub fn new(bwtype: &str, bandwidth: u32) -> Self {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut bw = mem::zeroed(); 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) SDPBandwidth(bw)
} }
} }
@ -44,7 +44,7 @@ impl Clone for SDPBandwidth {
impl Drop for SDPBandwidth { impl Drop for SDPBandwidth {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ffi::gst_sdp_bandwidth_clear(&mut self.0); gst_sdp_sys::gst_sdp_bandwidth_clear(&mut self.0);
} }
} }
} }

View file

@ -10,18 +10,18 @@ use std::ffi::CStr;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use ffi;
use glib::translate::*; use glib::translate::*;
use gst_sdp_sys;
#[repr(C)] #[repr(C)]
pub struct SDPConnection(pub(crate) ffi::GstSDPConnection); pub struct SDPConnection(pub(crate) gst_sdp_sys::GstSDPConnection);
impl SDPConnection { impl SDPConnection {
pub fn new(nettype: &str, addrtype: &str, address: &str, ttl: u32, addr_number: u32) -> Self { pub fn new(nettype: &str, addrtype: &str, address: &str, ttl: u32, addr_number: u32) -> Self {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut conn = mem::zeroed(); let mut conn = mem::zeroed();
ffi::gst_sdp_connection_set( gst_sdp_sys::gst_sdp_connection_set(
&mut conn, &mut conn,
nettype.to_glib_none().0, nettype.to_glib_none().0,
addrtype.to_glib_none().0, addrtype.to_glib_none().0,
@ -69,7 +69,7 @@ impl Clone for SDPConnection {
impl Drop for SDPConnection { impl Drop for SDPConnection {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ffi::gst_sdp_connection_clear(&mut self.0); gst_sdp_sys::gst_sdp_connection_clear(&mut self.0);
} }
} }
} }

View file

@ -9,10 +9,10 @@
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt; use std::fmt;
use ffi; use gst_sdp_sys;
#[repr(C)] #[repr(C)]
pub struct SDPKey(ffi::GstSDPKey); pub struct SDPKey(gst_sdp_sys::GstSDPKey);
impl SDPKey { impl SDPKey {
pub fn type_(&self) -> &str { pub fn type_(&self) -> &str {

View file

@ -13,10 +13,10 @@ use std::mem;
use std::ops; use std::ops;
use std::ptr; use std::ptr;
use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst::prelude::*; use gst::prelude::*;
use gst_sdp_sys;
use sdp_attribute::SDPAttribute; use sdp_attribute::SDPAttribute;
use sdp_bandwidth::SDPBandwidth; use sdp_bandwidth::SDPBandwidth;
@ -25,16 +25,16 @@ use sdp_key::SDPKey;
glib_wrapper! { glib_wrapper! {
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SDPMedia(Boxed<ffi::GstSDPMedia>); pub struct SDPMedia(Boxed<gst_sdp_sys::GstSDPMedia>);
match fn { match fn {
copy => |ptr| { copy => |ptr| {
let mut copy = ptr::null_mut(); 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 copy
}, },
free => |ptr| { 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!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut media = ptr::null_mut(); 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) from_glib_full(media)
} }
} }
@ -80,7 +80,7 @@ impl fmt::Display for SDPMedia {
} }
#[repr(C)] #[repr(C)]
pub struct SDPMediaRef(ffi::GstSDPMedia); pub struct SDPMediaRef(gst_sdp_sys::GstSDPMedia);
impl fmt::Debug for SDPMediaRef { impl fmt::Debug for SDPMediaRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -127,12 +127,18 @@ impl SDPMediaRef {
pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) { pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) {
let value = value.into(); let value = value.into();
let value = value.to_glib_none(); 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) { pub fn add_bandwidth(&mut self, bwtype: &str, bandwidth: u32) {
unsafe { 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, addr_number: u32,
) { ) {
unsafe { unsafe {
ffi::gst_sdp_media_add_connection( gst_sdp_sys::gst_sdp_media_add_connection(
&mut self.0, &mut self.0,
nettype.to_glib_none().0, nettype.to_glib_none().0,
addrtype.to_glib_none().0, addrtype.to_glib_none().0,
@ -157,11 +163,11 @@ impl SDPMediaRef {
} }
pub fn add_format(&mut self, format: &str) { 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<String> { pub fn as_text(&self) -> Option<String> {
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 { pub fn attributes(&self) -> AttributesIter {
@ -181,27 +187,28 @@ impl SDPMediaRef {
} }
pub fn attributes_len(&self) -> u32 { 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<(), ()> { 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
pub fn bandwidths_len(&self) -> u32 { 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 { 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 { 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> { pub fn get_attribute(&self, idx: u32) -> Option<&SDPAttribute> {
@ -210,7 +217,7 @@ impl SDPMediaRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -221,7 +228,7 @@ impl SDPMediaRef {
pub fn get_attribute_val(&self, key: &str) -> Option<&str> { pub fn get_attribute_val(&self, key: &str) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -236,7 +243,8 @@ impl SDPMediaRef {
pub fn get_attribute_val_n(&self, key: &str, nth: u32) -> Option<&str> { pub fn get_attribute_val_n(&self, key: &str, nth: u32) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -255,7 +263,7 @@ impl SDPMediaRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -265,7 +273,7 @@ impl SDPMediaRef {
} }
pub fn get_caps_from_media(&self, pt: i32) -> Option<gst::Caps> { pub fn get_caps_from_media(&self, pt: i32) -> Option<gst::Caps> {
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> { pub fn get_connection(&self, idx: u32) -> Option<&SDPConnection> {
@ -274,7 +282,7 @@ impl SDPMediaRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -289,7 +297,7 @@ impl SDPMediaRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -304,7 +312,7 @@ impl SDPMediaRef {
pub fn get_information(&self) -> Option<&str> { pub fn get_information(&self) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -319,7 +327,7 @@ impl SDPMediaRef {
pub fn get_key(&self) -> Option<&SDPKey> { pub fn get_key(&self) -> Option<&SDPKey> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -330,7 +338,7 @@ impl SDPMediaRef {
pub fn get_media(&self) -> Option<&str> { pub fn get_media(&self) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -344,16 +352,16 @@ impl SDPMediaRef {
} }
pub fn get_num_ports(&self) -> u32 { 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 { 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> { pub fn get_proto(&self) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -374,10 +382,11 @@ impl SDPMediaRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); 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); mem::forget(attr);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -390,10 +399,11 @@ impl SDPMediaRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); 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); mem::forget(bw);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -410,10 +420,11 @@ impl SDPMediaRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); 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); mem::forget(conn);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -426,10 +437,11 @@ impl SDPMediaRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); let idx = idx.map(|idx| idx as i32).unwrap_or(-1);
let result = let result = unsafe {
unsafe { ffi::gst_sdp_media_insert_format(&mut self.0, idx, format.to_glib_none().0) }; gst_sdp_sys::gst_sdp_media_insert_format(&mut self.0, idx, format.to_glib_none().0)
};
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -439,9 +451,9 @@ impl SDPMediaRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -451,9 +463,9 @@ impl SDPMediaRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -463,9 +475,9 @@ impl SDPMediaRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -475,9 +487,9 @@ impl SDPMediaRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -487,10 +499,11 @@ impl SDPMediaRef {
return Err(()); 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); mem::forget(attr);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -500,10 +513,11 @@ impl SDPMediaRef {
return Err(()); 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); mem::forget(bw);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -514,10 +528,10 @@ impl SDPMediaRef {
} }
let result = 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); mem::forget(conn);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -527,46 +541,53 @@ impl SDPMediaRef {
return Err(()); return Err(());
} }
let result = let result = unsafe {
unsafe { ffi::gst_sdp_media_replace_format(&mut self.0, idx, format.to_glib_none().0) }; gst_sdp_sys::gst_sdp_media_replace_format(&mut self.0, idx, format.to_glib_none().0)
};
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
pub fn set_information(&mut self, information: &str) { 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) { pub fn set_key(&mut self, type_: &str, data: &str) {
unsafe { 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) { 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) { 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) { 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<(), ()> { pub fn set_media_from_caps(caps: &gst::Caps, media: &mut SDPMedia) -> Result<(), ()> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let result = unsafe { 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, caps.to_glib_none().0,
media.to_glib_none_mut().0, media.to_glib_none_mut().0,
) )
}; };
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -590,7 +611,7 @@ impl ToOwned for SDPMediaRef {
fn to_owned(&self) -> SDPMedia { fn to_owned(&self) -> SDPMedia {
unsafe { unsafe {
let mut ptr = ptr::null_mut(); 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) from_glib_full(ptr)
} }
} }

View file

@ -13,11 +13,11 @@ use std::mem;
use std::ops; use std::ops;
use std::ptr; use std::ptr;
use ffi;
use glib::translate::*; use glib::translate::*;
use gobject_ffi; use gobject_sys;
use gst; use gst;
use gst::MiniObject; use gst::MiniObject;
use gst_sdp_sys;
use sdp_attribute::SDPAttribute; use sdp_attribute::SDPAttribute;
use sdp_bandwidth::SDPBandwidth; use sdp_bandwidth::SDPBandwidth;
@ -31,12 +31,12 @@ use sdp_zone::SDPZone;
glib_wrapper! { glib_wrapper! {
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SDPMessage(Boxed<ffi::GstSDPMessage>); pub struct SDPMessage(Boxed<gst_sdp_sys::GstSDPMessage>);
match fn { match fn {
copy => |ptr| gobject_ffi::g_boxed_copy(ffi::gst_sdp_message_get_type(), ptr as *mut _) as *mut ffi::GstSDPMessage, 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_ffi::g_boxed_free(ffi::gst_sdp_message_get_type(), ptr as *mut _), free => |ptr| gobject_sys::g_boxed_free(gst_sdp_sys::gst_sdp_message_get_type(), ptr as *mut _),
get_type => || ffi::gst_sdp_message_get_type(), get_type => || gst_sdp_sys::gst_sdp_message_get_type(),
} }
} }
@ -80,7 +80,7 @@ impl SDPMessage {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut msg = mem::zeroed(); 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) from_glib_full(msg)
} }
} }
@ -90,12 +90,13 @@ impl SDPMessage {
unsafe { unsafe {
let size = data.len() as u32; let size = data.len() as u32;
let mut msg = mem::zeroed(); let mut msg = mem::zeroed();
ffi::gst_sdp_message_new(&mut msg); gst_sdp_sys::gst_sdp_message_new(&mut msg);
let result = ffi::gst_sdp_message_parse_buffer(data.to_glib_none().0, size, msg); let result =
gst_sdp_sys::gst_sdp_message_parse_buffer(data.to_glib_none().0, size, msg);
match result { 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(()) Err(())
} }
} }
@ -106,12 +107,12 @@ impl SDPMessage {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut msg = mem::zeroed(); let mut msg = mem::zeroed();
ffi::gst_sdp_message_new(&mut msg); gst_sdp_sys::gst_sdp_message_new(&mut msg);
let result = ffi::gst_sdp_message_parse_uri(uri.to_glib_none().0, msg); let result = gst_sdp_sys::gst_sdp_message_parse_uri(uri.to_glib_none().0, msg);
match result { 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(()) Err(())
} }
} }
@ -120,7 +121,7 @@ impl SDPMessage {
} }
#[repr(C)] #[repr(C)]
pub struct SDPMessageRef(ffi::GstSDPMessage); pub struct SDPMessageRef(gst_sdp_sys::GstSDPMessage);
impl fmt::Debug for SDPMessageRef { impl fmt::Debug for SDPMessageRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -170,7 +171,7 @@ unsafe impl Sync for SDPMessageRef {}
impl SDPMessageRef { impl SDPMessageRef {
pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) { pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) {
unsafe { unsafe {
ffi::gst_sdp_message_add_attribute( gst_sdp_sys::gst_sdp_message_add_attribute(
&mut self.0, &mut self.0,
key.to_glib_none().0, key.to_glib_none().0,
value.into().to_glib_none().0, value.into().to_glib_none().0,
@ -179,25 +180,25 @@ impl SDPMessageRef {
} }
pub fn add_email(&mut self, email: &str) { 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) { pub fn add_media(&mut self, media: SDPMedia) {
unsafe { unsafe {
ffi::gst_sdp_message_add_media( gst_sdp_sys::gst_sdp_message_add_media(
&mut self.0, &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) { 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]) { pub fn add_time(&mut self, start: &str, stop: &str, repeat: &[&str]) {
unsafe { unsafe {
ffi::gst_sdp_message_add_time( gst_sdp_sys::gst_sdp_message_add_time(
&mut self.0, &mut self.0,
start.to_glib_none().0, start.to_glib_none().0,
stop.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) { pub fn add_zone(&mut self, adj_time: &str, typed_time: &str) {
unsafe { unsafe {
ffi::gst_sdp_message_add_zone( gst_sdp_sys::gst_sdp_message_add_zone(
&mut self.0, &mut self.0,
adj_time.to_glib_none().0, adj_time.to_glib_none().0,
typed_time.to_glib_none().0, typed_time.to_glib_none().0,
@ -217,31 +218,32 @@ impl SDPMessageRef {
} }
pub fn as_text(&self) -> Option<String> { pub fn as_text(&self) -> Option<String> {
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 { 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<(), ()> { 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
pub fn bandwidths_len(&self) -> u32 { 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) { 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 { 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> { pub fn get_attribute(&self, idx: u32) -> Option<&SDPAttribute> {
@ -250,7 +252,7 @@ impl SDPMessageRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -261,7 +263,7 @@ impl SDPMessageRef {
pub fn get_attribute_val(&self, key: &str) -> Option<&str> { pub fn get_attribute_val(&self, key: &str) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -276,7 +278,11 @@ impl SDPMessageRef {
pub fn get_attribute_val_n(&self, key: &str, nth: u32) -> Option<&str> { pub fn get_attribute_val_n(&self, key: &str, nth: u32) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -295,7 +301,7 @@ impl SDPMessageRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -306,7 +312,7 @@ impl SDPMessageRef {
pub fn get_connection(&self) -> Option<&SDPConnection> { pub fn get_connection(&self) -> Option<&SDPConnection> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -321,7 +327,7 @@ impl SDPMessageRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -336,7 +342,7 @@ impl SDPMessageRef {
pub fn get_information(&self) -> Option<&str> { pub fn get_information(&self) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -351,7 +357,7 @@ impl SDPMessageRef {
pub fn get_key(&self) -> Option<&SDPKey> { pub fn get_key(&self) -> Option<&SDPKey> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -366,7 +372,7 @@ impl SDPMessageRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -377,7 +383,7 @@ impl SDPMessageRef {
pub fn get_origin(&self) -> Option<&SDPOrigin> { pub fn get_origin(&self) -> Option<&SDPOrigin> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -392,7 +398,7 @@ impl SDPMessageRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -407,7 +413,7 @@ impl SDPMessageRef {
pub fn get_session_name(&self) -> Option<&str> { pub fn get_session_name(&self) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -426,7 +432,7 @@ impl SDPMessageRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -437,7 +443,7 @@ impl SDPMessageRef {
pub fn get_uri(&self) -> Option<&str> { pub fn get_uri(&self) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -452,7 +458,7 @@ impl SDPMessageRef {
pub fn get_version(&self) -> Option<&str> { pub fn get_version(&self) -> Option<&str> {
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -471,7 +477,7 @@ impl SDPMessageRef {
} }
unsafe { 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() { if ptr.is_null() {
None None
} else { } else {
@ -489,10 +495,10 @@ impl SDPMessageRef {
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); let idx = idx.map(|idx| idx as i32).unwrap_or(-1);
let result = 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); mem::forget(attr);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -505,10 +511,11 @@ impl SDPMessageRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); 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); mem::forget(bw);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -521,10 +528,11 @@ impl SDPMessageRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); let idx = idx.map(|idx| idx as i32).unwrap_or(-1);
let result = let result = unsafe {
unsafe { ffi::gst_sdp_message_insert_email(&mut self.0, idx, email.to_glib_none().0) }; gst_sdp_sys::gst_sdp_message_insert_email(&mut self.0, idx, email.to_glib_none().0)
};
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -537,10 +545,11 @@ impl SDPMessageRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); let idx = idx.map(|idx| idx as i32).unwrap_or(-1);
let result = let result = unsafe {
unsafe { ffi::gst_sdp_message_insert_phone(&mut self.0, idx, phone.to_glib_none().0) }; gst_sdp_sys::gst_sdp_message_insert_phone(&mut self.0, idx, phone.to_glib_none().0)
};
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -553,10 +562,11 @@ impl SDPMessageRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); 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); mem::forget(time);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -569,20 +579,21 @@ impl SDPMessageRef {
} }
let idx = idx.map(|idx| idx as i32).unwrap_or(-1); 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); mem::forget(zone);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
pub fn medias_len(&self) -> u32 { 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 { 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<(), ()> { pub fn remove_attribute(&mut self, idx: u32) -> Result<(), ()> {
@ -590,9 +601,9 @@ impl SDPMessageRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -602,9 +613,9 @@ impl SDPMessageRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -614,9 +625,9 @@ impl SDPMessageRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -626,9 +637,9 @@ impl SDPMessageRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -638,9 +649,9 @@ impl SDPMessageRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -650,9 +661,9 @@ impl SDPMessageRef {
return Err(()); 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 { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -662,11 +673,12 @@ impl SDPMessageRef {
return Err(()); return Err(());
} }
let result = let result = unsafe {
unsafe { ffi::gst_sdp_message_replace_attribute(&mut self.0, idx, &mut attr.0) }; gst_sdp_sys::gst_sdp_message_replace_attribute(&mut self.0, idx, &mut attr.0)
};
mem::forget(attr); mem::forget(attr);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -676,10 +688,11 @@ impl SDPMessageRef {
return Err(()); 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); mem::forget(bw);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -689,10 +702,11 @@ impl SDPMessageRef {
return Err(()); return Err(());
} }
let result = let result = unsafe {
unsafe { ffi::gst_sdp_message_replace_email(&mut self.0, idx, email.to_glib_none().0) }; gst_sdp_sys::gst_sdp_message_replace_email(&mut self.0, idx, email.to_glib_none().0)
};
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -702,10 +716,11 @@ impl SDPMessageRef {
return Err(()); return Err(());
} }
let result = let result = unsafe {
unsafe { ffi::gst_sdp_message_replace_phone(&mut self.0, idx, phone.to_glib_none().0) }; gst_sdp_sys::gst_sdp_message_replace_phone(&mut self.0, idx, phone.to_glib_none().0)
};
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -715,10 +730,11 @@ impl SDPMessageRef {
return Err(()); 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); mem::forget(time);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -728,10 +744,11 @@ impl SDPMessageRef {
return Err(()); 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); mem::forget(zone);
match result { match result {
ffi::GST_SDP_OK => Ok(()), gst_sdp_sys::GST_SDP_OK => Ok(()),
_ => Err(()), _ => Err(()),
} }
} }
@ -745,7 +762,7 @@ impl SDPMessageRef {
addr_number: u32, addr_number: u32,
) { ) {
unsafe { unsafe {
ffi::gst_sdp_message_set_connection( gst_sdp_sys::gst_sdp_message_set_connection(
&mut self.0, &mut self.0,
nettype.to_glib_none().0, nettype.to_glib_none().0,
addrtype.to_glib_none().0, addrtype.to_glib_none().0,
@ -757,12 +774,18 @@ impl SDPMessageRef {
} }
pub fn set_information(&mut self, information: &str) { 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) { pub fn set_key(&mut self, type_: &str, data: &str) {
unsafe { 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, addr: &str,
) { ) {
unsafe { unsafe {
ffi::gst_sdp_message_set_origin( gst_sdp_sys::gst_sdp_message_set_origin(
&mut self.0, &mut self.0,
username.to_glib_none().0, username.to_glib_none().0,
sess_id.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) { pub fn set_session_name(&mut self, session_name: &str) {
unsafe { 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) { 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) { 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 { 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 { 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<String> { pub fn as_uri(&self, scheme: &str) -> Option<String> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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, scheme.to_glib_none().0,
&self.0, &self.0,
)) ))
@ -867,7 +893,7 @@ impl ToOwned for SDPMessageRef {
fn to_owned(&self) -> SDPMessage { fn to_owned(&self) -> SDPMessage {
unsafe { unsafe {
let mut ptr = ptr::null_mut(); 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) from_glib_full(ptr)
} }
} }

View file

@ -9,10 +9,10 @@
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt; use std::fmt;
use ffi; use gst_sdp_sys;
#[repr(C)] #[repr(C)]
pub struct SDPOrigin(pub(crate) ffi::GstSDPOrigin); pub struct SDPOrigin(pub(crate) gst_sdp_sys::GstSDPOrigin);
impl SDPOrigin { impl SDPOrigin {
pub fn username(&self) -> &str { pub fn username(&self) -> &str {

View file

@ -11,18 +11,18 @@ use std::fmt;
use std::mem; use std::mem;
use std::os::raw::c_char; use std::os::raw::c_char;
use ffi;
use glib::translate::*; use glib::translate::*;
use gst_sdp_sys;
#[repr(C)] #[repr(C)]
pub struct SDPTime(pub(crate) ffi::GstSDPTime); pub struct SDPTime(pub(crate) gst_sdp_sys::GstSDPTime);
impl SDPTime { impl SDPTime {
pub fn new(start: &str, stop: &str, repeat: &[&str]) -> Self { pub fn new(start: &str, stop: &str, repeat: &[&str]) -> Self {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut time = mem::zeroed(); let mut time = mem::zeroed();
ffi::gst_sdp_time_set( gst_sdp_sys::gst_sdp_time_set(
&mut time, &mut time,
start.to_glib_none().0, start.to_glib_none().0,
stop.to_glib_none().0, stop.to_glib_none().0,
@ -63,7 +63,7 @@ impl Clone for SDPTime {
impl Drop for SDPTime { impl Drop for SDPTime {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ffi::gst_sdp_time_clear(&mut self.0); gst_sdp_sys::gst_sdp_time_clear(&mut self.0);
} }
} }
} }

View file

@ -10,18 +10,18 @@ use std::ffi::CStr;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use ffi;
use glib::translate::*; use glib::translate::*;
use gst_sdp_sys;
#[repr(C)] #[repr(C)]
pub struct SDPZone(pub(crate) ffi::GstSDPZone); pub struct SDPZone(pub(crate) gst_sdp_sys::GstSDPZone);
impl SDPZone { impl SDPZone {
pub fn new(time: &str, typed_time: &str) -> Self { pub fn new(time: &str, typed_time: &str) -> Self {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut zone = mem::zeroed(); let mut zone = mem::zeroed();
ffi::gst_sdp_zone_set( gst_sdp_sys::gst_sdp_zone_set(
&mut zone, &mut zone,
time.to_glib_none().0, time.to_glib_none().0,
typed_time.to_glib_none().0, typed_time.to_glib_none().0,
@ -48,7 +48,7 @@ impl Clone for SDPZone {
impl Drop for SDPZone { impl Drop for SDPZone {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ffi::gst_sdp_zone_clear(&mut self.0); gst_sdp_sys::gst_sdp_zone_clear(&mut self.0);
} }
} }
} }

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gst_sys;
use gst_ffi; use gst_video_sys;
use glib; use glib;
use glib::translate::{from_glib_full, ToGlib, ToGlibPtr}; use glib::translate::{from_glib_full, ToGlib, ToGlibPtr};
@ -24,7 +24,7 @@ pub fn convert_sample(
) -> Result<gst::Sample, glib::Error> { ) -> Result<gst::Sample, glib::Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); 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, sample.to_glib_none().0,
caps.to_glib_none().0, caps.to_glib_none().0,
timeout.to_glib(), timeout.to_glib(),
@ -73,9 +73,9 @@ unsafe fn convert_sample_async_unsafe<F>(
F: FnOnce(Result<gst::Sample, glib::Error>) + 'static, F: FnOnce(Result<gst::Sample, glib::Error>) + 'static,
{ {
unsafe extern "C" fn convert_sample_async_trampoline<F>( unsafe extern "C" fn convert_sample_async_trampoline<F>(
sample: *mut gst_ffi::GstSample, sample: *mut gst_sys::GstSample,
error: *mut glib_ffi::GError, error: *mut glib_sys::GError,
user_data: glib_ffi::gpointer, user_data: glib_sys::gpointer,
) where ) where
F: FnOnce(Result<gst::Sample, glib::Error>) + 'static, F: FnOnce(Result<gst::Sample, glib::Error>) + 'static,
{ {
@ -88,7 +88,7 @@ unsafe fn convert_sample_async_unsafe<F>(
callback(Err(from_glib_full(error))) callback(Err(from_glib_full(error)))
} }
} }
unsafe extern "C" fn convert_sample_async_free<F>(user_data: glib_ffi::gpointer) unsafe extern "C" fn convert_sample_async_free<F>(user_data: glib_sys::gpointer)
where where
F: FnOnce(Result<gst::Sample, glib::Error>) + 'static, F: FnOnce(Result<gst::Sample, glib::Error>) + 'static,
{ {
@ -97,12 +97,12 @@ unsafe fn convert_sample_async_unsafe<F>(
let user_data: Box<Option<F>> = Box::new(Some(func)); let user_data: Box<Option<F>> = Box::new(Some(func));
ffi::gst_video_convert_sample_async( gst_video_sys::gst_video_convert_sample_async(
sample.to_glib_none().0, sample.to_glib_none().0,
caps.to_glib_none().0, caps.to_glib_none().0,
timeout.to_glib(), timeout.to_glib(),
Some(convert_sample_async_trampoline::<F>), Some(convert_sample_async_trampoline::<F>),
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::<F> as usize)), Some(mem::transmute(convert_sample_async_free::<F> as usize)),
); );
} }

View file

@ -12,18 +12,18 @@ extern crate libc;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
#[macro_use] #[macro_use]
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base; extern crate gstreamer_base as gst_base;
extern crate gstreamer_base_sys as gst_base_ffi; extern crate gstreamer_base_sys as gst_base_sys;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
extern crate gstreamer_video_sys as ffi; extern crate gstreamer_video_sys as gst_video_sys;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

View file

@ -6,8 +6,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_sys;
use gst_ffi; use gst_video_sys;
use glib::translate::{from_glib, from_glib_full, ToGlib}; use glib::translate::{from_glib, from_glib_full, ToGlib};
use glib::ToSendValue; use glib::ToSendValue;
@ -16,7 +16,11 @@ use gst::MiniObject;
use std::mem; use std::mem;
pub fn is_force_key_unit_event(event: &gst::EventRef) -> bool { 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 // FIXME: Copy from gstreamer/src/event.rs
@ -50,16 +54,16 @@ macro_rules! event_builder_generic_impl {
unsafe { unsafe {
let event = $new_fn(&mut self); let event = $new_fn(&mut self);
if let Some(seqnum) = self.seqnum { 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 { 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( 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 { for (k, v) in self.other_fields {
@ -132,15 +136,15 @@ impl<'a> DownstreamForceKeyUnitEventBuilder<'a> {
Self { count, ..self } Self { count, ..self }
} }
event_builder_generic_impl!( event_builder_generic_impl!(|s: &mut Self| {
|s: &mut Self| ffi::gst_video_event_new_downstream_force_key_unit( gst_video_sys::gst_video_event_new_downstream_force_key_unit(
s.timestamp.to_glib(), s.timestamp.to_glib(),
s.stream_time.to_glib(), s.stream_time.to_glib(),
s.running_time.to_glib(), s.running_time.to_glib(),
s.all_headers.to_glib(), s.all_headers.to_glib(),
s.count, s.count,
) )
); });
} }
#[derive(Clone, PartialEq, Eq, Debug)] #[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 all_headers = mem::uninitialized();
let mut count = mem::uninitialized(); let mut count = mem::uninitialized();
let res: bool = from_glib(ffi::gst_video_event_parse_downstream_force_key_unit( let res: bool = from_glib(
gst_video_sys::gst_video_event_parse_downstream_force_key_unit(
event.as_mut_ptr(), event.as_mut_ptr(),
&mut timestamp, &mut timestamp,
&mut stream_time, &mut stream_time,
&mut running_time, &mut running_time,
&mut all_headers, &mut all_headers,
&mut count, &mut count,
)); ),
);
if res { if res {
Some(DownstreamForceKeyUnitEvent { Some(DownstreamForceKeyUnitEvent {
timestamp: from_glib(timestamp), timestamp: from_glib(timestamp),
@ -228,13 +234,13 @@ impl<'a> UpstreamForceKeyUnitEventBuilder<'a> {
Self { count, ..self } Self { count, ..self }
} }
event_builder_generic_impl!( event_builder_generic_impl!(|s: &mut Self| {
|s: &mut Self| ffi::gst_video_event_new_upstream_force_key_unit( gst_video_sys::gst_video_event_new_upstream_force_key_unit(
s.running_time.to_glib(), s.running_time.to_glib(),
s.all_headers.to_glib(), s.all_headers.to_glib(),
s.count, s.count,
) )
); });
} }
#[derive(Clone, PartialEq, Eq, Debug)] #[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 all_headers = mem::uninitialized();
let mut count = mem::uninitialized(); let mut count = mem::uninitialized();
let res: bool = from_glib(ffi::gst_video_event_parse_upstream_force_key_unit( let res: bool = from_glib(
gst_video_sys::gst_video_event_parse_upstream_force_key_unit(
event.as_mut_ptr(), event.as_mut_ptr(),
&mut running_time, &mut running_time,
&mut all_headers, &mut all_headers,
&mut count, &mut count,
)); ),
);
if res { if res {
Some(UpstreamForceKeyUnitEvent { Some(UpstreamForceKeyUnitEvent {
running_time: from_glib(running_time), 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( event_builder_generic_impl!(
s.in_still.to_glib() |s: &mut Self| gst_video_sys::gst_video_event_new_still_frame(s.in_still.to_glib())
)); );
} }
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug)]
@ -320,7 +328,7 @@ pub fn parse_still_frame_event(event: &gst::EventRef) -> Option<StillFrameEvent>
unsafe { unsafe {
let mut in_still = mem::uninitialized(); 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(), event.as_mut_ptr(),
&mut in_still, &mut in_still,
)); ));

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_video_sys;
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt; use std::fmt;
@ -49,13 +49,17 @@ impl ::VideoFormat {
pub fn from_string(s: &str) -> ::VideoFormat { pub fn from_string(s: &str) -> ::VideoFormat {
assert_initialized_main_thread!(); 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 { pub fn from_fourcc(fourcc: u32) -> ::VideoFormat {
assert_initialized_main_thread!(); 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( pub fn from_masks(
@ -70,7 +74,7 @@ impl ::VideoFormat {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
from_glib(ffi::gst_video_format_from_masks( from_glib(gst_video_sys::gst_video_format_from_masks(
depth as i32, depth as i32,
bpp as i32, bpp as i32,
endianness.to_glib(), endianness.to_glib(),
@ -88,7 +92,7 @@ impl ::VideoFormat {
} }
unsafe { 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() .to_str()
.unwrap() .unwrap()
} }

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_video_sys;
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt; use std::fmt;
@ -15,14 +15,14 @@ use std::str;
use glib; use glib;
use glib::translate::{from_glib, ToGlib}; use glib::translate::{from_glib, ToGlib};
pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo); pub struct VideoFormatInfo(&'static gst_video_sys::GstVideoFormatInfo);
impl VideoFormatInfo { impl VideoFormatInfo {
pub fn from_format(format: ::VideoFormat) -> VideoFormatInfo { pub fn from_format(format: ::VideoFormat) -> VideoFormatInfo {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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()); assert!(!info.is_null());
VideoFormatInfo(&*info) VideoFormatInfo(&*info)
@ -106,35 +106,35 @@ impl VideoFormatInfo {
} }
pub fn has_alpha(&self) -> bool { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { pub fn scale_width(&self, component: u8, width: u32) -> u32 {
@ -190,26 +190,30 @@ impl From<::VideoFormat> for VideoFormatInfo {
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::GlibPtrDefault for VideoFormatInfo { impl glib::translate::GlibPtrDefault for VideoFormatInfo {
type GlibType = *mut ffi::GstVideoFormatInfo; type GlibType = *mut gst_video_sys::GstVideoFormatInfo;
} }
#[doc(hidden)] #[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; 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) 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!() unimplemented!()
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*mut ffi::GstVideoFormatInfo> for VideoFormatInfo { impl glib::translate::FromGlibPtrNone<*mut gst_video_sys::GstVideoFormatInfo> for VideoFormatInfo {
#[inline] #[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) VideoFormatInfo(&*ptr)
} }
} }

View file

@ -6,8 +6,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use gst_sys;
use gst_ffi; use gst_video_sys;
use glib; use glib;
use glib::translate::{from_glib, ToGlibPtr}; use glib::translate::{from_glib, ToGlibPtr};
@ -25,7 +25,7 @@ pub enum Writable {}
#[derive(Debug)] #[derive(Debug)]
pub struct VideoFrame<T>( pub struct VideoFrame<T>(
ffi::GstVideoFrame, gst_video_sys::GstVideoFrame,
Option<gst::Buffer>, Option<gst::Buffer>,
::VideoInfo, ::VideoInfo,
PhantomData<T>, PhantomData<T>,
@ -53,7 +53,7 @@ impl<T> VideoFrame<T> {
pub fn copy(&self, dest: &mut VideoFrame<Writable>) -> Result<(), glib::BoolError> { pub fn copy(&self, dest: &mut VideoFrame<Writable>) -> Result<(), glib::BoolError> {
unsafe { 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 { if res {
Ok(()) Ok(())
} else { } else {
@ -70,7 +70,11 @@ impl<T> VideoFrame<T> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { 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 { if res {
Ok(()) Ok(())
} else { } else {
@ -162,7 +166,7 @@ impl<T> VideoFrame<T> {
} }
} }
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 info = ::VideoInfo(ptr::read(&frame.info));
let buffer = gst::Buffer::from_glib_none(frame.buffer); let buffer = gst::Buffer::from_glib_none(frame.buffer);
VideoFrame(frame, Some(buffer), info, PhantomData) VideoFrame(frame, Some(buffer), info, PhantomData)
@ -172,7 +176,7 @@ impl<T> VideoFrame<T> {
impl<T> Drop for VideoFrame<T> { impl<T> Drop for VideoFrame<T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { 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<Readable> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.to_glib_none().0, 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 { if !res {
@ -211,12 +215,12 @@ impl VideoFrame<Readable> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.to_glib_none().0, buffer.to_glib_none().0,
id, 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 { if !res {
@ -234,7 +238,7 @@ impl VideoFrame<Readable> {
VideoFrameRef(vframe, Some(self.buffer()), info, true) 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 &self.0
} }
} }
@ -248,13 +252,13 @@ impl VideoFrame<Writable> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.to_glib_none().0, buffer.to_glib_none().0,
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
| gst_ffi::GST_MAP_READ | gst_sys::GST_MAP_READ
| gst_ffi::GST_MAP_WRITE, | gst_sys::GST_MAP_WRITE,
)); ));
if !res { if !res {
@ -275,14 +279,14 @@ impl VideoFrame<Writable> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.to_glib_none().0, buffer.to_glib_none().0,
id, id,
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
| gst_ffi::GST_MAP_READ | gst_sys::GST_MAP_READ
| gst_ffi::GST_MAP_WRITE, | gst_sys::GST_MAP_WRITE,
)); ));
if !res { if !res {
@ -334,20 +338,20 @@ impl VideoFrame<Writable> {
VideoFrameRef(vframe, Some(self.buffer_mut()), info, true) 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 &mut self.0
} }
} }
#[derive(Debug)] #[derive(Debug)]
pub struct VideoFrameRef<T>(ffi::GstVideoFrame, Option<T>, ::VideoInfo, bool); pub struct VideoFrameRef<T>(gst_video_sys::GstVideoFrame, Option<T>, ::VideoInfo, bool);
impl<'a> VideoFrameRef<&'a gst::BufferRef> { 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 &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()); assert!(!frame.is_null());
let frame = ptr::read(frame); let frame = ptr::read(frame);
@ -364,11 +368,11 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.as_mut_ptr(), 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 { if !res {
@ -389,12 +393,12 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
id, 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 { if !res {
@ -423,7 +427,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
dest: &mut VideoFrameRef<&mut gst::BufferRef>, dest: &mut VideoFrameRef<&mut gst::BufferRef>,
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
unsafe { 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 { if res {
Ok(()) Ok(())
} else { } else {
@ -440,7 +444,11 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { 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 { if res {
Ok(()) Ok(())
} else { } else {
@ -534,7 +542,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
} }
impl<'a> VideoFrameRef<&'a mut 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()); assert!(!frame.is_null());
let frame = ptr::read(frame); let frame = ptr::read(frame);
@ -551,13 +559,13 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
| gst_ffi::GST_MAP_READ | gst_sys::GST_MAP_READ
| gst_ffi::GST_MAP_WRITE, | gst_sys::GST_MAP_WRITE,
)); ));
if !res { if !res {
@ -578,14 +586,14 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
unsafe { unsafe {
let mut frame = mem::zeroed(); 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, &mut frame,
info.to_glib_none().0 as *mut _, info.to_glib_none().0 as *mut _,
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
id, id,
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF gst_video_sys::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
| gst_ffi::GST_MAP_READ | gst_sys::GST_MAP_READ
| gst_ffi::GST_MAP_WRITE, | gst_sys::GST_MAP_WRITE,
)); ));
if !res { 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 &mut self.0
} }
} }
@ -651,7 +659,7 @@ impl<T> Drop for VideoFrameRef<T> {
fn drop(&mut self) { fn drop(&mut self) {
if !self.3 { if !self.3 {
unsafe { unsafe {
ffi::gst_video_frame_unmap(&mut self.0); gst_video_sys::gst_video_frame_unmap(&mut self.0);
} }
} }
} }

View file

@ -6,9 +6,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi; use glib_sys;
use glib_ffi; use gobject_sys;
use gobject_ffi; use gst_video_sys;
use glib; use glib;
use glib::translate::{ use glib::translate::{
@ -34,21 +34,21 @@ pub enum VideoColorRange {
#[doc(hidden)] #[doc(hidden)]
impl ToGlib for VideoColorRange { 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 { match *self {
VideoColorRange::Unknown => ffi::GST_VIDEO_COLOR_RANGE_UNKNOWN, VideoColorRange::Unknown => gst_video_sys::GST_VIDEO_COLOR_RANGE_UNKNOWN,
VideoColorRange::Range0255 => ffi::GST_VIDEO_COLOR_RANGE_0_255, VideoColorRange::Range0255 => gst_video_sys::GST_VIDEO_COLOR_RANGE_0_255,
VideoColorRange::Range16235 => ffi::GST_VIDEO_COLOR_RANGE_16_235, VideoColorRange::Range16235 => gst_video_sys::GST_VIDEO_COLOR_RANGE_16_235,
VideoColorRange::__Unknown(value) => value, VideoColorRange::__Unknown(value) => value,
} }
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlib<ffi::GstVideoColorRange> for VideoColorRange { impl FromGlib<gst_video_sys::GstVideoColorRange> for VideoColorRange {
fn from_glib(value: ffi::GstVideoColorRange) -> Self { fn from_glib(value: gst_video_sys::GstVideoColorRange) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
match value as i32 { match value as i32 {
0 => VideoColorRange::Unknown, 0 => VideoColorRange::Unknown,
@ -61,7 +61,7 @@ impl FromGlib<ffi::GstVideoColorRange> for VideoColorRange {
impl glib::StaticType for VideoColorRange { impl glib::StaticType for VideoColorRange {
fn static_type() -> glib::Type { 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 { impl<'a> glib::value::FromValue<'a> for VideoColorRange {
unsafe fn from_value(value: &glib::value::Value) -> Self { 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 { impl glib::value::SetValue for VideoColorRange {
unsafe fn set_value(value: &mut glib::value::Value, this: &Self) { 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 { impl VideoColorimetry {
pub fn new( pub fn new(
@ -95,7 +95,7 @@ impl VideoColorimetry {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let colorimetry = unsafe { 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.range = range.to_glib();
colorimetry.matrix = matrix.to_glib(); colorimetry.matrix = matrix.to_glib();
@ -109,7 +109,7 @@ impl VideoColorimetry {
} }
pub fn to_string(&self) -> String { 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<Self> { pub fn from_string(s: &str) -> Option<Self> {
@ -117,7 +117,7 @@ impl VideoColorimetry {
unsafe { unsafe {
let mut colorimetry = mem::zeroed(); 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, &mut colorimetry,
s.to_glib_none().0, s.to_glib_none().0,
)); ));
@ -154,7 +154,11 @@ impl Clone for VideoColorimetry {
impl PartialEq for VideoColorimetry { impl PartialEq for VideoColorimetry {
fn eq(&self, other: &Self) -> bool { 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 { impl fmt::Debug for VideoInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
@ -263,7 +267,7 @@ impl<'a> VideoInfoBuilder<'a> {
unsafe { unsafe {
let mut info = mem::uninitialized(); let mut info = mem::uninitialized();
ffi::gst_video_info_set_format( gst_video_sys::gst_video_info_set_format(
&mut info, &mut info,
self.format.to_glib(), self.format.to_glib(),
self.width, self.width,
@ -494,7 +498,10 @@ impl VideoInfo {
unsafe { unsafe {
let mut info = mem::uninitialized(); 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)) Some(VideoInfo(info))
} else { } else {
None None
@ -503,7 +510,11 @@ impl VideoInfo {
} }
pub fn to_caps(&self) -> Option<gst::Caps> { pub fn to_caps(&self) -> Option<gst::Caps> {
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 { pub fn format(&self) -> ::VideoFormat {
@ -621,7 +632,7 @@ impl VideoInfo {
let src_val = src_val.into(); let src_val = src_val.into();
unsafe { unsafe {
let mut dest_val = mem::uninitialized(); 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 _, &self.0 as *const _ as *mut _,
src_val.get_format().to_glib(), src_val.get_format().to_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
@ -645,7 +656,7 @@ impl VideoInfo {
let src_val = src_val.into(); let src_val = src_val.into();
unsafe { unsafe {
let mut dest_val = mem::uninitialized(); 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 _, &self.0 as *const _ as *mut _,
src_val.get_format().to_glib(), src_val.get_format().to_glib(),
src_val.to_raw_value(), src_val.to_raw_value(),
@ -668,7 +679,7 @@ impl Clone for VideoInfo {
impl PartialEq for VideoInfo { impl PartialEq for VideoInfo {
fn eq(&self, other: &Self) -> bool { 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 { impl glib::types::StaticType for VideoInfo {
fn static_type() -> glib::types::Type { 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)] #[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for VideoInfo { impl<'a> glib::value::FromValueOptional<'a> for VideoInfo {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> { unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<VideoInfo>::from_glib_none( Option::<VideoInfo>::from_glib_none(gobject_sys::g_value_get_boxed(value.to_glib_none().0)
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstVideoInfo as *mut gst_video_sys::GstVideoInfo)
)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::value::SetValue for VideoInfo { impl glib::value::SetValue for VideoInfo {
unsafe fn set_value(value: &mut glib::Value, this: &Self) { 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, value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(this).0 glib::translate::ToGlibPtr::<*const gst_video_sys::GstVideoInfo>::to_glib_none(this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }
@ -706,10 +716,10 @@ impl glib::value::SetValue for VideoInfo {
#[doc(hidden)] #[doc(hidden)]
impl glib::value::SetValueOptional for VideoInfo { impl glib::value::SetValueOptional for VideoInfo {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { 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, value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(&this).0 glib::translate::ToGlibPtr::<*const gst_video_sys::GstVideoInfo>::to_glib_none(&this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }
@ -723,36 +733,38 @@ impl glib::translate::Uninitialized for VideoInfo {
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::GlibPtrDefault for VideoInfo { impl glib::translate::GlibPtrDefault for VideoInfo {
type GlibType = *mut ffi::GstVideoInfo; type GlibType = *mut gst_video_sys::GstVideoInfo;
} }
#[doc(hidden)] #[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; 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) 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!() unimplemented!()
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::FromGlibPtrNone<*mut ffi::GstVideoInfo> for VideoInfo { impl glib::translate::FromGlibPtrNone<*mut gst_video_sys::GstVideoInfo> for VideoInfo {
#[inline] #[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)) VideoInfo(ptr::read(ptr))
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::translate::FromGlibPtrFull<*mut ffi::GstVideoInfo> for VideoInfo { impl glib::translate::FromGlibPtrFull<*mut gst_video_sys::GstVideoInfo> for VideoInfo {
#[inline] #[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); let info = from_glib_none(ptr);
glib_ffi::g_free(ptr as *mut _); glib_sys::g_free(ptr as *mut _);
info info
} }
} }
@ -760,13 +772,21 @@ impl glib::translate::FromGlibPtrFull<*mut ffi::GstVideoInfo> for VideoInfo {
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
impl ::VideoFieldOrder { impl ::VideoFieldOrder {
pub fn to_string(self) -> String { 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 { pub fn from_string(s: &str) -> Self {
assert_initialized_main_thread!(); 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 { impl ::VideoInterlaceMode {
pub fn to_string(self) -> String { 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 { pub fn from_string(s: &str) -> Self {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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, s.to_glib_none().0,
)) ))
} }

View file

@ -8,15 +8,15 @@
use std::fmt; use std::fmt;
use ffi;
use glib; use glib;
use glib::translate::{from_glib, ToGlib}; use glib::translate::{from_glib, ToGlib};
use gst; use gst;
use gst::prelude::*; use gst::prelude::*;
use gst_ffi; use gst_sys;
use gst_video_sys;
#[repr(C)] #[repr(C)]
pub struct VideoMeta(ffi::GstVideoMeta); pub struct VideoMeta(gst_video_sys::GstVideoMeta);
impl VideoMeta { impl VideoMeta {
pub fn add( pub fn add(
@ -30,7 +30,7 @@ impl VideoMeta {
assert!(buffer.get_size() >= info.size()); assert!(buffer.get_size() >= info.size());
unsafe { unsafe {
let meta = ffi::gst_buffer_add_video_meta( let meta = gst_video_sys::gst_buffer_add_video_meta(
buffer.as_mut_ptr(), buffer.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
format.to_glib(), format.to_glib(),
@ -61,7 +61,7 @@ impl VideoMeta {
assert!(buffer.get_size() >= info.size()); assert!(buffer.get_size() >= info.size());
unsafe { 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(), buffer.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
format.to_glib(), format.to_glib(),
@ -110,10 +110,10 @@ impl VideoMeta {
} }
unsafe impl MetaAPI for VideoMeta { unsafe impl MetaAPI for VideoMeta {
type GstType = ffi::GstVideoMeta; type GstType = gst_video_sys::GstVideoMeta;
fn get_meta_api() -> glib::Type { 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)] #[repr(C)]
pub struct VideoOverlayCompositionMeta(ffi::GstVideoOverlayCompositionMeta); pub struct VideoOverlayCompositionMeta(gst_video_sys::GstVideoOverlayCompositionMeta);
impl VideoOverlayCompositionMeta { impl VideoOverlayCompositionMeta {
pub fn add<'a>( pub fn add<'a>(
@ -141,7 +141,7 @@ impl VideoOverlayCompositionMeta {
overlay: &::VideoOverlayComposition, overlay: &::VideoOverlayComposition,
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
unsafe { 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(), buffer.as_mut_ptr(),
overlay.as_mut_ptr(), overlay.as_mut_ptr(),
); );
@ -157,17 +157,17 @@ impl VideoOverlayCompositionMeta {
pub fn set_overlay(&mut self, overlay: &::VideoOverlayComposition) { pub fn set_overlay(&mut self, overlay: &::VideoOverlayComposition) {
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
unsafe { unsafe {
gst_ffi::gst_mini_object_unref(self.0.overlay as *mut _); gst_sys::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 _; self.0.overlay = gst_sys::gst_mini_object_ref(overlay.as_mut_ptr() as *mut _) as *mut _;
} }
} }
} }
unsafe impl MetaAPI for VideoOverlayCompositionMeta { unsafe impl MetaAPI for VideoOverlayCompositionMeta {
type GstType = ffi::GstVideoOverlayCompositionMeta; type GstType = gst_video_sys::GstVideoOverlayCompositionMeta;
fn get_meta_api() -> glib::Type { 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()) }
} }
} }

View file

@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst::prelude::*; use gst::prelude::*;
use gst_video_sys;
use libc::uintptr_t; use libc::uintptr_t;
use VideoOverlay; use VideoOverlay;
@ -22,18 +22,18 @@ pub trait VideoOverlayExtManual: 'static {
impl<O: IsA<VideoOverlay>> VideoOverlayExtManual for O { impl<O: IsA<VideoOverlay>> VideoOverlayExtManual for O {
unsafe fn set_window_handle(&self, handle: uintptr_t) { 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) { 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 { pub fn is_video_overlay_prepare_window_handle_message(msg: &gst::MessageRef) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_is_video_overlay_prepare_window_handle_message( from_glib(
msg.as_mut_ptr(), gst_video_sys::gst_is_video_overlay_prepare_window_handle_message(msg.as_mut_ptr()),
)) )
} }
} }

View file

@ -8,9 +8,9 @@
use std::fmt; use std::fmt;
use ffi;
use gst; use gst;
use gst::miniobject::*; use gst::miniobject::*;
use gst_video_sys;
use glib; use glib;
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib}; 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!( gst_define_mini_object_wrapper!(
VideoOverlayRectangle, VideoOverlayRectangle,
VideoOverlayRectangleRef, VideoOverlayRectangleRef,
ffi::GstVideoOverlayRectangle, gst_video_sys::GstVideoOverlayRectangle,
[Debug,], [Debug,],
|| ffi::gst_video_overlay_rectangle_get_type() || gst_video_sys::gst_video_overlay_rectangle_get_type()
); );
impl fmt::Debug for VideoOverlayRectangleRef { impl fmt::Debug for VideoOverlayRectangleRef {
@ -44,7 +44,7 @@ impl VideoOverlayRectangle {
) -> Self { ) -> Self {
assert!(buffer.get_meta::<::VideoMeta>().is_some()); assert!(buffer.get_meta::<::VideoMeta>().is_some());
unsafe { 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(), buffer.as_mut_ptr(),
render_x, render_x,
render_y, render_y,
@ -59,22 +59,24 @@ impl VideoOverlayRectangle {
impl VideoOverlayRectangleRef { impl VideoOverlayRectangleRef {
pub fn get_flags(&self) -> ::VideoOverlayFormatFlags { pub fn get_flags(&self) -> ::VideoOverlayFormatFlags {
unsafe { 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(), self.as_mut_ptr(),
)) ))
} }
} }
pub fn get_global_alpha(&self) -> f32 { 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) { 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 { 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) { pub fn get_render_rectangle(&self) -> (i32, i32, u32, u32) {
@ -84,7 +86,7 @@ impl VideoOverlayRectangleRef {
let mut render_width = 0; let mut render_width = 0;
let mut render_height = 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(), self.as_mut_ptr(),
&mut render_x, &mut render_x,
&mut render_y, &mut render_y,
@ -104,7 +106,7 @@ impl VideoOverlayRectangleRef {
render_height: u32, render_height: u32,
) { ) {
unsafe { unsafe {
ffi::gst_video_overlay_rectangle_set_render_rectangle( gst_video_sys::gst_video_overlay_rectangle_set_render_rectangle(
self.as_mut_ptr(), self.as_mut_ptr(),
render_x, render_x,
render_y, render_y,
@ -116,34 +118,40 @@ impl VideoOverlayRectangleRef {
pub fn get_pixels_unscaled_raw(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { pub fn get_pixels_unscaled_raw(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_raw( from_glib_none(
gst_video_sys::gst_video_overlay_rectangle_get_pixels_unscaled_raw(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
)) ),
)
} }
} }
pub fn get_pixels_unscaled_ayuv(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { pub fn get_pixels_unscaled_ayuv(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_ayuv( from_glib_none(
gst_video_sys::gst_video_overlay_rectangle_get_pixels_unscaled_ayuv(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
)) ),
)
} }
} }
pub fn get_pixels_unscaled_argb(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { pub fn get_pixels_unscaled_argb(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer {
unsafe { unsafe {
from_glib_none(ffi::gst_video_overlay_rectangle_get_pixels_unscaled_argb( from_glib_none(
gst_video_sys::gst_video_overlay_rectangle_get_pixels_unscaled_argb(
self.as_mut_ptr(), self.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
)) ),
)
} }
} }
pub fn get_pixels_raw(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { pub fn get_pixels_raw(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer {
unsafe { 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(), self.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
)) ))
@ -152,7 +160,7 @@ impl VideoOverlayRectangleRef {
pub fn get_pixels_ayuv(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { pub fn get_pixels_ayuv(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer {
unsafe { 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(), self.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
)) ))
@ -161,7 +169,7 @@ impl VideoOverlayRectangleRef {
pub fn get_pixels_argb(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer { pub fn get_pixels_argb(&self, flags: ::VideoOverlayFormatFlags) -> gst::Buffer {
unsafe { 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(), self.as_mut_ptr(),
flags.to_glib(), flags.to_glib(),
)) ))
@ -172,9 +180,9 @@ impl VideoOverlayRectangleRef {
gst_define_mini_object_wrapper!( gst_define_mini_object_wrapper!(
VideoOverlayComposition, VideoOverlayComposition,
VideoOverlayCompositionRef, VideoOverlayCompositionRef,
ffi::GstVideoOverlayComposition, gst_video_sys::GstVideoOverlayComposition,
[Debug,], [Debug,],
|| ffi::gst_video_overlay_composition_get_type() || gst_video_sys::gst_video_overlay_composition_get_type()
); );
impl fmt::Debug for VideoOverlayCompositionRef { impl fmt::Debug for VideoOverlayCompositionRef {
@ -193,11 +201,12 @@ impl VideoOverlayComposition {
Some(first) => first, Some(first) => first,
}; };
let composition = let composition = Self::from_glib_full(
Self::from_glib_full(ffi::gst_video_overlay_composition_new(first.as_mut_ptr())); gst_video_sys::gst_video_overlay_composition_new(first.as_mut_ptr()),
);
for rect in iter { for rect in iter {
ffi::gst_video_overlay_composition_add_rectangle( gst_video_sys::gst_video_overlay_composition_add_rectangle(
composition.as_mut_ptr(), composition.as_mut_ptr(),
rect.as_mut_ptr(), rect.as_mut_ptr(),
); );
@ -210,7 +219,7 @@ impl VideoOverlayComposition {
impl VideoOverlayCompositionRef { impl VideoOverlayCompositionRef {
pub fn n_rectangles(&self) -> u32 { 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<VideoOverlayRectangle> { pub fn get_rectangle(&self, idx: u32) -> Option<VideoOverlayRectangle> {
@ -219,7 +228,7 @@ impl VideoOverlayCompositionRef {
} }
unsafe { 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(), self.as_mut_ptr(),
idx, idx,
)) ))
@ -227,7 +236,7 @@ impl VideoOverlayCompositionRef {
} }
pub fn get_seqnum(&self) -> u32 { 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( pub fn blend(
@ -236,7 +245,10 @@ impl VideoOverlayCompositionRef {
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!( 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", "Failed to blend overlay composition",
) )
} }

View file

@ -6,8 +6,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib::translate::ToGlib; use glib::translate::ToGlib;
use gst_video_sys;
#[derive(Clone, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct VideoRectangle { pub struct VideoRectangle {
@ -28,26 +28,26 @@ pub fn center_video_rectangle(
dst: &VideoRectangle, dst: &VideoRectangle,
scale: bool, scale: bool,
) -> VideoRectangle { ) -> VideoRectangle {
let mut result = ffi::GstVideoRectangle { let mut result = gst_video_sys::GstVideoRectangle {
x: 0, x: 0,
y: 0, y: 0,
w: 0, w: 0,
h: 0, h: 0,
}; };
let src_rect = ffi::GstVideoRectangle { let src_rect = gst_video_sys::GstVideoRectangle {
x: src.x, x: src.x,
y: src.y, y: src.y,
w: src.w, w: src.w,
h: src.h, h: src.h,
}; };
let dst_rect = ffi::GstVideoRectangle { let dst_rect = gst_video_sys::GstVideoRectangle {
x: dst.x, x: dst.x,
y: dst.y, y: dst.y,
w: dst.w, w: dst.w,
h: dst.h, h: dst.h,
}; };
unsafe { 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) VideoRectangle::new(result.x, result.y, result.w, result.h)
} }

View file

@ -6,15 +6,15 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use glib::prelude::*; use glib::prelude::*;
use glib::translate::*; use glib::translate::*;
use glib::value; use glib::value;
use glib_ffi; use glib_sys;
use gobject_ffi; use gobject_sys;
use gst; use gst;
use gst::prelude::*; use gst::prelude::*;
use gst_video_sys;
use std::cmp; use std::cmp;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
@ -26,15 +26,15 @@ use VideoTimeCodeFlags;
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
use VideoTimeCodeInterval; use VideoTimeCodeInterval;
pub struct VideoTimeCode(ffi::GstVideoTimeCode); pub struct VideoTimeCode(gst_video_sys::GstVideoTimeCode);
pub struct ValidVideoTimeCode(ffi::GstVideoTimeCode); pub struct ValidVideoTimeCode(gst_video_sys::GstVideoTimeCode);
impl VideoTimeCode { impl VideoTimeCode {
pub fn new_empty() -> VideoTimeCode { pub fn new_empty() -> VideoTimeCode {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut v = mem::zeroed(); 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) VideoTimeCode(v)
} }
} }
@ -53,7 +53,7 @@ impl VideoTimeCode {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut v = mem::zeroed(); let mut v = mem::zeroed();
ffi::gst_video_time_code_init( gst_video_sys::gst_video_time_code_init(
&mut v, &mut v,
*fps.numer() as u32, *fps.numer() as u32,
*fps.denom() as u32, *fps.denom() as u32,
@ -81,7 +81,7 @@ impl VideoTimeCode {
// assert!(fps_d > 0); // assert!(fps_d > 0);
// unsafe { // unsafe {
// let mut v = mem::zeroed(); // 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, // &mut v,
// *fps.numer() as u32, // *fps.numer() as u32,
// *fps.denom() as u32, // *fps.denom() as u32,
@ -90,7 +90,7 @@ impl VideoTimeCode {
// field_count, // field_count,
// ); // );
// //
// if res == glib_ffi::GFALSE { // if res == glib_sys::GFALSE {
// None // None
// } else { // } else {
// Some(VideoTimeCode(v)) // Some(VideoTimeCode(v))
@ -102,14 +102,18 @@ impl VideoTimeCode {
pub fn from_string(tc_str: &str) -> Option<VideoTimeCode> { pub fn from_string(tc_str: &str) -> Option<VideoTimeCode> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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, tc_str.to_glib_none().0,
)) ))
} }
} }
pub fn is_valid(&self) -> bool { 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) { pub fn set_fps(&mut self, fps: gst::Fraction) {
@ -191,14 +195,14 @@ impl ValidVideoTimeCode {
pub fn add_frames(&mut self, frames: i64) { pub fn add_frames(&mut self, frames: i64) {
unsafe { 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"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
pub fn add_interval(&self, tc_inter: &VideoTimeCodeInterval) -> Option<VideoTimeCode> { pub fn add_interval(&self, tc_inter: &VideoTimeCodeInterval) -> Option<VideoTimeCode> {
unsafe { 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, self.to_glib_none().0,
tc_inter.to_glib_none().0, tc_inter.to_glib_none().0,
)) ))
@ -206,25 +210,31 @@ impl ValidVideoTimeCode {
} }
fn compare(&self, tc2: &ValidVideoTimeCode) -> i32 { 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 { 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) { pub fn increment_frame(&mut self) {
unsafe { 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 { 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<glib::DateTime> { pub fn to_date_time(&self) -> Option<glib::DateTime> {
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) => { ($name:ident) => {
impl $name { impl $name {
pub fn to_string(&self) -> String { 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 { 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>) { pub fn set_latest_daily_jam(&mut self, latest_daily_jam: Option<&glib::DateTime>) {
unsafe { unsafe {
if !self.0.config.latest_daily_jam.is_null() { 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() self.0.config.latest_daily_jam = latest_daily_jam.to_glib_full()
@ -283,7 +297,7 @@ macro_rules! generic_impl {
unsafe { unsafe {
let v = self.0; let v = self.0;
if !v.config.latest_daily_jam.is_null() { 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) $name(v)
@ -295,7 +309,7 @@ macro_rules! generic_impl {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
if !self.0.config.latest_daily_jam.is_null() { 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)] #[doc(hidden)]
impl GlibPtrDefault for $name { impl GlibPtrDefault for $name {
type GlibType = *mut ffi::GstVideoTimeCode; type GlibType = *mut gst_video_sys::GstVideoTimeCode;
} }
#[doc(hidden)] #[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; type Storage = &'a Self;
#[inline] #[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) Stash(&self.0 as *const _, self)
} }
#[inline] #[inline]
fn to_glib_full(&self) -> *const ffi::GstVideoTimeCode { fn to_glib_full(&self) -> *const gst_video_sys::GstVideoTimeCode {
unsafe { ffi::gst_video_time_code_copy(&self.0 as *const _) } unsafe { gst_video_sys::gst_video_time_code_copy(&self.0 as *const _) }
} }
} }
#[doc(hidden)] #[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; type Storage = &'a mut Self;
#[inline] #[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 _; let ptr = &mut self.0 as *mut _;
StashMut(ptr, self) StashMut(ptr, self)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrNone<*mut ffi::GstVideoTimeCode> for $name { impl FromGlibPtrNone<*mut gst_video_sys::GstVideoTimeCode> for $name {
#[inline] #[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()); assert!(!ptr.is_null());
let v = ptr::read(ptr); let v = ptr::read(ptr);
if !v.config.latest_daily_jam.is_null() { 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) $name(v)
@ -372,13 +388,13 @@ macro_rules! generic_impl {
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrNone<*const ffi::GstVideoTimeCode> for $name { impl FromGlibPtrNone<*const gst_video_sys::GstVideoTimeCode> for $name {
#[inline] #[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()); assert!(!ptr.is_null());
let v = ptr::read(ptr); let v = ptr::read(ptr);
if !v.config.latest_daily_jam.is_null() { 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) $name(v)
@ -386,28 +402,28 @@ macro_rules! generic_impl {
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrFull<*mut ffi::GstVideoTimeCode> for $name { impl FromGlibPtrFull<*mut gst_video_sys::GstVideoTimeCode> for $name {
#[inline] #[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()); assert!(!ptr.is_null());
let v = ptr::read(ptr); let v = ptr::read(ptr);
if !v.config.latest_daily_jam.is_null() { 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) $name(v)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrBorrow<*mut ffi::GstVideoTimeCode> for $name { impl FromGlibPtrBorrow<*mut gst_video_sys::GstVideoTimeCode> for $name {
#[inline] #[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()); assert!(!ptr.is_null());
let v = ptr::read(ptr); let v = ptr::read(ptr);
if !v.config.latest_daily_jam.is_null() { 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) $name(v)
@ -416,26 +432,26 @@ macro_rules! generic_impl {
impl StaticType for $name { impl StaticType for $name {
fn static_type() -> glib::Type { 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)] #[doc(hidden)]
impl<'a> value::FromValueOptional<'a> for $name { impl<'a> value::FromValueOptional<'a> for $name {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> { unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
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, value.to_glib_none().0,
) as *mut ffi::GstVideoTimeCode) ) as *mut gst_video_sys::GstVideoTimeCode)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl value::SetValue for $name { impl value::SetValue for $name {
unsafe fn set_value(value: &mut glib::Value, this: &Self) { 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, value.to_glib_none_mut().0,
ToGlibPtr::<*const ffi::GstVideoTimeCode>::to_glib_none(this).0 ToGlibPtr::<*const gst_video_sys::GstVideoTimeCode>::to_glib_none(this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }
@ -443,10 +459,10 @@ macro_rules! generic_impl {
#[doc(hidden)] #[doc(hidden)]
impl value::SetValueOptional for $name { impl value::SetValueOptional for $name {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { 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, value.to_glib_none_mut().0,
ToGlibPtr::<*const ffi::GstVideoTimeCode>::to_glib_none(&this).0 ToGlibPtr::<*const gst_video_sys::GstVideoTimeCode>::to_glib_none(&this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }
@ -496,7 +512,7 @@ impl From<ValidVideoTimeCode> for VideoTimeCode {
} }
#[repr(C)] #[repr(C)]
pub struct VideoTimeCodeMeta(ffi::GstVideoTimeCodeMeta); pub struct VideoTimeCodeMeta(gst_video_sys::GstVideoTimeCodeMeta);
impl VideoTimeCodeMeta { impl VideoTimeCodeMeta {
pub fn add<'a>( pub fn add<'a>(
@ -504,7 +520,7 @@ impl VideoTimeCodeMeta {
tc: &ValidVideoTimeCode, tc: &ValidVideoTimeCode,
) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> { ) -> gst::MetaRefMut<'a, Self, gst::meta::Standalone> {
unsafe { 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(), buffer.as_mut_ptr(),
tc.to_glib_none().0 as *mut _, tc.to_glib_none().0 as *mut _,
); );
@ -520,20 +536,20 @@ impl VideoTimeCodeMeta {
pub fn set_tc(&mut self, tc: ValidVideoTimeCode) { pub fn set_tc(&mut self, tc: ValidVideoTimeCode) {
#![allow(clippy::cast_ptr_alignment)] #![allow(clippy::cast_ptr_alignment)]
unsafe { 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; self.0.tc = tc.0;
if !self.0.tc.config.latest_daily_jam.is_null() { 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 { unsafe impl MetaAPI for VideoTimeCodeMeta {
type GstType = ffi::GstVideoTimeCodeMeta; type GstType = gst_video_sys::GstVideoTimeCodeMeta;
fn get_meta_api() -> glib::Type { 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()) }
} }
} }

View file

@ -6,26 +6,26 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use ffi;
use glib; use glib;
use glib::prelude::*; use glib::prelude::*;
use glib::translate::*; use glib::translate::*;
use glib::value; use glib::value;
use glib_ffi; use glib_sys;
use gobject_ffi; use gobject_sys;
use gst_video_sys;
use std::cmp; use std::cmp;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use std::ptr; use std::ptr;
#[derive(Clone)] #[derive(Clone)]
pub struct VideoTimeCodeInterval(ffi::GstVideoTimeCodeInterval); pub struct VideoTimeCodeInterval(gst_video_sys::GstVideoTimeCodeInterval);
impl VideoTimeCodeInterval { impl VideoTimeCodeInterval {
pub fn from_string(tc_inter_str: &str) -> Option<Self> { pub fn from_string(tc_inter_str: &str) -> Option<Self> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { 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, tc_inter_str.to_glib_none().0,
)) ))
} }
@ -35,7 +35,9 @@ impl VideoTimeCodeInterval {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
let mut v = mem::zeroed(); 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) VideoTimeCodeInterval(v)
} }
} }
@ -131,69 +133,71 @@ impl fmt::Display for VideoTimeCodeInterval {
#[doc(hidden)] #[doc(hidden)]
impl GlibPtrDefault for VideoTimeCodeInterval { impl GlibPtrDefault for VideoTimeCodeInterval {
type GlibType = *mut ffi::GstVideoTimeCodeInterval; type GlibType = *mut gst_video_sys::GstVideoTimeCodeInterval;
} }
#[doc(hidden)] #[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; type Storage = &'a Self;
#[inline] #[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) Stash(&self.0 as *const _, self)
} }
#[inline] #[inline]
fn to_glib_full(&self) -> *const ffi::GstVideoTimeCodeInterval { fn to_glib_full(&self) -> *const gst_video_sys::GstVideoTimeCodeInterval {
unsafe { ffi::gst_video_time_code_interval_copy(&self.0 as *const _) } unsafe { gst_video_sys::gst_video_time_code_interval_copy(&self.0 as *const _) }
} }
} }
#[doc(hidden)] #[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; type Storage = &'a mut Self;
#[inline] #[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 _; let ptr = &mut self.0 as *mut _;
StashMut(ptr, self) StashMut(ptr, self)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrNone<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { impl FromGlibPtrNone<*mut gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval {
#[inline] #[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()); assert!(!ptr.is_null());
VideoTimeCodeInterval(ptr::read(ptr)) VideoTimeCodeInterval(ptr::read(ptr))
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrNone<*const ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { impl FromGlibPtrNone<*const gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval {
#[inline] #[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()); assert!(!ptr.is_null());
VideoTimeCodeInterval(ptr::read(ptr)) VideoTimeCodeInterval(ptr::read(ptr))
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrFull<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { impl FromGlibPtrFull<*mut gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval {
#[inline] #[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()); assert!(!ptr.is_null());
let res = VideoTimeCodeInterval(ptr::read(ptr)); 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 res
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl FromGlibPtrBorrow<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { impl FromGlibPtrBorrow<*mut gst_video_sys::GstVideoTimeCodeInterval> for VideoTimeCodeInterval {
#[inline] #[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()); assert!(!ptr.is_null());
VideoTimeCodeInterval(ptr::read(ptr)) VideoTimeCodeInterval(ptr::read(ptr))
} }
@ -201,27 +205,27 @@ impl FromGlibPtrBorrow<*mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInte
impl StaticType for VideoTimeCodeInterval { impl StaticType for VideoTimeCodeInterval {
fn static_type() -> glib::Type { 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)] #[doc(hidden)]
impl<'a> value::FromValueOptional<'a> for VideoTimeCodeInterval { impl<'a> value::FromValueOptional<'a> for VideoTimeCodeInterval {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> { unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<VideoTimeCodeInterval>::from_glib_full(gobject_ffi::g_value_dup_boxed( Option::<VideoTimeCodeInterval>::from_glib_full(gobject_sys::g_value_dup_boxed(
value.to_glib_none().0, value.to_glib_none().0,
) )
as *mut ffi::GstVideoTimeCodeInterval) as *mut gst_video_sys::GstVideoTimeCodeInterval)
} }
} }
#[doc(hidden)] #[doc(hidden)]
impl value::SetValue for VideoTimeCodeInterval { impl value::SetValue for VideoTimeCodeInterval {
unsafe fn set_value(value: &mut glib::Value, this: &Self) { 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, value.to_glib_none_mut().0,
ToGlibPtr::<*const ffi::GstVideoTimeCodeInterval>::to_glib_none(this).0 ToGlibPtr::<*const gst_video_sys::GstVideoTimeCodeInterval>::to_glib_none(this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }
@ -229,10 +233,10 @@ impl value::SetValue for VideoTimeCodeInterval {
#[doc(hidden)] #[doc(hidden)]
impl value::SetValueOptional for VideoTimeCodeInterval { impl value::SetValueOptional for VideoTimeCodeInterval {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { 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, value.to_glib_none_mut().0,
ToGlibPtr::<*const ffi::GstVideoTimeCodeInterval>::to_glib_none(&this).0 ToGlibPtr::<*const gst_video_sys::GstVideoTimeCodeInterval>::to_glib_none(&this).0
as glib_ffi::gpointer, as glib_sys::gpointer,
) )
} }
} }

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use ffi; use gst_web_rtc_sys;
use glib::translate::*; use glib::translate::*;

View file

@ -10,16 +10,16 @@ extern crate libc;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;
extern crate glib_sys as glib_ffi; extern crate glib_sys;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_sdp as gst_sdp; extern crate gstreamer_sdp as gst_sdp;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_sys;
extern crate gstreamer_webrtc_sys as ffi; extern crate gstreamer_webrtc_sys as gst_web_rtc_sys;
macro_rules! assert_initialized_main_thread { 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."); panic!("GStreamer has not been initialized. Call `gst::init` first.");
} }
}; };

Some files were not shown because too many files have changed in this diff Show more