forked from mirrors/gstreamer-rs
Random cleanup
This commit is contained in:
parent
ab4aa57a86
commit
9fdf422e9b
3 changed files with 25 additions and 18 deletions
|
@ -49,12 +49,11 @@ pub use auto::traits::ObjectExt as GstObjectExt;
|
||||||
pub mod miniobject;
|
pub mod miniobject;
|
||||||
pub use miniobject::GstRc;
|
pub use miniobject::GstRc;
|
||||||
pub mod message;
|
pub mod message;
|
||||||
pub use message::Message;
|
pub use message::{Message, MessageRef, MessageView};
|
||||||
pub use message::MessageView;
|
|
||||||
pub mod structure;
|
pub mod structure;
|
||||||
pub use structure::Structure;
|
pub use structure::{Structure, StructureRef};
|
||||||
pub mod caps;
|
pub mod caps;
|
||||||
pub use caps::Caps;
|
pub use caps::{Caps, CapsRef};
|
||||||
pub mod tags;
|
pub mod tags;
|
||||||
pub use tags::*;
|
pub use tags::*;
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ mod bus;
|
||||||
mod pad;
|
mod pad;
|
||||||
mod gobject;
|
mod gobject;
|
||||||
pub use bin::BinExtManual;
|
pub use bin::BinExtManual;
|
||||||
pub use pad::PadExtManual;
|
pub use pad::{PadExtManual, PadProbeId, PadProbeInfo, PadProbeData, PAD_PROBE_ID_INVALID};
|
||||||
pub use gobject::GObjectExtManualGst;
|
pub use gobject::GObjectExtManualGst;
|
||||||
|
|
||||||
mod value;
|
mod value;
|
||||||
|
|
|
@ -14,7 +14,7 @@ use std::cell::RefCell;
|
||||||
use std::mem::transmute;
|
use std::mem::transmute;
|
||||||
|
|
||||||
use glib::IsA;
|
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::source::CallbackGuard;
|
||||||
use glib_ffi::gpointer;
|
use glib_ffi::gpointer;
|
||||||
|
|
||||||
|
@ -22,7 +22,23 @@ use libc;
|
||||||
|
|
||||||
use ffi;
|
use ffi;
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||||
pub struct PadProbeId(libc::c_ulong);
|
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 struct PadProbeInfo {
|
||||||
pub mask: PadProbeType,
|
pub mask: PadProbeType,
|
||||||
|
@ -61,13 +77,13 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
||||||
Some(destroy_closure_pad_probe),
|
Some(destroy_closure_pad_probe),
|
||||||
);
|
);
|
||||||
|
|
||||||
PadProbeId(id)
|
from_glib(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove_probe(&self, id: PadProbeId) {
|
fn remove_probe(&self, id: PadProbeId) {
|
||||||
unsafe {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,13 +204,5 @@ impl SetValue for Fraction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
// TODO: Array, List, Ranges
|
||||||
mod tests {
|
// GStreamer value operations
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_simple() {
|
|
||||||
let f: Fraction = (1, 2).into();
|
|
||||||
println!("{}", f * 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue