mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
Fix various new 1.78 clippy warnings
Quite a bit of API was accidentally not exported but apparently nobody was using it. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1437>
This commit is contained in:
parent
1e293e5cb8
commit
2a9d0d035f
8 changed files with 75 additions and 78 deletions
|
@ -19,10 +19,6 @@ mod examples_common;
|
|||
#[display(fmt = "Could not get mount points")]
|
||||
struct NoMountPoints;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
|
||||
struct UsageError(#[error(not(source))] String);
|
||||
|
||||
fn main_loop() -> Result<(), Error> {
|
||||
let main_loop = glib::MainLoop::new(None, false);
|
||||
let server = server::Server::default();
|
||||
|
|
|
@ -56,6 +56,8 @@ pub use phys_memory::*;
|
|||
pub mod prelude {
|
||||
#[doc(hidden)]
|
||||
pub use gst::prelude::*;
|
||||
|
||||
pub use crate::auto::traits::*;
|
||||
}
|
||||
|
||||
pub mod subclass;
|
||||
|
|
|
@ -33,40 +33,16 @@ impl<O: IsA<EncodingProfile>> EncodingProfileExtManual for O {}
|
|||
trait EncodingProfileBuilderCommon {
|
||||
fn set_allow_dynamic_output(&self, allow_dynamic_output: bool);
|
||||
|
||||
fn set_allow_dynamic_output_if_some(&self, allow_dynamic_output: Option<bool>) {
|
||||
if let Some(allow_dynamic_output) = allow_dynamic_output {
|
||||
self.set_allow_dynamic_output(allow_dynamic_output)
|
||||
}
|
||||
}
|
||||
|
||||
fn set_description(&self, description: Option<&str>);
|
||||
|
||||
fn set_enabled(&self, enabled: bool);
|
||||
|
||||
fn set_enabled_if_some(&self, enabled: Option<bool>) {
|
||||
if let Some(enabled) = enabled {
|
||||
self.set_enabled(enabled)
|
||||
}
|
||||
}
|
||||
|
||||
fn set_format(&self, format: &gst::Caps);
|
||||
|
||||
fn set_format_if_some(&self, format: Option<&gst::Caps>) {
|
||||
if let Some(format) = format {
|
||||
self.set_format(format)
|
||||
}
|
||||
}
|
||||
|
||||
fn set_name(&self, name: Option<&str>);
|
||||
|
||||
fn set_presence(&self, presence: u32);
|
||||
|
||||
fn set_presence_if_some(&self, presence: Option<u32>) {
|
||||
if let Some(presence) = presence {
|
||||
self.set_presence(presence);
|
||||
}
|
||||
}
|
||||
|
||||
fn set_preset(&self, preset: Option<&str>);
|
||||
|
||||
fn set_preset_name(&self, preset_name: Option<&str>);
|
||||
|
@ -76,13 +52,6 @@ trait EncodingProfileBuilderCommon {
|
|||
|
||||
#[cfg(feature = "v1_20")]
|
||||
fn set_element_properties(&self, element_properties: ElementProperties);
|
||||
|
||||
#[cfg(feature = "v1_20")]
|
||||
fn set_element_properties_if_some(&self, element_properties: Option<ElementProperties>) {
|
||||
if let Some(element_properties) = element_properties {
|
||||
self.set_element_properties(element_properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
|
||||
|
@ -184,11 +153,6 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
|
|||
}
|
||||
}
|
||||
|
||||
// Split the trait as only the getter is public
|
||||
trait EncodingProfileHasRestrictionSetter {
|
||||
fn set_restriction(&self, restriction: Option<gst::Caps>);
|
||||
}
|
||||
|
||||
pub trait EncodingProfileHasRestrictionGetter {
|
||||
#[doc(alias = "get_restriction")]
|
||||
#[doc(alias = "gst_encoding_profile_get_restriction")]
|
||||
|
@ -197,25 +161,6 @@ pub trait EncodingProfileHasRestrictionGetter {
|
|||
|
||||
macro_rules! declare_encoding_profile_has_restriction(
|
||||
($name:ident) => {
|
||||
impl EncodingProfileHasRestrictionSetter for $name {
|
||||
// checker-ignore-item
|
||||
fn set_restriction(&self, restriction: Option<gst::Caps>) {
|
||||
let profile: &EncodingProfile = glib::object::Cast::upcast_ref(self);
|
||||
|
||||
unsafe {
|
||||
let restriction = match restriction {
|
||||
Some(restriction) => restriction.into_glib_ptr(),
|
||||
None => gst::ffi::gst_caps_new_any(),
|
||||
};
|
||||
|
||||
ffi::gst_encoding_profile_set_restriction(
|
||||
profile.to_glib_none().0,
|
||||
restriction,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl EncodingProfileHasRestrictionGetter for $name {
|
||||
// checker-ignore-item
|
||||
fn restriction(&self) -> Option<gst::Caps> {
|
||||
|
@ -401,20 +346,37 @@ pub trait EncodingProfileBuilder<'a>: Sized {
|
|||
#[doc(alias = "gst_encoding_profile_set_presence")]
|
||||
#[must_use]
|
||||
fn presence(self, presence: u32) -> Self;
|
||||
#[doc(alias = "gst_encoding_profile_set_presence")]
|
||||
#[must_use]
|
||||
fn presence_if_some(self, presence: Option<u32>) -> Self;
|
||||
#[doc(alias = "gst_encoding_profile_set_allow_dynamic_output")]
|
||||
#[must_use]
|
||||
fn allow_dynamic_output(self, allow: bool) -> Self;
|
||||
#[doc(alias = "gst_encoding_profile_set_allow_dynamic_output")]
|
||||
#[must_use]
|
||||
fn allow_dynamic_output_if_some(self, allow_dynamic_output: Option<bool>) -> Self;
|
||||
#[doc(alias = "gst_encoding_profile_set_enabled")]
|
||||
#[must_use]
|
||||
fn enabled(self, enabled: bool) -> Self;
|
||||
#[doc(alias = "gst_encoding_profile_set_enabled")]
|
||||
#[must_use]
|
||||
fn enabled_if_some(self, enabled: Option<bool>) -> Self;
|
||||
#[cfg(feature = "v1_18")]
|
||||
#[doc(alias = "gst_encoding_profile_set_single_segment")]
|
||||
#[must_use]
|
||||
fn single_segment(self, single_segment: bool) -> Self;
|
||||
#[cfg(feature = "v1_18")]
|
||||
#[doc(alias = "gst_encoding_profile_set_single_segment")]
|
||||
#[must_use]
|
||||
fn single_segment_if_some(self, single_segment: Option<bool>) -> Self;
|
||||
#[cfg(feature = "v1_20")]
|
||||
#[doc(alias = "gst_encoding_profile_set_element_properties")]
|
||||
#[must_use]
|
||||
fn element_properties(self, element_properties: ElementProperties) -> Self;
|
||||
#[cfg(feature = "v1_20")]
|
||||
#[doc(alias = "gst_encoding_profile_set_element_properties")]
|
||||
#[must_use]
|
||||
fn element_properties_if_some(self, element_properties: Option<ElementProperties>) -> Self;
|
||||
}
|
||||
|
||||
macro_rules! declare_encoding_profile_builder_common(
|
||||
|
@ -445,27 +407,69 @@ macro_rules! declare_encoding_profile_builder_common(
|
|||
self
|
||||
}
|
||||
|
||||
fn presence_if_some(self, presence: Option<u32>) -> $name<'a> {
|
||||
if let Some(presence) = presence {
|
||||
self.presence(presence)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn allow_dynamic_output(mut self, allow: bool) -> $name<'a> {
|
||||
self.base.allow_dynamic_output = allow;
|
||||
self
|
||||
}
|
||||
|
||||
fn allow_dynamic_output_if_some(self, allow_dynamic_output: Option<bool>) -> $name<'a> {
|
||||
if let Some(allow_dynamic_output) = allow_dynamic_output {
|
||||
self.allow_dynamic_output(allow_dynamic_output)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn enabled(mut self, enabled: bool) -> $name<'a> {
|
||||
self.base.enabled = enabled;
|
||||
self
|
||||
}
|
||||
|
||||
fn enabled_if_some(self, enabled: Option<bool>) -> $name<'a> {
|
||||
if let Some(enabled) = enabled {
|
||||
self.enabled(enabled)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_18")]
|
||||
fn single_segment(mut self, single_segment: bool) -> $name<'a> {
|
||||
self.base.single_segment = single_segment;
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_18")]
|
||||
fn single_segment_if_some(self, single_segment: Option<bool>) -> $name<'a> {
|
||||
if let Some(single_segment) = single_segment {
|
||||
self.single_segment(single_segment)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_20")]
|
||||
fn element_properties(mut self, element_properties: ElementProperties) -> $name<'a> {
|
||||
self.base.element_properties = Some(element_properties);
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_20")]
|
||||
fn element_properties_if_some(self, element_properties: Option<ElementProperties>) -> $name<'a> {
|
||||
if let Some(element_properties) = element_properties {
|
||||
self.element_properties(element_properties)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -475,6 +479,7 @@ fn set_common_fields<T: EncodingProfileBuilderCommon>(
|
|||
base_data: EncodingProfileBuilderCommonData,
|
||||
) {
|
||||
skip_assert_initialized!();
|
||||
profile.set_format(base_data.format);
|
||||
profile.set_name(base_data.name);
|
||||
profile.set_description(base_data.description);
|
||||
profile.set_preset(base_data.preset);
|
||||
|
@ -694,12 +699,6 @@ mod tests {
|
|||
assert_eq!(audio_profile.presence(), PRESENCE);
|
||||
assert_eq!(audio_profile.allows_dynamic_output(), ALLOW_DYNAMIC_OUTPUT);
|
||||
assert_eq!(audio_profile.is_enabled(), ENABLED);
|
||||
|
||||
let restriction = gst_audio::AudioCapsBuilder::new()
|
||||
.format(gst_audio::AudioFormat::S32be)
|
||||
.build();
|
||||
audio_profile.set_restriction(Some(restriction.clone()));
|
||||
assert_eq!(audio_profile.restriction().unwrap(), restriction);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -742,12 +741,6 @@ mod tests {
|
|||
glib::object::Cast::downcast(video_profile).ok().unwrap();
|
||||
assert_eq!(video_profile.is_variableframerate(), VARIABLE_FRAMERATE);
|
||||
assert_eq!(video_profile.pass(), PASS);
|
||||
|
||||
let restriction = gst_video::VideoCapsBuilder::new()
|
||||
.format(gst_video::VideoFormat::Nv12)
|
||||
.build();
|
||||
video_profile.set_restriction(Some(restriction.clone()));
|
||||
assert_eq!(video_profile.restriction().unwrap(), restriction);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -35,7 +35,7 @@ pub mod prelude {
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
|
||||
pub use super::video_aggregator_pad::{VideoAggregatorPadImpl, VideoAggregatorPadImplExt};
|
||||
pub use super::{
|
||||
navigation::NavigationImpl,
|
||||
navigation::{NavigationImpl, NavigationImplExt},
|
||||
video_decoder::{VideoDecoderImpl, VideoDecoderImplExt},
|
||||
video_encoder::{VideoEncoderImpl, VideoEncoderImplExt},
|
||||
video_filter::{VideoFilterImpl, VideoFilterImplExt},
|
||||
|
|
|
@ -36,7 +36,7 @@ mod sealed {
|
|||
impl<T: super::VideoAggregatorPadImplExt> Sealed for T {}
|
||||
}
|
||||
|
||||
pub trait VideoAggregatorPadImplExt: ObjectSubclass {
|
||||
pub trait VideoAggregatorPadImplExt: ObjectSubclass + sealed::Sealed {
|
||||
fn parent_update_conversion_info(&self) {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
|
|
@ -34,4 +34,8 @@ pub mod prelude {
|
|||
pub use crate::web_rtcice::WebRTCICEExtManual;
|
||||
#[doc(hidden)]
|
||||
pub use gst_sdp::prelude::*;
|
||||
|
||||
#[cfg(feature = "v1_22")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
|
||||
pub use crate::auto::traits::*;
|
||||
}
|
||||
|
|
|
@ -318,13 +318,13 @@ where
|
|||
unsafe impl<T> Send for Iterator<T> {}
|
||||
unsafe impl<T> Sync for Iterator<T> {}
|
||||
|
||||
unsafe extern "C" fn filter_trampoline<T: StaticType, F: Fn(T) -> bool + Send + Sync + 'static>(
|
||||
unsafe extern "C" fn filter_trampoline<
|
||||
T: for<'a> FromValue<'a> + StaticType + 'static,
|
||||
F: Fn(T) -> bool + Send + Sync + 'static,
|
||||
>(
|
||||
value: gconstpointer,
|
||||
func: gconstpointer,
|
||||
) -> i32
|
||||
where
|
||||
for<'a> T: FromValue<'a> + 'static,
|
||||
{
|
||||
) -> i32 {
|
||||
let value = value as *const glib::gobject_ffi::GValue;
|
||||
|
||||
let func = func as *const glib::gobject_ffi::GValue;
|
||||
|
|
|
@ -335,6 +335,8 @@ pub mod prelude {
|
|||
buffer_pool::BufferPoolExtManual,
|
||||
child_proxy::ChildProxyExtManual,
|
||||
clock::ClockExtManual,
|
||||
control_binding::ControlBindingExtManual,
|
||||
control_source::ControlSourceExtManual,
|
||||
device_monitor::DeviceMonitorExtManual,
|
||||
device_provider::{DeviceProviderClassExt, DeviceProviderExtManual},
|
||||
element::{ElementClassExt, ElementExtManual},
|
||||
|
|
Loading…
Reference in a new issue