mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
Fix/hide various clippy warnings in gstreamer
This commit is contained in:
parent
a0ba290d4d
commit
85b335fd89
14 changed files with 154 additions and 190 deletions
|
@ -142,6 +142,12 @@ impl GstRc<BufferRef> {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for GstRc<BufferRef> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl BufferRef {
|
||||
pub fn map_readable(&self) -> Option<BufferMap<Readable>> {
|
||||
let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||
|
|
|
@ -68,11 +68,21 @@ impl BufferListRef {
|
|||
unsafe { ffi::gst_buffer_list_length(self.as_mut_ptr()) as usize }
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> Iter {
|
||||
Iter::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for GstRc<BufferListRef> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl ToOwned for BufferListRef {
|
||||
type Owned = GstRc<BufferListRef>;
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ unsafe extern "C" fn trampoline_watch(
|
|||
func: gpointer,
|
||||
) -> gboolean {
|
||||
let _guard = CallbackGuard::new();
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||
let func: &RefCell<Box<FnMut(&Bus, &Message) -> Continue + Send + 'static>> = transmute(func);
|
||||
(&mut *func.borrow_mut())(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).to_glib()
|
||||
}
|
||||
|
@ -49,6 +50,7 @@ unsafe extern "C" fn destroy_closure_watch(ptr: gpointer) {
|
|||
}
|
||||
|
||||
fn into_raw_watch<F: FnMut(&Bus, &Message) -> Continue + Send + 'static>(func: F) -> gpointer {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
let func: Box<RefCell<Box<FnMut(&Bus, &Message) -> Continue + Send + 'static>>> =
|
||||
Box::new(RefCell::new(Box::new(func)));
|
||||
Box::into_raw(func) as gpointer
|
||||
|
@ -60,6 +62,7 @@ unsafe extern "C" fn trampoline_sync(
|
|||
func: gpointer,
|
||||
) -> ffi::GstBusSyncReply {
|
||||
let _guard = CallbackGuard::new();
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||
let f: &&(Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static) = transmute(func);
|
||||
f(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).to_glib()
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ unsafe extern "C" fn trampoline_wait_async(
|
|||
func: gpointer,
|
||||
) -> gboolean {
|
||||
let _guard = CallbackGuard::new();
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||
let f: &&(Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static) = transmute(func);
|
||||
f(&from_glib_borrow(clock), time, &from_glib_borrow(id)).to_glib()
|
||||
}
|
||||
|
@ -51,6 +52,7 @@ unsafe extern "C" fn destroy_closure_wait_async(ptr: gpointer) {
|
|||
fn into_raw_wait_async<F: Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>(
|
||||
func: F,
|
||||
) -> gpointer {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
let func: Box<Box<Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>> =
|
||||
Box::new(Box::new(func));
|
||||
Box::into_raw(func) as gpointer
|
||||
|
|
|
@ -69,66 +69,41 @@ impl EventRef {
|
|||
pub fn view(&self) -> EventView {
|
||||
let type_ = unsafe { (*self.as_ptr()).type_ };
|
||||
|
||||
if type_ == ffi::GST_EVENT_FLUSH_START {
|
||||
EventView::FlushStart(FlushStart(self))
|
||||
} else if type_ == ffi::GST_EVENT_FLUSH_STOP {
|
||||
EventView::FlushStop(FlushStop(self))
|
||||
} else if type_ == ffi::GST_EVENT_STREAM_START {
|
||||
EventView::StreamStart(StreamStart(self))
|
||||
} else if type_ == ffi::GST_EVENT_CAPS {
|
||||
EventView::Caps(Caps(self))
|
||||
} else if type_ == ffi::GST_EVENT_SEGMENT {
|
||||
EventView::Segment(Segment(self))
|
||||
} else if type_ == ffi::GST_EVENT_STREAM_COLLECTION {
|
||||
EventView::StreamCollection(StreamCollection(self))
|
||||
} else if type_ == ffi::GST_EVENT_TAG {
|
||||
EventView::Tag(Tag(self))
|
||||
} else if type_ == ffi::GST_EVENT_BUFFERSIZE {
|
||||
EventView::BufferSize(BufferSize(self))
|
||||
} else if type_ == ffi::GST_EVENT_SINK_MESSAGE {
|
||||
EventView::SinkMessage(SinkMessage(self))
|
||||
} else if type_ == ffi::GST_EVENT_STREAM_GROUP_DONE {
|
||||
EventView::StreamGroupDone(StreamGroupDone(self))
|
||||
} else if type_ == ffi::GST_EVENT_EOS {
|
||||
EventView::Eos(Eos(self))
|
||||
} else if type_ == ffi::GST_EVENT_TOC {
|
||||
EventView::Toc(Toc(self))
|
||||
} else if type_ == ffi::GST_EVENT_PROTECTION {
|
||||
EventView::Protection(Protection(self))
|
||||
} else if type_ == ffi::GST_EVENT_SEGMENT_DONE {
|
||||
EventView::SegmentDone(SegmentDone(self))
|
||||
} else if type_ == ffi::GST_EVENT_GAP {
|
||||
EventView::Gap(Gap(self))
|
||||
} else if type_ == ffi::GST_EVENT_QOS {
|
||||
EventView::Qos(Qos(self))
|
||||
} else if type_ == ffi::GST_EVENT_SEEK {
|
||||
EventView::Seek(Seek(self))
|
||||
} else if type_ == ffi::GST_EVENT_NAVIGATION {
|
||||
EventView::Navigation(Navigation(self))
|
||||
} else if type_ == ffi::GST_EVENT_LATENCY {
|
||||
EventView::Latency(Latency(self))
|
||||
} else if type_ == ffi::GST_EVENT_STEP {
|
||||
EventView::Step(Step(self))
|
||||
} else if type_ == ffi::GST_EVENT_RECONFIGURE {
|
||||
EventView::Reconfigure(Reconfigure(self))
|
||||
} else if type_ == ffi::GST_EVENT_TOC_SELECT {
|
||||
EventView::TocSelect(TocSelect(self))
|
||||
} else if type_ == ffi::GST_EVENT_SELECT_STREAMS {
|
||||
EventView::SelectStreams(SelectStreams(self))
|
||||
} else if type_ == ffi::GST_EVENT_CUSTOM_UPSTREAM {
|
||||
EventView::CustomUpstream(CustomUpstream(self))
|
||||
} else if type_ == ffi::GST_EVENT_CUSTOM_DOWNSTREAM {
|
||||
EventView::CustomDownstream(CustomDownstream(self))
|
||||
} else if type_ == ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB {
|
||||
match type_ {
|
||||
ffi::GST_EVENT_FLUSH_START => EventView::FlushStart(FlushStart(self)),
|
||||
ffi::GST_EVENT_FLUSH_STOP => EventView::FlushStop(FlushStop(self)),
|
||||
ffi::GST_EVENT_STREAM_START => EventView::StreamStart(StreamStart(self)),
|
||||
ffi::GST_EVENT_CAPS => EventView::Caps(Caps(self)),
|
||||
ffi::GST_EVENT_SEGMENT => EventView::Segment(Segment(self)),
|
||||
ffi::GST_EVENT_STREAM_COLLECTION => EventView::StreamCollection(StreamCollection(self)),
|
||||
ffi::GST_EVENT_TAG => EventView::Tag(Tag(self)),
|
||||
ffi::GST_EVENT_BUFFERSIZE => EventView::BufferSize(BufferSize(self)),
|
||||
ffi::GST_EVENT_SINK_MESSAGE => EventView::SinkMessage(SinkMessage(self)),
|
||||
ffi::GST_EVENT_STREAM_GROUP_DONE => EventView::StreamGroupDone(StreamGroupDone(self)),
|
||||
ffi::GST_EVENT_EOS => EventView::Eos(Eos(self)),
|
||||
ffi::GST_EVENT_TOC => EventView::Toc(Toc(self)),
|
||||
ffi::GST_EVENT_PROTECTION => EventView::Protection(Protection(self)),
|
||||
ffi::GST_EVENT_SEGMENT_DONE => EventView::SegmentDone(SegmentDone(self)),
|
||||
ffi::GST_EVENT_GAP => EventView::Gap(Gap(self)),
|
||||
ffi::GST_EVENT_QOS => EventView::Qos(Qos(self)),
|
||||
ffi::GST_EVENT_SEEK => EventView::Seek(Seek(self)),
|
||||
ffi::GST_EVENT_NAVIGATION => EventView::Navigation(Navigation(self)),
|
||||
ffi::GST_EVENT_LATENCY => EventView::Latency(Latency(self)),
|
||||
ffi::GST_EVENT_STEP => EventView::Step(Step(self)),
|
||||
ffi::GST_EVENT_RECONFIGURE => EventView::Reconfigure(Reconfigure(self)),
|
||||
ffi::GST_EVENT_TOC_SELECT => EventView::TocSelect(TocSelect(self)),
|
||||
ffi::GST_EVENT_SELECT_STREAMS => EventView::SelectStreams(SelectStreams(self)),
|
||||
ffi::GST_EVENT_CUSTOM_UPSTREAM => EventView::CustomUpstream(CustomUpstream(self)),
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM => EventView::CustomDownstream(CustomDownstream(self)),
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB => {
|
||||
EventView::CustomDownstreamOob(CustomDownstreamOob(self))
|
||||
} else if type_ == ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY {
|
||||
}
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY => {
|
||||
EventView::CustomDownstreamSticky(CustomDownstreamSticky(self))
|
||||
} else if type_ == ffi::GST_EVENT_CUSTOM_BOTH {
|
||||
EventView::CustomBoth(CustomBoth(self))
|
||||
} else if type_ == ffi::GST_EVENT_CUSTOM_BOTH_OOB {
|
||||
EventView::CustomBothOob(CustomBothOob(self))
|
||||
} else {
|
||||
EventView::Other
|
||||
}
|
||||
ffi::GST_EVENT_CUSTOM_BOTH => EventView::CustomBoth(CustomBoth(self)),
|
||||
ffi::GST_EVENT_CUSTOM_BOTH_OOB => EventView::CustomBothOob(CustomBothOob(self)),
|
||||
_ => EventView::Other,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ glib_wrapper! {
|
|||
}
|
||||
|
||||
impl Iterator {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
|
||||
pub fn next(&mut self) -> Result<Value, IteratorResult> {
|
||||
unsafe {
|
||||
let mut value = Value::uninitialized();
|
||||
|
|
|
@ -52,6 +52,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(too_many_arguments))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
mod auto;
|
||||
pub use auto::*;
|
||||
pub use auto::functions::*;
|
||||
|
|
|
@ -49,80 +49,52 @@ impl MessageRef {
|
|||
pub fn view(&self) -> MessageView {
|
||||
let type_ = unsafe { (*self.as_ptr()).type_ };
|
||||
|
||||
if type_ == ffi::GST_MESSAGE_EOS {
|
||||
MessageView::Eos(Eos(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_ERROR {
|
||||
MessageView::Error(Error(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_WARNING {
|
||||
MessageView::Warning(Warning(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_INFO {
|
||||
MessageView::Info(Info(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_TAG {
|
||||
MessageView::Tag(Tag(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_BUFFERING {
|
||||
MessageView::Buffering(Buffering(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STATE_CHANGED {
|
||||
MessageView::StateChanged(StateChanged(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STATE_DIRTY {
|
||||
MessageView::StateDirty(StateDirty(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STEP_DONE {
|
||||
MessageView::StepDone(StepDone(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_CLOCK_PROVIDE {
|
||||
MessageView::ClockProvide(ClockProvide(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_CLOCK_LOST {
|
||||
MessageView::ClockLost(ClockLost(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_NEW_CLOCK {
|
||||
MessageView::NewClock(NewClock(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STRUCTURE_CHANGE {
|
||||
match type_ {
|
||||
ffi::GST_MESSAGE_EOS => MessageView::Eos(Eos(self)),
|
||||
ffi::GST_MESSAGE_ERROR => MessageView::Error(Error(self)),
|
||||
ffi::GST_MESSAGE_WARNING => MessageView::Warning(Warning(self)),
|
||||
ffi::GST_MESSAGE_INFO => MessageView::Info(Info(self)),
|
||||
ffi::GST_MESSAGE_TAG => MessageView::Tag(Tag(self)),
|
||||
ffi::GST_MESSAGE_BUFFERING => MessageView::Buffering(Buffering(self)),
|
||||
ffi::GST_MESSAGE_STATE_CHANGED => MessageView::StateChanged(StateChanged(self)),
|
||||
ffi::GST_MESSAGE_STATE_DIRTY => MessageView::StateDirty(StateDirty(self)),
|
||||
ffi::GST_MESSAGE_STEP_DONE => MessageView::StepDone(StepDone(self)),
|
||||
ffi::GST_MESSAGE_CLOCK_PROVIDE => MessageView::ClockProvide(ClockProvide(self)),
|
||||
ffi::GST_MESSAGE_CLOCK_LOST => MessageView::ClockLost(ClockLost(self)),
|
||||
ffi::GST_MESSAGE_NEW_CLOCK => MessageView::NewClock(NewClock(self)),
|
||||
ffi::GST_MESSAGE_STRUCTURE_CHANGE => {
|
||||
MessageView::StructureChange(StructureChange(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STREAM_STATUS {
|
||||
MessageView::StreamStatus(StreamStatus(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_APPLICATION {
|
||||
MessageView::Application(Application(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_ELEMENT {
|
||||
MessageView::Element(Element(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_SEGMENT_START {
|
||||
MessageView::SegmentStart(SegmentStart(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_SEGMENT_DONE {
|
||||
MessageView::SegmentDone(SegmentDone(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_DURATION_CHANGED {
|
||||
}
|
||||
ffi::GST_MESSAGE_STREAM_STATUS => MessageView::StreamStatus(StreamStatus(self)),
|
||||
ffi::GST_MESSAGE_APPLICATION => MessageView::Application(Application(self)),
|
||||
ffi::GST_MESSAGE_ELEMENT => MessageView::Element(Element(self)),
|
||||
ffi::GST_MESSAGE_SEGMENT_START => MessageView::SegmentStart(SegmentStart(self)),
|
||||
ffi::GST_MESSAGE_SEGMENT_DONE => MessageView::SegmentDone(SegmentDone(self)),
|
||||
ffi::GST_MESSAGE_DURATION_CHANGED => {
|
||||
MessageView::DurationChanged(DurationChanged(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_LATENCY {
|
||||
MessageView::Latency(Latency(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_ASYNC_START {
|
||||
MessageView::AsyncStart(AsyncStart(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_ASYNC_DONE {
|
||||
MessageView::AsyncDone(AsyncDone(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_REQUEST_STATE {
|
||||
MessageView::RequestState(RequestState(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STEP_START {
|
||||
MessageView::StepStart(StepStart(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_QOS {
|
||||
MessageView::Qos(Qos(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_PROGRESS {
|
||||
MessageView::Progress(Progress(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_TOC {
|
||||
MessageView::Toc(Toc(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_RESET_TIME {
|
||||
MessageView::ResetTime(ResetTime(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STREAM_START {
|
||||
MessageView::StreamStart(StreamStart(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_NEED_CONTEXT {
|
||||
MessageView::NeedContext(NeedContext(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_HAVE_CONTEXT {
|
||||
MessageView::HaveContext(HaveContext(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_DEVICE_ADDED {
|
||||
MessageView::DeviceAdded(DeviceAdded(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_DEVICE_REMOVED {
|
||||
MessageView::DeviceRemoved(DeviceRemoved(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_PROPERTY_NOTIFY {
|
||||
MessageView::PropertyNotify(PropertyNotify(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STREAM_COLLECTION {
|
||||
}
|
||||
ffi::GST_MESSAGE_LATENCY => MessageView::Latency(Latency(self)),
|
||||
ffi::GST_MESSAGE_ASYNC_START => MessageView::AsyncStart(AsyncStart(self)),
|
||||
ffi::GST_MESSAGE_ASYNC_DONE => MessageView::AsyncDone(AsyncDone(self)),
|
||||
ffi::GST_MESSAGE_REQUEST_STATE => MessageView::RequestState(RequestState(self)),
|
||||
ffi::GST_MESSAGE_STEP_START => MessageView::StepStart(StepStart(self)),
|
||||
ffi::GST_MESSAGE_QOS => MessageView::Qos(Qos(self)),
|
||||
ffi::GST_MESSAGE_PROGRESS => MessageView::Progress(Progress(self)),
|
||||
ffi::GST_MESSAGE_TOC => MessageView::Toc(Toc(self)),
|
||||
ffi::GST_MESSAGE_RESET_TIME => MessageView::ResetTime(ResetTime(self)),
|
||||
ffi::GST_MESSAGE_STREAM_START => MessageView::StreamStart(StreamStart(self)),
|
||||
ffi::GST_MESSAGE_NEED_CONTEXT => MessageView::NeedContext(NeedContext(self)),
|
||||
ffi::GST_MESSAGE_HAVE_CONTEXT => MessageView::HaveContext(HaveContext(self)),
|
||||
ffi::GST_MESSAGE_DEVICE_ADDED => MessageView::DeviceAdded(DeviceAdded(self)),
|
||||
ffi::GST_MESSAGE_DEVICE_REMOVED => MessageView::DeviceRemoved(DeviceRemoved(self)),
|
||||
ffi::GST_MESSAGE_PROPERTY_NOTIFY => MessageView::PropertyNotify(PropertyNotify(self)),
|
||||
ffi::GST_MESSAGE_STREAM_COLLECTION => {
|
||||
MessageView::StreamCollection(StreamCollection(self))
|
||||
} else if type_ == ffi::GST_MESSAGE_STREAMS_SELECTED {
|
||||
}
|
||||
ffi::GST_MESSAGE_STREAMS_SELECTED => {
|
||||
MessageView::StreamsSelected(StreamsSelected(self))
|
||||
} else {
|
||||
MessageView::Other
|
||||
}
|
||||
_ => MessageView::Other,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1181,8 +1153,7 @@ pub struct ErrorBuilder<'a> {
|
|||
seqnum: Option<u32>,
|
||||
error: &'a glib::Error,
|
||||
debug: Option<&'a str>,
|
||||
#[allow(unused)]
|
||||
details: Option<Structure>,
|
||||
#[allow(unused)] details: Option<Structure>,
|
||||
}
|
||||
impl<'a> ErrorBuilder<'a> {
|
||||
fn new(error: &'a glib::Error) -> Self {
|
||||
|
@ -1242,8 +1213,7 @@ pub struct WarningBuilder<'a> {
|
|||
seqnum: Option<u32>,
|
||||
error: &'a glib::Error,
|
||||
debug: Option<&'a str>,
|
||||
#[allow(unused)]
|
||||
details: Option<Structure>,
|
||||
#[allow(unused)] details: Option<Structure>,
|
||||
}
|
||||
impl<'a> WarningBuilder<'a> {
|
||||
fn new(error: &'a glib::Error) -> Self {
|
||||
|
@ -1303,8 +1273,7 @@ pub struct InfoBuilder<'a> {
|
|||
seqnum: Option<u32>,
|
||||
error: &'a glib::Error,
|
||||
debug: Option<&'a str>,
|
||||
#[allow(unused)]
|
||||
details: Option<Structure>,
|
||||
#[allow(unused)] details: Option<Structure>,
|
||||
}
|
||||
impl<'a> InfoBuilder<'a> {
|
||||
fn new(error: &'a glib::Error) -> Self {
|
||||
|
@ -1877,13 +1846,7 @@ pub struct QosBuilder {
|
|||
stats: Option<(::Format, u64, u64)>,
|
||||
}
|
||||
impl QosBuilder {
|
||||
fn new(
|
||||
live: bool,
|
||||
running_time: u64,
|
||||
stream_time: u64,
|
||||
timestamp: u64,
|
||||
duration: u64,
|
||||
) -> Self {
|
||||
fn new(live: bool, running_time: u64, stream_time: u64, timestamp: u64, duration: u64) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
src: None,
|
||||
|
@ -2182,10 +2145,8 @@ impl<'a> StreamCollectionBuilder<'a> {
|
|||
pub struct StreamsSelectedBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
#[cfg(feature = "v1_10")]
|
||||
collection: &'a ::StreamCollection,
|
||||
#[cfg(feature = "v1_10")]
|
||||
streams: Option<&'a [&'a ::Stream]>,
|
||||
#[cfg(feature = "v1_10")] collection: &'a ::StreamCollection,
|
||||
#[cfg(feature = "v1_10")] streams: Option<&'a [&'a ::Stream]>,
|
||||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
impl<'a> StreamsSelectedBuilder<'a> {
|
||||
|
@ -2224,6 +2185,7 @@ pub struct RedirectBuilder<'a> {
|
|||
location: &'a str,
|
||||
tag_list: Option<&'a TagList>,
|
||||
entry_struct: Option<Structure>,
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
entries: Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
|
||||
}
|
||||
#[cfg(feature = "v1_10")]
|
||||
|
@ -2271,7 +2233,7 @@ impl<'a> RedirectBuilder<'a> {
|
|||
);
|
||||
if let Some(entries) = s.entries {
|
||||
for &(location, tag_list, entry_struct) in entries {
|
||||
let entry_struct = entry_struct.map(|s| s.clone());
|
||||
let entry_struct = entry_struct.cloned();
|
||||
let entry_struct_ptr = if let Some(entry_struct) = entry_struct {
|
||||
entry_struct.into_ptr()
|
||||
} else {
|
||||
|
|
|
@ -241,6 +241,7 @@ impl<'a, T: MiniObject + 'static> ToGlibPtrMut<'a, *mut T::GstType> for GstRc<T>
|
|||
}
|
||||
|
||||
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstType> for GstRc<T> {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
|
||||
|
||||
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*mut *mut T::GstType, Self::Storage) {
|
||||
|
@ -284,6 +285,7 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
|
|||
}
|
||||
|
||||
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType> for GstRc<T> {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
|
||||
|
||||
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*const *mut T::GstType, Self::Storage) {
|
||||
|
|
|
@ -289,6 +289,7 @@ unsafe extern "C" fn trampoline_pad_probe(
|
|||
func: gpointer,
|
||||
) -> ffi::GstPadProbeReturn {
|
||||
let _guard = CallbackGuard::new();
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||
let func: &&(Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static) =
|
||||
transmute(func);
|
||||
let mut data_type = None;
|
||||
|
|
|
@ -43,3 +43,9 @@ impl ParseContext {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ParseContext {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,44 +145,26 @@ impl QueryRef {
|
|||
pub fn view(&self) -> QueryView<&Self> {
|
||||
let type_ = unsafe { (*self.as_ptr()).type_ };
|
||||
|
||||
if type_ == ffi::GST_QUERY_POSITION {
|
||||
QueryView::Position(Position(self))
|
||||
} else if type_ == ffi::GST_QUERY_DURATION {
|
||||
QueryView::Duration(Duration(self))
|
||||
} else if type_ == ffi::GST_QUERY_LATENCY {
|
||||
QueryView::Latency(Latency(self))
|
||||
} else if type_ == ffi::GST_QUERY_JITTER {
|
||||
QueryView::Jitter(Jitter(self))
|
||||
} else if type_ == ffi::GST_QUERY_RATE {
|
||||
QueryView::Rate(Rate(self))
|
||||
} else if type_ == ffi::GST_QUERY_SEEKING {
|
||||
QueryView::Seeking(Seeking(self))
|
||||
} else if type_ == ffi::GST_QUERY_SEGMENT {
|
||||
QueryView::Segment(Segment(self))
|
||||
} else if type_ == ffi::GST_QUERY_CONVERT {
|
||||
QueryView::Convert(Convert(self))
|
||||
} else if type_ == ffi::GST_QUERY_FORMATS {
|
||||
QueryView::Formats(Formats(self))
|
||||
} else if type_ == ffi::GST_QUERY_BUFFERING {
|
||||
QueryView::Buffering(Buffering(self))
|
||||
} else if type_ == ffi::GST_QUERY_CUSTOM {
|
||||
QueryView::Custom(Custom(self))
|
||||
} else if type_ == ffi::GST_QUERY_URI {
|
||||
QueryView::Uri(Uri(self))
|
||||
} else if type_ == ffi::GST_QUERY_ALLOCATION {
|
||||
QueryView::Allocation(Allocation(self))
|
||||
} else if type_ == ffi::GST_QUERY_SCHEDULING {
|
||||
QueryView::Scheduling(Scheduling(self))
|
||||
} else if type_ == ffi::GST_QUERY_ACCEPT_CAPS {
|
||||
QueryView::AcceptCaps(AcceptCaps(self))
|
||||
} else if type_ == ffi::GST_QUERY_CAPS {
|
||||
QueryView::Caps(Caps(self))
|
||||
} else if type_ == ffi::GST_QUERY_DRAIN {
|
||||
QueryView::Drain(Drain(self))
|
||||
} else if type_ == ffi::GST_QUERY_CONTEXT {
|
||||
QueryView::Context(Context(self))
|
||||
} else {
|
||||
QueryView::Other(Other(self))
|
||||
match type_ {
|
||||
ffi::GST_QUERY_POSITION => QueryView::Position(Position(self)),
|
||||
ffi::GST_QUERY_DURATION => QueryView::Duration(Duration(self)),
|
||||
ffi::GST_QUERY_LATENCY => QueryView::Latency(Latency(self)),
|
||||
ffi::GST_QUERY_JITTER => QueryView::Jitter(Jitter(self)),
|
||||
ffi::GST_QUERY_RATE => QueryView::Rate(Rate(self)),
|
||||
ffi::GST_QUERY_SEEKING => QueryView::Seeking(Seeking(self)),
|
||||
ffi::GST_QUERY_SEGMENT => QueryView::Segment(Segment(self)),
|
||||
ffi::GST_QUERY_CONVERT => QueryView::Convert(Convert(self)),
|
||||
ffi::GST_QUERY_FORMATS => QueryView::Formats(Formats(self)),
|
||||
ffi::GST_QUERY_BUFFERING => QueryView::Buffering(Buffering(self)),
|
||||
ffi::GST_QUERY_CUSTOM => QueryView::Custom(Custom(self)),
|
||||
ffi::GST_QUERY_URI => QueryView::Uri(Uri(self)),
|
||||
ffi::GST_QUERY_ALLOCATION => QueryView::Allocation(Allocation(self)),
|
||||
ffi::GST_QUERY_SCHEDULING => QueryView::Scheduling(Scheduling(self)),
|
||||
ffi::GST_QUERY_ACCEPT_CAPS => QueryView::AcceptCaps(AcceptCaps(self)),
|
||||
ffi::GST_QUERY_CAPS => QueryView::Caps(Caps(self)),
|
||||
ffi::GST_QUERY_DRAIN => QueryView::Drain(Drain(self)),
|
||||
ffi::GST_QUERY_CONTEXT => QueryView::Context(Context(self)),
|
||||
_ => QueryView::Other(Other(self)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ impl Segment {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||
pub fn do_seek(
|
||||
&mut self,
|
||||
rate: f64,
|
||||
|
@ -320,6 +321,12 @@ impl glib::types::StaticType for Segment {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Segment {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl<'a> glib::value::FromValueOptional<'a> for Segment {
|
||||
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
||||
|
|
|
@ -244,6 +244,12 @@ impl GstRc<TagListRef> {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for GstRc<TagListRef> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl TagListRef {
|
||||
pub fn add<'a, T: Tag<'a>>(&mut self, value: T::TagType, mode: TagMergeMode)
|
||||
where
|
||||
|
|
Loading…
Reference in a new issue