Commit b87ffa17 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Run rustfmt also over all the generated code

parent e5aa6f59
This diff is collapsed.
This diff is collapsed.
......@@ -2,18 +2,17 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_app_sys;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum AppStreamType {
Stream,
Seekable,
......@@ -31,7 +30,7 @@ impl ToGlib for AppStreamType {
AppStreamType::Stream => gst_app_sys::GST_APP_STREAM_TYPE_STREAM,
AppStreamType::Seekable => gst_app_sys::GST_APP_STREAM_TYPE_SEEKABLE,
AppStreamType::RandomAccess => gst_app_sys::GST_APP_STREAM_TYPE_RANDOM_ACCESS,
AppStreamType::__Unknown(value) => value
AppStreamType::__Unknown(value) => value,
}
}
}
......@@ -72,4 +71,3 @@ impl SetValue for AppStreamType {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
......@@ -12,5 +12,4 @@ mod enums;
pub use self::enums::AppStreamType;
#[doc(hidden)]
pub mod traits {
}
pub mod traits {}
......@@ -27,7 +27,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
#[allow(clippy::unreadable_literal)]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)]
#[rustfmt::skip]
mod auto;
pub use auto::*;
......
......@@ -21,45 +21,63 @@ glib_wrapper! {
impl AudioStreamAlign {
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn new(rate: i32, alignment_threshold: gst::ClockTime, discont_wait: gst::ClockTime) -> AudioStreamAlign {
pub fn new(
rate: i32,
alignment_threshold: gst::ClockTime,
discont_wait: gst::ClockTime,
) -> AudioStreamAlign {
assert_initialized_main_thread!();
unsafe {
from_glib_full(gst_audio_sys::gst_audio_stream_align_new(rate, alignment_threshold.to_glib(), discont_wait.to_glib()))
from_glib_full(gst_audio_sys::gst_audio_stream_align_new(
rate,
alignment_threshold.to_glib(),
discont_wait.to_glib(),
))
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn get_alignment_threshold(&mut self) -> gst::ClockTime {
unsafe {
from_glib(gst_audio_sys::gst_audio_stream_align_get_alignment_threshold(self.to_glib_none_mut().0))
from_glib(
gst_audio_sys::gst_audio_stream_align_get_alignment_threshold(
self.to_glib_none_mut().0,
),
)
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn get_discont_wait(&mut self) -> gst::ClockTime {
unsafe {
from_glib(gst_audio_sys::gst_audio_stream_align_get_discont_wait(self.to_glib_none_mut().0))
from_glib(gst_audio_sys::gst_audio_stream_align_get_discont_wait(
self.to_glib_none_mut().0,
))
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn get_rate(&mut self) -> i32 {
unsafe {
gst_audio_sys::gst_audio_stream_align_get_rate(self.to_glib_none_mut().0)
}
unsafe { gst_audio_sys::gst_audio_stream_align_get_rate(self.to_glib_none_mut().0) }
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn get_samples_since_discont(&mut self) -> u64 {
unsafe {
gst_audio_sys::gst_audio_stream_align_get_samples_since_discont(self.to_glib_none_mut().0)
gst_audio_sys::gst_audio_stream_align_get_samples_since_discont(
self.to_glib_none_mut().0,
)
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn get_timestamp_at_discont(&mut self) -> gst::ClockTime {
unsafe {
from_glib(gst_audio_sys::gst_audio_stream_align_get_timestamp_at_discont(self.to_glib_none_mut().0))
from_glib(
gst_audio_sys::gst_audio_stream_align_get_timestamp_at_discont(
self.to_glib_none_mut().0,
),
)
}
}
......@@ -73,14 +91,20 @@ impl AudioStreamAlign {
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn set_alignment_threshold(&mut self, alignment_threshold: gst::ClockTime) {
unsafe {
gst_audio_sys::gst_audio_stream_align_set_alignment_threshold(self.to_glib_none_mut().0, alignment_threshold.to_glib());
gst_audio_sys::gst_audio_stream_align_set_alignment_threshold(
self.to_glib_none_mut().0,
alignment_threshold.to_glib(),
);
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn set_discont_wait(&mut self, discont_wait: gst::ClockTime) {
unsafe {
gst_audio_sys::gst_audio_stream_align_set_discont_wait(self.to_glib_none_mut().0, discont_wait.to_glib());
gst_audio_sys::gst_audio_stream_align_set_discont_wait(
self.to_glib_none_mut().0,
discont_wait.to_glib(),
);
}
}
......
......@@ -2,18 +2,17 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_audio_sys;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum AudioChannelPosition {
None,
Mono,
......@@ -60,34 +59,70 @@ impl ToGlib for AudioChannelPosition {
AudioChannelPosition::Mono => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_MONO,
AudioChannelPosition::Invalid => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_INVALID,
AudioChannelPosition::FrontLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
AudioChannelPosition::FrontRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
AudioChannelPosition::FrontCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
AudioChannelPosition::FrontRight => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
}
AudioChannelPosition::FrontCenter => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER
}
AudioChannelPosition::Lfe1 => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_LFE1,
AudioChannelPosition::RearLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
AudioChannelPosition::RearRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
AudioChannelPosition::FrontLeftOfCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
AudioChannelPosition::FrontRightOfCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
AudioChannelPosition::RearCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
AudioChannelPosition::FrontLeftOfCenter => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER
}
AudioChannelPosition::FrontRightOfCenter => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER
}
AudioChannelPosition::RearCenter => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_REAR_CENTER
}
AudioChannelPosition::Lfe2 => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_LFE2,
AudioChannelPosition::SideLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
AudioChannelPosition::SideRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
AudioChannelPosition::TopFrontLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT,
AudioChannelPosition::TopFrontRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT,
AudioChannelPosition::TopFrontCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER,
AudioChannelPosition::TopFrontLeft => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT
}
AudioChannelPosition::TopFrontRight => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT
}
AudioChannelPosition::TopFrontCenter => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER
}
AudioChannelPosition::TopCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_CENTER,
AudioChannelPosition::TopRearLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT,
AudioChannelPosition::TopRearRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT,
AudioChannelPosition::TopSideLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT,
AudioChannelPosition::TopSideRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT,
AudioChannelPosition::TopRearCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER,
AudioChannelPosition::BottomFrontCenter => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER,
AudioChannelPosition::BottomFrontLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT,
AudioChannelPosition::BottomFrontRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT,
AudioChannelPosition::TopRearLeft => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT
}
AudioChannelPosition::TopRearRight => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT
}
AudioChannelPosition::TopSideLeft => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT
}
AudioChannelPosition::TopSideRight => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT
}
AudioChannelPosition::TopRearCenter => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER
}
AudioChannelPosition::BottomFrontCenter => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER
}
AudioChannelPosition::BottomFrontLeft => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT
}
AudioChannelPosition::BottomFrontRight => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT
}
AudioChannelPosition::WideLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT,
AudioChannelPosition::WideRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT,
AudioChannelPosition::SurroundLeft => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT,
AudioChannelPosition::SurroundRight => gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT,
AudioChannelPosition::__Unknown(value) => value
AudioChannelPosition::SurroundLeft => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT
}
AudioChannelPosition::SurroundRight => {
gst_audio_sys::GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT
}
AudioChannelPosition::__Unknown(value) => value,
}
}
}
......@@ -157,8 +192,7 @@ impl SetValue for AudioChannelPosition {
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum AudioFormat {
Unknown,
Encoded,
......@@ -234,7 +268,7 @@ impl ToGlib for AudioFormat {
AudioFormat::F32be => gst_audio_sys::GST_AUDIO_FORMAT_F32BE,
AudioFormat::F64le => gst_audio_sys::GST_AUDIO_FORMAT_F64LE,
AudioFormat::F64be => gst_audio_sys::GST_AUDIO_FORMAT_F64BE,
AudioFormat::__Unknown(value) => value
AudioFormat::__Unknown(value) => value,
}
}
}
......@@ -305,8 +339,7 @@ impl SetValue for AudioFormat {
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum AudioLayout {
Interleaved,
NonInterleaved,
......@@ -322,7 +355,7 @@ impl ToGlib for AudioLayout {
match *self {
AudioLayout::Interleaved => gst_audio_sys::GST_AUDIO_LAYOUT_INTERLEAVED,
AudioLayout::NonInterleaved => gst_audio_sys::GST_AUDIO_LAYOUT_NON_INTERLEAVED,
AudioLayout::__Unknown(value) => value
AudioLayout::__Unknown(value) => value,
}
}
}
......@@ -363,8 +396,7 @@ impl SetValue for AudioLayout {
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum StreamVolumeFormat {
Linear,
Cubic,
......@@ -382,7 +414,7 @@ impl ToGlib for StreamVolumeFormat {
StreamVolumeFormat::Linear => gst_audio_sys::GST_STREAM_VOLUME_FORMAT_LINEAR,
StreamVolumeFormat::Cubic => gst_audio_sys::GST_STREAM_VOLUME_FORMAT_CUBIC,
StreamVolumeFormat::Db => gst_audio_sys::GST_STREAM_VOLUME_FORMAT_DB,
StreamVolumeFormat::__Unknown(value) => value
StreamVolumeFormat::__Unknown(value) => value,
}
}
}
......@@ -399,4 +431,3 @@ impl FromGlib<gst_audio_sys::GstStreamVolumeFormat> for StreamVolumeFormat {
}
}
}
......@@ -2,13 +2,13 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_audio_sys;
......@@ -158,4 +158,3 @@ impl SetValue for AudioPackFlags {
gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
}
}
......@@ -3,8 +3,8 @@
// DO NOT EDIT
mod stream_volume;
pub use self::stream_volume::{StreamVolume, NONE_STREAM_VOLUME};
pub use self::stream_volume::StreamVolumeExt;
pub use self::stream_volume::{StreamVolume, NONE_STREAM_VOLUME};
#[cfg(any(feature = "v1_14", feature = "dox"))]
mod audio_stream_align;
......
......@@ -2,16 +2,16 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use StreamVolumeFormat;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib_sys;
use gst_audio_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use StreamVolumeFormat;
glib_wrapper! {
pub struct StreamVolume(Interface<gst_audio_sys::GstStreamVolume>);
......@@ -44,61 +44,101 @@ pub trait StreamVolumeExt: 'static {
fn set_volume(&self, format: StreamVolumeFormat, val: f64);
fn connect_property_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<StreamVolume>> StreamVolumeExt for O {
fn get_mute(&self) -> bool {
unsafe {
from_glib(gst_audio_sys::gst_stream_volume_get_mute(self.as_ref().to_glib_none().0))
from_glib(gst_audio_sys::gst_stream_volume_get_mute(
self.as_ref().to_glib_none().0,
))
}
}
fn get_volume(&self, format: StreamVolumeFormat) -> f64 {
unsafe {
gst_audio_sys::gst_stream_volume_get_volume(self.as_ref().to_glib_none().0, format.to_glib())
gst_audio_sys::gst_stream_volume_get_volume(
self.as_ref().to_glib_none().0,
format.to_glib(),
)
}
}
fn set_mute(&self, mute: bool) {
unsafe {
gst_audio_sys::gst_stream_volume_set_mute(self.as_ref().to_glib_none().0, mute.to_glib());
gst_audio_sys::gst_stream_volume_set_mute(
self.as_ref().to_glib_none().0,
mute.to_glib(),
);
}
}
fn set_volume(&self, format: StreamVolumeFormat, val: f64) {
unsafe {
gst_audio_sys::gst_stream_volume_set_volume(self.as_ref().to_glib_none().0, format.to_glib(), val);
gst_audio_sys::gst_stream_volume_set_volume(
self.as_ref().to_glib_none().0,
format.to_glib(),
val,
);
}
}
fn connect_property_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_mute_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(this: *mut gst_audio_sys::GstStreamVolume, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<StreamVolume>
fn connect_property_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_mute_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_audio_sys::GstStreamVolume,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<StreamVolume>,
{
let f: &F = &*(f as *const F);
f(&StreamVolume::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _,
Some(transmute(notify_mute_trampoline::<Self, F> as usize)), Box_::into_raw(f))
connect_raw(
self.as_ptr() as *mut _,
b"notify::mute\0".as_ptr() as *const _,
Some(transmute(notify_mute_trampoline::<Self, F> as usize)),
Box_::into_raw(f),
)
}
}
fn connect_property_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_volume_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(this: *mut gst_audio_sys::GstStreamVolume, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
where P: IsA<StreamVolume>
fn connect_property_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_volume_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_audio_sys::GstStreamVolume,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<StreamVolume>,
{
let f: &F = &*(f as *const F);
f(&StreamVolume::from_glib_borrow(this).unsafe_cast())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::volume\0".as_ptr() as *const _,
Some(transmute(notify_volume_trampoline::<Self, F> as usize)), Box_::into_raw(f))
connect_raw(
self.as_ptr() as *mut _,
b"notify::volume\0".as_ptr() as *const _,
Some(transmute(notify_volume_trampoline::<Self, F> as usize)),
Box_::into_raw(f),
)
}
}
}
......@@ -35,7 +35,6 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
#[allow(clippy::unreadable_literal)]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)]
#[rustfmt::skip]
mod auto;
pub use auto::*;
......
......@@ -3,8 +3,8 @@
// DO NOT EDIT
use glib;
use glib::ObjectExt;
use glib::translate::*;
use glib::ObjectExt;
use gst;
use gst_base_sys;
use std::mem;
......@@ -20,21 +20,15 @@ glib_wrapper! {
impl Adapter {
pub fn new() -> Adapter {
assert_initialized_main_thread!();
unsafe {
from_glib_full(gst_base_sys::gst_adapter_new())
}
unsafe { from_glib_full(gst_base_sys::gst_adapter_new()) }
}
pub fn available(&self) -> usize {
unsafe {
gst_base_sys::gst_adapter_available(self.to_glib_none().0)
}
unsafe { gst_base_sys::gst_adapter_available(self.to_glib_none().0) }
}
pub fn available_fast(&self) -> usize {
unsafe {
gst_base_sys::gst_adapter_available_fast(self.to_glib_none().0)
}
unsafe { gst_base_sys::gst_adapter_available_fast(self.to_glib_none().0) }
}
pub fn clear(&self) {
......@@ -45,20 +39,24 @@ impl Adapter {
pub fn copy_bytes(&self, offset: usize, size: usize) -> Option<glib::Bytes> {
unsafe {
from_glib_full(gst_base_sys::gst_adapter_copy_bytes(self.to_glib_none().0, offset, size))
from_glib_full(gst_base_sys::gst_adapter_copy_bytes(
self.to_glib_none().0,
offset,
size,
))
}
}
pub fn distance_from_discont(&self) -> u64 {
unsafe {
gst_base_sys::gst_adapter_distance_from_discont(self.to_glib_none().0)
}
unsafe { gst_base_sys::gst_adapter_distance_from_discont(self.to_glib_none().0) }
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn dts_at_discont(&self) -> gst::ClockTime {
unsafe {
from_glib(gst_base_sys::gst_adapter_dts_at_discont(self.to_glib_none().0))
from_glib(gst_base_sys::gst_adapter_dts_at_discont(
self.to_glib_none().0,
))
}
}
......@@ -70,53 +68,85 @@ impl Adapter {
pub fn get_buffer(&self, nbytes: usize) -> Option<gst::Buffer> {
unsafe {
from_glib_full(gst_base_sys::gst_adapter_get_buffer(self.to_glib_none().0, nbytes))
from_glib_full(gst_base_sys::gst_adapter_get_buffer(
self.to_glib_none().0,
nbytes,
))
}
}
pub fn get_buffer_fast(&self, nbytes: usize) -> Option<gst::Buffer> {
unsafe {
from_glib_full(gst_base_sys::gst_adapter_get_buffer_fast(self.to_glib_none().0, nbytes))
from_glib_full(gst_base_sys::gst_adapter_get_buffer_fast(
self.to_glib_none().0,
nbytes,
))
}
}
pub fn get_buffer_list(&self, nbytes: usize) -> Option<gst::BufferList> {
unsafe {
from_glib_full(gst_base_sys::gst_adapter_get_buffer_list(self.to_glib_none().0, nbytes))
from_glib_full(gst_base_sys::gst_adapter_get_buffer_list(
self.to_glib_none().0,
nbytes,
))
}
}
pub fn get_list(&self, nbytes: usize) -> Vec<gst::Buffer> {
unsafe {
FromGlibPtrContainer::from_glib_full(gst_base_sys::gst_adapter_get_list(self.to_glib_none().0, nbytes))
FromGlibPtrContainer::from_glib_full(gst_base_sys::gst_adapter_get_list(
self.to_glib_none().0,
nbytes,
))
}
}
pub fn masked_scan_uint32(&self, mask: u32, pattern: u32, offset: usize, size: usize) -> isize {
unsafe {
gst_base_sys::gst_adapter_masked_scan_uint32(self.to_glib_none().0, mask, pattern, offset, size)
gst_base_sys::gst_adapter_masked_scan_uint32(
self.to_glib_none().0,
mask,
pattern,
offset,
size,
)
}
}
pub fn masked_scan_uint32_peek(&self, mask: u32, pattern: u32, offset: usize, size: usize) -> (isize, u32) {
pub fn masked_scan_uint32_peek(
&self,
mask: u32,
pattern: u32,
offset: usize,
size: usize,
) -> (isize, u32) {
unsafe {
let mut value = mem::uninitialized();
let ret = gst_base_sys::gst_adapter_masked_scan_uint32_peek(self.to_glib_none().0, mask, pattern, offset, size, &mut value);
let ret = gst_base_sys::gst_adapter_masked_scan_uint32_peek(
self.to_glib_none().0,
mask,
pattern,
offset,
size,
&mut value,
);
(ret, value)