mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 19:41:00 +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"]
|
#![crate_type = "cdylib"]
|
||||||
|
|
||||||
extern crate url;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate slog;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gst_plugin;
|
extern crate gst_plugin;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate slog;
|
||||||
|
extern crate url;
|
||||||
|
|
||||||
use gst_plugin::plugin::*;
|
use gst_plugin::plugin::*;
|
||||||
use gst_plugin::source::*;
|
use gst_plugin::source::*;
|
||||||
|
|
|
@ -1067,7 +1067,6 @@ impl FlvDemux {
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,15 @@
|
||||||
|
|
||||||
#![crate_type = "cdylib"]
|
#![crate_type = "cdylib"]
|
||||||
|
|
||||||
extern crate url;
|
extern crate flavors;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gst_plugin;
|
extern crate gst_plugin;
|
||||||
#[macro_use]
|
extern crate muldiv;
|
||||||
extern crate slog;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate nom;
|
extern crate nom;
|
||||||
extern crate flavors;
|
#[macro_use]
|
||||||
extern crate muldiv;
|
extern crate slog;
|
||||||
|
extern crate url;
|
||||||
|
|
||||||
use gst_plugin::plugin::*;
|
use gst_plugin::plugin::*;
|
||||||
use gst_plugin::demuxer::*;
|
use gst_plugin::demuxer::*;
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
#![crate_type = "cdylib"]
|
#![crate_type = "cdylib"]
|
||||||
|
|
||||||
extern crate url;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate gst_plugin;
|
extern crate gst_plugin;
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate slog;
|
extern crate slog;
|
||||||
|
extern crate url;
|
||||||
|
|
||||||
use gst_plugin::plugin::*;
|
use gst_plugin::plugin::*;
|
||||||
use gst_plugin::source::*;
|
use gst_plugin::source::*;
|
||||||
|
|
|
@ -174,8 +174,9 @@ impl Adapter {
|
||||||
return Ok(Buffer::new());
|
return Ok(Buffer::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
let sub = self.deque.front().and_then(
|
let sub = self.deque
|
||||||
|front| if front.get_size() - self.skip >= size {
|
.front()
|
||||||
|
.and_then(|front| if front.get_size() - self.skip >= size {
|
||||||
trace!(LOGGER, "Get buffer of {} bytes, subbuffer of first", size);
|
trace!(LOGGER, "Get buffer of {} bytes, subbuffer of first", size);
|
||||||
let new = front
|
let new = front
|
||||||
.get_buffer()
|
.get_buffer()
|
||||||
|
@ -184,8 +185,7 @@ impl Adapter {
|
||||||
Some(new)
|
Some(new)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if let Some(s) = sub {
|
if let Some(s) = sub {
|
||||||
self.flush(size).unwrap();
|
self.flush(size).unwrap();
|
||||||
|
|
|
@ -24,32 +24,28 @@ pub struct Buffer(gst_ffi::GstBuffer);
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct ReadBufferMap<'a> {
|
pub struct ReadBufferMap<'a> {
|
||||||
buffer: &'a Buffer,
|
buffer: &'a Buffer,
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||||
map_info: gst_ffi::GstMapInfo,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Derivative)]
|
#[derive(Derivative)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct ReadWriteBufferMap<'a> {
|
pub struct ReadWriteBufferMap<'a> {
|
||||||
buffer: &'a Buffer,
|
buffer: &'a Buffer,
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||||
map_info: gst_ffi::GstMapInfo,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Derivative)]
|
#[derive(Derivative)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct ReadMappedBuffer {
|
pub struct ReadMappedBuffer {
|
||||||
buffer: GstRc<Buffer>,
|
buffer: GstRc<Buffer>,
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||||
map_info: gst_ffi::GstMapInfo,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Derivative)]
|
#[derive(Derivative)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct ReadWriteMappedBuffer {
|
pub struct ReadWriteMappedBuffer {
|
||||||
buffer: GstRc<Buffer>,
|
buffer: GstRc<Buffer>,
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")] map_info: gst_ffi::GstMapInfo,
|
||||||
map_info: gst_ffi::GstMapInfo,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl MiniObject for Buffer {
|
unsafe impl MiniObject for Buffer {
|
||||||
|
@ -62,7 +58,8 @@ impl Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_with_size(size: usize) -> Option<GstRc<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() {
|
if raw.is_null() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,8 +133,9 @@ impl Buffer {
|
||||||
|
|
||||||
pub fn into_read_mapped_buffer(buffer: GstRc<Buffer>) -> Option<ReadMappedBuffer> {
|
pub fn into_read_mapped_buffer(buffer: GstRc<Buffer>) -> Option<ReadMappedBuffer> {
|
||||||
let mut map_info: gst_ffi::GstMapInfo = unsafe { mem::zeroed() };
|
let mut map_info: gst_ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||||
let res =
|
let res = unsafe {
|
||||||
unsafe { gst_ffi::gst_buffer_map(buffer.as_mut_ptr(), &mut map_info, gst_ffi::GST_MAP_READ) };
|
gst_ffi::gst_buffer_map(buffer.as_mut_ptr(), &mut map_info, gst_ffi::GST_MAP_READ)
|
||||||
|
};
|
||||||
if res == glib_ffi::GTRUE {
|
if res == glib_ffi::GTRUE {
|
||||||
Some(ReadMappedBuffer {
|
Some(ReadMappedBuffer {
|
||||||
buffer: buffer,
|
buffer: buffer,
|
||||||
|
@ -151,7 +149,11 @@ impl Buffer {
|
||||||
pub fn into_readwrite_mapped_buffer(buffer: GstRc<Buffer>) -> Option<ReadWriteMappedBuffer> {
|
pub fn into_readwrite_mapped_buffer(buffer: GstRc<Buffer>) -> Option<ReadWriteMappedBuffer> {
|
||||||
let mut map_info: gst_ffi::GstMapInfo = unsafe { mem::zeroed() };
|
let mut map_info: gst_ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||||
let res = unsafe {
|
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 {
|
if res == glib_ffi::GTRUE {
|
||||||
Some(ReadWriteMappedBuffer {
|
Some(ReadWriteMappedBuffer {
|
||||||
|
@ -199,7 +201,12 @@ impl Buffer {
|
||||||
|
|
||||||
let copied = unsafe {
|
let copied = unsafe {
|
||||||
let src = slice.as_ptr();
|
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 {
|
if copied == size {
|
||||||
|
|
|
@ -145,7 +145,6 @@ impl DemuxerWrapper {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
fn stop(&self) -> bool {
|
fn stop(&self) -> bool {
|
||||||
let demuxer = &mut self.demuxer.lock().unwrap();
|
let demuxer = &mut self.demuxer.lock().unwrap();
|
||||||
|
@ -190,7 +189,6 @@ impl DemuxerWrapper {
|
||||||
glib_ffi::GTRUE
|
glib_ffi::GTRUE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_duration(&self, duration: &mut u64) -> glib_ffi::gboolean {
|
fn get_duration(&self, duration: &mut u64) -> glib_ffi::gboolean {
|
||||||
|
@ -494,7 +492,6 @@ pub unsafe extern "C" fn demuxer_seek(
|
||||||
stop: u64,
|
stop: u64,
|
||||||
offset: *mut u64,
|
offset: *mut u64,
|
||||||
) -> glib_ffi::gboolean {
|
) -> glib_ffi::gboolean {
|
||||||
|
|
||||||
let wrap: &mut DemuxerWrapper = &mut *ptr;
|
let wrap: &mut DemuxerWrapper = &mut *ptr;
|
||||||
|
|
||||||
panic_to_error!(wrap, glib_ffi::GFALSE, {
|
panic_to_error!(wrap, glib_ffi::GFALSE, {
|
||||||
|
|
|
@ -7,22 +7,22 @@
|
||||||
// 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 libc;
|
|
||||||
extern crate url;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
#[macro_use]
|
|
||||||
extern crate slog;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate lazy_static;
|
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
extern crate num_rational;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derivative;
|
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 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_base_sys as gst_base_ffi;
|
||||||
|
pub extern crate gstreamer_sys as gst_ffi;
|
||||||
|
|
||||||
pub extern crate glib as glib;
|
pub extern crate glib as glib;
|
||||||
pub extern crate gstreamer as gst;
|
pub extern crate gstreamer as gst;
|
||||||
|
|
|
@ -58,7 +58,10 @@ impl GstDebugDrain {
|
||||||
|
|
||||||
if !element.is_null() {
|
if !element.is_null() {
|
||||||
unsafe {
|
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;
|
return &mut *self.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.0 = T::from_mut_ptr(
|
self.0 = T::from_mut_ptr(gst_ffi::gst_mini_object_make_writable(
|
||||||
gst_ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut gst_ffi::GstMiniObject) as
|
self.as_mut_ptr() as *mut gst_ffi::GstMiniObject,
|
||||||
*mut T::PtrType,
|
) as *mut T::PtrType);
|
||||||
);
|
|
||||||
assert!(self.is_writable());
|
assert!(self.is_writable());
|
||||||
|
|
||||||
&mut *self.0
|
&mut *self.0
|
||||||
|
@ -69,8 +68,9 @@ impl<T: MiniObject> GstRc<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_writable(&self) -> bool {
|
fn is_writable(&self) -> bool {
|
||||||
(unsafe { gst_ffi::gst_mini_object_is_writable(self.as_ptr() as *const gst_ffi::GstMiniObject) } ==
|
(unsafe {
|
||||||
glib_ffi::GTRUE)
|
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 {
|
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);
|
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 = &mut *(instance as *mut RsSink);
|
||||||
let sink_klass = &*(klass as *const RsSinkClass);
|
let sink_klass = &*(klass as *const RsSinkClass);
|
||||||
let sink_info = &*sink_klass.sink_info;
|
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
|
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 klass = gobject_ffi::g_type_class_peek(type_);
|
||||||
let sink_klass = &*(klass as *const RsSinkClass);
|
let sink_klass = &*(klass as *const RsSinkClass);
|
||||||
(*sink_klass.protocols).as_ptr()
|
(*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)
|
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)
|
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);
|
let uri_handler_iface = &mut *(iface as *mut gst_ffi::GstURIHandlerInterface);
|
||||||
|
|
||||||
uri_handler_iface.get_type = Some(sink_uri_handler_get_type);
|
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_finalize: None,
|
||||||
interface_data: ptr::null_mut(),
|
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_);
|
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 wrap: &SourceWrapper = &*src.wrap;
|
||||||
let buffer: &mut Buffer = <Buffer as MiniObject>::from_mut_ptr(buffer);
|
let buffer: &mut Buffer = <Buffer as MiniObject>::from_mut_ptr(buffer);
|
||||||
|
|
||||||
panic_to_error!(
|
panic_to_error!(wrap, gst_ffi::GST_FLOW_ERROR, {
|
||||||
wrap,
|
wrap.fill(offset, length, buffer)
|
||||||
gst_ffi::GST_FLOW_ERROR,
|
})
|
||||||
{ wrap.fill(offset, length, buffer) }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn source_seek(
|
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);
|
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 = &mut *(instance as *mut RsSrc);
|
||||||
let src_klass = &*(klass as *const RsSrcClass);
|
let src_klass = &*(klass as *const RsSrcClass);
|
||||||
let source_info = &*src_klass.source_info;
|
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
|
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 klass = gobject_ffi::g_type_class_peek(type_);
|
||||||
let src_klass = &*(klass as *const RsSrcClass);
|
let src_klass = &*(klass as *const RsSrcClass);
|
||||||
(*src_klass.protocols).as_ptr()
|
(*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)
|
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);
|
let uri_handler_iface = &mut *(iface as *mut gst_ffi::GstURIHandlerInterface);
|
||||||
|
|
||||||
uri_handler_iface.get_type = Some(source_uri_handler_get_type);
|
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_finalize: None,
|
||||||
interface_data: ptr::null_mut(),
|
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_);
|
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 {
|
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 {
|
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 {
|
pub fn get_stream_id(&self) -> &str {
|
||||||
|
@ -122,8 +126,10 @@ impl Stream {
|
||||||
impl Clone for Stream {
|
impl Clone for Stream {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
Stream(gst_ffi::gst_object_ref(self.0 as *mut gst_ffi::GstObject) as
|
Stream(
|
||||||
*mut gst_ffi::GstStream)
|
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 {
|
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()
|
cstr.to_str().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,8 +210,10 @@ impl<'a> Iterator for StreamCollectionIterator<'a> {
|
||||||
self.position += 1;
|
self.position += 1;
|
||||||
|
|
||||||
Some(unsafe {
|
Some(unsafe {
|
||||||
Stream(gst_ffi::gst_object_ref(stream as *mut gst_ffi::GstObject) as
|
Stream(
|
||||||
*mut gst_ffi::GstStream)
|
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 {
|
Some(unsafe {
|
||||||
Stream(gst_ffi::gst_object_ref(stream as *mut gst_ffi::GstObject) as
|
Stream(
|
||||||
*mut gst_ffi::GstStream)
|
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 {
|
impl Clone for StreamCollection {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
StreamCollection(gst_ffi::gst_object_ref(self.0 as *mut gst_ffi::GstObject) as
|
StreamCollection(
|
||||||
*mut gst_ffi::GstStreamCollection)
|
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 mut gvalue = mem::zeroed();
|
||||||
let tag_name = CString::new(T::tag_name()).unwrap();
|
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 {
|
if found == glib_ffi::GFALSE {
|
||||||
return None;
|
return None;
|
||||||
|
@ -119,7 +120,8 @@ impl TagList {
|
||||||
unsafe {
|
unsafe {
|
||||||
let tag_name = CString::new(T::tag_name()).unwrap();
|
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() {
|
if value.is_null() {
|
||||||
return None;
|
return None;
|
||||||
|
@ -160,7 +162,8 @@ impl fmt::Debug for TagList {
|
||||||
|
|
||||||
impl PartialEq for TagList {
|
impl PartialEq for TagList {
|
||||||
fn eq(&self, other: &TagList) -> bool {
|
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,
|
impl_value_type_simple!(
|
||||||
Bool,
|
bool,
|
||||||
gobject_ffi::G_TYPE_BOOLEAN,
|
Bool,
|
||||||
|value: &gobject_ffi::GValue| !(gobject_ffi::g_value_get_boolean(value) == 0),
|
gobject_ffi::G_TYPE_BOOLEAN,
|
||||||
|value: &mut gobject_ffi::GValue, v| {
|
|value: &gobject_ffi::GValue| !(gobject_ffi::g_value_get_boolean(value) == 0),
|
||||||
gobject_ffi::g_value_set_boolean(value,
|
|value: &mut gobject_ffi::GValue, v| {
|
||||||
if v { glib_ffi::GTRUE } else { glib_ffi::GFALSE })
|
gobject_ffi::g_value_set_boolean(value, if v { glib_ffi::GTRUE } else { glib_ffi::GFALSE })
|
||||||
});
|
}
|
||||||
impl_value_type_simple!(i32,
|
);
|
||||||
Int,
|
impl_value_type_simple!(
|
||||||
gobject_ffi::G_TYPE_INT,
|
i32,
|
||||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_int(value),
|
Int,
|
||||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_int(value, v));
|
gobject_ffi::G_TYPE_INT,
|
||||||
impl_value_type_simple!(u32,
|
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_int(value),
|
||||||
UInt,
|
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_int(value, v)
|
||||||
gobject_ffi::G_TYPE_UINT,
|
);
|
||||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_uint(value),
|
impl_value_type_simple!(
|
||||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_uint(value, v));
|
u32,
|
||||||
impl_value_type_simple!(i64,
|
UInt,
|
||||||
Int64,
|
gobject_ffi::G_TYPE_UINT,
|
||||||
gobject_ffi::G_TYPE_INT64,
|
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_uint(value),
|
||||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_int64(value),
|
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_uint(value, v)
|
||||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_int64(value, v));
|
);
|
||||||
impl_value_type_simple!(u64,
|
impl_value_type_simple!(
|
||||||
UInt64,
|
i64,
|
||||||
gobject_ffi::G_TYPE_UINT64,
|
Int64,
|
||||||
|value: &gobject_ffi::GValue| gobject_ffi::g_value_get_uint64(value),
|
gobject_ffi::G_TYPE_INT64,
|
||||||
|value: &mut gobject_ffi::GValue, v| gobject_ffi::g_value_set_uint64(value, v));
|
|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!(
|
impl_value_type_simple!(
|
||||||
Rational32,
|
Rational32,
|
||||||
Fraction,
|
Fraction,
|
||||||
|
|
Loading…
Reference in a new issue