Random cleanup

This commit is contained in:
Sebastian Dröge 2017-07-25 01:17:50 +03:00
parent ab4aa57a86
commit 9fdf422e9b
3 changed files with 25 additions and 18 deletions

View file

@ -49,12 +49,11 @@ pub use auto::traits::ObjectExt as GstObjectExt;
pub mod miniobject;
pub use miniobject::GstRc;
pub mod message;
pub use message::Message;
pub use message::MessageView;
pub use message::{Message, MessageRef, MessageView};
pub mod structure;
pub use structure::Structure;
pub use structure::{Structure, StructureRef};
pub mod caps;
pub use caps::Caps;
pub use caps::{Caps, CapsRef};
pub mod tags;
pub use tags::*;
@ -64,7 +63,7 @@ mod bus;
mod pad;
mod gobject;
pub use bin::BinExtManual;
pub use pad::PadExtManual;
pub use pad::{PadExtManual, PadProbeId, PadProbeInfo, PadProbeData, PAD_PROBE_ID_INVALID};
pub use gobject::GObjectExtManualGst;
mod value;

View file

@ -14,7 +14,7 @@ use std::cell::RefCell;
use std::mem::transmute;
use glib::IsA;
use glib::translate::{ToGlib, from_glib, from_glib_none};
use glib::translate::{ToGlib, FromGlib, from_glib, from_glib_none};
use glib::source::CallbackGuard;
use glib_ffi::gpointer;
@ -22,7 +22,23 @@ use libc;
use ffi;
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct PadProbeId(libc::c_ulong);
pub const PAD_PROBE_ID_INVALID: PadProbeId = PadProbeId(0);
impl ToGlib for PadProbeId {
type GlibType = libc::c_ulong;
fn to_glib(&self) -> libc::c_ulong {
self.0
}
}
impl FromGlib<libc::c_ulong> for PadProbeId {
fn from_glib(val: libc::c_ulong) -> PadProbeId {
PadProbeId(val)
}
}
pub struct PadProbeInfo {
pub mask: PadProbeType,
@ -61,13 +77,13 @@ impl<O: IsA<Pad>> PadExtManual for O {
Some(destroy_closure_pad_probe),
);
PadProbeId(id)
from_glib(id)
}
}
fn remove_probe(&self, id: PadProbeId) {
unsafe {
ffi::gst_pad_remove_probe(self.to_glib_none().0, id.0 as libc::c_ulong);
ffi::gst_pad_remove_probe(self.to_glib_none().0, id.to_glib());
}
}
}

View file

@ -204,13 +204,5 @@ impl SetValue for Fraction {
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_simple() {
let f: Fraction = (1, 2).into();
println!("{}", f * 2);
}
}
// TODO: Array, List, Ranges
// GStreamer value operations