mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
Fix all clippy warnings
Or silence the ones we don't care about.
This commit is contained in:
parent
fc79b4c4c8
commit
694bcaa697
54 changed files with 272 additions and 231 deletions
|
@ -74,7 +74,7 @@ fn get_request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst
|
||||||
|
|
||||||
fn connect_rtpbin_srcpad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(), Error> {
|
fn connect_rtpbin_srcpad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(), Error> {
|
||||||
let name = src_pad.get_name();
|
let name = src_pad.get_name();
|
||||||
let split_name = name.split("_");
|
let split_name = name.split('_');
|
||||||
let split_name = split_name.collect::<Vec<&str>>();
|
let split_name = split_name.collect::<Vec<&str>>();
|
||||||
let pt = split_name[5].parse::<u32>()?;
|
let pt = split_name[5].parse::<u32>()?;
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
return Err(ErrorMessage {
|
return Err(ErrorMessage {
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or_else(|| String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
|
|
|
@ -186,7 +186,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
return Err(ErrorMessage {
|
return Err(ErrorMessage {
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or_else(|| String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
|
|
|
@ -42,7 +42,7 @@ fn main_loop() -> Result<(), Error> {
|
||||||
let factory = RTSPMediaFactory::new();
|
let factory = RTSPMediaFactory::new();
|
||||||
let mounts = server.get_mount_points().ok_or(NoMountPoints)?;
|
let mounts = server.get_mount_points().ok_or(NoMountPoints)?;
|
||||||
let auth = RTSPAuth::new();
|
let auth = RTSPAuth::new();
|
||||||
let mut token = RTSPToken::new(&[(*RTSP_TOKEN_MEDIA_FACTORY_ROLE, &"user")]);
|
let token = RTSPToken::new(&[(*RTSP_TOKEN_MEDIA_FACTORY_ROLE, &"user")]);
|
||||||
let basic = RTSPAuth::make_basic("user", "password");
|
let basic = RTSPAuth::make_basic("user", "password");
|
||||||
let cert = gio::TlsCertificate::new_from_pem(
|
let cert = gio::TlsCertificate::new_from_pem(
|
||||||
"-----BEGIN CERTIFICATE-----\
|
"-----BEGIN CERTIFICATE-----\
|
||||||
|
@ -86,7 +86,7 @@ fn main_loop() -> Result<(), Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
auth.set_tls_certificate(&cert);
|
auth.set_tls_certificate(&cert);
|
||||||
auth.add_basic(basic.as_str(), &mut token);
|
auth.add_basic(basic.as_str(), &token);
|
||||||
server.set_auth(&auth);
|
server.set_auth(&auth);
|
||||||
factory.set_launch(args[1].as_str());
|
factory.set_launch(args[1].as_str());
|
||||||
factory.set_transport_mode(RTSPTransportMode::RECORD);
|
factory.set_transport_mode(RTSPTransportMode::RECORD);
|
||||||
|
|
|
@ -53,7 +53,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
|
|
||||||
let tagsetter = pipeline
|
let tagsetter = pipeline
|
||||||
.get_by_interface(gst::TagSetter::static_type())
|
.get_by_interface(gst::TagSetter::static_type())
|
||||||
.ok_or(failure::err_msg("No TagSetter found"))?;
|
.ok_or_else(|| failure::err_msg("No TagSetter found"))?;
|
||||||
let tagsetter = tagsetter
|
let tagsetter = tagsetter
|
||||||
.dynamic_cast::<gst::TagSetter>()
|
.dynamic_cast::<gst::TagSetter>()
|
||||||
.map_err(|_| failure::err_msg("No TagSetter found"))?;
|
.map_err(|_| failure::err_msg("No TagSetter found"))?;
|
||||||
|
|
|
@ -15,6 +15,7 @@ use std::cell::RefCell;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use AppSink;
|
use AppSink;
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
pub struct AppSinkCallbacks {
|
pub struct AppSinkCallbacks {
|
||||||
eos: Option<RefCell<Box<FnMut(&AppSink) + Send + 'static>>>,
|
eos: Option<RefCell<Box<FnMut(&AppSink) + Send + 'static>>>,
|
||||||
new_preroll: Option<RefCell<Box<FnMut(&AppSink) -> gst::FlowReturn + Send + 'static>>>,
|
new_preroll: Option<RefCell<Box<FnMut(&AppSink) -> gst::FlowReturn + Send + 'static>>>,
|
||||||
|
@ -36,6 +37,7 @@ impl AppSinkCallbacks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
pub struct AppSinkCallbacksBuilder {
|
pub struct AppSinkCallbacksBuilder {
|
||||||
eos: Option<RefCell<Box<FnMut(&AppSink) + Send + 'static>>>,
|
eos: Option<RefCell<Box<FnMut(&AppSink) + Send + 'static>>>,
|
||||||
new_preroll: Option<RefCell<Box<FnMut(&AppSink) -> gst::FlowReturn + Send + 'static>>>,
|
new_preroll: Option<RefCell<Box<FnMut(&AppSink) -> gst::FlowReturn + Send + 'static>>>,
|
||||||
|
@ -105,10 +107,9 @@ impl AppSinkCallbacksBuilder {
|
||||||
unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gpointer) {
|
unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gpointer) {
|
||||||
let callbacks = &*(callbacks as *const AppSinkCallbacks);
|
let callbacks = &*(callbacks as *const AppSinkCallbacks);
|
||||||
|
|
||||||
callbacks
|
if let Some(ref eos) = callbacks.eos {
|
||||||
.eos
|
(&mut *eos.borrow_mut())(&from_glib_borrow(appsink))
|
||||||
.as_ref()
|
}
|
||||||
.map(|f| (&mut *f.borrow_mut())(&from_glib_borrow(appsink)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn trampoline_new_preroll(
|
unsafe extern "C" fn trampoline_new_preroll(
|
||||||
|
@ -117,12 +118,13 @@ unsafe extern "C" fn trampoline_new_preroll(
|
||||||
) -> gst_ffi::GstFlowReturn {
|
) -> gst_ffi::GstFlowReturn {
|
||||||
let callbacks = &*(callbacks as *const AppSinkCallbacks);
|
let callbacks = &*(callbacks as *const AppSinkCallbacks);
|
||||||
|
|
||||||
callbacks
|
let ret = if let Some(ref new_preroll) = callbacks.new_preroll {
|
||||||
.new_preroll
|
(&mut *new_preroll.borrow_mut())(&from_glib_borrow(appsink))
|
||||||
.as_ref()
|
} else {
|
||||||
.map(|f| (&mut *f.borrow_mut())(&from_glib_borrow(appsink)))
|
gst::FlowReturn::Error
|
||||||
.unwrap_or(gst::FlowReturn::Error)
|
};
|
||||||
.to_glib()
|
|
||||||
|
ret.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn trampoline_new_sample(
|
unsafe extern "C" fn trampoline_new_sample(
|
||||||
|
@ -131,12 +133,13 @@ unsafe extern "C" fn trampoline_new_sample(
|
||||||
) -> gst_ffi::GstFlowReturn {
|
) -> gst_ffi::GstFlowReturn {
|
||||||
let callbacks = &*(callbacks as *const AppSinkCallbacks);
|
let callbacks = &*(callbacks as *const AppSinkCallbacks);
|
||||||
|
|
||||||
callbacks
|
let ret = if let Some(ref new_sample) = callbacks.new_sample {
|
||||||
.new_sample
|
(&mut *new_sample.borrow_mut())(&from_glib_borrow(appsink))
|
||||||
.as_ref()
|
} else {
|
||||||
.map(|f| (&mut *f.borrow_mut())(&from_glib_borrow(appsink)))
|
gst::FlowReturn::Error
|
||||||
.unwrap_or(gst::FlowReturn::Error)
|
};
|
||||||
.to_glib()
|
|
||||||
|
ret.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
|
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use AppSrc;
|
use AppSrc;
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
pub struct AppSrcCallbacks {
|
pub struct AppSrcCallbacks {
|
||||||
need_data: Option<RefCell<Box<FnMut(&AppSrc, u32) + Send + 'static>>>,
|
need_data: Option<RefCell<Box<FnMut(&AppSrc, u32) + Send + 'static>>>,
|
||||||
enough_data: Option<Box<Fn(&AppSrc) + Send + Sync + 'static>>,
|
enough_data: Option<Box<Fn(&AppSrc) + Send + Sync + 'static>>,
|
||||||
|
@ -37,6 +38,7 @@ impl AppSrcCallbacks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
pub struct AppSrcCallbacksBuilder {
|
pub struct AppSrcCallbacksBuilder {
|
||||||
need_data: Option<RefCell<Box<FnMut(&AppSrc, u32) + Send + 'static>>>,
|
need_data: Option<RefCell<Box<FnMut(&AppSrc, u32) + Send + 'static>>>,
|
||||||
enough_data: Option<Box<Fn(&AppSrc) + Send + Sync + 'static>>,
|
enough_data: Option<Box<Fn(&AppSrc) + Send + Sync + 'static>>,
|
||||||
|
@ -111,19 +113,17 @@ unsafe extern "C" fn trampoline_need_data(
|
||||||
) {
|
) {
|
||||||
let callbacks = &*(callbacks as *const AppSrcCallbacks);
|
let callbacks = &*(callbacks as *const AppSrcCallbacks);
|
||||||
|
|
||||||
callbacks
|
if let Some(ref need_data) = callbacks.need_data {
|
||||||
.need_data
|
(&mut *need_data.borrow_mut())(&from_glib_borrow(appsrc), length);
|
||||||
.as_ref()
|
}
|
||||||
.map(|f| (&mut *f.borrow_mut())(&from_glib_borrow(appsrc), length));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) {
|
unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) {
|
||||||
let callbacks = &*(callbacks as *const AppSrcCallbacks);
|
let callbacks = &*(callbacks as *const AppSrcCallbacks);
|
||||||
|
|
||||||
callbacks
|
if let Some(ref enough_data) = callbacks.enough_data {
|
||||||
.enough_data
|
(*enough_data)(&from_glib_borrow(appsrc));
|
||||||
.as_ref()
|
}
|
||||||
.map(|f| f(&from_glib_borrow(appsrc)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn trampoline_seek_data(
|
unsafe extern "C" fn trampoline_seek_data(
|
||||||
|
@ -133,12 +133,13 @@ unsafe extern "C" fn trampoline_seek_data(
|
||||||
) -> gboolean {
|
) -> gboolean {
|
||||||
let callbacks = &*(callbacks as *const AppSrcCallbacks);
|
let callbacks = &*(callbacks as *const AppSrcCallbacks);
|
||||||
|
|
||||||
callbacks
|
let ret = if let Some(ref seek_data) = callbacks.seek_data {
|
||||||
.seek_data
|
(*seek_data)(&from_glib_borrow(appsrc), offset)
|
||||||
.as_ref()
|
} else {
|
||||||
.map(|f| f(&from_glib_borrow(appsrc), offset))
|
false
|
||||||
.unwrap_or(false)
|
};
|
||||||
.to_glib()
|
|
||||||
|
ret.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
|
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ use gst::MiniObject;
|
||||||
use array_init;
|
use array_init;
|
||||||
|
|
||||||
impl AudioChannelPosition {
|
impl AudioChannelPosition {
|
||||||
pub fn to_mask(&self) -> u64 {
|
pub fn to_mask(self) -> u64 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let val = mem::transmute::<ffi::GstAudioChannelPosition, u32>(self.to_glib());
|
let val = mem::transmute::<ffi::GstAudioChannelPosition, u32>(self.to_glib());
|
||||||
1 << val
|
1 << val
|
||||||
|
|
|
@ -39,8 +39,8 @@ impl ::AudioFormat {
|
||||||
unsafe { from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)) }
|
unsafe { from_glib(ffi::gst_audio_format_from_string(s.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_string<'a>(&self) -> &'a str {
|
pub fn to_string<'a>(self) -> &'a str {
|
||||||
if *self == ::AudioFormat::Unknown {
|
if self == ::AudioFormat::Unknown {
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ impl str::FromStr for ::AudioFormat {
|
||||||
|
|
||||||
impl fmt::Display for ::AudioFormat {
|
impl fmt::Display for ::AudioFormat {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
f.write_str(self.to_string())
|
f.write_str(self.to_string().as_str())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,13 +131,14 @@ impl<'a> AudioInfoBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AudioInfo {
|
impl AudioInfo {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(new_ret_no_self))]
|
||||||
pub fn new<'a>(format: ::AudioFormat, rate: u32, channels: u32) -> AudioInfoBuilder<'a> {
|
pub fn new<'a>(format: ::AudioFormat, rate: u32, channels: u32) -> AudioInfoBuilder<'a> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
AudioInfoBuilder {
|
AudioInfoBuilder {
|
||||||
format: format,
|
format,
|
||||||
rate: rate,
|
rate,
|
||||||
channels: channels,
|
channels,
|
||||||
positions: None,
|
positions: None,
|
||||||
flags: None,
|
flags: None,
|
||||||
layout: None,
|
layout: None,
|
||||||
|
|
|
@ -20,7 +20,7 @@ glib_wrapper! {
|
||||||
|
|
||||||
match fn {
|
match fn {
|
||||||
ref => |ptr| {
|
ref => |ptr| {
|
||||||
gobject_ffi::g_boxed_copy(ffi::gst_flow_combiner_get_type(), ptr as *mut _) as *mut ffi::GstFlowCombiner
|
gobject_ffi::g_boxed_copy(ffi::gst_flow_combiner_get_type(), ptr as *mut _)
|
||||||
},
|
},
|
||||||
unref => |ptr| {
|
unref => |ptr| {
|
||||||
gobject_ffi::g_boxed_free(ffi::gst_flow_combiner_get_type(), ptr as *mut _)
|
gobject_ffi::g_boxed_free(ffi::gst_flow_combiner_get_type(), ptr as *mut _)
|
||||||
|
|
|
@ -29,6 +29,7 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
mod auto;
|
mod auto;
|
||||||
pub use auto::functions::*;
|
pub use auto::functions::*;
|
||||||
pub use auto::*;
|
pub use auto::*;
|
||||||
|
|
|
@ -12,6 +12,7 @@ use glib_ffi;
|
||||||
pub struct MutexGuard<'a>(&'a glib_ffi::GMutex);
|
pub struct MutexGuard<'a>(&'a glib_ffi::GMutex);
|
||||||
|
|
||||||
impl<'a> MutexGuard<'a> {
|
impl<'a> MutexGuard<'a> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(trivially_copy_pass_by_ref))]
|
||||||
pub fn lock(mutex: &'a glib_ffi::GMutex) -> Self {
|
pub fn lock(mutex: &'a glib_ffi::GMutex) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib_ffi::g_mutex_lock(mut_override(mutex));
|
glib_ffi::g_mutex_lock(mut_override(mutex));
|
||||||
|
|
|
@ -71,6 +71,7 @@ unsafe extern "C" fn notify_timeout_trampoline<P>(
|
||||||
) where
|
) where
|
||||||
P: IsA<Discoverer>,
|
P: IsA<Discoverer>,
|
||||||
{
|
{
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
||||||
f(&Discoverer::from_glib_borrow(this).downcast_unchecked())
|
f(&Discoverer::from_glib_borrow(this).downcast_unchecked())
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ impl Iterator for Iter {
|
||||||
|
|
||||||
fn next(&mut self) -> Option<DiscovererStreamInfo> {
|
fn next(&mut self) -> Option<DiscovererStreamInfo> {
|
||||||
let current = self.stream_info.take();
|
let current = self.stream_info.take();
|
||||||
self.stream_info = match ¤t {
|
self.stream_info = match current {
|
||||||
&Some(ref c) => {
|
Some(ref c) => {
|
||||||
// Decide on the direction
|
// Decide on the direction
|
||||||
if self.direction_forward {
|
if self.direction_forward {
|
||||||
c.get_next()
|
c.get_next()
|
||||||
|
@ -29,7 +29,7 @@ impl Iterator for Iter {
|
||||||
c.get_previous()
|
c.get_previous()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
current
|
current
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
mod auto;
|
mod auto;
|
||||||
pub use auto::*;
|
pub use auto::*;
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,7 @@ unsafe extern "C" fn duration_changed_trampoline(
|
||||||
object: u64,
|
object: u64,
|
||||||
f: glib_ffi::gpointer,
|
f: glib_ffi::gpointer,
|
||||||
) {
|
) {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
|
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
|
||||||
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
|
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
|
||||||
}
|
}
|
||||||
|
@ -114,6 +115,7 @@ unsafe extern "C" fn position_updated_trampoline(
|
||||||
object: u64,
|
object: u64,
|
||||||
f: glib_ffi::gpointer,
|
f: glib_ffi::gpointer,
|
||||||
) {
|
) {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
let f: &&(Fn(&Player, gst::ClockTime) + Send + Sync + 'static) = transmute(f);
|
let f: &&(Fn(&Player, gst::ClockTime) + Send + Sync + 'static) = transmute(f);
|
||||||
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
|
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
|
||||||
}
|
}
|
||||||
|
@ -123,6 +125,7 @@ unsafe extern "C" fn seek_done_trampoline(
|
||||||
object: u64,
|
object: u64,
|
||||||
f: glib_ffi::gpointer,
|
f: glib_ffi::gpointer,
|
||||||
) {
|
) {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
|
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
|
||||||
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
|
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
mod auto;
|
mod auto;
|
||||||
pub use auto::*;
|
pub use auto::*;
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,11 @@ impl GstRcRTSPTokenExt<RTSPTokenRef> for GstRc<RTSPTokenRef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(values: &[(&str, &ToSendValue)]) -> Self {
|
fn new(values: &[(&str, &ToSendValue)]) -> Self {
|
||||||
let token = RTSPToken::new_empty();
|
let mut token = RTSPToken::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
let structure = token.writable_structure().unwrap();
|
let token = token.get_mut().unwrap();
|
||||||
|
let structure = token.get_mut_structure().unwrap();
|
||||||
|
|
||||||
for &(f, v) in values {
|
for &(f, v) in values {
|
||||||
structure.set_value(f, v.to_send_value());
|
structure.set_value(f, v.to_send_value());
|
||||||
|
@ -64,7 +65,7 @@ impl RTSPTokenRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn writable_structure(&self) -> Option<&mut gst::StructureRef> {
|
pub fn get_mut_structure(&mut self) -> Option<&mut gst::StructureRef> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let structure = ffi::gst_rtsp_token_writable_structure(self.as_mut_ptr());
|
let structure = ffi::gst_rtsp_token_writable_structure(self.as_mut_ptr());
|
||||||
if structure.is_null() {
|
if structure.is_null() {
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(non_snake_case))]
|
#[allow(non_snake_case)]
|
||||||
mod auto;
|
mod auto;
|
||||||
pub use auto::*;
|
pub use auto::*;
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ pub struct MIKEYMapSRTP(ffi::GstMIKEYMapSRTP);
|
||||||
impl MIKEYMapSRTP {
|
impl MIKEYMapSRTP {
|
||||||
pub fn new(policy: u8, ssrc: u32, roc: u32) -> MIKEYMapSRTP {
|
pub fn new(policy: u8, ssrc: u32, roc: u32) -> MIKEYMapSRTP {
|
||||||
MIKEYMapSRTP(ffi::GstMIKEYMapSRTP {
|
MIKEYMapSRTP(ffi::GstMIKEYMapSRTP {
|
||||||
policy: policy,
|
policy,
|
||||||
ssrc: ssrc,
|
ssrc,
|
||||||
roc: roc,
|
roc,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,10 @@ impl MIKEYPayloadSPParam {
|
||||||
self.0.len
|
self.0.len
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.0.len == 0
|
||||||
|
}
|
||||||
|
|
||||||
pub fn val(&self) -> &[u8] {
|
pub fn val(&self) -> &[u8] {
|
||||||
unsafe { slice::from_raw_parts(self.0.val as *const u8, self.0.len as usize) }
|
unsafe { slice::from_raw_parts(self.0.val as *const u8, self.0.len as usize) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,7 +508,6 @@ impl SDPMedia {
|
||||||
media.to_glib_none_mut().0,
|
media.to_glib_none_mut().0,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
mem::forget(media);
|
|
||||||
match result {
|
match result {
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
ffi::GST_SDP_OK => Ok(()),
|
||||||
_ => Err(()),
|
_ => Err(()),
|
||||||
|
|
|
@ -709,12 +709,12 @@ impl SDPMessage {
|
||||||
unsafe { ffi::gst_sdp_message_zones_len(self.to_glib_none().0) }
|
unsafe { ffi::gst_sdp_message_zones_len(self.to_glib_none().0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_uri(scheme: &str, msg: &SDPMessage) -> Option<String> {
|
pub fn as_uri(&self, scheme: &str) -> Option<String> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_sdp_message_as_uri(
|
from_glib_full(ffi::gst_sdp_message_as_uri(
|
||||||
scheme.to_glib_none().0,
|
scheme.to_glib_none().0,
|
||||||
msg.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -753,4 +753,10 @@ impl SDPMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for SDPMessage {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsafe impl Send for SDPMessage {}
|
unsafe impl Send for SDPMessage {}
|
||||||
|
|
|
@ -43,6 +43,7 @@ impl SDPTime {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn repeat(&self) -> Vec<&str> {
|
pub fn repeat(&self) -> Vec<&str> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
unsafe {
|
unsafe {
|
||||||
let arr = (*self.0.repeat).data as *const *const c_char;
|
let arr = (*self.0.repeat).data as *const *const c_char;
|
||||||
let len = (*self.0.repeat).len as usize;
|
let len = (*self.0.repeat).len as usize;
|
||||||
|
|
|
@ -54,6 +54,7 @@ pub fn convert_sample_async<F>(
|
||||||
) where
|
) where
|
||||||
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
|
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
|
||||||
{
|
{
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
let callback: &mut Option<Box<F>> = mem::transmute(user_data);
|
let callback: &mut Option<Box<F>> = mem::transmute(user_data);
|
||||||
let callback = callback.take().unwrap();
|
let callback = callback.take().unwrap();
|
||||||
|
|
||||||
|
|
|
@ -105,35 +105,35 @@ impl<'a> DownstreamForceKeyUnitEventBuilder<'a> {
|
||||||
|
|
||||||
pub fn timestamp(self, timestamp: gst::ClockTime) -> Self {
|
pub fn timestamp(self, timestamp: gst::ClockTime) -> Self {
|
||||||
Self {
|
Self {
|
||||||
timestamp: timestamp,
|
timestamp,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stream_time(self, stream_time: gst::ClockTime) -> Self {
|
pub fn stream_time(self, stream_time: gst::ClockTime) -> Self {
|
||||||
Self {
|
Self {
|
||||||
stream_time: stream_time,
|
stream_time,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn running_time(self, running_time: gst::ClockTime) -> Self {
|
pub fn running_time(self, running_time: gst::ClockTime) -> Self {
|
||||||
Self {
|
Self {
|
||||||
running_time: running_time,
|
running_time,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn all_headers(self, all_headers: bool) -> Self {
|
pub fn all_headers(self, all_headers: bool) -> Self {
|
||||||
Self {
|
Self {
|
||||||
all_headers: all_headers,
|
all_headers,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn count(self, count: u32) -> Self {
|
pub fn count(self, count: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
count: count,
|
count,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ pub fn parse_downstream_force_key_unit_event(
|
||||||
stream_time: from_glib(stream_time),
|
stream_time: from_glib(stream_time),
|
||||||
running_time: from_glib(running_time),
|
running_time: from_glib(running_time),
|
||||||
all_headers: from_glib(all_headers),
|
all_headers: from_glib(all_headers),
|
||||||
count: count,
|
count,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -218,21 +218,21 @@ impl<'a> UpstreamForceKeyUnitEventBuilder<'a> {
|
||||||
|
|
||||||
pub fn running_time(self, running_time: gst::ClockTime) -> Self {
|
pub fn running_time(self, running_time: gst::ClockTime) -> Self {
|
||||||
Self {
|
Self {
|
||||||
running_time: running_time,
|
running_time,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn all_headers(self, all_headers: bool) -> Self {
|
pub fn all_headers(self, all_headers: bool) -> Self {
|
||||||
Self {
|
Self {
|
||||||
all_headers: all_headers,
|
all_headers,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn count(self, count: u32) -> Self {
|
pub fn count(self, count: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
count: count,
|
count,
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ pub fn parse_upstream_force_key_unit_event(
|
||||||
Some(UpstreamForceKeyUnitEvent {
|
Some(UpstreamForceKeyUnitEvent {
|
||||||
running_time: from_glib(running_time),
|
running_time: from_glib(running_time),
|
||||||
all_headers: from_glib(all_headers),
|
all_headers: from_glib(all_headers),
|
||||||
count: count,
|
count,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -311,7 +311,7 @@ impl<'a> StillFrameEventBuilder<'a> {
|
||||||
seqnum: None,
|
seqnum: None,
|
||||||
running_time_offset: None,
|
running_time_offset: None,
|
||||||
other_fields: Vec::new(),
|
other_fields: Vec::new(),
|
||||||
in_still: in_still,
|
in_still,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,8 @@ impl ::VideoFormat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_string<'a>(&self) -> &'a str {
|
pub fn to_string<'a>(self) -> &'a str {
|
||||||
if *self == ::VideoFormat::Unknown {
|
if self == ::VideoFormat::Unknown {
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,6 @@ impl str::FromStr for ::VideoFormat {
|
||||||
|
|
||||||
impl fmt::Display for ::VideoFormat {
|
impl fmt::Display for ::VideoFormat {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
f.write_str(self.to_string())
|
f.write_str(self.to_string().as_str())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ impl VideoFrame<Readable> {
|
||||||
&mut frame,
|
&mut frame,
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.to_glib_none().0,
|
buffer.to_glib_none().0,
|
||||||
mem::transmute(ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ),
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ,
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -205,7 +205,7 @@ impl VideoFrame<Readable> {
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.to_glib_none().0,
|
buffer.to_glib_none().0,
|
||||||
id,
|
id,
|
||||||
mem::transmute(ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ),
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ,
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -237,10 +237,8 @@ impl VideoFrame<Writable> {
|
||||||
&mut frame,
|
&mut frame,
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.to_glib_none().0,
|
buffer.to_glib_none().0,
|
||||||
mem::transmute(
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
| gst_ffi::GST_MAP_WRITE,
|
||||||
| gst_ffi::GST_MAP_WRITE,
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -266,10 +264,8 @@ impl VideoFrame<Writable> {
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.to_glib_none().0,
|
buffer.to_glib_none().0,
|
||||||
id,
|
id,
|
||||||
mem::transmute(
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
| gst_ffi::GST_MAP_WRITE,
|
||||||
| gst_ffi::GST_MAP_WRITE,
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -337,7 +333,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
&mut frame,
|
&mut frame,
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
mem::transmute(ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ),
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ,
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -363,7 +359,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
id,
|
id,
|
||||||
mem::transmute(ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ),
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ,
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -515,10 +511,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
&mut frame,
|
&mut frame,
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
mem::transmute(
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
| gst_ffi::GST_MAP_WRITE,
|
||||||
| gst_ffi::GST_MAP_WRITE,
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -544,10 +538,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
info.to_glib_none().0 as *mut _,
|
info.to_glib_none().0 as *mut _,
|
||||||
buffer.as_mut_ptr(),
|
buffer.as_mut_ptr(),
|
||||||
id,
|
id,
|
||||||
mem::transmute(
|
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
| gst_ffi::GST_MAP_WRITE,
|
||||||
| gst_ffi::GST_MAP_WRITE,
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if !res {
|
if !res {
|
||||||
|
@ -598,8 +590,7 @@ impl<'a> ops::Deref for VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
type Target = VideoFrameRef<&'a gst::BufferRef>;
|
type Target = VideoFrameRef<&'a gst::BufferRef>;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
use std::mem;
|
unsafe { &*(self as *const VideoFrameRef<&'a mut gst::BufferRef> as *const VideoFrameRef<&'a gst::BufferRef>) }
|
||||||
unsafe { mem::transmute(self) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ impl<'a> VideoInfoBuilder<'a> {
|
||||||
self.height,
|
self.height,
|
||||||
);
|
);
|
||||||
|
|
||||||
if info.finfo.is_null() || info.width <= 0 || info.width <= 0 {
|
if info.finfo.is_null() || info.width <= 0 || info.height <= 0 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +423,7 @@ impl<'a> VideoInfoBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VideoInfo {
|
impl VideoInfo {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(new_ret_no_self))]
|
||||||
pub fn new<'a>(format: ::VideoFormat, width: u32, height: u32) -> VideoInfoBuilder<'a> {
|
pub fn new<'a>(format: ::VideoFormat, width: u32, height: u32) -> VideoInfoBuilder<'a> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
|
@ -449,9 +450,9 @@ impl VideoInfo {
|
||||||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||||
{
|
{
|
||||||
VideoInfoBuilder {
|
VideoInfoBuilder {
|
||||||
format: format,
|
format,
|
||||||
width: width,
|
width,
|
||||||
height: height,
|
height,
|
||||||
interlace_mode: None,
|
interlace_mode: None,
|
||||||
flags: None,
|
flags: None,
|
||||||
size: None,
|
size: None,
|
||||||
|
@ -736,7 +737,7 @@ impl glib::translate::FromGlibPtrFull<*mut ffi::GstVideoInfo> for VideoInfo {
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||||
impl ::VideoFieldOrder {
|
impl ::VideoFieldOrder {
|
||||||
pub fn to_string(&self) -> String {
|
pub fn to_string(self) -> String {
|
||||||
unsafe { from_glib_full(ffi::gst_video_field_order_to_string(self.to_glib())) }
|
unsafe { from_glib_full(ffi::gst_video_field_order_to_string(self.to_glib())) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,7 +766,7 @@ impl fmt::Display for ::VideoFieldOrder {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::VideoInterlaceMode {
|
impl ::VideoInterlaceMode {
|
||||||
pub fn to_string(&self) -> String {
|
pub fn to_string(self) -> String {
|
||||||
unsafe { from_glib_full(ffi::gst_video_interlace_mode_to_string(self.to_glib())) }
|
unsafe { from_glib_full(ffi::gst_video_interlace_mode_to_string(self.to_glib())) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ impl GstRc<BufferRef> {
|
||||||
if res {
|
if res {
|
||||||
Ok(MappedBuffer {
|
Ok(MappedBuffer {
|
||||||
buffer: Some(self),
|
buffer: Some(self),
|
||||||
map_info: map_info,
|
map_info,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,7 +147,7 @@ impl GstRc<BufferRef> {
|
||||||
if res {
|
if res {
|
||||||
Ok(MappedBuffer {
|
Ok(MappedBuffer {
|
||||||
buffer: Some(self),
|
buffer: Some(self),
|
||||||
map_info: map_info,
|
map_info,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -175,7 +175,7 @@ impl BufferRef {
|
||||||
if res == glib_ffi::GTRUE {
|
if res == glib_ffi::GTRUE {
|
||||||
Some(BufferMap {
|
Some(BufferMap {
|
||||||
buffer: self,
|
buffer: self,
|
||||||
map_info: map_info,
|
map_info,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -191,7 +191,7 @@ impl BufferRef {
|
||||||
if res == glib_ffi::GTRUE {
|
if res == glib_ffi::GTRUE {
|
||||||
Some(BufferMap {
|
Some(BufferMap {
|
||||||
buffer: self,
|
buffer: self,
|
||||||
map_info: map_info,
|
map_info,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -105,6 +105,7 @@ impl ToOwned for BufferListRef {
|
||||||
type Owned = GstRc<BufferListRef>;
|
type Owned = GstRc<BufferListRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<BufferListRef> {
|
fn to_owned(&self) -> GstRc<BufferListRef> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +146,7 @@ impl<'a> Iter<'a> {
|
||||||
fn new(list: &'a BufferListRef) -> Iter<'a> {
|
fn new(list: &'a BufferListRef) -> Iter<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Iter {
|
Iter {
|
||||||
list: list,
|
list,
|
||||||
idx: 0,
|
idx: 0,
|
||||||
size: list.len() as u32,
|
size: list.len() as u32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ impl ClockTime {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for ClockTime {
|
impl fmt::Display for ClockTime {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(many_single_char_names))]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
let precision = f.precision().unwrap_or(9);
|
let precision = f.precision().unwrap_or(9);
|
||||||
// TODO: Could also check width and pad the hours as needed
|
// TODO: Could also check width and pad the hours as needed
|
||||||
|
|
|
@ -90,6 +90,7 @@ impl ToOwned for ContextRef {
|
||||||
type Owned = GstRc<ContextRef>;
|
type Owned = GstRc<ContextRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<ContextRef> {
|
fn to_owned(&self) -> GstRc<ContextRef> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ pub trait ElementExtManual {
|
||||||
fn get_pad_template(&self, name: &str) -> Option<PadTemplate>;
|
fn get_pad_template(&self, name: &str) -> Option<PadTemplate>;
|
||||||
fn get_pad_template_list(&self) -> Vec<PadTemplate>;
|
fn get_pad_template_list(&self) -> Vec<PadTemplate>;
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
fn message_full<T: ::MessageErrorDomain>(
|
fn message_full<T: ::MessageErrorDomain>(
|
||||||
&self,
|
&self,
|
||||||
type_: ElementMessageType,
|
type_: ElementMessageType,
|
||||||
|
@ -110,7 +111,9 @@ pub trait ElementExtManual {
|
||||||
function: &str,
|
function: &str,
|
||||||
line: u32,
|
line: u32,
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
fn message_full_with_details<T: ::MessageErrorDomain>(
|
fn message_full_with_details<T: ::MessageErrorDomain>(
|
||||||
&self,
|
&self,
|
||||||
type_: ElementMessageType,
|
type_: ElementMessageType,
|
||||||
|
|
|
@ -75,19 +75,19 @@ impl ErrorMessage {
|
||||||
function: &'static str,
|
function: &'static str,
|
||||||
line: u32,
|
line: u32,
|
||||||
) -> ErrorMessage {
|
) -> ErrorMessage {
|
||||||
let domain = T::domain();
|
let error_domain = T::domain();
|
||||||
let code = error.code();
|
let error_code = error.code();
|
||||||
let message = message.into();
|
let message = message.into();
|
||||||
let debug = debug.into();
|
let debug = debug.into();
|
||||||
|
|
||||||
ErrorMessage {
|
ErrorMessage {
|
||||||
error_domain: domain,
|
error_domain,
|
||||||
error_code: code,
|
error_code,
|
||||||
message: message.map(String::from),
|
message: message.map(String::from),
|
||||||
debug: debug.map(String::from),
|
debug: debug.map(String::from),
|
||||||
filename: filename,
|
filename,
|
||||||
function: function,
|
function,
|
||||||
line: line,
|
line,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,23 +102,23 @@ unsafe impl MiniObject for EventRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventType {
|
impl EventType {
|
||||||
pub fn is_upstream(&self) -> bool {
|
pub fn is_upstream(self) -> bool {
|
||||||
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_UPSTREAM != 0
|
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_UPSTREAM != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_downstream(&self) -> bool {
|
pub fn is_downstream(self) -> bool {
|
||||||
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_DOWNSTREAM != 0
|
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_DOWNSTREAM != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_serialized(&self) -> bool {
|
pub fn is_serialized(self) -> bool {
|
||||||
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_SERIALIZED != 0
|
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_SERIALIZED != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_sticky(&self) -> bool {
|
pub fn is_sticky(self) -> bool {
|
||||||
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY != 0
|
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_sticky_multi(&self) -> bool {
|
pub fn is_sticky_multi(self) -> bool {
|
||||||
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY_MULTI != 0
|
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_STICKY_MULTI != 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -914,6 +914,7 @@ impl<'a> EventBuilder<'a> {
|
||||||
|
|
||||||
macro_rules! event_builder_generic_impl {
|
macro_rules! event_builder_generic_impl {
|
||||||
($new_fn:expr) => {
|
($new_fn:expr) => {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(needless_update))]
|
||||||
pub fn seqnum(self, seqnum: Seqnum) -> Self {
|
pub fn seqnum(self, seqnum: Seqnum) -> Self {
|
||||||
Self {
|
Self {
|
||||||
builder: self.builder.seqnum(seqnum),
|
builder: self.builder.seqnum(seqnum),
|
||||||
|
@ -921,6 +922,7 @@ macro_rules! event_builder_generic_impl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(needless_update))]
|
||||||
pub fn running_time_offset(self, running_time_offset: i64) -> Self {
|
pub fn running_time_offset(self, running_time_offset: i64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
builder: self.builder.running_time_offset(running_time_offset),
|
builder: self.builder.running_time_offset(running_time_offset),
|
||||||
|
@ -928,6 +930,7 @@ macro_rules! event_builder_generic_impl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(needless_update))]
|
||||||
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
||||||
Self {
|
Self {
|
||||||
builder: self.builder.other_fields(other_fields),
|
builder: self.builder.other_fields(other_fields),
|
||||||
|
@ -986,7 +989,7 @@ impl<'a> FlushStopBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
reset_time: reset_time,
|
reset_time,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,7 +1007,7 @@ impl<'a> StreamStartBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
stream_id: stream_id,
|
stream_id,
|
||||||
flags: None,
|
flags: None,
|
||||||
group_id: None,
|
group_id: None,
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1048,7 @@ impl<'a> CapsBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
caps: caps,
|
caps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,7 +1064,7 @@ impl<'a> SegmentBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
segment: segment,
|
segment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,7 +1082,7 @@ impl<'a> StreamCollectionBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
stream_collection: stream_collection,
|
stream_collection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1118,9 +1121,9 @@ impl<'a> BufferSizeBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
minsize: minsize,
|
minsize,
|
||||||
maxsize: maxsize,
|
maxsize,
|
||||||
async: async,
|
async,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1142,8 +1145,8 @@ impl<'a> SinkMessageBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
name: name,
|
name,
|
||||||
msg: msg,
|
msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,7 +1167,7 @@ impl<'a> StreamGroupDoneBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
group_id: group_id,
|
group_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,8 +1200,8 @@ impl<'a> TocBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
toc: toc,
|
toc,
|
||||||
updated: updated,
|
updated,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,8 +1222,8 @@ impl<'a> ProtectionBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
system_id: system_id,
|
system_id,
|
||||||
data: data,
|
data,
|
||||||
origin: None,
|
origin: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1251,7 @@ impl<'a> SegmentDoneBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
position: position,
|
position,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1268,8 +1271,8 @@ impl<'a> GapBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
timestamp: timestamp,
|
timestamp,
|
||||||
duration: duration,
|
duration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1291,10 +1294,10 @@ impl<'a> QosBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
type_: type_,
|
type_,
|
||||||
proportion: proportion,
|
proportion,
|
||||||
diff: diff,
|
diff,
|
||||||
timestamp: timestamp,
|
timestamp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1327,8 +1330,8 @@ impl<'a> SeekBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
rate: rate,
|
rate,
|
||||||
flags: flags,
|
flags,
|
||||||
start_type,
|
start_type,
|
||||||
start,
|
start,
|
||||||
stop_type,
|
stop_type,
|
||||||
|
@ -1378,7 +1381,7 @@ impl<'a> LatencyBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
latency: latency,
|
latency,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1397,10 +1400,10 @@ impl<'a> StepBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
amount: amount,
|
amount,
|
||||||
rate: rate,
|
rate,
|
||||||
flush: flush,
|
flush,
|
||||||
intermediate: intermediate,
|
intermediate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1436,7 +1439,7 @@ impl<'a> TocSelectBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
uid: uid,
|
uid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1454,7 +1457,7 @@ impl<'a> SelectStreamsBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: EventBuilder::new(),
|
builder: EventBuilder::new(),
|
||||||
streams: streams,
|
streams,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl GenericFormattedValue {
|
||||||
GenericFormattedValue::Bytes(v) => v.map(|v| v as i64).unwrap_or(-1),
|
GenericFormattedValue::Bytes(v) => v.map(|v| v as i64).unwrap_or(-1),
|
||||||
GenericFormattedValue::Time(v) => v.map(|v| v as i64).unwrap_or(-1),
|
GenericFormattedValue::Time(v) => v.map(|v| v as i64).unwrap_or(-1),
|
||||||
GenericFormattedValue::Buffers(v) => v.map(|v| v as i64).unwrap_or(-1),
|
GenericFormattedValue::Buffers(v) => v.map(|v| v as i64).unwrap_or(-1),
|
||||||
GenericFormattedValue::Percent(v) => v.map(|v| v as i64).unwrap_or(-1),
|
GenericFormattedValue::Percent(v) => v.map(i64::from).unwrap_or(-1),
|
||||||
GenericFormattedValue::Other(_, v) => v,
|
GenericFormattedValue::Other(_, v) => v,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,7 @@ where
|
||||||
fn new(items: Vec<T>) -> Self {
|
fn new(items: Vec<T>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
pos: 0,
|
pos: 0,
|
||||||
items: items,
|
items,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
use libc::c_char;
|
use libc::c_char;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ffi;
|
use ffi;
|
||||||
|
@ -18,9 +17,11 @@ use gobject_ffi;
|
||||||
use glib::translate::{from_glib, ToGlib, ToGlibPtr};
|
use glib::translate::{from_glib, ToGlib, ToGlibPtr};
|
||||||
use glib::IsA;
|
use glib::IsA;
|
||||||
|
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||||
pub struct DebugCategory(ptr::NonNull<ffi::GstDebugCategory>);
|
pub struct DebugCategory(ptr::NonNull<ffi::GstDebugCategory>);
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(trivially_copy_pass_by_ref))]
|
||||||
impl DebugCategory {
|
impl DebugCategory {
|
||||||
pub fn new<'a, P: Into<Option<&'a str>>>(
|
pub fn new<'a, P: Into<Option<&'a str>>>(
|
||||||
name: &str,
|
name: &str,
|
||||||
|
@ -78,9 +79,9 @@ impl DebugCategory {
|
||||||
|
|
||||||
pub fn get_color(&self) -> ::DebugColorFlags {
|
pub fn get_color(&self) -> ::DebugColorFlags {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(mem::transmute::<u32, ffi::GstDebugColorFlags>(
|
from_glib(
|
||||||
ffi::gst_debug_category_get_color(self.0.as_ptr()),
|
ffi::gst_debug_category_get_color(self.0.as_ptr()),
|
||||||
))
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1206,6 +1206,7 @@ impl<'a> MessageBuilder<'a> {
|
||||||
|
|
||||||
macro_rules! message_builder_generic_impl {
|
macro_rules! message_builder_generic_impl {
|
||||||
($new_fn:expr) => {
|
($new_fn:expr) => {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(needless_update))]
|
||||||
pub fn src<O: IsA<Object> + Cast + Clone>(self, src: Option<&O>) -> Self {
|
pub fn src<O: IsA<Object> + Cast + Clone>(self, src: Option<&O>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
builder: self.builder.src(src),
|
builder: self.builder.src(src),
|
||||||
|
@ -1213,6 +1214,7 @@ macro_rules! message_builder_generic_impl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(needless_update))]
|
||||||
pub fn seqnum(self, seqnum: Seqnum) -> Self {
|
pub fn seqnum(self, seqnum: Seqnum) -> Self {
|
||||||
Self {
|
Self {
|
||||||
builder: self.builder.seqnum(seqnum),
|
builder: self.builder.seqnum(seqnum),
|
||||||
|
@ -1221,6 +1223,7 @@ macro_rules! message_builder_generic_impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(needless_update))]
|
||||||
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
pub fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
||||||
Self {
|
Self {
|
||||||
builder: self.builder.other_fields(other_fields),
|
builder: self.builder.other_fields(other_fields),
|
||||||
|
@ -1292,8 +1295,8 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
error: error,
|
error,
|
||||||
message: message,
|
message,
|
||||||
debug: None,
|
debug: None,
|
||||||
details: None,
|
details: None,
|
||||||
}
|
}
|
||||||
|
@ -1357,8 +1360,8 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
error: error,
|
error,
|
||||||
message: message,
|
message,
|
||||||
debug: None,
|
debug: None,
|
||||||
details: None,
|
details: None,
|
||||||
}
|
}
|
||||||
|
@ -1422,8 +1425,8 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
error: error,
|
error,
|
||||||
message: message,
|
message,
|
||||||
debug: None,
|
debug: None,
|
||||||
details: None,
|
details: None,
|
||||||
}
|
}
|
||||||
|
@ -1483,7 +1486,7 @@ impl<'a> TagBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
tags: tags,
|
tags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1503,7 +1506,7 @@ impl<'a> BufferingBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
percent: percent,
|
percent,
|
||||||
stats: None,
|
stats: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1550,9 +1553,9 @@ impl<'a> StateChangedBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
old: old,
|
old,
|
||||||
new: new,
|
new,
|
||||||
pending: pending,
|
pending,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1600,12 +1603,12 @@ impl<'a> StepDoneBuilder<'a> {
|
||||||
assert_eq!(amount.get_format(), duration.get_format());
|
assert_eq!(amount.get_format(), duration.get_format());
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
amount: amount,
|
amount,
|
||||||
rate: rate,
|
rate,
|
||||||
flush: flush,
|
flush,
|
||||||
intermediate: intermediate,
|
intermediate,
|
||||||
duration: duration,
|
duration,
|
||||||
eos: eos,
|
eos,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1631,8 +1634,8 @@ impl<'a> ClockProvideBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
clock: clock,
|
clock,
|
||||||
ready: ready,
|
ready,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1652,7 +1655,7 @@ impl<'a> ClockLostBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
clock: clock,
|
clock,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1671,7 +1674,7 @@ impl<'a> NewClockBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
clock: clock,
|
clock,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1692,9 +1695,9 @@ impl<'a> StructureChangeBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
type_: type_,
|
type_,
|
||||||
owner: owner,
|
owner,
|
||||||
busy: busy,
|
busy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1717,8 +1720,8 @@ impl<'a> StreamStatusBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
type_: type_,
|
type_,
|
||||||
owner: owner,
|
owner,
|
||||||
status_object: None,
|
status_object: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1790,7 +1793,7 @@ impl<'a> SegmentStartBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
position: position,
|
position,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1810,7 +1813,7 @@ impl<'a> SegmentDoneBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
position: position,
|
position,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1872,7 +1875,7 @@ impl<'a> AsyncDoneBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
running_time: running_time,
|
running_time,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1891,7 +1894,7 @@ impl<'a> RequestStateBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
state: state,
|
state,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1920,11 +1923,11 @@ impl<'a> StepStartBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
active: active,
|
active,
|
||||||
amount: amount,
|
amount,
|
||||||
rate: rate,
|
rate,
|
||||||
flush: flush,
|
flush,
|
||||||
intermediate: intermediate,
|
intermediate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1960,11 +1963,11 @@ impl<'a> QosBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
live: live,
|
live,
|
||||||
running_time: running_time,
|
running_time,
|
||||||
stream_time: stream_time,
|
stream_time,
|
||||||
timestamp: timestamp,
|
timestamp,
|
||||||
duration: duration,
|
duration,
|
||||||
values: None,
|
values: None,
|
||||||
stats: None,
|
stats: None,
|
||||||
}
|
}
|
||||||
|
@ -2022,9 +2025,9 @@ impl<'a> ProgressBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
type_: type_,
|
type_,
|
||||||
code: code,
|
code,
|
||||||
text: text,
|
text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2046,8 +2049,8 @@ impl<'a> TocBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
toc: toc,
|
toc,
|
||||||
updated: updated,
|
updated,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2067,7 +2070,7 @@ impl<'a> ResetTimeBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
running_time: running_time,
|
running_time,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2115,7 +2118,7 @@ impl<'a> NeedContextBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
context_type: context_type,
|
context_type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2153,7 +2156,7 @@ impl<'a> DeviceAddedBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
device: device,
|
device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2172,7 +2175,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
device: device,
|
device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2194,7 +2197,7 @@ impl<'a> PropertyNotifyBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
property_name: property_name,
|
property_name,
|
||||||
value: None,
|
value: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2231,7 +2234,7 @@ impl<'a> StreamCollectionBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
collection: collection,
|
collection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2255,7 +2258,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
collection: collection,
|
collection,
|
||||||
streams: None,
|
streams: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2293,7 +2296,7 @@ impl<'a> RedirectBuilder<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self {
|
Self {
|
||||||
builder: MessageBuilder::new(),
|
builder: MessageBuilder::new(),
|
||||||
location: location,
|
location,
|
||||||
tag_list: None,
|
tag_list: None,
|
||||||
entry_struct: None,
|
entry_struct: None,
|
||||||
entries: None,
|
entries: None,
|
||||||
|
|
|
@ -432,6 +432,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
||||||
where
|
where
|
||||||
F: Fn(&Pad, &Option<::Object>) -> bool + Send + Sync + 'static,
|
F: Fn(&Pad, &Option<::Object>) -> bool + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
unsafe {
|
unsafe {
|
||||||
let func_box: Box<
|
let func_box: Box<
|
||||||
Fn(&Pad, &Option<::Object>) -> bool + Send + Sync + 'static,
|
Fn(&Pad, &Option<::Object>) -> bool + Send + Sync + 'static,
|
||||||
|
@ -449,6 +450,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
||||||
where
|
where
|
||||||
F: Fn(&Pad, &Option<::Object>, ::PadMode, bool) -> bool + Send + Sync + 'static,
|
F: Fn(&Pad, &Option<::Object>, ::PadMode, bool) -> bool + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
unsafe {
|
unsafe {
|
||||||
let func_box: Box<
|
let func_box: Box<
|
||||||
Fn(&Pad, &Option<::Object>, ::PadMode, bool) -> bool + Send + Sync + 'static,
|
Fn(&Pad, &Option<::Object>, ::PadMode, bool) -> bool + Send + Sync + 'static,
|
||||||
|
|
|
@ -20,7 +20,7 @@ glib_wrapper! {
|
||||||
pub struct Promise(Shared<ffi::GstPromise>);
|
pub struct Promise(Shared<ffi::GstPromise>);
|
||||||
|
|
||||||
match fn {
|
match fn {
|
||||||
ref => |ptr| ffi::gst_mini_object_ref(ptr as *mut _) as *mut ffi::GstPromise,
|
ref => |ptr| ffi::gst_mini_object_ref(ptr as *mut _),
|
||||||
unref => |ptr| ffi::gst_mini_object_unref(ptr as *mut _),
|
unref => |ptr| ffi::gst_mini_object_unref(ptr as *mut _),
|
||||||
get_type => || ffi::gst_promise_get_type(),
|
get_type => || ffi::gst_promise_get_type(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ macro_rules! declare_concrete_query(
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(self)
|
&*(self as *const $name<&'a mut QueryRef> as *const $name<&'a QueryRef>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ impl ToOwned for SampleRef {
|
||||||
type Owned = GstRc<SampleRef>;
|
type Owned = GstRc<SampleRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<SampleRef> {
|
fn to_owned(&self) -> GstRc<SampleRef> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl Segment {
|
||||||
if T::get_default_format() == Format::Undefined
|
if T::get_default_format() == Format::Undefined
|
||||||
|| T::get_default_format() == self.get_format()
|
|| T::get_default_format() == self.get_format()
|
||||||
{
|
{
|
||||||
Some(unsafe { mem::transmute(self) })
|
Some(unsafe { &*(self as *const FormattedSegment<GenericFormattedValue> as *const FormattedSegment<T>) })
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ impl Segment {
|
||||||
if T::get_default_format() == Format::Undefined
|
if T::get_default_format() == Format::Undefined
|
||||||
|| T::get_default_format() == self.get_format()
|
|| T::get_default_format() == self.get_format()
|
||||||
{
|
{
|
||||||
Some(unsafe { mem::transmute(self) })
|
Some(unsafe { &mut *(self as *mut FormattedSegment<GenericFormattedValue> as *mut FormattedSegment<T>) })
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn upcast_ref(&self) -> &Segment {
|
pub fn upcast_ref(&self) -> &Segment {
|
||||||
unsafe { mem::transmute(self) }
|
unsafe { &*(self as *const FormattedSegment<T> as *const FormattedSegment<GenericFormattedValue>) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
|
@ -353,6 +353,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
||||||
self.0.rate
|
self.0.rate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
||||||
pub fn set_rate(&mut self, rate: f64) {
|
pub fn set_rate(&mut self, rate: f64) {
|
||||||
assert_ne!(rate, 0.0);
|
assert_ne!(rate, 0.0);
|
||||||
self.0.rate = rate;
|
self.0.rate = rate;
|
||||||
|
@ -362,6 +363,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
||||||
self.0.applied_rate
|
self.0.applied_rate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
||||||
pub fn set_applied_rate(&mut self, applied_rate: f64) {
|
pub fn set_applied_rate(&mut self, applied_rate: f64) {
|
||||||
assert_ne!(applied_rate, 0.0);
|
assert_ne!(applied_rate, 0.0);
|
||||||
self.0.applied_rate = applied_rate;
|
self.0.applied_rate = applied_rate;
|
||||||
|
@ -489,7 +491,7 @@ impl<T: FormattedValue> Clone for FormattedSegment<T> {
|
||||||
|
|
||||||
impl<T: FormattedValue> AsRef<Segment> for FormattedSegment<T> {
|
impl<T: FormattedValue> AsRef<Segment> for FormattedSegment<T> {
|
||||||
fn as_ref(&self) -> &Segment {
|
fn as_ref(&self) -> &Segment {
|
||||||
unsafe { mem::transmute(self) }
|
unsafe { &*(self as *const FormattedSegment<T> as *const FormattedSegment<GenericFormattedValue>) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ impl<'a> Iter<'a> {
|
||||||
fn new(collection: &'a StreamCollection) -> Iter<'a> {
|
fn new(collection: &'a StreamCollection) -> Iter<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Iter {
|
Iter {
|
||||||
collection: collection,
|
collection,
|
||||||
idx: 0,
|
idx: 0,
|
||||||
size: collection.len() as u32,
|
size: collection.len() as u32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -538,9 +538,9 @@ impl<'a> FieldIterator<'a> {
|
||||||
let n_fields = structure.n_fields();
|
let n_fields = structure.n_fields();
|
||||||
|
|
||||||
FieldIterator {
|
FieldIterator {
|
||||||
structure: structure,
|
structure,
|
||||||
idx: 0,
|
idx: 0,
|
||||||
n_fields: n_fields,
|
n_fields,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ impl TagListRef {
|
||||||
unsafe { ffi::gst_tag_list_n_tags(self.as_ptr()) }
|
unsafe { ffi::gst_tag_list_n_tags(self.as_ptr()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn nth_tag_name<'a>(&'a self, idx: u32) -> &'a str {
|
pub fn nth_tag_name(&self, idx: u32) -> &str {
|
||||||
unsafe { CStr::from_ptr(ffi::gst_tag_list_nth_tag_name(self.as_ptr(), idx)).to_str().unwrap() }
|
unsafe { CStr::from_ptr(ffi::gst_tag_list_nth_tag_name(self.as_ptr(), idx)).to_str().unwrap() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ impl TagListRef {
|
||||||
GenericTagIterator::new(self, tag_name)
|
GenericTagIterator::new(self, tag_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter_tag_list<'a>(&'a self) -> TagListIterator<'a> {
|
pub fn iter_tag_list(&self) -> TagListIterator {
|
||||||
TagListIterator::new(self)
|
TagListIterator::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ impl<'a, T: Tag<'a>> TagIterator<'a, T> {
|
||||||
fn new(taglist: &'a TagListRef) -> TagIterator<'a, T> {
|
fn new(taglist: &'a TagListRef) -> TagIterator<'a, T> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
TagIterator {
|
TagIterator {
|
||||||
taglist: taglist,
|
taglist,
|
||||||
idx: 0,
|
idx: 0,
|
||||||
size: taglist.get_size::<T>(),
|
size: taglist.get_size::<T>(),
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
|
@ -420,7 +420,7 @@ impl<'a> GenericTagIterator<'a> {
|
||||||
fn new(taglist: &'a TagListRef, name: &'a str) -> GenericTagIterator<'a> {
|
fn new(taglist: &'a TagListRef, name: &'a str) -> GenericTagIterator<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
GenericTagIterator {
|
GenericTagIterator {
|
||||||
taglist: taglist,
|
taglist,
|
||||||
name,
|
name,
|
||||||
idx: 0,
|
idx: 0,
|
||||||
size: taglist.get_size_by_name(name),
|
size: taglist.get_size_by_name(name),
|
||||||
|
@ -478,7 +478,7 @@ impl<'a> TagListIterator<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
let size = taglist.n_tags();
|
let size = taglist.n_tags();
|
||||||
TagListIterator {
|
TagListIterator {
|
||||||
taglist: taglist,
|
taglist,
|
||||||
idx: 0,
|
idx: 0,
|
||||||
size: if size > 0 {
|
size: if size > 0 {
|
||||||
size as u32
|
size as u32
|
||||||
|
|
|
@ -89,6 +89,7 @@ impl ToOwned for TocRef {
|
||||||
type Owned = GstRc<TocRef>;
|
type Owned = GstRc<TocRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<TocRef> {
|
fn to_owned(&self) -> GstRc<TocRef> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,6 +235,7 @@ impl ToOwned for TocEntryRef {
|
||||||
type Owned = GstRc<TocEntryRef>;
|
type Owned = GstRc<TocEntryRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<TocEntryRef> {
|
fn to_owned(&self) -> GstRc<TocEntryRef> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,7 @@ unsafe extern "C" fn type_find_trampoline(
|
||||||
find: *mut ffi::GstTypeFind,
|
find: *mut ffi::GstTypeFind,
|
||||||
user_data: glib_ffi::gpointer,
|
user_data: glib_ffi::gpointer,
|
||||||
) {
|
) {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
let func: &&(Fn(&mut TypeFind) + Send + Sync + 'static) = mem::transmute(user_data);
|
let func: &&(Fn(&mut TypeFind) + Send + Sync + 'static) = mem::transmute(user_data);
|
||||||
func(&mut *(find as *mut TypeFind));
|
func(&mut *(find as *mut TypeFind));
|
||||||
}
|
}
|
||||||
|
@ -159,7 +160,7 @@ impl<T: AsRef<[u8]>> SliceTypeFind<T> {
|
||||||
SliceTypeFind {
|
SliceTypeFind {
|
||||||
probability: None,
|
probability: None,
|
||||||
caps: None,
|
caps: None,
|
||||||
data: data,
|
data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ impl<T: AsRef<[u8]>> SliceTypeFind<T> {
|
||||||
let mut t = SliceTypeFind {
|
let mut t = SliceTypeFind {
|
||||||
probability: None,
|
probability: None,
|
||||||
caps: None,
|
caps: None,
|
||||||
data: data,
|
data,
|
||||||
};
|
};
|
||||||
|
|
||||||
t.run();
|
t.run();
|
||||||
|
|
|
@ -12,6 +12,7 @@ use glib_ffi;
|
||||||
pub struct MutexGuard<'a>(&'a glib_ffi::GMutex);
|
pub struct MutexGuard<'a>(&'a glib_ffi::GMutex);
|
||||||
|
|
||||||
impl<'a> MutexGuard<'a> {
|
impl<'a> MutexGuard<'a> {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(trivially_copy_pass_by_ref))]
|
||||||
pub fn lock(mutex: &'a glib_ffi::GMutex) -> Self {
|
pub fn lock(mutex: &'a glib_ffi::GMutex) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib_ffi::g_mutex_lock(mut_override(mutex));
|
glib_ffi::g_mutex_lock(mut_override(mutex));
|
||||||
|
|
|
@ -249,9 +249,9 @@ impl IntRange<i32> {
|
||||||
assert!(step > 0);
|
assert!(step > 0);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
min: min,
|
min,
|
||||||
max: max,
|
max,
|
||||||
step: step,
|
step,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,9 +269,9 @@ impl IntRange<i64> {
|
||||||
assert!(step > 0);
|
assert!(step > 0);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
min: min,
|
min,
|
||||||
max: max,
|
max,
|
||||||
step: step,
|
step,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ impl FractionRange {
|
||||||
|
|
||||||
assert!(min <= max);
|
assert!(min <= max);
|
||||||
|
|
||||||
FractionRange { min: min, max: max }
|
FractionRange { min, max }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn min(&self) -> Fraction {
|
pub fn min(&self) -> Fraction {
|
||||||
|
@ -564,6 +564,7 @@ impl<'a> FromValue<'a> for Array<'a> {
|
||||||
if arr.is_null() {
|
if arr.is_null() {
|
||||||
Array(Cow::Borrowed(&[]))
|
Array(Cow::Borrowed(&[]))
|
||||||
} else {
|
} else {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
Array(Cow::Borrowed(slice::from_raw_parts(
|
Array(Cow::Borrowed(slice::from_raw_parts(
|
||||||
(*arr).data as *const glib::SendValue,
|
(*arr).data as *const glib::SendValue,
|
||||||
(*arr).len as usize,
|
(*arr).len as usize,
|
||||||
|
@ -635,6 +636,7 @@ impl<'a> FromValue<'a> for List<'a> {
|
||||||
if arr.is_null() {
|
if arr.is_null() {
|
||||||
List(Cow::Borrowed(&[]))
|
List(Cow::Borrowed(&[]))
|
||||||
} else {
|
} else {
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
List(Cow::Borrowed(slice::from_raw_parts(
|
List(Cow::Borrowed(slice::from_raw_parts(
|
||||||
(*arr).data as *const glib::SendValue,
|
(*arr).data as *const glib::SendValue,
|
||||||
(*arr).len as usize,
|
(*arr).len as usize,
|
||||||
|
|
|
@ -38,7 +38,7 @@ fn tutorial_main() {
|
||||||
// Listen to the bus
|
// Listen to the bus
|
||||||
let bus = playbin.get_bus().unwrap();
|
let bus = playbin.get_bus().unwrap();
|
||||||
let mut custom_data = CustomData {
|
let mut custom_data = CustomData {
|
||||||
playbin: playbin,
|
playbin,
|
||||||
playing: false,
|
playing: false,
|
||||||
terminate: false,
|
terminate: false,
|
||||||
seek_enabled: false,
|
seek_enabled: false,
|
||||||
|
|
|
@ -157,10 +157,10 @@ fn main() {
|
||||||
let mut buffer = gst::Buffer::with_size(CHUNK_SIZE).unwrap();
|
let mut buffer = gst::Buffer::with_size(CHUNK_SIZE).unwrap();
|
||||||
let num_samples = CHUNK_SIZE / 2; /* Each sample is 16 bits */
|
let num_samples = CHUNK_SIZE / 2; /* Each sample is 16 bits */
|
||||||
let pts = gst::SECOND
|
let pts = gst::SECOND
|
||||||
.mul_div_floor(data.num_samples, SAMPLE_RATE as u64)
|
.mul_div_floor(data.num_samples, u64::from(SAMPLE_RATE))
|
||||||
.expect("u64 overflow");
|
.expect("u64 overflow");
|
||||||
let duration = gst::SECOND
|
let duration = gst::SECOND
|
||||||
.mul_div_floor(num_samples as u64, SAMPLE_RATE as u64)
|
.mul_div_floor(num_samples as u64, u64::from(SAMPLE_RATE))
|
||||||
.expect("u64 overflow");
|
.expect("u64 overflow");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue