mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-22 10:06:29 +00:00
Run everything through latest rustfmt-nightly
This commit is contained in:
parent
71dcb979c7
commit
5ae66e191c
15 changed files with 157 additions and 102 deletions
|
@ -8,11 +8,11 @@
|
|||
|
||||
#![crate_type = "cdylib"]
|
||||
|
||||
extern crate url;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
#[macro_use]
|
||||
extern crate gst_plugin;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate url;
|
||||
|
||||
use gst_plugin::plugin::*;
|
||||
use gst_plugin::source::*;
|
||||
|
|
|
@ -1067,7 +1067,6 @@ impl FlvDemux {
|
|||
}
|
||||
|
||||
res
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
|
||||
#![crate_type = "cdylib"]
|
||||
|
||||
extern crate url;
|
||||
extern crate flavors;
|
||||
#[macro_use]
|
||||
extern crate gst_plugin;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate muldiv;
|
||||
#[macro_use]
|
||||
extern crate nom;
|
||||
extern crate flavors;
|
||||
extern crate muldiv;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate url;
|
||||
|
||||
use gst_plugin::plugin::*;
|
||||
use gst_plugin::demuxer::*;
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
#![crate_type = "cdylib"]
|
||||
|
||||
extern crate url;
|
||||
#[macro_use]
|
||||
extern crate gst_plugin;
|
||||
extern crate reqwest;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate url;
|
||||
|
||||
use gst_plugin::plugin::*;
|
||||
use gst_plugin::source::*;
|
||||
|
|
|
@ -174,8 +174,9 @@ impl Adapter {
|
|||
return Ok(Buffer::new());
|
||||
}
|
||||
|
||||
let sub = self.deque.front().and_then(
|
||||
|front| if front.get_size() - self.skip >= size {
|
||||
let sub = self.deque
|
||||
.front()
|
||||
.and_then(|front| if front.get_size() - self.skip >= size {
|
||||
trace!(LOGGER, "Get buffer of {} bytes, subbuffer of first", size);
|
||||
let new = front
|
||||
.get_buffer()
|
||||
|
@ -184,8 +185,7 @@ impl Adapter {
|
|||
Some(new)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
if let Some(s) = sub {
|
||||
self.flush(size).unwrap();
|
||||
|
|
|
@ -24,32 +24,28 @@ pub struct Buffer(gst_ffi::GstBuffer);
|
|||
#[derivative(Debug)]
|
||||
pub struct ReadBufferMap<'a> {
|
||||
buffer: &'a Buffer,
|
||||
#[derivative(Debug = "ignore")]
|
||||
map_info: gst_ffi::GstMapInfo,
|
||||
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||
}
|
||||
|
||||
#[derive(Derivative)]
|
||||
#[derivative(Debug)]
|
||||
pub struct ReadWriteBufferMap<'a> {
|
||||
buffer: &'a Buffer,
|
||||
#[derivative(Debug = "ignore")]
|
||||
map_info: gst_ffi::GstMapInfo,
|
||||
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||
}
|
||||
|
||||
#[derive(Derivative)]
|
||||
#[derivative(Debug)]
|
||||
pub struct ReadMappedBuffer {
|
||||
buffer: GstRc<Buffer>,
|
||||
#[derivative(Debug = "ignore")]
|
||||
map_info: gst_ffi::GstMapInfo,
|
||||
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||
}
|
||||
|
||||
#[derive(Derivative)]
|
||||
#[derivative(Debug)]
|
||||
pub struct ReadWriteMappedBuffer {
|
||||
buffer: GstRc<Buffer>,
|
||||
#[derivative(Debug = "ignore")]
|
||||
map_info: gst_ffi::GstMapInfo,
|
||||
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||
}
|
||||
|
||||
unsafe impl MiniObject for Buffer {
|
||||
|
@ -62,7 +58,8 @@ impl Buffer {
|
|||
}
|
||||
|
||||
pub fn new_with_size(size: usize) -> Option<GstRc<Buffer>> {
|
||||
let raw = unsafe { gst_ffi::gst_buffer_new_allocate(ptr::null_mut(), size, ptr::null_mut()) };
|
||||
let raw =
|
||||
unsafe { gst_ffi::gst_buffer_new_allocate(ptr::null_mut(), size, ptr::null_mut()) };
|
||||
if raw.is_null() {
|
||||
None
|
||||
} else {
|
||||
|
@ -136,8 +133,9 @@ impl Buffer {
|
|||
|
||||
pub fn into_read_mapped_buffer(buffer: GstRc<Buffer>) -> Option<ReadMappedBuffer> {
|
||||
let mut map_info: gst_ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||
let res =
|
||||
unsafe { gst_ffi::gst_buffer_map(buffer.as_mut_ptr(), &mut map_info, gst_ffi::GST_MAP_READ) };
|
||||
let res = unsafe {
|
||||
gst_ffi::gst_buffer_map(buffer.as_mut_ptr(), &mut map_info, gst_ffi::GST_MAP_READ)
|
||||
};
|
||||
if res == glib_ffi::GTRUE {
|
||||
Some(ReadMappedBuffer {
|
||||
buffer: buffer,
|
||||
|
@ -151,7 +149,11 @@ impl Buffer {
|
|||
pub fn into_readwrite_mapped_buffer(buffer: GstRc<Buffer>) -> Option<ReadWriteMappedBuffer> {
|
||||
let mut map_info: gst_ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||
let res = unsafe {
|
||||
gst_ffi::gst_buffer_map(buffer.as_mut_ptr(), &mut map_info, gst_ffi::GST_MAP_READWRITE)
|
||||
gst_ffi::gst_buffer_map(
|
||||
buffer.as_mut_ptr(),
|
||||
&mut map_info,
|
||||
gst_ffi::GST_MAP_READWRITE,
|
||||
)
|
||||
};
|
||||
if res == glib_ffi::GTRUE {
|
||||
Some(ReadWriteMappedBuffer {
|
||||
|
@ -199,7 +201,12 @@ impl Buffer {
|
|||
|
||||
let copied = unsafe {
|
||||
let src = slice.as_ptr();
|
||||
gst_ffi::gst_buffer_fill(self.as_mut_ptr(), offset, src as glib_ffi::gconstpointer, size)
|
||||
gst_ffi::gst_buffer_fill(
|
||||
self.as_mut_ptr(),
|
||||
offset,
|
||||
src as glib_ffi::gconstpointer,
|
||||
size,
|
||||
)
|
||||
};
|
||||
|
||||
if copied == size {
|
||||
|
|
|
@ -145,7 +145,6 @@ impl DemuxerWrapper {
|
|||
false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
fn stop(&self) -> bool {
|
||||
let demuxer = &mut self.demuxer.lock().unwrap();
|
||||
|
@ -190,7 +189,6 @@ impl DemuxerWrapper {
|
|||
glib_ffi::GTRUE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn get_duration(&self, duration: &mut u64) -> glib_ffi::gboolean {
|
||||
|
@ -494,7 +492,6 @@ pub unsafe extern "C" fn demuxer_seek(
|
|||
stop: u64,
|
||||
offset: *mut u64,
|
||||
) -> glib_ffi::gboolean {
|
||||
|
||||
let wrap: &mut DemuxerWrapper = &mut *ptr;
|
||||
|
||||
panic_to_error!(wrap, glib_ffi::GFALSE, {
|
||||
|
|
|
@ -7,22 +7,22 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern crate libc;
|
||||
extern crate url;
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate byteorder;
|
||||
extern crate num_rational;
|
||||
#[macro_use]
|
||||
extern crate derivative;
|
||||
pub extern crate gobject_sys as gobject_ffi;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate libc;
|
||||
extern crate num_rational;
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate url;
|
||||
pub extern crate glib_sys as glib_ffi;
|
||||
pub extern crate gstreamer_sys as gst_ffi;
|
||||
pub extern crate gobject_sys as gobject_ffi;
|
||||
pub extern crate gstreamer_base_sys as gst_base_ffi;
|
||||
pub extern crate gstreamer_sys as gst_ffi;
|
||||
|
||||
pub extern crate glib as glib;
|
||||
pub extern crate gstreamer as gst;
|
||||
|
|
|
@ -58,7 +58,10 @@ impl GstDebugDrain {
|
|||
|
||||
if !element.is_null() {
|
||||
unsafe {
|
||||
gobject_ffi::g_weak_ref_set(&mut *drain.element, element as *mut gobject_ffi::GObject);
|
||||
gobject_ffi::g_weak_ref_set(
|
||||
&mut *drain.element,
|
||||
element as *mut gobject_ffi::GObject,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,10 +41,9 @@ impl<T: MiniObject> GstRc<T> {
|
|||
return &mut *self.0;
|
||||
}
|
||||
|
||||
self.0 = T::from_mut_ptr(
|
||||
gst_ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut gst_ffi::GstMiniObject) as
|
||||
*mut T::PtrType,
|
||||
);
|
||||
self.0 = T::from_mut_ptr(gst_ffi::gst_mini_object_make_writable(
|
||||
self.as_mut_ptr() as *mut gst_ffi::GstMiniObject,
|
||||
) as *mut T::PtrType);
|
||||
assert!(self.is_writable());
|
||||
|
||||
&mut *self.0
|
||||
|
@ -69,8 +68,9 @@ impl<T: MiniObject> GstRc<T> {
|
|||
}
|
||||
|
||||
fn is_writable(&self) -> bool {
|
||||
(unsafe { gst_ffi::gst_mini_object_is_writable(self.as_ptr() as *const gst_ffi::GstMiniObject) } ==
|
||||
glib_ffi::GTRUE)
|
||||
(unsafe {
|
||||
gst_ffi::gst_mini_object_is_writable(self.as_ptr() as *const gst_ffi::GstMiniObject)
|
||||
} == glib_ffi::GTRUE)
|
||||
}
|
||||
|
||||
pub unsafe fn into_ptr(self) -> *mut T::PtrType {
|
||||
|
|
|
@ -429,7 +429,10 @@ unsafe extern "C" fn sink_class_init(klass: glib_ffi::gpointer, klass_data: glib
|
|||
sink_klass.parent_vtable = gobject_ffi::g_type_class_peek_parent(klass);
|
||||
}
|
||||
|
||||
unsafe extern "C" fn sink_init(instance: *mut gobject_ffi::GTypeInstance, klass: glib_ffi::gpointer) {
|
||||
unsafe extern "C" fn sink_init(
|
||||
instance: *mut gobject_ffi::GTypeInstance,
|
||||
klass: glib_ffi::gpointer,
|
||||
) {
|
||||
let sink = &mut *(instance as *mut RsSink);
|
||||
let sink_klass = &*(klass as *const RsSinkClass);
|
||||
let sink_info = &*sink_klass.sink_info;
|
||||
|
@ -449,13 +452,17 @@ unsafe extern "C" fn sink_uri_handler_get_type(_type: glib_ffi::GType) -> gst_ff
|
|||
gst_ffi::GST_URI_SINK
|
||||
}
|
||||
|
||||
unsafe extern "C" fn sink_uri_handler_get_protocols(type_: glib_ffi::GType) -> *const *const c_char {
|
||||
unsafe extern "C" fn sink_uri_handler_get_protocols(
|
||||
type_: glib_ffi::GType,
|
||||
) -> *const *const c_char {
|
||||
let klass = gobject_ffi::g_type_class_peek(type_);
|
||||
let sink_klass = &*(klass as *const RsSinkClass);
|
||||
(*sink_klass.protocols).as_ptr()
|
||||
}
|
||||
|
||||
unsafe extern "C" fn sink_uri_handler_get_uri(uri_handler: *mut gst_ffi::GstURIHandler) -> *mut c_char {
|
||||
unsafe extern "C" fn sink_uri_handler_get_uri(
|
||||
uri_handler: *mut gst_ffi::GstURIHandler,
|
||||
) -> *mut c_char {
|
||||
sink_get_uri(uri_handler as *const RsSink)
|
||||
}
|
||||
|
||||
|
@ -467,7 +474,10 @@ unsafe extern "C" fn sink_uri_handler_set_uri(
|
|||
sink_set_uri(uri_handler as *const RsSink, uri, err)
|
||||
}
|
||||
|
||||
unsafe extern "C" fn sink_uri_handler_init(iface: glib_ffi::gpointer, _iface_data: glib_ffi::gpointer) {
|
||||
unsafe extern "C" fn sink_uri_handler_init(
|
||||
iface: glib_ffi::gpointer,
|
||||
_iface_data: glib_ffi::gpointer,
|
||||
) {
|
||||
let uri_handler_iface = &mut *(iface as *mut gst_ffi::GstURIHandlerInterface);
|
||||
|
||||
uri_handler_iface.get_type = Some(sink_uri_handler_get_type);
|
||||
|
@ -514,7 +524,11 @@ pub fn sink_register(plugin: &Plugin, sink_info: SinkInfo) {
|
|||
interface_finalize: None,
|
||||
interface_data: ptr::null_mut(),
|
||||
};
|
||||
gobject_ffi::g_type_add_interface_static(type_, gst_ffi::gst_uri_handler_get_type(), &iface_info);
|
||||
gobject_ffi::g_type_add_interface_static(
|
||||
type_,
|
||||
gst_ffi::gst_uri_handler_get_type(),
|
||||
&iface_info,
|
||||
);
|
||||
|
||||
gst_ffi::gst_element_register(plugin.as_ptr(), name_cstr.as_ptr(), rank, type_);
|
||||
}
|
||||
|
|
|
@ -342,11 +342,9 @@ unsafe extern "C" fn source_fill(
|
|||
let wrap: &SourceWrapper = &*src.wrap;
|
||||
let buffer: &mut Buffer = <Buffer as MiniObject>::from_mut_ptr(buffer);
|
||||
|
||||
panic_to_error!(
|
||||
wrap,
|
||||
gst_ffi::GST_FLOW_ERROR,
|
||||
{ wrap.fill(offset, length, buffer) }
|
||||
)
|
||||
panic_to_error!(wrap, gst_ffi::GST_FLOW_ERROR, {
|
||||
wrap.fill(offset, length, buffer)
|
||||
})
|
||||
}
|
||||
|
||||
unsafe extern "C" fn source_seek(
|
||||
|
@ -519,7 +517,10 @@ unsafe extern "C" fn source_class_init(klass: glib_ffi::gpointer, klass_data: gl
|
|||
src_klass.parent_vtable = gobject_ffi::g_type_class_peek_parent(klass);
|
||||
}
|
||||
|
||||
unsafe extern "C" fn source_init(instance: *mut gobject_ffi::GTypeInstance, klass: glib_ffi::gpointer) {
|
||||
unsafe extern "C" fn source_init(
|
||||
instance: *mut gobject_ffi::GTypeInstance,
|
||||
klass: glib_ffi::gpointer,
|
||||
) {
|
||||
let src = &mut *(instance as *mut RsSrc);
|
||||
let src_klass = &*(klass as *const RsSrcClass);
|
||||
let source_info = &*src_klass.source_info;
|
||||
|
@ -539,7 +540,9 @@ unsafe extern "C" fn source_uri_handler_get_type(_type: glib_ffi::GType) -> gst_
|
|||
gst_ffi::GST_URI_SRC
|
||||
}
|
||||
|
||||
unsafe extern "C" fn source_uri_handler_get_protocols(type_: glib_ffi::GType) -> *const *const c_char {
|
||||
unsafe extern "C" fn source_uri_handler_get_protocols(
|
||||
type_: glib_ffi::GType,
|
||||
) -> *const *const c_char {
|
||||
let klass = gobject_ffi::g_type_class_peek(type_);
|
||||
let src_klass = &*(klass as *const RsSrcClass);
|
||||
(*src_klass.protocols).as_ptr()
|
||||
|
@ -559,7 +562,10 @@ unsafe extern "C" fn source_uri_handler_set_uri(
|
|||
source_set_uri(uri_handler as *const RsSrc, uri, err)
|
||||
}
|
||||
|
||||
unsafe extern "C" fn source_uri_handler_init(iface: glib_ffi::gpointer, _iface_data: glib_ffi::gpointer) {
|
||||
unsafe extern "C" fn source_uri_handler_init(
|
||||
iface: glib_ffi::gpointer,
|
||||
_iface_data: glib_ffi::gpointer,
|
||||
) {
|
||||
let uri_handler_iface = &mut *(iface as *mut gst_ffi::GstURIHandlerInterface);
|
||||
|
||||
uri_handler_iface.get_type = Some(source_uri_handler_get_type);
|
||||
|
@ -610,7 +616,11 @@ pub fn source_register(plugin: &Plugin, source_info: SourceInfo) {
|
|||
interface_finalize: None,
|
||||
interface_data: ptr::null_mut(),
|
||||
};
|
||||
gobject_ffi::g_type_add_interface_static(type_, gst_ffi::gst_uri_handler_get_type(), &iface_info);
|
||||
gobject_ffi::g_type_add_interface_static(
|
||||
type_,
|
||||
gst_ffi::gst_uri_handler_get_type(),
|
||||
&iface_info,
|
||||
);
|
||||
|
||||
gst_ffi::gst_element_register(plugin.as_ptr(), name_cstr.as_ptr(), rank, type_);
|
||||
}
|
||||
|
|
|
@ -74,11 +74,15 @@ impl Stream {
|
|||
}
|
||||
|
||||
pub fn get_stream_flags(&self) -> StreamFlags {
|
||||
StreamFlags::from_bits_truncate(unsafe { gst_ffi::gst_stream_get_stream_flags(self.0).bits() })
|
||||
StreamFlags::from_bits_truncate(unsafe {
|
||||
gst_ffi::gst_stream_get_stream_flags(self.0).bits()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_stream_type(&self) -> StreamType {
|
||||
StreamType::from_bits_truncate(unsafe { gst_ffi::gst_stream_get_stream_type(self.0).bits() })
|
||||
StreamType::from_bits_truncate(unsafe {
|
||||
gst_ffi::gst_stream_get_stream_type(self.0).bits()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_stream_id(&self) -> &str {
|
||||
|
@ -122,8 +126,10 @@ impl Stream {
|
|||
impl Clone for Stream {
|
||||
fn clone(&self) -> Self {
|
||||
unsafe {
|
||||
Stream(gst_ffi::gst_object_ref(self.0 as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStream)
|
||||
Stream(
|
||||
gst_ffi::gst_object_ref(self.0 as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStream,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +167,8 @@ impl StreamCollection {
|
|||
}
|
||||
|
||||
pub fn get_upstream_id(&self) -> &str {
|
||||
let cstr = unsafe { CStr::from_ptr(gst_ffi::gst_stream_collection_get_upstream_id(self.0)) };
|
||||
let cstr =
|
||||
unsafe { CStr::from_ptr(gst_ffi::gst_stream_collection_get_upstream_id(self.0)) };
|
||||
cstr.to_str().unwrap()
|
||||
}
|
||||
|
||||
|
@ -203,8 +210,10 @@ impl<'a> Iterator for StreamCollectionIterator<'a> {
|
|||
self.position += 1;
|
||||
|
||||
Some(unsafe {
|
||||
Stream(gst_ffi::gst_object_ref(stream as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStream)
|
||||
Stream(
|
||||
gst_ffi::gst_object_ref(stream as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStream,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -235,8 +244,10 @@ impl<'a> DoubleEndedIterator for StreamCollectionIterator<'a> {
|
|||
}
|
||||
|
||||
Some(unsafe {
|
||||
Stream(gst_ffi::gst_object_ref(stream as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStream)
|
||||
Stream(
|
||||
gst_ffi::gst_object_ref(stream as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStream,
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -246,8 +257,10 @@ impl<'a> ExactSizeIterator for StreamCollectionIterator<'a> {}
|
|||
impl Clone for StreamCollection {
|
||||
fn clone(&self) -> Self {
|
||||
unsafe {
|
||||
StreamCollection(gst_ffi::gst_object_ref(self.0 as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStreamCollection)
|
||||
StreamCollection(
|
||||
gst_ffi::gst_object_ref(self.0 as *mut gst_ffi::GstObject) as
|
||||
*mut gst_ffi::GstStreamCollection,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,8 @@ impl TagList {
|
|||
let mut gvalue = mem::zeroed();
|
||||
let tag_name = CString::new(T::tag_name()).unwrap();
|
||||
|
||||
let found = gst_ffi::gst_tag_list_copy_value(&mut gvalue, self.as_ptr(), tag_name.as_ptr());
|
||||
let found =
|
||||
gst_ffi::gst_tag_list_copy_value(&mut gvalue, self.as_ptr(), tag_name.as_ptr());
|
||||
|
||||
if found == glib_ffi::GFALSE {
|
||||
return None;
|
||||
|
@ -119,7 +120,8 @@ impl TagList {
|
|||
unsafe {
|
||||
let tag_name = CString::new(T::tag_name()).unwrap();
|
||||
|
||||
let value = gst_ffi::gst_tag_list_get_value_index(self.as_ptr(), tag_name.as_ptr(), idx);
|
||||
let value =
|
||||
gst_ffi::gst_tag_list_get_value_index(self.as_ptr(), tag_name.as_ptr(), idx);
|
||||
|
||||
if value.is_null() {
|
||||
return None;
|
||||
|
@ -160,7 +162,8 @@ impl fmt::Debug for TagList {
|
|||
|
||||
impl PartialEq for TagList {
|
||||
fn eq(&self, other: &TagList) -> bool {
|
||||
(unsafe { gst_ffi::gst_tag_list_is_equal(self.as_ptr(), other.as_ptr()) } == glib_ffi::GTRUE)
|
||||
(unsafe { gst_ffi::gst_tag_list_is_equal(self.as_ptr(), other.as_ptr()) } ==
|
||||
glib_ffi::GTRUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -306,34 +306,43 @@ macro_rules! impl_value_type_simple(
|
|||
};
|
||||
);
|
||||
|
||||
impl_value_type_simple!(bool,
|
||||
Bool,
|
||||
gobject_ffi::G_TYPE_BOOLEAN,
|
||||
|value: &gobject_ffi::GValue| !(gobject_ffi::g_value_get_boolean(value) == 0),
|
||||
|value: &mut gobject_ffi::GValue, v| {
|
||||
gobject_ffi::g_value_set_boolean(value,
|
||||
if v { glib_ffi::GTRUE } else { glib_ffi::GFALSE })
|
||||
});
|
||||
impl_value_type_simple!(i32,
|
||||
Int,
|
||||
gobject_ffi::G_TYPE_INT,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_int(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_int(value, v));
|
||||
impl_value_type_simple!(u32,
|
||||
UInt,
|
||||
gobject_ffi::G_TYPE_UINT,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_uint(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_uint(value, v));
|
||||
impl_value_type_simple!(i64,
|
||||
Int64,
|
||||
gobject_ffi::G_TYPE_INT64,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_int64(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_int64(value, v));
|
||||
impl_value_type_simple!(u64,
|
||||
UInt64,
|
||||
gobject_ffi::G_TYPE_UINT64,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_uint64(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_uint64(value, v));
|
||||
impl_value_type_simple!(
|
||||
bool,
|
||||
Bool,
|
||||
gobject_ffi::G_TYPE_BOOLEAN,
|
||||
|value: &gobject_ffi::GValue| !(gobject_ffi::g_value_get_boolean(value) == 0),
|
||||
|value: &mut gobject_ffi::GValue, v| {
|
||||
gobject_ffi::g_value_set_boolean(value, if v { glib_ffi::GTRUE } else { glib_ffi::GFALSE })
|
||||
}
|
||||
);
|
||||
impl_value_type_simple!(
|
||||
i32,
|
||||
Int,
|
||||
gobject_ffi::G_TYPE_INT,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_int(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_int(value, v)
|
||||
);
|
||||
impl_value_type_simple!(
|
||||
u32,
|
||||
UInt,
|
||||
gobject_ffi::G_TYPE_UINT,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_uint(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_uint(value, v)
|
||||
);
|
||||
impl_value_type_simple!(
|
||||
i64,
|
||||
Int64,
|
||||
gobject_ffi::G_TYPE_INT64,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_int64(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_int64(value, v)
|
||||
);
|
||||
impl_value_type_simple!(
|
||||
u64,
|
||||
UInt64,
|
||||
gobject_ffi::G_TYPE_UINT64,
|
||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_uint64(value),
|
||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_uint64(value, v)
|
||||
);
|
||||
impl_value_type_simple!(
|
||||
Rational32,
|
||||
Fraction,
|
||||
|
|
Loading…
Reference in a new issue