From 567ce0a3bf73fbae933e304c9acf0920ec9ec30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 3 Jan 2023 20:58:25 +0200 Subject: [PATCH] Group and merge imports in all manual code Part-of: --- examples/src/bin/appsink.rs | 7 +- examples/src/bin/appsrc.rs | 3 +- examples/src/bin/cairo_compositor.rs | 17 ++- examples/src/bin/custom_meta.rs | 11 +- examples/src/bin/d3d11videosink.rs | 17 ++- examples/src/bin/debug_ringbuffer.rs | 4 +- examples/src/bin/decodebin.rs | 11 +- examples/src/bin/discoverer.rs | 8 +- examples/src/bin/encodebin.rs | 13 +-- examples/src/bin/fd_allocator.rs | 16 ++- examples/src/bin/futures.rs | 8 +- examples/src/bin/ges.rs | 5 +- examples/src/bin/glfilter.rs | 18 +-- examples/src/bin/glib-futures.rs | 5 +- examples/src/bin/gtksink.rs | 6 +- examples/src/bin/gtkvideooverlay.rs | 10 +- examples/src/bin/launch.rs | 5 +- examples/src/bin/launch_glib_main.rs | 4 +- examples/src/bin/overlay-composition.rs | 12 +- examples/src/bin/pad_probes.rs | 5 +- examples/src/bin/pango-cairo.rs | 12 +- examples/src/bin/playbin.rs | 4 +- examples/src/bin/player.rs | 9 +- examples/src/bin/queries.rs | 4 +- examples/src/bin/rtpfecclient.rs | 5 +- examples/src/bin/rtpfecserver.rs | 3 +- examples/src/bin/rtsp-server-record.rs | 8 +- examples/src/bin/rtsp-server-subclass.rs | 11 +- examples/src/bin/rtsp-server.rs | 3 +- examples/src/bin/subclass.rs | 11 +- examples/src/bin/tagsetter.rs | 6 +- examples/src/bin/thumbnail.rs | 4 +- examples/src/bin/toc.rs | 4 +- examples/src/bin/transmux.rs | 4 +- examples/src/examples-common.rs | 4 +- examples/src/glupload.rs | 14 +-- gstreamer-allocators/src/caps_features.rs | 1 - gstreamer-allocators/src/dma_buf_allocator.rs | 1 - gstreamer-allocators/src/fd_allocator.rs | 1 - gstreamer-allocators/src/phys_memory.rs | 1 - gstreamer-app/src/app_sink.rs | 31 +++--- gstreamer-app/src/app_src.rs | 32 ++++-- gstreamer-audio/src/audio_aggregator.rs | 17 ++- .../src/audio_aggregator_convert_pad.rs | 15 ++- gstreamer-audio/src/audio_aggregator_pad.rs | 4 +- gstreamer-audio/src/audio_buffer.rs | 9 +- gstreamer-audio/src/audio_channel_position.rs | 4 +- gstreamer-audio/src/audio_converter.rs | 4 +- gstreamer-audio/src/audio_decoder.rs | 11 +- gstreamer-audio/src/audio_encoder.rs | 8 +- gstreamer-audio/src/audio_format.rs | 4 +- gstreamer-audio/src/audio_format_info.rs | 12 +- gstreamer-audio/src/audio_info.rs | 7 +- gstreamer-audio/src/audio_ring_buffer_spec.rs | 8 +- gstreamer-audio/src/audio_stream_align.rs | 5 +- gstreamer-audio/src/caps.rs | 7 +- gstreamer-audio/src/flag_serde.rs | 6 +- gstreamer-audio/src/functions.rs | 4 +- gstreamer-audio/src/lib.rs | 15 ++- .../src/subclass/audio_aggregator.rs | 11 +- .../src/subclass/audio_aggregator_pad.rs | 8 +- gstreamer-audio/src/subclass/audio_decoder.rs | 10 +- gstreamer-audio/src/subclass/audio_encoder.rs | 10 +- gstreamer-audio/src/subclass/audio_filter.rs | 7 +- gstreamer-audio/src/subclass/audio_sink.rs | 9 +- gstreamer-audio/src/subclass/audio_src.rs | 9 +- gstreamer-audio/src/subclass/mod.rs | 22 ++-- gstreamer-base/src/adapter.rs | 8 +- gstreamer-base/src/aggregator.rs | 18 +-- gstreamer-base/src/aggregator_pad.rs | 4 +- gstreamer-base/src/base_parse.rs | 10 +- gstreamer-base/src/base_parse_frame.rs | 10 +- gstreamer-base/src/base_sink.rs | 7 +- gstreamer-base/src/base_src.rs | 7 +- gstreamer-base/src/base_transform.rs | 8 +- gstreamer-base/src/flow_combiner.rs | 3 +- gstreamer-base/src/functions.rs | 4 +- gstreamer-base/src/lib.rs | 15 +-- gstreamer-base/src/subclass/aggregator.rs | 11 +- gstreamer-base/src/subclass/aggregator_pad.rs | 7 +- gstreamer-base/src/subclass/base_parse.rs | 5 +- gstreamer-base/src/subclass/base_sink.rs | 8 +- gstreamer-base/src/subclass/base_src.rs | 14 +-- gstreamer-base/src/subclass/base_transform.rs | 8 +- gstreamer-base/src/subclass/mod.rs | 16 +-- gstreamer-base/src/subclass/push_src.rs | 11 +- gstreamer-check/src/harness.rs | 10 +- gstreamer-check/src/test_clock.rs | 6 +- gstreamer-editing-services/src/flag_serde.rs | 6 +- gstreamer-editing-services/src/lib.rs | 7 +- gstreamer-gl/egl/src/gl_display_egl.rs | 6 +- gstreamer-gl/src/caps_features.rs | 1 - gstreamer-gl/src/context.rs | 9 +- gstreamer-gl/src/flag_serde.rs | 6 +- gstreamer-gl/src/functions.rs | 8 +- gstreamer-gl/src/gl_base_memory.rs | 12 +- gstreamer-gl/src/gl_context.rs | 9 +- gstreamer-gl/src/gl_memory.rs | 13 +-- gstreamer-gl/src/gl_memory_pbo.rs | 3 +- gstreamer-gl/src/gl_video_frame.rs | 4 +- gstreamer-gl/src/lib.rs | 12 +- gstreamer-gl/src/subclass/gl_base_filter.rs | 9 +- gstreamer-gl/src/subclass/gl_base_src.rs | 6 +- gstreamer-gl/src/subclass/gl_filter.rs | 14 +-- gstreamer-gl/src/subclass/mod.rs | 6 +- .../wayland/src/gl_display_wayland.rs | 6 +- gstreamer-gl/x11/src/gl_display_x11.rs | 6 +- gstreamer-mpegts/src/lib.rs | 4 +- gstreamer-net/src/lib.rs | 4 +- gstreamer-net/src/net_address_meta.rs | 3 +- gstreamer-net/src/ptp_clock.rs | 3 +- gstreamer-pbutils/src/audio_visualizer.rs | 4 +- gstreamer-pbutils/src/discoverer.rs | 16 +-- .../src/discoverer_stream_info.rs | 3 +- .../src/discoverer_video_info.rs | 4 +- gstreamer-pbutils/src/element_properties.rs | 4 +- gstreamer-pbutils/src/encoding_profile.rs | 18 ++- gstreamer-pbutils/src/flag_serde.rs | 6 +- gstreamer-pbutils/src/functions.rs | 3 +- gstreamer-pbutils/src/lib.rs | 20 ++-- .../src/subclass/audio_visualizer.rs | 6 +- gstreamer-play/src/config.rs | 5 +- gstreamer-play/src/play.rs | 3 +- gstreamer-play/src/play_message.rs | 3 +- gstreamer-play/src/play_signal_adapter.rs | 14 ++- gstreamer-play/src/play_video_info.rs | 6 +- .../src/play_video_overlay_video_renderer.rs | 7 +- gstreamer-play/src/play_visualization.rs | 3 +- .../src/subclass/play_video_renderer.rs | 6 +- gstreamer-player/src/config.rs | 5 +- gstreamer-player/src/player.rs | 14 ++- ...player_g_main_context_signal_dispatcher.rs | 3 +- gstreamer-player/src/player_video_info.rs | 6 +- .../player_video_overlay_video_renderer.rs | 7 +- gstreamer-player/src/player_visualization.rs | 3 +- .../src/subclass/player_video_renderer.rs | 6 +- gstreamer-rtp/src/flag_serde.rs | 6 +- gstreamer-rtp/src/lib.rs | 18 ++- gstreamer-rtp/src/rtp_base_depayload.rs | 4 +- gstreamer-rtp/src/rtp_base_payload.rs | 7 +- gstreamer-rtp/src/rtp_buffer.rs | 7 +- gstreamer-rtp/src/rtp_header_extension.rs | 7 +- gstreamer-rtp/src/subclass/mod.rs | 4 +- .../src/subclass/rtp_base_depayload.rs | 7 +- .../src/subclass/rtp_base_payload.rs | 4 +- .../src/subclass/rtp_header_extension.rs | 5 +- gstreamer-rtsp-server/src/flag_serde.rs | 6 +- gstreamer-rtsp-server/src/lib.rs | 24 ++-- .../src/rtsp_address_pool.rs | 9 +- gstreamer-rtsp-server/src/rtsp_auth.rs | 15 ++- gstreamer-rtsp-server/src/rtsp_client.rs | 5 +- gstreamer-rtsp-server/src/rtsp_context.rs | 4 +- gstreamer-rtsp-server/src/rtsp_media.rs | 3 +- .../src/rtsp_media_factory.rs | 5 +- .../src/rtsp_onvif_media_factory.rs | 6 +- gstreamer-rtsp-server/src/rtsp_server.rs | 5 +- gstreamer-rtsp-server/src/rtsp_session.rs | 8 +- .../src/rtsp_session_pool.rs | 14 ++- gstreamer-rtsp-server/src/rtsp_token.rs | 5 +- gstreamer-rtsp-server/src/subclass/mod.rs | 20 ++-- .../src/subclass/rtsp_client.rs | 6 +- .../src/subclass/rtsp_media.rs | 9 +- .../src/subclass/rtsp_media_factory.rs | 8 +- .../src/subclass/rtsp_mount_points.rs | 4 +- .../src/subclass/rtsp_onvif_media_factory.rs | 4 +- .../src/subclass/rtsp_server.rs | 4 +- gstreamer-rtsp/src/flag_serde.rs | 6 +- gstreamer-sdp/src/sdp_attribute.rs | 4 +- gstreamer-sdp/src/sdp_bandwidth.rs | 4 +- gstreamer-sdp/src/sdp_connection.rs | 4 +- gstreamer-sdp/src/sdp_key.rs | 3 +- gstreamer-sdp/src/sdp_media.rs | 19 ++-- gstreamer-sdp/src/sdp_message.rs | 33 +++--- gstreamer-sdp/src/sdp_origin.rs | 3 +- gstreamer-sdp/src/sdp_time.rs | 6 +- gstreamer-sdp/src/sdp_zone.rs | 4 +- gstreamer-utils/src/streamproducer.rs | 19 ++-- gstreamer-video/src/caps.rs | 7 +- gstreamer-video/src/caps_features.rs | 2 +- gstreamer-video/src/color_balance_channel.rs | 4 +- gstreamer-video/src/flag_serde.rs | 6 +- gstreamer-video/src/functions.rs | 9 +- gstreamer-video/src/lib.rs | 14 +-- gstreamer-video/src/navigation.rs | 7 +- gstreamer-video/src/subclass/mod.rs | 12 +- gstreamer-video/src/subclass/navigation.rs | 5 +- .../src/subclass/video_aggregator.rs | 9 +- .../src/subclass/video_aggregator_pad.rs | 13 +-- gstreamer-video/src/subclass/video_decoder.rs | 10 +- gstreamer-video/src/subclass/video_encoder.rs | 10 +- gstreamer-video/src/subclass/video_filter.rs | 8 +- gstreamer-video/src/subclass/video_sink.rs | 4 +- gstreamer-video/src/video_aggregator.rs | 4 +- .../src/video_aggregator_convert_pad.rs | 15 ++- gstreamer-video/src/video_aggregator_pad.rs | 7 +- gstreamer-video/src/video_buffer_pool.rs | 5 +- gstreamer-video/src/video_codec_frame.rs | 9 +- gstreamer-video/src/video_codec_state.rs | 10 +- gstreamer-video/src/video_converter.rs | 5 +- gstreamer-video/src/video_decoder.rs | 18 +-- gstreamer-video/src/video_encoder.rs | 17 +-- gstreamer-video/src/video_event.rs | 11 +- gstreamer-video/src/video_format.rs | 5 +- gstreamer-video/src/video_format_info.rs | 6 +- gstreamer-video/src/video_frame.rs | 9 +- gstreamer-video/src/video_hdr.rs | 7 +- gstreamer-video/src/video_info.rs | 8 +- gstreamer-video/src/video_message.rs | 13 ++- gstreamer-video/src/video_meta.rs | 3 +- gstreamer-video/src/video_overlay.rs | 5 +- .../src/video_overlay_composition.rs | 3 +- gstreamer-video/src/video_rectangle.rs | 4 +- gstreamer-video/src/video_time_code.rs | 9 +- .../src/video_time_code_interval.rs | 6 +- .../src/web_rtc_ice_candidate_stats.rs | 6 +- .../src/web_rtc_session_description.rs | 7 +- gstreamer/src/allocation_params.rs | 3 +- gstreamer/src/allocator.rs | 4 +- gstreamer/src/bin.rs | 20 ++-- gstreamer/src/buffer.rs | 23 +--- gstreamer/src/buffer_cursor.rs | 16 +-- gstreamer/src/buffer_pool.rs | 21 ++-- gstreamer/src/buffer_serde.rs | 17 ++- gstreamer/src/bufferlist.rs | 13 +-- gstreamer/src/bufferlist_serde.rs | 15 ++- gstreamer/src/bus.rs | 29 ++--- gstreamer/src/caps.rs | 22 ++-- gstreamer/src/caps_features.rs | 21 ++-- gstreamer/src/caps_features_serde.rs | 13 ++- gstreamer/src/caps_serde.rs | 22 ++-- gstreamer/src/child_proxy.rs | 7 +- gstreamer/src/clock.rs | 44 ++++---- gstreamer/src/context.rs | 3 +- gstreamer/src/control_binding.rs | 7 +- gstreamer/src/control_source.rs | 7 +- gstreamer/src/date_time.rs | 4 +- gstreamer/src/date_time_serde.rs | 16 ++- gstreamer/src/device_monitor.rs | 10 +- gstreamer/src/device_provider.rs | 11 +- gstreamer/src/device_provider_factory.rs | 16 +-- gstreamer/src/element.rs | 41 +++---- gstreamer/src/element_factory.rs | 19 +--- gstreamer/src/enums.rs | 19 ++-- gstreamer/src/error.rs | 3 +- gstreamer/src/event.rs | 31 ++---- gstreamer/src/flag_serde.rs | 6 +- gstreamer/src/format/clock_time.rs | 23 ++-- gstreamer/src/format/clock_time_serde.rs | 6 +- gstreamer/src/format/compatible.rs | 5 +- gstreamer/src/format/format_serde.rs | 15 +-- gstreamer/src/format/generic.rs | 12 +- gstreamer/src/format/undefined.rs | 9 +- gstreamer/src/functions.rs | 13 +-- gstreamer/src/ghost_pad.rs | 16 +-- gstreamer/src/gobject.rs | 3 +- gstreamer/src/gtype.rs | 6 +- gstreamer/src/iterator.rs | 27 ++--- gstreamer/src/lib.rs | 104 ++++++++---------- gstreamer/src/log.rs | 17 +-- gstreamer/src/memory.rs | 17 ++- gstreamer/src/message.rs | 25 ++--- gstreamer/src/meta.rs | 13 +-- gstreamer/src/miniobject.rs | 3 +- gstreamer/src/object.rs | 10 +- gstreamer/src/pad.rs | 45 +++----- gstreamer/src/pad_template.rs | 11 +- gstreamer/src/param_spec.rs | 7 +- gstreamer/src/pipeline.rs | 6 +- gstreamer/src/plugin.rs | 8 +- gstreamer/src/plugin_feature.rs | 9 +- gstreamer/src/promise.rs | 18 +-- gstreamer/src/proxy_pad.rs | 11 +- gstreamer/src/query.rs | 22 ++-- gstreamer/src/registry.rs | 6 +- gstreamer/src/sample.rs | 21 +--- gstreamer/src/sample_serde.rs | 27 ++--- gstreamer/src/segment.rs | 22 ++-- gstreamer/src/segment_serde.rs | 23 ++-- gstreamer/src/static_caps.rs | 12 +- gstreamer/src/static_pad_template.rs | 11 +- gstreamer/src/stream.rs | 3 +- gstreamer/src/stream_collection.rs | 18 +-- gstreamer/src/structure.rs | 27 +++-- gstreamer/src/structure_serde.rs | 31 ++---- gstreamer/src/subclass/allocator.rs | 6 +- gstreamer/src/subclass/bin.rs | 10 +- gstreamer/src/subclass/buffer_pool.rs | 5 +- gstreamer/src/subclass/child_proxy.rs | 6 +- gstreamer/src/subclass/clock.rs | 14 +-- gstreamer/src/subclass/device.rs | 14 +-- gstreamer/src/subclass/device_provider.rs | 12 +- gstreamer/src/subclass/element.rs | 25 ++--- gstreamer/src/subclass/error.rs | 3 +- gstreamer/src/subclass/ghost_pad.rs | 2 +- gstreamer/src/subclass/mod.rs | 54 ++++----- gstreamer/src/subclass/pad.rs | 11 +- gstreamer/src/subclass/pipeline.rs | 2 +- gstreamer/src/subclass/proxy_pad.rs | 2 +- gstreamer/src/subclass/system_clock.rs | 2 +- gstreamer/src/subclass/task_pool.rs | 27 +++-- gstreamer/src/subclass/tracer.rs | 3 +- gstreamer/src/subclass/uri_handler.rs | 12 +- gstreamer/src/tag_setter.rs | 8 +- gstreamer/src/tags.rs | 19 ++-- gstreamer/src/tags_serde.rs | 42 +++---- gstreamer/src/task.rs | 14 +-- gstreamer/src/task_pool.rs | 11 +- gstreamer/src/toc.rs | 11 +- gstreamer/src/toc_serde.rs | 19 +--- gstreamer/src/tracer.rs | 3 +- gstreamer/src/tracer_factory.rs | 4 +- gstreamer/src/typefind.rs | 10 +- gstreamer/src/typefind_factory.rs | 4 +- gstreamer/src/value.rs | 10 +- gstreamer/src/value_serde.rs | 37 ++----- tutorials/src/bin/basic-tutorial-12.rs | 2 +- tutorials/src/bin/basic-tutorial-13.rs | 16 ++- tutorials/src/bin/basic-tutorial-4.rs | 4 +- tutorials/src/bin/basic-tutorial-5.rs | 8 +- tutorials/src/bin/basic-tutorial-8.rs | 1 - tutorials/src/bin/basic-tutorial-9.rs | 5 +- tutorials/src/bin/playback-tutorial-1.rs | 11 +- tutorials/src/bin/playback-tutorial-2.rs | 11 +- tutorials/src/bin/playback-tutorial-3.rs | 1 - tutorials/src/bin/playback-tutorial-4.rs | 12 +- tutorials/src/bin/playback-tutorial-5.rs | 11 +- tutorials/src/bin/playback-tutorial-6.rs | 3 +- tutorials/src/bin/playback-tutorial-7.rs | 3 +- tutorials/src/tutorials-common.rs | 4 +- 329 files changed, 1466 insertions(+), 1929 deletions(-) diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index 687c90434..648f9b4cd 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -10,15 +10,12 @@ // This is the format we request: // Audio / Signed 16bit / 1 channel / arbitrary sample rate -use gst::element_error; -use gst::prelude::*; - -use byte_slice_cast::*; - use std::i16; use anyhow::Error; +use byte_slice_cast::*; use derive_more::{Display, Error}; +use gst::{element_error, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index e1020edd4..73690dff0 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -10,10 +10,9 @@ // The application provides data of the following format: // Video / BGRx (4 bytes) / 2 fps -use gst::prelude::*; - use anyhow::Error; use derive_more::{Display, Error}; +use gst::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/cairo_compositor.rs b/examples/src/bin/cairo_compositor.rs index 9cc2b26cf..1cb8f2033 100644 --- a/examples/src/bin/cairo_compositor.rs +++ b/examples/src/bin/cairo_compositor.rs @@ -1,29 +1,27 @@ // This example demonstrates how to implement a custom compositor based on cairo. #![allow(clippy::non_send_fields_in_send_ty)] +use anyhow::{Context, Error}; use gst::prelude::*; use gst_base::prelude::*; -use anyhow::{Context, Error}; - #[path = "../examples-common.rs"] mod examples_common; // Our custom compositor element is defined in this module. mod cairo_compositor { - use super::*; use gst_base::subclass::prelude::*; - use gst_video::prelude::*; - use gst_video::subclass::prelude::*; - + use gst_video::{prelude::*, subclass::prelude::*}; use once_cell::sync::Lazy; + use super::*; + // In the imp submodule we include the actual implementation of the compositor. mod imp { - use super::*; - use std::sync::Mutex; + use super::*; + // Settings of the compositor. #[derive(Clone)] struct Settings { @@ -413,9 +411,10 @@ mod cairo_compositor { // This doesn't implement any additional logic but only provides properties for configuring the // appearance of the stream corresponding to this pad and the storage of the property values. mod imp_pad { - use super::*; use std::sync::Mutex; + use super::*; + // Settings of our pad. #[derive(Clone)] pub(super) struct Settings { diff --git a/examples/src/bin/custom_meta.rs b/examples/src/bin/custom_meta.rs index a129d99e5..19dcd3e0a 100644 --- a/examples/src/bin/custom_meta.rs +++ b/examples/src/bin/custom_meta.rs @@ -4,16 +4,15 @@ // an appsrc and retrieves them again from an appsink. #![allow(clippy::non_send_fields_in_send_ty)] -use gst::element_error; -use gst::prelude::*; +use gst::{element_error, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; mod custom_meta { + use std::{fmt, mem}; + use gst::prelude::*; - use std::fmt; - use std::mem; // Public Rust type for the custom meta. #[repr(transparent)] @@ -70,10 +69,10 @@ mod custom_meta { // Actual unsafe implementation of the meta. mod imp { + use std::{mem, ptr}; + use glib::translate::*; use once_cell::sync::Lazy; - use std::mem; - use std::ptr; pub(super) struct CustomMetaParams { pub label: String, diff --git a/examples/src/bin/d3d11videosink.rs b/examples/src/bin/d3d11videosink.rs index bdde4fc55..c9109d19d 100644 --- a/examples/src/bin/d3d11videosink.rs +++ b/examples/src/bin/d3d11videosink.rs @@ -7,15 +7,20 @@ // directly to the on the DXGI swapchain's backbuffer via Windows API in // strictly zero-copy manner -use gst::glib; -use gst::prelude::*; -use std::collections::VecDeque; -use std::sync::{Arc, Mutex}; -use std::time::SystemTime; +use std::{ + collections::VecDeque, + sync::{Arc, Mutex}, + time::SystemTime, +}; + +use gst::{glib, prelude::*}; use windows::{ core::*, Win32::Graphics::{ - Direct2D::Common::*, Direct2D::*, Direct3D11::*, DirectWrite::*, Dxgi::Common::*, Dxgi::*, + Direct2D::{Common::*, *}, + Direct3D11::*, + DirectWrite::*, + Dxgi::{Common::*, *}, }, }; diff --git a/examples/src/bin/debug_ringbuffer.rs b/examples/src/bin/debug_ringbuffer.rs index 50f7d114e..44f1276b6 100644 --- a/examples/src/bin/debug_ringbuffer.rs +++ b/examples/src/bin/debug_ringbuffer.rs @@ -5,10 +5,10 @@ // // It's possible to dump the logs at any time in an application, // not just on exit like is done here. -use gst::prelude::*; - use std::process; +use gst::prelude::*; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index 9726e78dd..e287bfa7d 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -29,15 +29,14 @@ // Especially Windows APIs tend to be quite picky about samplerate and sample-format. // The same applies to videostreams. -use gst::element_error; -use gst::element_warning; -use gst::prelude::*; - -use std::env; -use std::sync::{Arc, Mutex}; +use std::{ + env, + sync::{Arc, Mutex}, +}; use anyhow::Error; use derive_more::{Display, Error}; +use gst::{element_error, element_warning, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/discoverer.rs b/examples/src/bin/discoverer.rs index 36f2a8971..23f38e680 100644 --- a/examples/src/bin/discoverer.rs +++ b/examples/src/bin/discoverer.rs @@ -8,15 +8,11 @@ // Discovered information could for example contain the stream's duration or whether it is // seekable (filesystem) or not (some http servers). -use gst_pbutils::prelude::*; - -use gst_pbutils::DiscovererInfo; -use gst_pbutils::DiscovererStreamInfo; +use std::env; use anyhow::Error; use derive_more::{Display, Error}; - -use std::env; +use gst_pbutils::{prelude::*, DiscovererInfo, DiscovererStreamInfo}; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/encodebin.rs b/examples/src/bin/encodebin.rs index 163c01765..a9b71d07e 100644 --- a/examples/src/bin/encodebin.rs +++ b/examples/src/bin/encodebin.rs @@ -12,16 +12,15 @@ // {uridecodebin} -| {encodebin}-{filesink} // \-{queue}-{videoconvert}-{videoscale}----/ -use gst::element_error; -use gst::element_warning; - -use gst_pbutils::prelude::*; - -use std::env; -use std::sync::{Arc, Mutex}; +use std::{ + env, + sync::{Arc, Mutex}, +}; use anyhow::Error; use derive_more::{Display, Error}; +use gst::{element_error, element_warning}; +use gst_pbutils::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/fd_allocator.rs b/examples/src/bin/fd_allocator.rs index 4a458226c..ae5b2a4f4 100644 --- a/examples/src/bin/fd_allocator.rs +++ b/examples/src/bin/fd_allocator.rs @@ -14,20 +14,18 @@ // how the file descriptor of FdMemory can be accessed in a pipeline. // Note that instead of manual mapping the file descriptor it is also possible // to use map_writable, which will also map the file descriptor. -use futures::StreamExt; -use gst::{element_error, prelude::*}; - -use anyhow::Error; -use derive_more::{Display, Error}; - -use memmap2::MmapMut; -use uds::UnixStreamExt; - use std::{ os::unix::{net::UnixStream, prelude::AsRawFd}, sync::{Arc, Mutex}, }; +use anyhow::Error; +use derive_more::{Display, Error}; +use futures::StreamExt; +use gst::{element_error, prelude::*}; +use memmap2::MmapMut; +use uds::UnixStreamExt; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/futures.rs b/examples/src/bin/futures.rs index 930993571..3b9fc76fc 100644 --- a/examples/src/bin/futures.rs +++ b/examples/src/bin/futures.rs @@ -3,13 +3,11 @@ // or for an EOS message. When a message notifying about either of both // is received, the future is resolved. -use gst::prelude::*; - -use futures::executor::LocalPool; -use futures::prelude::*; - use std::env; +use futures::{executor::LocalPool, prelude::*}; +use gst::prelude::*; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/ges.rs b/examples/src/bin/ges.rs index 8db3ae7fe..8022c4cdb 100644 --- a/examples/src/bin/ges.rs +++ b/examples/src/bin/ges.rs @@ -35,11 +35,10 @@ // those with lowers (higher number). Thus, Layers with higher priority are "in the front". // - The timeline is the enclosing element, grouping all layers and providing a timeframe. -use gst::prelude::*; +use std::env; use ges::prelude::*; - -use std::env; +use gst::prelude::*; #[allow(unused_imports)] #[path = "../examples-common.rs"] diff --git a/examples/src/bin/glfilter.rs b/examples/src/bin/glfilter.rs index 404b51856..c6138d6a4 100644 --- a/examples/src/bin/glfilter.rs +++ b/examples/src/bin/glfilter.rs @@ -28,16 +28,18 @@ void main () { "#; mod mirror { - use super::{gl, FRAGMENT_SHADER}; - use gst_base::subclass::BaseTransformMode; - use gst_gl::prelude::*; - use gst_gl::subclass::prelude::*; - use gst_gl::subclass::GLFilterMode; - use gst_gl::*; - - use once_cell::sync::Lazy; use std::sync::Mutex; + use gst_base::subclass::BaseTransformMode; + use gst_gl::{ + prelude::*, + subclass::{prelude::*, GLFilterMode}, + *, + }; + use once_cell::sync::Lazy; + + use super::{gl, FRAGMENT_SHADER}; + pub static CAT: Lazy = Lazy::new(|| { gst::DebugCategory::new( "rsglmirrorfilter", diff --git a/examples/src/bin/glib-futures.rs b/examples/src/bin/glib-futures.rs index e936077e3..4d0c2f6b9 100644 --- a/examples/src/bin/glib-futures.rs +++ b/examples/src/bin/glib-futures.rs @@ -1,8 +1,7 @@ -use gst::prelude::*; +use std::env; use futures::prelude::*; - -use std::env; +use gst::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index d7adce5c0..61e8ad874 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -10,14 +10,12 @@ // (|) // {videotestsrc} - {glsinkbin} -use gst::prelude::*; +use std::cell::RefCell; use gio::prelude::*; - +use gst::prelude::*; use gtk::prelude::*; -use std::cell::RefCell; - fn create_ui(app: >k::Application) { let pipeline = gst::Pipeline::default(); let src = gst::ElementFactory::make("videotestsrc").build().unwrap(); diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index 5da1f7e04..6d460f449 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -17,18 +17,12 @@ // {videotestsrc} - {xvimagesink(on linux)} // {videotestsrc} - {glimagesink(on mac)} -use gst_video::prelude::*; +use std::{cell::RefCell, os::raw::c_void, process}; use gio::prelude::*; - +use gst_video::prelude::*; use gtk::prelude::*; -use std::os::raw::c_void; - -use std::cell::RefCell; - -use std::process; - #[cfg(all(target_os = "linux", feature = "gtkvideooverlay-x11"))] fn create_video_sink() -> gst::Element { // When we are on linux with the Xorg display server, we use the diff --git a/examples/src/bin/launch.rs b/examples/src/bin/launch.rs index 7d625c944..ecff96f08 100644 --- a/examples/src/bin/launch.rs +++ b/examples/src/bin/launch.rs @@ -3,10 +3,9 @@ // as launch syntax. // When the parsing succeeded, the pipeline is run until the stream ends or an error happens. -use gst::prelude::*; +use std::{env, process}; -use std::env; -use std::process; +use gst::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/launch_glib_main.rs b/examples/src/bin/launch_glib_main.rs index c959337d4..34b302d08 100644 --- a/examples/src/bin/launch_glib_main.rs +++ b/examples/src/bin/launch_glib_main.rs @@ -7,10 +7,10 @@ // things from the main loop (timeouts, UI events, socket events, ...) instead // of just handling messages from GStreamer's bus. -use gst::prelude::*; - use std::env; +use gst::prelude::*; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/overlay-composition.rs b/examples/src/bin/overlay-composition.rs index 7163aa1de..8fda4b92d 100644 --- a/examples/src/bin/overlay-composition.rs +++ b/examples/src/bin/overlay-composition.rs @@ -8,15 +8,15 @@ // The capsfilter element allows us to dictate the video resolution we want for the // videotestsrc and the overlaycomposition element. -use gst::prelude::*; - -use pango::prelude::*; - -use std::ops; -use std::sync::{Arc, Mutex}; +use std::{ + ops, + sync::{Arc, Mutex}, +}; use anyhow::Error; use derive_more::{Display, Error}; +use gst::prelude::*; +use pango::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/pad_probes.rs b/examples/src/bin/pad_probes.rs index fca06431a..4cc1095a9 100644 --- a/examples/src/bin/pad_probes.rs +++ b/examples/src/bin/pad_probes.rs @@ -8,11 +8,10 @@ // {audiotestsrc} - {fakesink} #![allow(clippy::question_mark)] -use gst::prelude::*; +use std::i16; use byte_slice_cast::*; - -use std::i16; +use gst::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/pango-cairo.rs b/examples/src/bin/pango-cairo.rs index ba16f4ba2..651fb9a33 100644 --- a/examples/src/bin/pango-cairo.rs +++ b/examples/src/bin/pango-cairo.rs @@ -11,15 +11,15 @@ // The capsfilter element allows us to dictate the video resolution we want for the // videotestsrc and the cairooverlay element. -use gst::prelude::*; - -use pango::prelude::*; - -use std::ops; -use std::sync::{Arc, Mutex}; +use std::{ + ops, + sync::{Arc, Mutex}, +}; use anyhow::Error; use derive_more::{Display, Error}; +use gst::prelude::*; +use pango::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 1d024e60a..34e9e2645 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -9,10 +9,10 @@ // Much of the playbin's behavior can be controlled by so-called flags, as well // as the playbin's properties and signals. -use gst::prelude::*; - use std::env; +use gst::prelude::*; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/player.rs b/examples/src/bin/player.rs index 6974f686e..f44e5b860 100644 --- a/examples/src/bin/player.rs +++ b/examples/src/bin/player.rs @@ -5,12 +5,13 @@ // audio / subtitle streams or changing the volume) are all supported by simple // one-line function calls on the GstPlayer. -use gst::prelude::*; - -use std::env; -use std::sync::{Arc, Mutex}; +use std::{ + env, + sync::{Arc, Mutex}, +}; use anyhow::Error; +use gst::prelude::*; #[allow(unused_imports)] #[path = "../examples-common.rs"] diff --git a/examples/src/bin/queries.rs b/examples/src/bin/queries.rs index e9cd417d4..7a63bef19 100644 --- a/examples/src/bin/queries.rs +++ b/examples/src/bin/queries.rs @@ -12,10 +12,10 @@ // For convenience, the API has a set of pre-defined queries, but also // allows custom queries (which can be defined and used by your own elements). -use gst::prelude::*; - use std::env; +use gst::prelude::*; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/rtpfecclient.rs b/examples/src/bin/rtpfecclient.rs index a5c3e1f27..b8aa9ae78 100644 --- a/examples/src/bin/rtpfecclient.rs +++ b/examples/src/bin/rtpfecclient.rs @@ -1,8 +1,7 @@ -use gst::element_error; -use gst::prelude::*; - use std::env; +use gst::{element_error, prelude::*}; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/rtpfecserver.rs b/examples/src/bin/rtpfecserver.rs index a02ff1478..2fd963a1b 100644 --- a/examples/src/bin/rtpfecserver.rs +++ b/examples/src/bin/rtpfecserver.rs @@ -1,5 +1,4 @@ -use gst::element_error; -use gst::prelude::*; +use gst::{element_error, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/rtsp-server-record.rs b/examples/src/bin/rtsp-server-record.rs index 02c4ae022..f2a20109c 100644 --- a/examples/src/bin/rtsp-server-record.rs +++ b/examples/src/bin/rtsp-server-record.rs @@ -4,14 +4,12 @@ // send to the server. For this, the launch syntax pipeline, that is passed // to this example's cli is spawned and the client's media is streamed into it. -use std::env; -use std::ptr; - -use glib::translate::*; -use gst_rtsp_server::prelude::*; +use std::{env, ptr}; use anyhow::Error; use derive_more::{Display, Error}; +use glib::translate::*; +use gst_rtsp_server::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/rtsp-server-subclass.rs b/examples/src/bin/rtsp-server-subclass.rs index f484c586e..36f4f8300 100644 --- a/examples/src/bin/rtsp-server-subclass.rs +++ b/examples/src/bin/rtsp-server-subclass.rs @@ -8,10 +8,9 @@ // the client machinery and printing some status. #![allow(clippy::non_send_fields_in_send_ty)] -use gst_rtsp_server::prelude::*; - use anyhow::Error; use derive_more::{Display, Error}; +use gst_rtsp_server::prelude::*; #[path = "../examples-common.rs"] mod examples_common; @@ -81,10 +80,10 @@ fn main_loop() -> Result<(), Error> { // Our custom media factory that creates a media input manually mod media_factory { - use super::*; - use gst_rtsp_server::subclass::prelude::*; + use super::*; + // In the imp submodule we include the actual implementation mod imp { use super::*; @@ -211,10 +210,10 @@ mod media { // Our custom RTSP server subclass that reports when clients are connecting and uses // our custom RTSP client subclass for each client mod server { - use super::*; - use gst_rtsp_server::subclass::prelude::*; + use super::*; + // In the imp submodule we include the actual implementation mod imp { use super::*; diff --git a/examples/src/bin/rtsp-server.rs b/examples/src/bin/rtsp-server.rs index 5d8090388..384cb645f 100644 --- a/examples/src/bin/rtsp-server.rs +++ b/examples/src/bin/rtsp-server.rs @@ -5,10 +5,9 @@ use std::env; -use gst_rtsp_server::prelude::*; - use anyhow::Error; use derive_more::{Display, Error}; +use gst_rtsp_server::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/subclass.rs b/examples/src/bin/subclass.rs index 9c32c85f8..d328425d6 100644 --- a/examples/src/bin/subclass.rs +++ b/examples/src/bin/subclass.rs @@ -7,20 +7,17 @@ // coefficients are provided via Rust API on the filter as a Vec. #![allow(clippy::non_send_fields_in_send_ty)] -use gst::prelude::*; - use anyhow::Error; use derive_more::{Display, Error}; +use gst::prelude::*; #[path = "../examples-common.rs"] mod examples_common; // Our custom FIR filter element is defined in this module mod fir_filter { - use gst_base::subclass::prelude::*; - use byte_slice_cast::*; - + use gst_base::subclass::prelude::*; use once_cell::sync::Lazy; // The debug category we use below for our filter @@ -34,9 +31,9 @@ mod fir_filter { // In the imp submodule we include the actual implementation mod imp { + use std::{collections::VecDeque, sync::Mutex}; + use super::*; - use std::collections::VecDeque; - use std::sync::Mutex; // This is the private data of our filter #[derive(Default)] diff --git a/examples/src/bin/tagsetter.rs b/examples/src/bin/tagsetter.rs index fea739965..8dd71e71a 100644 --- a/examples/src/bin/tagsetter.rs +++ b/examples/src/bin/tagsetter.rs @@ -18,11 +18,9 @@ // (More modes of operation are possible, see: gst::TagMergeMode) // This merge-mode can also be supplied to any method that adds new tags. -use gst::prelude::*; - -use anyhow::anyhow; -use anyhow::Error; +use anyhow::{anyhow, Error}; use derive_more::{Display, Error}; +use gst::prelude::*; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/thumbnail.rs b/examples/src/bin/thumbnail.rs index 52d519050..fd0468af7 100644 --- a/examples/src/bin/thumbnail.rs +++ b/examples/src/bin/thumbnail.rs @@ -7,11 +7,9 @@ // with the correct stride from GStreamer to the image crate as GStreamer does not necessarily // produce tightly packed pixels, and in case of RGBx never. -use gst::element_error; -use gst::prelude::*; - use anyhow::Error; use derive_more::{Display, Error}; +use gst::{element_error, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/toc.rs b/examples/src/bin/toc.rs index 3edffb013..bef7dff50 100644 --- a/examples/src/bin/toc.rs +++ b/examples/src/bin/toc.rs @@ -9,10 +9,10 @@ // {filesrc} - {decodebin} - {queue} - {fakesink} // \- ... -use gst::prelude::*; - use std::env; +use gst::prelude::*; + #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/bin/transmux.rs b/examples/src/bin/transmux.rs index 535de3048..67c823545 100644 --- a/examples/src/bin/transmux.rs +++ b/examples/src/bin/transmux.rs @@ -17,13 +17,11 @@ // {src} - {typefind} - {demuxer} -| {multiqueue} - {matroskamux} - {filesink} // \-[video]-/ -use gst::element_error; -use gst::prelude::*; - use std::env; use anyhow::Error; use derive_more::{Display, Error}; +use gst::{element_error, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; diff --git a/examples/src/examples-common.rs b/examples/src/examples-common.rs index 48b7b42dd..6d0e801ae 100644 --- a/examples/src/examples-common.rs +++ b/examples/src/examples-common.rs @@ -17,10 +17,10 @@ pub fn run T + Send + 'static>(main: F) -> T where T: Send + 'static, { - use cocoa::appkit::NSApplication; - use std::thread; + use cocoa::appkit::NSApplication; + unsafe { let app = cocoa::appkit::NSApp(); let t = thread::spawn(|| { diff --git a/examples/src/glupload.rs b/examples/src/glupload.rs index 0a4d7a61e..c75f51746 100644 --- a/examples/src/glupload.rs +++ b/examples/src/glupload.rs @@ -4,17 +4,12 @@ // {videotestsrc} - { glsinkbin } -use gst::element_error; - -use gst_gl::prelude::*; - -use std::ffi::CStr; -use std::mem; -use std::ptr; -use std::sync; +use std::{ffi::CStr, mem, ptr, sync}; use anyhow::Error; use derive_more::{Display, Error}; +use gst::element_error; +use gst_gl::prelude::*; #[derive(Debug, Display, Error)] #[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] @@ -343,10 +338,9 @@ impl App { let shared_context: gst_gl::GLContext; if cfg!(target_os = "linux") { - use glutin::platform::unix::RawHandle; #[cfg(any(feature = "gst-gl-x11", feature = "gst-gl-wayland"))] use glutin::platform::unix::WindowExtUnix; - use glutin::platform::ContextTraitExt; + use glutin::platform::{unix::RawHandle, ContextTraitExt}; let api = App::map_gl_api(windowed_context.get_api()); diff --git a/gstreamer-allocators/src/caps_features.rs b/gstreamer-allocators/src/caps_features.rs index a4697d8cb..67eb19c2e 100644 --- a/gstreamer-allocators/src/caps_features.rs +++ b/gstreamer-allocators/src/caps_features.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. use gst::CapsFeatures; - use once_cell::sync::Lazy; pub static CAPS_FEATURES_MEMORY_DMABUF: Lazy = diff --git a/gstreamer-allocators/src/dma_buf_allocator.rs b/gstreamer-allocators/src/dma_buf_allocator.rs index 34a9f83ef..9333c5ad9 100644 --- a/gstreamer-allocators/src/dma_buf_allocator.rs +++ b/gstreamer-allocators/src/dma_buf_allocator.rs @@ -4,7 +4,6 @@ use std::{ }; use glib::{translate::*, Cast}; - use gst::{Memory, MemoryRef}; #[cfg(any(feature = "v1_16", feature = "dox"))] diff --git a/gstreamer-allocators/src/fd_allocator.rs b/gstreamer-allocators/src/fd_allocator.rs index f3934535d..be6679ec6 100644 --- a/gstreamer-allocators/src/fd_allocator.rs +++ b/gstreamer-allocators/src/fd_allocator.rs @@ -1,7 +1,6 @@ use std::{fmt, os::unix::prelude::RawFd}; use glib::{translate::*, Cast}; - use gst::{Memory, MemoryRef}; use crate::{FdAllocator, FdMemoryFlags}; diff --git a/gstreamer-allocators/src/phys_memory.rs b/gstreamer-allocators/src/phys_memory.rs index 8d34a1e39..cd277ecbc 100644 --- a/gstreamer-allocators/src/phys_memory.rs +++ b/gstreamer-allocators/src/phys_memory.rs @@ -1,7 +1,6 @@ use std::fmt; use glib::translate::*; - use gst::{Memory, MemoryRef}; gst::memory_object_wrapper!( diff --git a/gstreamer-app/src/app_sink.rs b/gstreamer-app/src/app_sink.rs index be1dea64b..4c4e38f9f 100644 --- a/gstreamer-app/src/app_sink.rs +++ b/gstreamer-app/src/app_sink.rs @@ -1,23 +1,21 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::AppSink; -use glib::ffi::gpointer; -use glib::prelude::*; -use glib::translate::*; -use std::mem; -use std::panic; -use std::ptr; -use std::sync::atomic::{AtomicBool, Ordering}; - -use { - futures_core::Stream, - std::{ - pin::Pin, - sync::{Arc, Mutex}, - task::{Context, Poll, Waker}, +use std::{ + mem, panic, + pin::Pin, + ptr, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, Mutex, }, + task::{Context, Poll, Waker}, }; +use futures_core::Stream; +use glib::{ffi::gpointer, prelude::*, translate::*}; + +use crate::AppSink; + #[allow(clippy::type_complexity)] pub struct AppSinkCallbacks { eos: Option>, @@ -1205,10 +1203,11 @@ impl Stream for AppSinkStream { #[cfg(test)] mod tests { - use super::*; use futures_util::StreamExt; use gst::prelude::*; + use super::*; + #[test] fn test_app_sink_stream() { gst::init().unwrap(); diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 7169a5eca..f06ee131d 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -1,18 +1,24 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{ + mem, panic, + pin::Pin, + ptr, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, Mutex, + }, + task::{Context, Poll, Waker}, +}; + use futures_sink::Sink; -use glib::ffi::{gboolean, gpointer}; -use glib::prelude::*; -use glib::translate::*; +use glib::{ + ffi::{gboolean, gpointer}, + prelude::*, + translate::*, +}; use crate::AppSrc; -use std::mem; -use std::panic; -use std::pin::Pin; -use std::ptr; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Arc, Mutex}; -use std::task::{Context, Poll, Waker}; #[allow(clippy::type_complexity)] pub struct AppSrcCallbacks { @@ -678,10 +684,12 @@ impl Sink for AppSrcSink { #[cfg(test)] mod tests { - use super::*; + use std::sync::atomic::{AtomicUsize, Ordering}; + use futures_util::{sink::SinkExt, stream::StreamExt}; use gst::prelude::*; - use std::sync::atomic::{AtomicUsize, Ordering}; + + use super::*; #[test] fn test_app_src_sink() { diff --git a/gstreamer-audio/src/audio_aggregator.rs b/gstreamer-audio/src/audio_aggregator.rs index 145f92d4b..ab931237a 100644 --- a/gstreamer-audio/src/audio_aggregator.rs +++ b/gstreamer-audio/src/audio_aggregator.rs @@ -1,15 +1,14 @@ -use crate::auto::AudioAggregator; -use crate::auto::AudioAggregatorPad; -#[cfg(any(feature = "v1_18", feature = "dox"))] -use glib::object::Cast; -use glib::object::IsA; -#[cfg(any(feature = "v1_18", feature = "dox"))] -use glib::signal::{connect_raw, SignalHandlerId}; -use glib::translate::*; - #[cfg(any(feature = "v1_18", feature = "dox"))] use std::mem::transmute; +#[cfg(any(feature = "v1_18", feature = "dox"))] +use glib::object::Cast; +#[cfg(any(feature = "v1_18", feature = "dox"))] +use glib::signal::{connect_raw, SignalHandlerId}; +use glib::{object::IsA, translate::*}; + +use crate::auto::{AudioAggregator, AudioAggregatorPad}; + pub trait AudioAggregatorExtManual: 'static { #[doc(alias = "gst_audio_aggregator_set_sink_caps")] fn set_sink_caps(&self, pad: &impl IsA, caps: &gst::CapsRef); diff --git a/gstreamer-audio/src/audio_aggregator_convert_pad.rs b/gstreamer-audio/src/audio_aggregator_convert_pad.rs index 1ff8a3314..63fd0d149 100644 --- a/gstreamer-audio/src/audio_aggregator_convert_pad.rs +++ b/gstreamer-audio/src/audio_aggregator_convert_pad.rs @@ -1,11 +1,14 @@ -use crate::auto::AudioAggregatorConvertPad; -use glib::object::IsA; -use glib::signal::{connect_raw, SignalHandlerId}; -use glib::translate::*; -use glib::Cast; - use std::mem::transmute; +use glib::{ + object::IsA, + signal::{connect_raw, SignalHandlerId}, + translate::*, + Cast, +}; + +use crate::auto::AudioAggregatorConvertPad; + pub trait AudioAggregatorConvertPadExtManual: 'static { #[doc(alias = "converter-config")] fn converter_config(&self) -> Option; diff --git a/gstreamer-audio/src/audio_aggregator_pad.rs b/gstreamer-audio/src/audio_aggregator_pad.rs index 9a050ff42..a6ee20753 100644 --- a/gstreamer-audio/src/audio_aggregator_pad.rs +++ b/gstreamer-audio/src/audio_aggregator_pad.rs @@ -1,6 +1,6 @@ +use glib::{object::IsA, translate::*}; + use crate::auto::AudioAggregatorPad; -use glib::object::IsA; -use glib::translate::*; pub trait AudioAggregatorPadExtManual: 'static { fn audio_info(&self) -> Option; diff --git a/gstreamer-audio/src/audio_buffer.rs b/gstreamer-audio/src/audio_buffer.rs index d7c03b9d7..8302ab4ab 100644 --- a/gstreamer-audio/src/audio_buffer.rs +++ b/gstreamer-audio/src/audio_buffer.rs @@ -1,13 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, Borrowed, FromGlibPtrNone, ToGlibPtr}; +use std::{fmt, marker::PhantomData, mem, ops, ptr, slice}; -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ops; -use std::ptr; -use std::slice; +use glib::translate::{from_glib, Borrowed, FromGlibPtrNone, ToGlibPtr}; pub enum Readable {} pub enum Writable {} diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index 425cfb89b..7ac019db9 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -1,11 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::AudioChannelPosition; - use std::mem; use glib::translate::{from_glib, IntoGlib}; +use crate::AudioChannelPosition; + impl AudioChannelPosition { pub fn to_mask(self) -> u64 { let pos = self.into_glib(); diff --git a/gstreamer-audio/src/audio_converter.rs b/gstreamer-audio/src/audio_converter.rs index 7c037f5f5..f892c9d22 100644 --- a/gstreamer-audio/src/audio_converter.rs +++ b/gstreamer-audio/src/audio_converter.rs @@ -1,9 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; - use std::ops; +use glib::prelude::*; + #[derive(Debug, Clone, PartialEq, Eq)] pub struct AudioConverterConfig(gst::Structure); diff --git a/gstreamer-audio/src/audio_decoder.rs b/gstreamer-audio/src/audio_decoder.rs index 8d8bb4381..811fa21e7 100644 --- a/gstreamer-audio/src/audio_decoder.rs +++ b/gstreamer-audio/src/audio_decoder.rs @@ -1,11 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::AudioDecoder; -use crate::AudioInfo; -use glib::prelude::*; -use glib::translate::*; -use std::mem; -use std::ptr; +use std::{mem, ptr}; + +use glib::{prelude::*, translate::*}; + +use crate::{AudioDecoder, AudioInfo}; extern "C" { fn _gst_audio_decoder_error( diff --git a/gstreamer-audio/src/audio_encoder.rs b/gstreamer-audio/src/audio_encoder.rs index f9bb5c8fd..d14ced233 100644 --- a/gstreamer-audio/src/audio_encoder.rs +++ b/gstreamer-audio/src/audio_encoder.rs @@ -1,10 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{mem, ptr}; + +use glib::{prelude::*, translate::*}; + use crate::AudioEncoder; -use glib::prelude::*; -use glib::translate::*; -use std::mem; -use std::ptr; pub trait AudioEncoderExtManual: 'static { #[doc(alias = "gst_audio_encoder_finish_frame")] diff --git a/gstreamer-audio/src/audio_format.rs b/gstreamer-audio/src/audio_format.rs index 2d4b8513f..301d17233 100644 --- a/gstreamer-audio/src/audio_format.rs +++ b/gstreamer-audio/src/audio_format.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::str; +use std::{ffi::CStr, str}; use glib::translate::{from_glib, IntoGlib}; - use once_cell::sync::Lazy; #[cfg(feature = "v1_18")] diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index 260c69c48..b9ce88d04 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -1,13 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::cmp::Ordering; -use std::ffi::CStr; -use std::fmt; -use std::marker::PhantomData; -use std::str; +use std::{cmp::Ordering, ffi::CStr, fmt, marker::PhantomData, str}; -use glib::translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut}; -use glib::StaticType; +use glib::{ + translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut}, + StaticType, +}; #[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)] pub enum AudioEndianness { diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index 4c6aed448..4ee2faaba 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -1,15 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{fmt, marker::PhantomData, mem, ptr}; + use glib::translate::{ from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr, ToGlibPtrMut, }; use gst::prelude::*; -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ptr; - #[doc(alias = "GstAudioInfo")] pub struct AudioInfo(ffi::GstAudioInfo, [crate::AudioChannelPosition; 64]); diff --git a/gstreamer-audio/src/audio_ring_buffer_spec.rs b/gstreamer-audio/src/audio_ring_buffer_spec.rs index 5beca1e2a..37134fc89 100644 --- a/gstreamer-audio/src/audio_ring_buffer_spec.rs +++ b/gstreamer-audio/src/audio_ring_buffer_spec.rs @@ -1,13 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::ffi::GstAudioRingBufferSpec; +use std::fmt; + use glib::translate::*; use gst::Caps; -use crate::AudioInfo; -use crate::AudioRingBufferFormatType; - -use std::fmt; +use crate::{ffi::GstAudioRingBufferSpec, AudioInfo, AudioRingBufferFormatType}; #[repr(transparent)] pub struct AudioRingBufferSpec(pub(crate) GstAudioRingBufferSpec); diff --git a/gstreamer-audio/src/audio_stream_align.rs b/gstreamer-audio/src/audio_stream_align.rs index a4d7b5898..af82ac6ca 100644 --- a/gstreamer-audio/src/audio_stream_align.rs +++ b/gstreamer-audio/src/audio_stream_align.rs @@ -1,9 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::AudioStreamAlign; +use std::mem; use glib::translate::*; -use std::mem; + +use crate::AudioStreamAlign; impl AudioStreamAlign { #[doc(alias = "gst_audio_stream_align_process")] diff --git a/gstreamer-audio/src/caps.rs b/gstreamer-audio/src/caps.rs index a8c866b04..bf4b33094 100644 --- a/gstreamer-audio/src/caps.rs +++ b/gstreamer-audio/src/caps.rs @@ -1,7 +1,8 @@ -use crate::{AudioFormat, AudioLayout}; +use std::ops::{Bound::*, RangeBounds}; + use gst::Caps; -use std::ops::Bound::*; -use std::ops::RangeBounds; + +use crate::{AudioFormat, AudioLayout}; pub struct AudioCapsBuilder { builder: gst::caps::Builder, diff --git a/gstreamer-audio/src/flag_serde.rs b/gstreamer-audio/src/flag_serde.rs index 8500d43d8..ef5603ee4 100644 --- a/gstreamer-audio/src/flag_serde.rs +++ b/gstreamer-audio/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::AudioFlags); diff --git a/gstreamer-audio/src/functions.rs b/gstreamer-audio/src/functions.rs index 8811ef7a4..bcd5b90c8 100644 --- a/gstreamer-audio/src/functions.rs +++ b/gstreamer-audio/src/functions.rs @@ -1,9 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib_full, IntoGlibPtr, ToGlibPtr}; - use std::i32; +use glib::translate::{from_glib_full, IntoGlibPtr, ToGlibPtr}; + #[doc(alias = "gst_audio_buffer_clip")] pub fn audio_buffer_clip( buffer: gst::Buffer, diff --git a/gstreamer-audio/src/lib.rs b/gstreamer-audio/src/lib.rs index 7fbaf807d..ec47b4222 100644 --- a/gstreamer-audio/src/lib.rs +++ b/gstreamer-audio/src/lib.rs @@ -81,14 +81,13 @@ pub mod prelude { #[doc(hidden)] pub use gst_base::prelude::*; - pub use super::audio_decoder::AudioDecoderExtManual; - pub use super::audio_encoder::AudioEncoderExtManual; - pub use crate::audio_aggregator::AudioAggregatorExtManual; - pub use crate::audio_aggregator_convert_pad::AudioAggregatorConvertPadExtManual; - pub use crate::audio_aggregator_pad::AudioAggregatorPadExtManual; - pub use crate::audio_format::AudioFormatIteratorExt; - - pub use crate::auto::traits::*; + pub use super::{audio_decoder::AudioDecoderExtManual, audio_encoder::AudioEncoderExtManual}; + pub use crate::{ + audio_aggregator::AudioAggregatorExtManual, + audio_aggregator_convert_pad::AudioAggregatorConvertPadExtManual, + audio_aggregator_pad::AudioAggregatorPadExtManual, audio_format::AudioFormatIteratorExt, + auto::traits::*, + }; } pub mod subclass; diff --git a/gstreamer-audio/src/subclass/audio_aggregator.rs b/gstreamer-audio/src/subclass/audio_aggregator.rs index 892d0f10f..abb838e1c 100644 --- a/gstreamer-audio/src/subclass/audio_aggregator.rs +++ b/gstreamer-audio/src/subclass/audio_aggregator.rs @@ -1,14 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; - -use gst_base::prelude::*; -use gst_base::subclass::prelude::*; - use std::ptr; -use crate::AudioAggregator; -use crate::AudioAggregatorPad; +use glib::translate::*; +use gst_base::{prelude::*, subclass::prelude::*}; + +use crate::{AudioAggregator, AudioAggregatorPad}; pub trait AudioAggregatorImpl: AudioAggregatorImplExt + AggregatorImpl { fn create_output_buffer(&self, num_frames: u32) -> Option { diff --git a/gstreamer-audio/src/subclass/audio_aggregator_pad.rs b/gstreamer-audio/src/subclass/audio_aggregator_pad.rs index 421552515..01b5ce693 100644 --- a/gstreamer-audio/src/subclass/audio_aggregator_pad.rs +++ b/gstreamer-audio/src/subclass/audio_aggregator_pad.rs @@ -1,12 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; - -use gst_base::prelude::*; -use gst_base::subclass::prelude::*; - use std::ptr; +use glib::translate::*; +use gst_base::{prelude::*, subclass::prelude::*}; + use crate::AudioAggregatorPad; pub trait AudioAggregatorPadImpl: AudioAggregatorPadImplExt + AggregatorPadImpl { diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index 672a9250e..f464e0bc2 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -1,15 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; +use std::{mem, ptr}; +use glib::translate::*; use gst::subclass::prelude::*; -use std::mem; -use std::ptr; - -use crate::prelude::*; - -use crate::AudioDecoder; +use crate::{prelude::*, AudioDecoder}; pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl { fn open(&self) -> Result<(), gst::ErrorMessage> { diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index 1660a64ff..3a6bb47fb 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -1,15 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; - -use gst::subclass::prelude::*; - use std::ptr; -use crate::prelude::*; +use glib::translate::*; +use gst::subclass::prelude::*; -use crate::AudioEncoder; -use crate::AudioInfo; +use crate::{prelude::*, AudioEncoder, AudioInfo}; pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl { fn open(&self) -> Result<(), gst::ErrorMessage> { diff --git a/gstreamer-audio/src/subclass/audio_filter.rs b/gstreamer-audio/src/subclass/audio_filter.rs index fab261ceb..c03de3b38 100644 --- a/gstreamer-audio/src/subclass/audio_filter.rs +++ b/gstreamer-audio/src/subclass/audio_filter.rs @@ -1,12 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; +use gst_base::{prelude::*, subclass::prelude::*}; -use gst_base::prelude::*; -use gst_base::subclass::prelude::*; - -use crate::AudioFilter; -use crate::AudioInfo; +use crate::{AudioFilter, AudioInfo}; pub trait AudioFilterImpl: AudioFilterImplExt + BaseTransformImpl { fn allowed_caps() -> &'static gst::Caps; diff --git a/gstreamer-audio/src/subclass/audio_sink.rs b/gstreamer-audio/src/subclass/audio_sink.rs index ea3334ac3..49b6f7599 100644 --- a/gstreamer-audio/src/subclass/audio_sink.rs +++ b/gstreamer-audio/src/subclass/audio_sink.rs @@ -1,14 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - -use super::prelude::*; +use glib::{prelude::*, translate::*}; use gst::LoggableError; use gst_base::subclass::prelude::*; -use crate::AudioRingBufferSpec; -use crate::AudioSink; +use super::prelude::*; +use crate::{AudioRingBufferSpec, AudioSink}; pub trait AudioSinkImpl: AudioSinkImplExt + AudioBaseSinkImpl { fn close(&self) -> Result<(), LoggableError> { diff --git a/gstreamer-audio/src/subclass/audio_src.rs b/gstreamer-audio/src/subclass/audio_src.rs index 06058ad78..112f7be3c 100644 --- a/gstreamer-audio/src/subclass/audio_src.rs +++ b/gstreamer-audio/src/subclass/audio_src.rs @@ -2,15 +2,12 @@ use std::mem; -use glib::prelude::*; -use glib::translate::*; - -use super::prelude::*; +use glib::{prelude::*, translate::*}; use gst::LoggableError; use gst_base::subclass::prelude::*; -use crate::AudioRingBufferSpec; -use crate::AudioSrc; +use super::prelude::*; +use crate::{AudioRingBufferSpec, AudioSrc}; pub trait AudioSrcImpl: AudioSrcImplExt + AudioBaseSrcImpl { fn close(&self) -> Result<(), LoggableError> { diff --git a/gstreamer-audio/src/subclass/mod.rs b/gstreamer-audio/src/subclass/mod.rs index df1efdd25..9e7220d90 100644 --- a/gstreamer-audio/src/subclass/mod.rs +++ b/gstreamer-audio/src/subclass/mod.rs @@ -17,14 +17,16 @@ pub mod prelude { #[doc(hidden)] pub use gst_base::subclass::prelude::*; - pub use super::audio_aggregator::{AudioAggregatorImpl, AudioAggregatorImplExt}; - pub use super::audio_aggregator_convert_pad::AudioAggregatorConvertPadImpl; - pub use super::audio_aggregator_pad::{AudioAggregatorPadImpl, AudioAggregatorPadImplExt}; - pub use super::audio_base_sink::AudioBaseSinkImpl; - pub use super::audio_base_src::AudioBaseSrcImpl; - pub use super::audio_decoder::{AudioDecoderImpl, AudioDecoderImplExt}; - pub use super::audio_encoder::{AudioEncoderImpl, AudioEncoderImplExt}; - pub use super::audio_filter::{AudioFilterImpl, AudioFilterImplExt}; - pub use super::audio_sink::{AudioSinkImpl, AudioSinkImplExt}; - pub use super::audio_src::{AudioSrcImpl, AudioSrcImplExt}; + pub use super::{ + audio_aggregator::{AudioAggregatorImpl, AudioAggregatorImplExt}, + audio_aggregator_convert_pad::AudioAggregatorConvertPadImpl, + audio_aggregator_pad::{AudioAggregatorPadImpl, AudioAggregatorPadImplExt}, + audio_base_sink::AudioBaseSinkImpl, + audio_base_src::AudioBaseSrcImpl, + audio_decoder::{AudioDecoderImpl, AudioDecoderImplExt}, + audio_encoder::{AudioEncoderImpl, AudioEncoderImplExt}, + audio_filter::{AudioFilterImpl, AudioFilterImplExt}, + audio_sink::{AudioSinkImpl, AudioSinkImplExt}, + audio_src::{AudioSrcImpl, AudioSrcImplExt}, + }; } diff --git a/gstreamer-base/src/adapter.rs b/gstreamer-base/src/adapter.rs index 06bab7f19..ceaeb1482 100644 --- a/gstreamer-base/src/adapter.rs +++ b/gstreamer-base/src/adapter.rs @@ -1,10 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Adapter; +use std::{io, mem, ops}; + use glib::translate::*; -use std::io; -use std::mem; -use std::ops; + +use crate::Adapter; impl Adapter { #[doc(alias = "gst_adapter_copy")] diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index e3f6561b2..1f00239e6 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -1,20 +1,20 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Aggregator; -use glib::prelude::*; -#[cfg(any(feature = "v1_16", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] -use glib::signal::{connect_raw, SignalHandlerId}; -use glib::translate::*; -use gst::format::FormattedValue; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use std::boxed::Box as Box_; -use std::mem; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use std::mem::transmute; -use std::ptr; +use std::{mem, ptr}; + +#[cfg(any(feature = "v1_16", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] +use glib::signal::{connect_raw, SignalHandlerId}; +use glib::{prelude::*, translate::*}; +use gst::format::FormattedValue; + +use crate::Aggregator; pub trait AggregatorExtManual: 'static { #[doc(alias = "get_allocator")] diff --git a/gstreamer-base/src/aggregator_pad.rs b/gstreamer-base/src/aggregator_pad.rs index 6f2d8af89..9fde7ebd8 100644 --- a/gstreamer-base/src/aggregator_pad.rs +++ b/gstreamer-base/src/aggregator_pad.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::{prelude::*, translate::*}; + use crate::AggregatorPad; -use glib::prelude::*; -use glib::translate::*; pub trait AggregatorPadExtManual: 'static { #[doc(alias = "get_segment")] diff --git a/gstreamer-base/src/base_parse.rs b/gstreamer-base/src/base_parse.rs index c76c67e7e..d327d9d71 100644 --- a/gstreamer-base/src/base_parse.rs +++ b/gstreamer-base/src/base_parse.rs @@ -1,12 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::BaseParse; -use crate::BaseParseFrame; -use glib::prelude::*; -use glib::translate::*; -use gst::format::{FormattedValue, SpecificFormattedValueFullRange}; use std::mem; +use glib::{prelude::*, translate::*}; +use gst::format::{FormattedValue, SpecificFormattedValueFullRange}; + +use crate::{BaseParse, BaseParseFrame}; + pub trait BaseParseExtManual: 'static { #[doc(alias = "get_sink_pad")] fn sink_pad(&self) -> &gst::Pad; diff --git a/gstreamer-base/src/base_parse_frame.rs b/gstreamer-base/src/base_parse_frame.rs index c367d006b..1cd1e9547 100644 --- a/gstreamer-base/src/base_parse_frame.rs +++ b/gstreamer-base/src/base_parse_frame.rs @@ -1,12 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; -use std::fmt; -use std::marker::PhantomData; -use std::ptr; +use std::{fmt, marker::PhantomData, ptr}; -use crate::BaseParse; -use crate::BaseParseFrameFlags; +use glib::translate::*; + +use crate::{BaseParse, BaseParseFrameFlags}; pub struct BaseParseFrame<'a>( ptr::NonNull, diff --git a/gstreamer-base/src/base_sink.rs b/gstreamer-base/src/base_sink.rs index 433e34762..111d59396 100644 --- a/gstreamer-base/src/base_sink.rs +++ b/gstreamer-base/src/base_sink.rs @@ -1,10 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::BaseSink; -use glib::prelude::*; -use glib::translate::*; use std::mem; +use glib::{prelude::*, translate::*}; + +use crate::BaseSink; + pub trait BaseSinkExtManual: 'static { #[doc(alias = "get_segment")] fn segment(&self) -> gst::Segment; diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index e62f3f500..eeffdafee 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; -use std::mem; -use std::ptr; +use std::{mem, ptr}; + +use glib::{prelude::*, translate::*}; use crate::BaseSrc; diff --git a/gstreamer-base/src/base_transform.rs b/gstreamer-base/src/base_transform.rs index a072a414f..704394cba 100644 --- a/gstreamer-base/src/base_transform.rs +++ b/gstreamer-base/src/base_transform.rs @@ -1,10 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{mem, ptr}; + +use glib::{prelude::*, translate::*}; + use crate::BaseTransform; -use glib::prelude::*; -use glib::translate::*; -use std::mem; -use std::ptr; pub trait BaseTransformExtManual: 'static { #[doc(alias = "get_allocator")] diff --git a/gstreamer-base/src/flow_combiner.rs b/gstreamer-base/src/flow_combiner.rs index 61dfb45fc..fdccc2be1 100644 --- a/gstreamer-base/src/flow_combiner.rs +++ b/gstreamer-base/src/flow_combiner.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/gstreamer-base/src/functions.rs b/gstreamer-base/src/functions.rs index 751c6eb6a..639c8008a 100644 --- a/gstreamer-base/src/functions.rs +++ b/gstreamer-base/src/functions.rs @@ -1,9 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; use std::mem; +use glib::{prelude::*, translate::*}; + #[doc(alias = "gst_type_find_helper_for_data")] pub fn type_find_helper_for_data( obj: Option<&impl IsA>, diff --git a/gstreamer-base/src/lib.rs b/gstreamer-base/src/lib.rs index bfe8b964f..e2a168b6e 100644 --- a/gstreamer-base/src/lib.rs +++ b/gstreamer-base/src/lib.rs @@ -33,8 +33,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::use_self)] #[allow(unused_imports)] mod auto; -pub use crate::auto::functions::*; -pub use crate::auto::*; +pub use crate::auto::{functions::*, *}; pub mod functions; pub use crate::functions::*; @@ -63,13 +62,11 @@ pub mod prelude { #[doc(hidden)] pub use gst::prelude::*; - pub use crate::aggregator::AggregatorExtManual; - pub use crate::aggregator_pad::AggregatorPadExtManual; - pub use crate::auto::traits::*; - pub use crate::base_parse::BaseParseExtManual; - pub use crate::base_sink::BaseSinkExtManual; - pub use crate::base_src::BaseSrcExtManual; - pub use crate::base_transform::BaseTransformExtManual; + pub use crate::{ + aggregator::AggregatorExtManual, aggregator_pad::AggregatorPadExtManual, auto::traits::*, + base_parse::BaseParseExtManual, base_sink::BaseSinkExtManual, base_src::BaseSrcExtManual, + base_transform::BaseTransformExtManual, + }; } mod utils; diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index 2490dd05a..db29a543b 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -1,14 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - -use gst::subclass::prelude::*; - use std::ptr; -use crate::Aggregator; -use crate::AggregatorPad; +use glib::{prelude::*, translate::*}; +use gst::subclass::prelude::*; + +use crate::{Aggregator, AggregatorPad}; pub trait AggregatorImpl: AggregatorImplExt + ElementImpl { fn flush(&self) -> Result { diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index 22796f538..ca7c9f0f3 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -1,12 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - +use glib::{prelude::*, translate::*}; use gst::subclass::prelude::*; -use crate::Aggregator; -use crate::AggregatorPad; +use crate::{Aggregator, AggregatorPad}; pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl { fn flush(&self, aggregator: &Aggregator) -> Result { diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index a7bbe2aed..dd9ede2cd 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -2,13 +2,10 @@ use std::mem; -use crate::prelude::*; - use glib::translate::*; use gst::subclass::prelude::*; -use crate::BaseParse; -use crate::BaseParseFrame; +use crate::{prelude::*, BaseParse, BaseParseFrame}; pub trait BaseParseImpl: BaseParseImplExt + ElementImpl { fn start(&self) -> Result<(), gst::ErrorMessage> { diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index c607d7e5b..416b6229b 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -1,12 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - -use gst::subclass::prelude::*; - use std::ptr; +use glib::{prelude::*, translate::*}; +use gst::subclass::prelude::*; + use crate::BaseSink; pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl { diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 8cf0392d0..fe94f73a7 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -1,18 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - -use gst::prelude::*; -use gst::subclass::prelude::*; - -use std::mem; -use std::ptr; +use std::{mem, ptr}; use atomic_refcell::AtomicRefCell; +use glib::{prelude::*, translate::*}; +use gst::{prelude::*, subclass::prelude::*}; -use crate::prelude::BaseSrcExtManual; -use crate::BaseSrc; +use crate::{prelude::BaseSrcExtManual, BaseSrc}; #[derive(Default)] pub(super) struct InstanceData { diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index cfe13f9bd..7e769ef9f 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -1,15 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::prelude::*; +use std::{mem, ptr}; use glib::translate::*; - use gst::subclass::prelude::*; -use std::mem; -use std::ptr; - -use crate::BaseTransform; +use crate::{prelude::*, BaseTransform}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum BaseTransformMode { diff --git a/gstreamer-base/src/subclass/mod.rs b/gstreamer-base/src/subclass/mod.rs index 59f64b3c0..0747769ac 100644 --- a/gstreamer-base/src/subclass/mod.rs +++ b/gstreamer-base/src/subclass/mod.rs @@ -19,11 +19,13 @@ pub mod prelude { #[doc(hidden)] pub use gst::subclass::prelude::*; - pub use super::aggregator::{AggregatorImpl, AggregatorImplExt}; - pub use super::aggregator_pad::{AggregatorPadImpl, AggregatorPadImplExt}; - pub use super::base_parse::{BaseParseImpl, BaseParseImplExt}; - pub use super::base_sink::{BaseSinkImpl, BaseSinkImplExt}; - pub use super::base_src::{BaseSrcImpl, BaseSrcImplExt}; - pub use super::base_transform::{BaseTransformImpl, BaseTransformImplExt}; - pub use super::push_src::{PushSrcImpl, PushSrcImplExt}; + pub use super::{ + aggregator::{AggregatorImpl, AggregatorImplExt}, + aggregator_pad::{AggregatorPadImpl, AggregatorPadImplExt}, + base_parse::{BaseParseImpl, BaseParseImplExt}, + base_sink::{BaseSinkImpl, BaseSinkImplExt}, + base_src::{BaseSrcImpl, BaseSrcImplExt}, + base_transform::{BaseTransformImpl, BaseTransformImplExt}, + push_src::{PushSrcImpl, PushSrcImplExt}, + }; } diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index 37e701854..284483fd7 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -1,15 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; -use gst::prelude::*; - use std::ptr; +use glib::{prelude::*, subclass::prelude::*, translate::*}; +use gst::prelude::*; + use super::base_src::{BaseSrcImpl, CreateSuccess}; -use crate::prelude::BaseSrcExtManual; -use crate::PushSrc; +use crate::{prelude::BaseSrcExtManual, PushSrc}; pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl { fn fill(&self, buffer: &mut gst::BufferRef) -> Result { diff --git a/gstreamer-check/src/harness.rs b/gstreamer-check/src/harness.rs index bfcecd359..56debd0ff 100644 --- a/gstreamer-check/src/harness.rs +++ b/gstreamer-check/src/harness.rs @@ -1,13 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::TestClock; +use std::{marker::PhantomData, mem, ops, path, ptr}; + use glib::translate::*; use gst::prelude::*; -use std::marker::PhantomData; -use std::mem; -use std::ops; -use std::path; -use std::ptr; + +use crate::TestClock; #[derive(Debug)] #[doc(alias = "GstHarness")] diff --git a/gstreamer-check/src/test_clock.rs b/gstreamer-check/src/test_clock.rs index 13d96b471..9d206e104 100644 --- a/gstreamer-check/src/test_clock.rs +++ b/gstreamer-check/src/test_clock.rs @@ -1,9 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::TestClock; -use glib::translate::*; use std::ptr; +use glib::translate::*; + +use crate::TestClock; + impl TestClock { #[doc(alias = "gst_test_clock_has_id")] pub fn has_id(&self, id: &gst::ClockId) -> bool { diff --git a/gstreamer-editing-services/src/flag_serde.rs b/gstreamer-editing-services/src/flag_serde.rs index a49a65982..70ab8c765 100644 --- a/gstreamer-editing-services/src/flag_serde.rs +++ b/gstreamer-editing-services/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::MarkerFlags, "v1_20"); diff --git a/gstreamer-editing-services/src/lib.rs b/gstreamer-editing-services/src/lib.rs index 9cf0c9a1f..4f17414f0 100644 --- a/gstreamer-editing-services/src/lib.rs +++ b/gstreamer-editing-services/src/lib.rs @@ -5,17 +5,16 @@ #![allow(clippy::non_send_fields_in_send_ty)] #![doc = include_str!("../README.md")] +use std::sync::Once; + pub use ffi; pub use gio; pub use glib; +use glib::translate::from_glib; pub use gst; pub use gst_base; pub use gst_pbutils; -use std::sync::Once; - -use glib::translate::from_glib; - static GES_INIT: Once = Once::new(); #[doc(alias = "ges_init")] diff --git a/gstreamer-gl/egl/src/gl_display_egl.rs b/gstreamer-gl/egl/src/gl_display_egl.rs index cbd53ecce..5cc5ef769 100644 --- a/gstreamer-gl/egl/src/gl_display_egl.rs +++ b/gstreamer-gl/egl/src/gl_display_egl.rs @@ -6,12 +6,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use crate::GLDisplayEGL; -use glib::ffi::gpointer; -use glib::translate::*; +use glib::{ffi::gpointer, translate::*}; use gst_gl::GLDisplayType; use libc::uintptr_t; +use crate::GLDisplayEGL; + impl GLDisplayEGL { pub unsafe fn with_egl_display( display: uintptr_t, diff --git a/gstreamer-gl/src/caps_features.rs b/gstreamer-gl/src/caps_features.rs index f6a651e45..fc048637f 100644 --- a/gstreamer-gl/src/caps_features.rs +++ b/gstreamer-gl/src/caps_features.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. use gst::CapsFeatures; - use once_cell::sync::Lazy; pub static CAPS_FEATURES_MEMORY_GL_MEMORY: Lazy = diff --git a/gstreamer-gl/src/context.rs b/gstreamer-gl/src/context.rs index 697fa38f4..e686d92db 100644 --- a/gstreamer-gl/src/context.rs +++ b/gstreamer-gl/src/context.rs @@ -1,11 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::GLDisplay; -use glib::prelude::*; -use glib::translate::*; -use gst::ContextRef; use std::ptr; +use glib::{prelude::*, translate::*}; +use gst::ContextRef; + +use crate::GLDisplay; + pub trait ContextGLExt { #[doc(alias = "get_gl_display")] #[doc(alias = "gst_context_get_gl_display")] diff --git a/gstreamer-gl/src/flag_serde.rs b/gstreamer-gl/src/flag_serde.rs index 9a72df060..80f8ba127 100644 --- a/gstreamer-gl/src/flag_serde.rs +++ b/gstreamer-gl/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::GLAPI); diff --git a/gstreamer-gl/src/functions.rs b/gstreamer-gl/src/functions.rs index 7c92ac1cf..6e95a5314 100644 --- a/gstreamer-gl/src/functions.rs +++ b/gstreamer-gl/src/functions.rs @@ -1,9 +1,9 @@ -use crate::GLContext; -use crate::GLDisplay; -use glib::object::IsA; -use glib::translate::*; use std::ptr; +use glib::{object::IsA, translate::*}; + +use crate::{GLContext, GLDisplay}; + #[doc(alias = "gst_gl_handle_context_query")] pub fn gl_handle_context_query( element: &impl IsA, diff --git a/gstreamer-gl/src/gl_base_memory.rs b/gstreamer-gl/src/gl_base_memory.rs index 42ab36113..610114813 100644 --- a/gstreamer-gl/src/gl_base_memory.rs +++ b/gstreamer-gl/src/gl_base_memory.rs @@ -1,12 +1,8 @@ -use glib::prelude::*; -use glib::translate::*; -use gst::Memory; - -use crate::GLAllocationParams; -use crate::GLBaseMemoryAllocator; - use ffi::GstGLBaseMemory; -use gst::MemoryRef; +use glib::{prelude::*, translate::*}; +use gst::{Memory, MemoryRef}; + +use crate::{GLAllocationParams, GLBaseMemoryAllocator}; gst::memory_object_wrapper!( GLBaseMemory, diff --git a/gstreamer-gl/src/gl_context.rs b/gstreamer-gl/src/gl_context.rs index f3e0ba6bf..86d7fa0a8 100644 --- a/gstreamer-gl/src/gl_context.rs +++ b/gstreamer-gl/src/gl_context.rs @@ -1,13 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::GLContext; -use crate::GLDisplay; -use crate::GLPlatform; -use crate::GLAPI; -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; use libc::uintptr_t; +use crate::{GLContext, GLDisplay, GLPlatform, GLAPI}; + impl GLContext { pub unsafe fn new_wrapped>( display: &T, diff --git a/gstreamer-gl/src/gl_memory.rs b/gstreamer-gl/src/gl_memory.rs index b7fa022ee..75b5a3df0 100644 --- a/gstreamer-gl/src/gl_memory.rs +++ b/gstreamer-gl/src/gl_memory.rs @@ -1,13 +1,8 @@ -use glib::translate::*; - -use crate::GLBaseMemory; -use crate::GLBaseMemoryRef; -use crate::GLFormat; -use crate::GLTextureTarget; - use ffi::GstGLMemory; -use gst::{result_from_gboolean, LoggableError, CAT_RUST}; -use gst::{Memory, MemoryRef}; +use glib::translate::*; +use gst::{result_from_gboolean, LoggableError, Memory, MemoryRef, CAT_RUST}; + +use crate::{GLBaseMemory, GLBaseMemoryRef, GLFormat, GLTextureTarget}; gst::memory_object_wrapper!( GLMemory, diff --git a/gstreamer-gl/src/gl_memory_pbo.rs b/gstreamer-gl/src/gl_memory_pbo.rs index c6b75c9f4..aaa0dde2b 100644 --- a/gstreamer-gl/src/gl_memory_pbo.rs +++ b/gstreamer-gl/src/gl_memory_pbo.rs @@ -1,9 +1,8 @@ use ffi::GstGLMemoryPBO; - use glib::translate::*; +use gst::{Memory, MemoryRef}; use crate::{GLBaseMemory, GLBaseMemoryRef, GLMemory, GLMemoryRef}; -use gst::{Memory, MemoryRef}; gst::memory_object_wrapper!( GLMemoryPBO, diff --git a/gstreamer-gl/src/gl_video_frame.rs b/gstreamer-gl/src/gl_video_frame.rs index c30ba5852..761d62f5e 100644 --- a/gstreamer-gl/src/gl_video_frame.rs +++ b/gstreamer-gl/src/gl_video_frame.rs @@ -1,10 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::mem; + use glib::translate::{from_glib, ToGlibPtr}; use gst_video::video_frame::Readable; -use std::mem; - pub trait VideoFrameGLExt { fn from_buffer_readable_gl( buffer: gst::Buffer, diff --git a/gstreamer-gl/src/lib.rs b/gstreamer-gl/src/lib.rs index 0d067acc7..3f69dd2c4 100644 --- a/gstreamer-gl/src/lib.rs +++ b/gstreamer-gl/src/lib.rs @@ -34,8 +34,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::use_self)] #[allow(unused_imports)] mod auto; -pub use crate::auto::functions::*; -pub use crate::auto::*; +pub use crate::auto::{functions::*, *}; #[cfg(feature = "serde")] mod flag_serde; @@ -62,11 +61,10 @@ pub mod prelude { #[doc(hidden)] pub use gst_video::prelude::*; - pub use crate::auto::traits::*; - - pub use crate::context::ContextGLExt; - pub use crate::gl_context::GLContextExtManual; - pub use crate::gl_video_frame::VideoFrameGLExt; + pub use crate::{ + auto::traits::*, context::ContextGLExt, gl_context::GLContextExtManual, + gl_video_frame::VideoFrameGLExt, + }; } pub mod subclass; diff --git a/gstreamer-gl/src/subclass/gl_base_filter.rs b/gstreamer-gl/src/subclass/gl_base_filter.rs index a5ea3f832..08e7338a3 100644 --- a/gstreamer-gl/src/subclass/gl_base_filter.rs +++ b/gstreamer-gl/src/subclass/gl_base_filter.rs @@ -1,14 +1,9 @@ use ffi::GstGLBaseFilter; -use gst::ffi::GstCaps; - -use crate::prelude::*; - use glib::translate::*; - -use gst::{result_from_gboolean, Caps, LoggableError, CAT_RUST}; +use gst::{ffi::GstCaps, result_from_gboolean, Caps, LoggableError, CAT_RUST}; use gst_base::subclass::prelude::*; -use crate::GLBaseFilter; +use crate::{prelude::*, GLBaseFilter}; pub trait GLBaseFilterImpl: GLBaseFilterImplExt + BaseTransformImpl { fn gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> { diff --git a/gstreamer-gl/src/subclass/gl_base_src.rs b/gstreamer-gl/src/subclass/gl_base_src.rs index f84e4937c..313f68cf1 100644 --- a/gstreamer-gl/src/subclass/gl_base_src.rs +++ b/gstreamer-gl/src/subclass/gl_base_src.rs @@ -1,13 +1,9 @@ use ffi::{GstGLBaseSrc, GstGLMemory}; - -use crate::prelude::*; - use glib::translate::*; - use gst::{result_from_gboolean, LoggableError, CAT_RUST}; use gst_base::subclass::prelude::*; -use crate::{GLBaseSrc, GLMemory, GLAPI}; +use crate::{prelude::*, GLBaseSrc, GLMemory, GLAPI}; pub trait GLBaseSrcImpl: GLBaseSrcImplExt + PushSrcImpl { const SUPPORTED_GL_API: GLAPI; diff --git a/gstreamer-gl/src/subclass/gl_filter.rs b/gstreamer-gl/src/subclass/gl_filter.rs index 11b225bee..2368a7f0b 100644 --- a/gstreamer-gl/src/subclass/gl_filter.rs +++ b/gstreamer-gl/src/subclass/gl_filter.rs @@ -1,15 +1,11 @@ use ffi::{GstGLFilter, GstGLFilterClass, GstGLMemory}; -use gst::ffi::GstBuffer; +use glib::translate::*; +use gst::{ + ffi::GstBuffer, result_from_gboolean, Buffer, Caps, LoggableError, PadDirection, CAT_RUST, +}; use super::prelude::*; -use crate::prelude::*; - -use glib::translate::*; - -use gst::{result_from_gboolean, Buffer, Caps, LoggableError, PadDirection, CAT_RUST}; - -use crate::GLFilter; -use crate::GLMemory; +use crate::{prelude::*, GLFilter, GLMemory}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum GLFilterMode { diff --git a/gstreamer-gl/src/subclass/mod.rs b/gstreamer-gl/src/subclass/mod.rs index d12b1de16..232626f72 100644 --- a/gstreamer-gl/src/subclass/mod.rs +++ b/gstreamer-gl/src/subclass/mod.rs @@ -10,9 +10,11 @@ pub mod prelude { #[doc(hidden)] pub use gst_video::subclass::prelude::*; - pub use super::gl_base_filter::{GLBaseFilterImpl, GLBaseFilterImplExt}; #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] pub use super::gl_base_src::{GLBaseSrcImpl, GLBaseSrcImplExt}; - pub use super::gl_filter::{GLFilterImpl, GLFilterImplExt}; + pub use super::{ + gl_base_filter::{GLBaseFilterImpl, GLBaseFilterImplExt}, + gl_filter::{GLFilterImpl, GLFilterImplExt}, + }; } diff --git a/gstreamer-gl/wayland/src/gl_display_wayland.rs b/gstreamer-gl/wayland/src/gl_display_wayland.rs index 132bc80dd..2fbf67b77 100644 --- a/gstreamer-gl/wayland/src/gl_display_wayland.rs +++ b/gstreamer-gl/wayland/src/gl_display_wayland.rs @@ -6,11 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use crate::GLDisplayWayland; -use glib::ffi::gpointer; -use glib::translate::*; +use glib::{ffi::gpointer, translate::*}; use libc::uintptr_t; +use crate::GLDisplayWayland; + impl GLDisplayWayland { pub unsafe fn with_display( display: uintptr_t, diff --git a/gstreamer-gl/x11/src/gl_display_x11.rs b/gstreamer-gl/x11/src/gl_display_x11.rs index d517e780a..d5d8f7e89 100644 --- a/gstreamer-gl/x11/src/gl_display_x11.rs +++ b/gstreamer-gl/x11/src/gl_display_x11.rs @@ -6,11 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use crate::GLDisplayX11; -use glib::ffi::gpointer; -use glib::translate::*; +use glib::{ffi::gpointer, translate::*}; use libc::uintptr_t; +use crate::GLDisplayX11; + impl GLDisplayX11 { pub unsafe fn with_display(display: uintptr_t) -> Result { from_glib_full::<_, Option>(ffi::gst_gl_display_x11_new_with_display( diff --git a/gstreamer-mpegts/src/lib.rs b/gstreamer-mpegts/src/lib.rs index a83882989..965db2b0e 100644 --- a/gstreamer-mpegts/src/lib.rs +++ b/gstreamer-mpegts/src/lib.rs @@ -2,12 +2,12 @@ #![allow(clippy::missing_safety_doc)] #![allow(clippy::non_send_fields_in_send_ty)] +use std::sync::Once; + pub use ffi::*; pub use glib; pub use gst; -use std::sync::Once; - static MPEGTS_INIT: Once = Once::new(); macro_rules! assert_initialized_main_thread { diff --git a/gstreamer-net/src/lib.rs b/gstreamer-net/src/lib.rs index 9bac10558..a37528947 100644 --- a/gstreamer-net/src/lib.rs +++ b/gstreamer-net/src/lib.rs @@ -32,9 +32,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::use_self)] #[allow(unused_imports)] mod auto; -pub use crate::auto::*; - -pub use crate::net_address_meta::*; +pub use crate::{auto::*, net_address_meta::*}; mod net_address_meta; mod ptp_clock; diff --git a/gstreamer-net/src/net_address_meta.rs b/gstreamer-net/src/net_address_meta.rs index 1c94a7ddc..945de97e9 100644 --- a/gstreamer-net/src/net_address_meta.rs +++ b/gstreamer-net/src/net_address_meta.rs @@ -61,9 +61,10 @@ impl fmt::Debug for NetAddressMeta { #[cfg(test)] mod tests { - use super::*; use gio::prelude::*; + use super::*; + #[test] fn test_add_get_meta() { gst::init().unwrap(); diff --git a/gstreamer-net/src/ptp_clock.rs b/gstreamer-net/src/ptp_clock.rs index ef7337980..68aa96781 100644 --- a/gstreamer-net/src/ptp_clock.rs +++ b/gstreamer-net/src/ptp_clock.rs @@ -2,9 +2,10 @@ use std::num::NonZeroU64; -use crate::PtpClock; use glib::translate::*; +use crate::PtpClock; + impl PtpClock { // rustdoc-stripper-ignore-next /// Initialize GStreamer PTP clock support diff --git a/gstreamer-pbutils/src/audio_visualizer.rs b/gstreamer-pbutils/src/audio_visualizer.rs index 7d1ba4c47..9bb07d3ca 100644 --- a/gstreamer-pbutils/src/audio_visualizer.rs +++ b/gstreamer-pbutils/src/audio_visualizer.rs @@ -1,10 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::auto::AudioVisualizer; -use crate::subclass::AudioVisualizerSetupToken; use glib::object::IsA; use gst::prelude::*; +use crate::{auto::AudioVisualizer, subclass::AudioVisualizerSetupToken}; + pub trait AudioVisualizerExtManual: 'static { // rustdoc-stripper-ignore-next /// Returns the number of samples per frame required before calling the render method diff --git a/gstreamer-pbutils/src/discoverer.rs b/gstreamer-pbutils/src/discoverer.rs index cec984790..53df28a90 100644 --- a/gstreamer-pbutils/src/discoverer.rs +++ b/gstreamer-pbutils/src/discoverer.rs @@ -1,15 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{boxed::Box as Box_, mem::transmute}; + +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; + use crate::auto::Discoverer; -use glib::prelude::*; -use glib::signal::connect_raw; -use glib::signal::SignalHandlerId; -use glib::translate::*; - -use std::boxed::Box as Box_; -use std::mem::transmute; - impl Discoverer { pub fn set_timeout(&self, timeout: gst::ClockTime) { self.set_property("timeout", &timeout); diff --git a/gstreamer-pbutils/src/discoverer_stream_info.rs b/gstreamer-pbutils/src/discoverer_stream_info.rs index b3d697b8a..8f83fa3ba 100644 --- a/gstreamer-pbutils/src/discoverer_stream_info.rs +++ b/gstreamer-pbutils/src/discoverer_stream_info.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::prelude::*; -use crate::DiscovererStreamInfo; +use crate::{prelude::*, DiscovererStreamInfo}; #[derive(Debug)] pub struct Iter { diff --git a/gstreamer-pbutils/src/discoverer_video_info.rs b/gstreamer-pbutils/src/discoverer_video_info.rs index 5b03e3292..d5c48ce47 100644 --- a/gstreamer-pbutils/src/discoverer_video_info.rs +++ b/gstreamer-pbutils/src/discoverer_video_info.rs @@ -1,9 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::DiscovererVideoInfo; - use glib::translate::*; +use crate::DiscovererVideoInfo; + impl DiscovererVideoInfo { #[doc(alias = "get_framerate")] #[doc(alias = "gst_discoverer_video_info_get_framerate_num")] diff --git a/gstreamer-pbutils/src/element_properties.rs b/gstreamer-pbutils/src/element_properties.rs index bf4c68c53..4ab540e2d 100644 --- a/gstreamer-pbutils/src/element_properties.rs +++ b/gstreamer-pbutils/src/element_properties.rs @@ -1,7 +1,7 @@ -use gst::prelude::*; - use std::ops::{Deref, DerefMut}; +use gst::prelude::*; + // rustdoc-stripper-ignore-next /// Wrapper around `gst::Structure` for `element-properties` /// property of `EncodingProfile`. diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index 2b376497e..64c7017da 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -1,13 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - -use crate::auto::EncodingAudioProfile; -use crate::auto::EncodingContainerProfile; -use crate::auto::EncodingProfile; -use crate::auto::EncodingVideoProfile; +use glib::{prelude::*, translate::*}; +use crate::auto::{ + EncodingAudioProfile, EncodingContainerProfile, EncodingProfile, EncodingVideoProfile, +}; #[cfg(any(feature = "v1_20", feature = "dox"))] use crate::ElementProperties; @@ -609,9 +606,10 @@ impl<'a> EncodingContainerProfileBuilder<'a> { #[cfg(test)] mod tests { use super::*; - use crate::auto::EncodingContainerProfile; - use crate::auto::EncodingVideoProfile; - use crate::prelude::*; + use crate::{ + auto::{EncodingContainerProfile, EncodingVideoProfile}, + prelude::*, + }; const AUDIO_PROFILE_NAME: &str = "audio-profile"; const AUDIO_PROFILE_DESCRIPTION: &str = "audio-profile-description"; diff --git a/gstreamer-pbutils/src/flag_serde.rs b/gstreamer-pbutils/src/flag_serde.rs index b8345d06e..d75d5a7e5 100644 --- a/gstreamer-pbutils/src/flag_serde.rs +++ b/gstreamer-pbutils/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::DiscovererSerializeFlags); diff --git a/gstreamer-pbutils/src/functions.rs b/gstreamer-pbutils/src/functions.rs index 6f8f20246..5cd2fbcba 100644 --- a/gstreamer-pbutils/src/functions.rs +++ b/gstreamer-pbutils/src/functions.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; use std::{mem, ptr}; +use glib::translate::*; + pub unsafe trait CodecTag<'a>: gst::Tag<'a, TagType = &'a str> {} unsafe impl<'a> CodecTag<'a> for gst::tags::ContainerFormat {} diff --git a/gstreamer-pbutils/src/lib.rs b/gstreamer-pbutils/src/lib.rs index cc09e736e..ffc2709d9 100644 --- a/gstreamer-pbutils/src/lib.rs +++ b/gstreamer-pbutils/src/lib.rs @@ -5,12 +5,12 @@ #![allow(clippy::non_send_fields_in_send_ty)] #![doc = include_str!("../README.md")] +use std::sync::Once; + pub use ffi; pub use glib; pub use gst; -use std::sync::Once; - static PBUTILS_INIT: Once = Once::new(); macro_rules! assert_initialized_main_thread { @@ -40,8 +40,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::use_self)] #[allow(unused_imports)] mod auto; -pub use crate::auto::functions::*; -pub use crate::auto::*; +pub use crate::auto::{functions::*, *}; #[cfg(any(feature = "v1_20", feature = "dox"))] mod element_properties; @@ -72,11 +71,12 @@ pub mod prelude { #[doc(hidden)] pub use gst::prelude::*; - pub use crate::audio_visualizer::*; - pub use crate::auto::traits::*; - pub use crate::encoding_profile::{ - EncodingProfileBuilder, EncodingProfileExtManual, EncodingProfileHasRestrictionGetter, + pub use crate::{ + audio_visualizer::*, + auto::traits::*, + encoding_profile::{ + EncodingProfileBuilder, EncodingProfileExtManual, EncodingProfileHasRestrictionGetter, + }, + functions::CodecTag, }; - - pub use crate::functions::CodecTag; } diff --git a/gstreamer-pbutils/src/subclass/audio_visualizer.rs b/gstreamer-pbutils/src/subclass/audio_visualizer.rs index a0f601c03..5d4b1c1e4 100644 --- a/gstreamer-pbutils/src/subclass/audio_visualizer.rs +++ b/gstreamer-pbutils/src/subclass/audio_visualizer.rs @@ -1,9 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; -use gst::subclass::prelude::*; -use gst::{result_from_gboolean, LoggableError, CAT_RUST}; +use glib::{prelude::*, translate::*}; +use gst::{result_from_gboolean, subclass::prelude::*, LoggableError, CAT_RUST}; use crate::AudioVisualizer; diff --git a/gstreamer-play/src/config.rs b/gstreamer-play/src/config.rs index 0b6ede3c7..c27c2c07e 100644 --- a/gstreamer-play/src/config.rs +++ b/gstreamer-play/src/config.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; +use std::{mem, ops}; -use std::mem; -use std::ops; +use glib::translate::*; #[derive(Debug, Clone, PartialEq, Eq)] pub struct PlayConfig(gst::Structure); diff --git a/gstreamer-play/src/play.rs b/gstreamer-play/src/play.rs index 4aa57c258..b2e17992f 100644 --- a/gstreamer-play/src/play.rs +++ b/gstreamer-play/src/play.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Play; use glib::translate::*; +use crate::Play; + impl Play { #[doc(alias = "get_config")] #[doc(alias = "gst_play_get_config")] diff --git a/gstreamer-play/src/play_message.rs b/gstreamer-play/src/play_message.rs index 4a5528f2d..69416c5e7 100644 --- a/gstreamer-play/src/play_message.rs +++ b/gstreamer-play/src/play_message.rs @@ -1,5 +1,4 @@ -use crate::PlayMessageType; -use crate::{PlayMediaInfo, PlayState}; +use crate::{PlayMediaInfo, PlayMessageType, PlayState}; #[derive(Clone, PartialEq, Debug)] #[non_exhaustive] diff --git a/gstreamer-play/src/play_signal_adapter.rs b/gstreamer-play/src/play_signal_adapter.rs index 97b5b240b..feac372e6 100644 --- a/gstreamer-play/src/play_signal_adapter.rs +++ b/gstreamer-play/src/play_signal_adapter.rs @@ -1,12 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{boxed::Box as Box_, mem::transmute}; + +use glib::{ + signal::{connect_raw, SignalHandlerId}, + translate::*, + ObjectType, +}; + use crate::PlaySignalAdapter; -use glib::signal::connect_raw; -use glib::signal::SignalHandlerId; -use glib::translate::*; -use glib::ObjectType; -use std::boxed::Box as Box_; -use std::mem::transmute; impl PlaySignalAdapter { #[doc(alias = "duration-changed")] diff --git a/gstreamer-play/src/play_video_info.rs b/gstreamer-play/src/play_video_info.rs index e6dde3ed0..ac9ec8e36 100644 --- a/gstreamer-play/src/play_video_info.rs +++ b/gstreamer-play/src/play_video_info.rs @@ -1,9 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::PlayVideoInfo; -use glib::translate::*; use std::mem; +use glib::translate::*; + +use crate::PlayVideoInfo; + impl PlayVideoInfo { #[doc(alias = "get_framerate")] #[doc(alias = "gst_play_video_info_get_framerate")] diff --git a/gstreamer-play/src/play_video_overlay_video_renderer.rs b/gstreamer-play/src/play_video_overlay_video_renderer.rs index 70fee3b7f..d2250235b 100644 --- a/gstreamer-play/src/play_video_overlay_video_renderer.rs +++ b/gstreamer-play/src/play_video_overlay_video_renderer.rs @@ -1,13 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::PlayVideoOverlayVideoRenderer; -use glib::prelude::*; -use glib::translate::*; - use std::ptr; +use glib::{prelude::*, translate::*}; use libc::uintptr_t; +use crate::PlayVideoOverlayVideoRenderer; + impl PlayVideoOverlayVideoRenderer { pub unsafe fn new(window_handle: uintptr_t) -> PlayVideoOverlayVideoRenderer { assert_initialized_main_thread!(); diff --git a/gstreamer-play/src/play_visualization.rs b/gstreamer-play/src/play_visualization.rs index 4f26deb54..bfd6109ec 100644 --- a/gstreamer-play/src/play_visualization.rs +++ b/gstreamer-play/src/play_visualization.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; use std::ffi::CStr; +use glib::translate::*; + use crate::PlayVisualization; impl PlayVisualization { diff --git a/gstreamer-play/src/subclass/play_video_renderer.rs b/gstreamer-play/src/subclass/play_video_renderer.rs index b44cfb0d1..5b96b1f41 100644 --- a/gstreamer-play/src/subclass/play_video_renderer.rs +++ b/gstreamer-play/src/subclass/play_video_renderer.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::{Play, PlayVideoRenderer}; +use glib::{prelude::*, subclass::prelude::*, translate::*}; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use crate::{Play, PlayVideoRenderer}; pub trait PlayVideoRendererImpl: ObjectImpl { fn create_video_sink(&self, play: &Play) -> gst::Element; diff --git a/gstreamer-player/src/config.rs b/gstreamer-player/src/config.rs index b54a8ace7..11bcb8573 100644 --- a/gstreamer-player/src/config.rs +++ b/gstreamer-player/src/config.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; +use std::{mem, ops}; -use std::mem; -use std::ops; +use glib::translate::*; #[derive(Debug, Clone, PartialEq, Eq)] pub struct PlayerConfig(gst::Structure); diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index 3872ad663..3fc00e0c5 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -1,12 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{boxed::Box as Box_, mem::transmute}; + +use glib::{ + object::ObjectType, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; + use crate::Player; -use glib::object::ObjectType; -use glib::signal::connect_raw; -use glib::signal::SignalHandlerId; -use glib::translate::*; -use std::boxed::Box as Box_; -use std::mem::transmute; impl Player { #[doc(alias = "get_config")] diff --git a/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs b/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs index da1764ff9..6de1cec67 100644 --- a/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs +++ b/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::PlayerGMainContextSignalDispatcher; use glib::translate::*; +use crate::PlayerGMainContextSignalDispatcher; + impl PlayerGMainContextSignalDispatcher { #[doc(alias = "gst_player_g_main_context_signal_dispatcher_new")] pub fn new( diff --git a/gstreamer-player/src/player_video_info.rs b/gstreamer-player/src/player_video_info.rs index 0bf352b55..5e723a907 100644 --- a/gstreamer-player/src/player_video_info.rs +++ b/gstreamer-player/src/player_video_info.rs @@ -1,9 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::PlayerVideoInfo; -use glib::translate::*; use std::mem; +use glib::translate::*; + +use crate::PlayerVideoInfo; + impl PlayerVideoInfo { #[doc(alias = "get_framerate")] #[doc(alias = "gst_player_video_info_get_framerate")] diff --git a/gstreamer-player/src/player_video_overlay_video_renderer.rs b/gstreamer-player/src/player_video_overlay_video_renderer.rs index f6727195f..0a8fef68c 100644 --- a/gstreamer-player/src/player_video_overlay_video_renderer.rs +++ b/gstreamer-player/src/player_video_overlay_video_renderer.rs @@ -1,13 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::PlayerVideoOverlayVideoRenderer; -use glib::prelude::*; -use glib::translate::*; - use std::ptr; +use glib::{prelude::*, translate::*}; use libc::uintptr_t; +use crate::PlayerVideoOverlayVideoRenderer; + impl PlayerVideoOverlayVideoRenderer { pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer { assert_initialized_main_thread!(); diff --git a/gstreamer-player/src/player_visualization.rs b/gstreamer-player/src/player_visualization.rs index e7efff7b9..8ed8ad404 100644 --- a/gstreamer-player/src/player_visualization.rs +++ b/gstreamer-player/src/player_visualization.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; use std::ffi::CStr; +use glib::translate::*; + use crate::PlayerVisualization; impl PlayerVisualization { diff --git a/gstreamer-player/src/subclass/player_video_renderer.rs b/gstreamer-player/src/subclass/player_video_renderer.rs index 89a8f3495..a2ec0740a 100644 --- a/gstreamer-player/src/subclass/player_video_renderer.rs +++ b/gstreamer-player/src/subclass/player_video_renderer.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::{Player, PlayerVideoRenderer}; +use glib::{prelude::*, subclass::prelude::*, translate::*}; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use crate::{Player, PlayerVideoRenderer}; pub trait PlayerVideoRendererImpl: ObjectImpl { fn create_video_sink(&self, player: &Player) -> gst::Element; diff --git a/gstreamer-rtp/src/flag_serde.rs b/gstreamer-rtp/src/flag_serde.rs index 1aa945474..b6ceb603a 100644 --- a/gstreamer-rtp/src/flag_serde.rs +++ b/gstreamer-rtp/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::{bitflags_deserialize_impl, bitflags_serde_impl, bitflags_serialize_impl}; bitflags_serialize_impl!(crate::RTPBufferFlags, by_ones_decreasing); diff --git a/gstreamer-rtp/src/lib.rs b/gstreamer-rtp/src/lib.rs index cd01e069e..d5278d2ac 100644 --- a/gstreamer-rtp/src/lib.rs +++ b/gstreamer-rtp/src/lib.rs @@ -34,8 +34,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::use_self)] #[allow(unused_imports)] mod auto; -pub use crate::auto::functions::*; -pub use crate::auto::*; +pub use crate::auto::{functions::*, *}; #[cfg(feature = "serde")] mod flag_serde; @@ -62,16 +61,13 @@ pub mod prelude { #[doc(hidden)] pub use gst::prelude::*; - pub use crate::auto::traits::*; - - pub use crate::rtp_buffer::RTPBufferExt; - #[cfg(any(feature = "v1_20", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] - pub use crate::rtp_header_extension::RTPHeaderExtensionExtManual; - #[cfg(any(feature = "v1_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] pub use crate::rtp_base_payload::RTPBasePayloadExtManual; - - pub use crate::rtp_base_depayload::RTPBaseDepayloadExtManual; + #[cfg(any(feature = "v1_20", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] + pub use crate::rtp_header_extension::RTPHeaderExtensionExtManual; + pub use crate::{ + auto::traits::*, rtp_base_depayload::RTPBaseDepayloadExtManual, rtp_buffer::RTPBufferExt, + }; } diff --git a/gstreamer-rtp/src/rtp_base_depayload.rs b/gstreamer-rtp/src/rtp_base_depayload.rs index 2fd468d68..42c876df5 100644 --- a/gstreamer-rtp/src/rtp_base_depayload.rs +++ b/gstreamer-rtp/src/rtp_base_depayload.rs @@ -1,6 +1,6 @@ +use glib::{object::IsA, translate::*}; + use crate::RTPBaseDepayload; -use glib::object::IsA; -use glib::translate::*; pub trait RTPBaseDepayloadExtManual: 'static { #[doc(alias = "gst_rtp_base_depayload_push")] diff --git a/gstreamer-rtp/src/rtp_base_payload.rs b/gstreamer-rtp/src/rtp_base_payload.rs index d231e6f8f..a9df66cc3 100644 --- a/gstreamer-rtp/src/rtp_base_payload.rs +++ b/gstreamer-rtp/src/rtp_base_payload.rs @@ -1,8 +1,9 @@ -use crate::RTPBasePayload; -use glib::object::IsA; -use glib::translate::*; use std::ptr; +use glib::{object::IsA, translate::*}; + +use crate::RTPBasePayload; + pub trait RTPBasePayloadExtManual: 'static { #[cfg(any(feature = "v1_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] diff --git a/gstreamer-rtp/src/rtp_buffer.rs b/gstreamer-rtp/src/rtp_buffer.rs index 84aa6932e..9e22d09a9 100644 --- a/gstreamer-rtp/src/rtp_buffer.rs +++ b/gstreamer-rtp/src/rtp_buffer.rs @@ -1,11 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{fmt, marker::PhantomData, mem, ptr, slice}; + use glib::translate::{from_glib, mut_override, FromGlibPtrFull, IntoGlib}; -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ptr; -use std::slice; pub enum Readable {} pub enum Writable {} diff --git a/gstreamer-rtp/src/rtp_header_extension.rs b/gstreamer-rtp/src/rtp_header_extension.rs index d6e3e23df..04d154dae 100644 --- a/gstreamer-rtp/src/rtp_header_extension.rs +++ b/gstreamer-rtp/src/rtp_header_extension.rs @@ -1,7 +1,6 @@ -use crate::RTPHeaderExtension; -use crate::RTPHeaderExtensionFlags; -use glib::object::IsA; -use glib::translate::*; +use glib::{object::IsA, translate::*}; + +use crate::{RTPHeaderExtension, RTPHeaderExtensionFlags}; pub trait RTPHeaderExtensionExtManual: 'static { #[doc(alias = "gst_rtp_header_extension_read")] diff --git a/gstreamer-rtp/src/subclass/mod.rs b/gstreamer-rtp/src/subclass/mod.rs index e2190e0f4..12416be27 100644 --- a/gstreamer-rtp/src/subclass/mod.rs +++ b/gstreamer-rtp/src/subclass/mod.rs @@ -16,12 +16,10 @@ pub mod prelude { #[doc(hidden)] pub use gst::subclass::prelude::*; + pub use super::rtp_base_depayload::{RTPBaseDepayloadImpl, RTPBaseDepayloadImplExt}; #[cfg(any(feature = "v1_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] pub use super::rtp_base_payload::{RTPBasePayloadImpl, RTPBasePayloadImplExt}; - - pub use super::rtp_base_depayload::{RTPBaseDepayloadImpl, RTPBaseDepayloadImplExt}; - #[cfg(any(feature = "v1_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] pub use super::rtp_header_extension::{RTPHeaderExtensionImpl, RTPHeaderExtensionImplExt}; diff --git a/gstreamer-rtp/src/subclass/rtp_base_depayload.rs b/gstreamer-rtp/src/subclass/rtp_base_depayload.rs index 4a286f2eb..1bb525d8a 100644 --- a/gstreamer-rtp/src/subclass/rtp_base_depayload.rs +++ b/gstreamer-rtp/src/subclass/rtp_base_depayload.rs @@ -1,12 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; +use std::ptr; +use glib::translate::*; use gst::subclass::prelude::*; -use crate::prelude::*; -use crate::RTPBaseDepayload; -use std::ptr; +use crate::{prelude::*, RTPBaseDepayload}; pub trait RTPBaseDepayloadImpl: RTPBaseDepayloadImplExt + ElementImpl { fn set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { diff --git a/gstreamer-rtp/src/subclass/rtp_base_payload.rs b/gstreamer-rtp/src/subclass/rtp_base_payload.rs index 56d49bccd..f79dfd912 100644 --- a/gstreamer-rtp/src/subclass/rtp_base_payload.rs +++ b/gstreamer-rtp/src/subclass/rtp_base_payload.rs @@ -1,11 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; - use gst::subclass::prelude::*; -use crate::prelude::*; -use crate::RTPBasePayload; +use crate::{prelude::*, RTPBasePayload}; pub trait RTPBasePayloadImpl: RTPBasePayloadImplExt + ElementImpl { fn caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps { diff --git a/gstreamer-rtp/src/subclass/rtp_header_extension.rs b/gstreamer-rtp/src/subclass/rtp_header_extension.rs index 8367d0538..1ba3bee90 100644 --- a/gstreamer-rtp/src/subclass/rtp_header_extension.rs +++ b/gstreamer-rtp/src/subclass/rtp_header_extension.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::{prelude::*, subclass::prelude::*, translate::*}; + use super::prelude::*; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; pub trait RTPHeaderExtensionImpl: RTPHeaderExtensionImplExt + ElementImpl { const URI: &'static str; diff --git a/gstreamer-rtsp-server/src/flag_serde.rs b/gstreamer-rtsp-server/src/flag_serde.rs index 79f7f9c4f..95dced3a0 100644 --- a/gstreamer-rtsp-server/src/flag_serde.rs +++ b/gstreamer-rtsp-server/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::RTSPTransportMode); diff --git a/gstreamer-rtsp-server/src/lib.rs b/gstreamer-rtsp-server/src/lib.rs index a127fe6bd..3e62ba9bd 100644 --- a/gstreamer-rtsp-server/src/lib.rs +++ b/gstreamer-rtsp-server/src/lib.rs @@ -58,13 +58,11 @@ mod rtsp_token; pub mod subclass; -pub use crate::rtsp_context::*; -pub use crate::rtsp_thread::*; -pub use crate::rtsp_token::*; +use std::ffi::CStr; use once_cell::sync::Lazy; -use std::ffi::CStr; +pub use crate::{rtsp_context::*, rtsp_thread::*, rtsp_token::*}; pub static RTSP_ADDRESS_POOL_ANY_IPV4: Lazy<&'static str> = Lazy::new(|| unsafe { CStr::from_ptr(ffi::GST_RTSP_ADDRESS_POOL_ANY_IPV4) @@ -132,15 +130,11 @@ pub mod prelude { #[doc(hidden)] pub use gst_rtsp::prelude::*; - pub use crate::auto::traits::*; - - pub use crate::rtsp_address_pool::RTSPAddressPoolExtManual; - pub use crate::rtsp_auth::RTSPAuthExtManual; - pub use crate::rtsp_client::RTSPClientExtManual; - pub use crate::rtsp_media::RTSPMediaExtManual; - pub use crate::rtsp_media_factory::RTSPMediaFactoryExtManual; - pub use crate::rtsp_onvif_media_factory::RTSPOnvifMediaFactoryExtManual; - pub use crate::rtsp_server::RTSPServerExtManual; - pub use crate::rtsp_session::RTSPSessionExtManual; - pub use crate::rtsp_session_pool::RTSPSessionPoolExtManual; + pub use crate::{ + auto::traits::*, rtsp_address_pool::RTSPAddressPoolExtManual, rtsp_auth::RTSPAuthExtManual, + rtsp_client::RTSPClientExtManual, rtsp_media::RTSPMediaExtManual, + rtsp_media_factory::RTSPMediaFactoryExtManual, + rtsp_onvif_media_factory::RTSPOnvifMediaFactoryExtManual, rtsp_server::RTSPServerExtManual, + rtsp_session::RTSPSessionExtManual, rtsp_session_pool::RTSPSessionPoolExtManual, + }; } diff --git a/gstreamer-rtsp-server/src/rtsp_address_pool.rs b/gstreamer-rtsp-server/src/rtsp_address_pool.rs index 18ac1d070..4ee82fe62 100644 --- a/gstreamer-rtsp-server/src/rtsp_address_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_address_pool.rs @@ -1,12 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::RTSPAddress; -use crate::RTSPAddressPool; -use crate::RTSPAddressPoolResult; -use glib::prelude::*; -use glib::translate::*; use std::ptr; +use glib::{prelude::*, translate::*}; + +use crate::{RTSPAddress, RTSPAddressPool, RTSPAddressPoolResult}; + pub trait RTSPAddressPoolExtManual: 'static { #[doc(alias = "gst_rtsp_address_pool_reserve_address")] fn reserve_address( diff --git a/gstreamer-rtsp-server/src/rtsp_auth.rs b/gstreamer-rtsp-server/src/rtsp_auth.rs index c10972001..3b02973ac 100644 --- a/gstreamer-rtsp-server/src/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/rtsp_auth.rs @@ -1,15 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::signal::connect_raw; -use glib::signal::SignalHandlerId; -use glib::translate::*; +use std::{boxed::Box as Box_, mem::transmute}; -use std::boxed::Box as Box_; -use std::mem::transmute; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; -use crate::RTSPAuth; -use crate::RTSPToken; +use crate::{RTSPAuth, RTSPToken}; pub trait RTSPAuthExtManual: 'static { #[doc(alias = "gst_rtsp_auth_set_default_token")] diff --git a/gstreamer-rtsp-server/src/rtsp_client.rs b/gstreamer-rtsp-server/src/rtsp_client.rs index ba6f74cae..a243c876e 100644 --- a/gstreamer-rtsp-server/src/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/rtsp_client.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::{prelude::*, source::SourceId, translate::*}; + use crate::RTSPClient; -use glib::prelude::*; -use glib::source::SourceId; -use glib::translate::*; pub trait RTSPClientExtManual: 'static { #[doc(alias = "gst_rtsp_client_attach")] diff --git a/gstreamer-rtsp-server/src/rtsp_context.rs b/gstreamer-rtsp-server/src/rtsp_context.rs index 2e381ae40..33ac4c657 100644 --- a/gstreamer-rtsp-server/src/rtsp_context.rs +++ b/gstreamer-rtsp-server/src/rtsp_context.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{marker::PhantomData, ptr}; + use glib::translate::*; -use std::marker::PhantomData; -use std::ptr; #[derive(Debug, PartialEq, Eq)] #[doc(alias = "GstRTSPContext")] diff --git a/gstreamer-rtsp-server/src/rtsp_media.rs b/gstreamer-rtsp-server/src/rtsp_media.rs index 4a74972b4..4018b7800 100644 --- a/gstreamer-rtsp-server/src/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/rtsp_media.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; use crate::RTSPMedia; diff --git a/gstreamer-rtsp-server/src/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/rtsp_media_factory.rs index d7f1e04e2..cb96441ed 100644 --- a/gstreamer-rtsp-server/src/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/rtsp_media_factory.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::RTSPMediaFactory; +use glib::{prelude::*, translate::*}; -use glib::prelude::*; -use glib::translate::*; +use crate::RTSPMediaFactory; pub trait RTSPMediaFactoryExtManual: 'static { #[doc(alias = "gst_rtsp_media_factory_add_role_from_structure")] diff --git a/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs b/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs index 89d349542..f0c38b104 100644 --- a/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs +++ b/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::RTSPContext; -use crate::RTSPOnvifMediaFactory; +use glib::{prelude::*, translate::*}; -use glib::prelude::*; -use glib::translate::*; +use crate::{RTSPContext, RTSPOnvifMediaFactory}; pub trait RTSPOnvifMediaFactoryExtManual: 'static { #[doc(alias = "gst_rtsp_onvif_media_factory_requires_backchannel")] diff --git a/gstreamer-rtsp-server/src/rtsp_server.rs b/gstreamer-rtsp-server/src/rtsp_server.rs index 9ba9ee80b..27db437f8 100644 --- a/gstreamer-rtsp-server/src/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/rtsp_server.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::{prelude::*, source::SourceId, translate::*}; + use crate::RTSPServer; -use glib::prelude::*; -use glib::source::SourceId; -use glib::translate::*; pub trait RTSPServerExtManual: 'static { #[doc(alias = "gst_rtsp_server_attach")] diff --git a/gstreamer-rtsp-server/src/rtsp_session.rs b/gstreamer-rtsp-server/src/rtsp_session.rs index 282676148..7bd53212c 100644 --- a/gstreamer-rtsp-server/src/rtsp_session.rs +++ b/gstreamer-rtsp-server/src/rtsp_session.rs @@ -1,11 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::RTSPSession; -use crate::RTSPSessionMedia; -use glib::prelude::*; -use glib::translate::*; use std::mem; +use glib::{prelude::*, translate::*}; + +use crate::{RTSPSession, RTSPSessionMedia}; + pub trait RTSPSessionExtManual: 'static { #[doc(alias = "gst_rtsp_session_dup_media")] #[doc(alias = "gst_rtsp_session_get_media")] diff --git a/gstreamer-rtsp-server/src/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/rtsp_session_pool.rs index 9a0c1b42b..e0083cbc8 100644 --- a/gstreamer-rtsp-server/src/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_session_pool.rs @@ -1,12 +1,16 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::RTSPSessionPool; -use glib::ffi::{gboolean, gpointer}; -use glib::prelude::*; -use glib::source::{Continue, Priority}; -use glib::translate::*; use std::mem::transmute; +use glib::{ + ffi::{gboolean, gpointer}, + prelude::*, + source::{Continue, Priority}, + translate::*, +}; + +use crate::RTSPSessionPool; + unsafe extern "C" fn trampoline_watch Continue + Send + 'static>( pool: *mut ffi::GstRTSPSessionPool, func: gpointer, diff --git a/gstreamer-rtsp-server/src/rtsp_token.rs b/gstreamer-rtsp-server/src/rtsp_token.rs index ef5a02a17..cf63eb13b 100644 --- a/gstreamer-rtsp-server/src/rtsp_token.rs +++ b/gstreamer-rtsp-server/src/rtsp_token.rs @@ -1,10 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; -use glib::value::ToSendValue; - use std::fmt; +use glib::{translate::*, value::ToSendValue}; + gst::mini_object_wrapper!(RTSPToken, RTSPTokenRef, ffi::GstRTSPToken, || { ffi::gst_rtsp_token_get_type() }); diff --git a/gstreamer-rtsp-server/src/subclass/mod.rs b/gstreamer-rtsp-server/src/subclass/mod.rs index 2bd497c03..6a9ee7a7d 100644 --- a/gstreamer-rtsp-server/src/subclass/mod.rs +++ b/gstreamer-rtsp-server/src/subclass/mod.rs @@ -19,15 +19,15 @@ pub mod prelude { #[doc(hidden)] pub use gst::subclass::prelude::*; - pub use super::rtsp_client::{RTSPClientImpl, RTSPClientImplExt}; - pub use super::rtsp_media::{RTSPMediaImpl, RTSPMediaImplExt}; - pub use super::rtsp_media_factory::{RTSPMediaFactoryImpl, RTSPMediaFactoryImplExt}; - pub use super::rtsp_mount_points::{RTSPMountPointsImpl, RTSPMountPointsImplExt}; - pub use super::rtsp_onvif_client::RTSPOnvifClientImpl; - pub use super::rtsp_onvif_media::RTSPOnvifMediaImpl; - pub use super::rtsp_onvif_media_factory::{ - RTSPOnvifMediaFactoryImpl, RTSPOnvifMediaFactoryImplExt, + pub use super::{ + rtsp_client::{RTSPClientImpl, RTSPClientImplExt}, + rtsp_media::{RTSPMediaImpl, RTSPMediaImplExt}, + rtsp_media_factory::{RTSPMediaFactoryImpl, RTSPMediaFactoryImplExt}, + rtsp_mount_points::{RTSPMountPointsImpl, RTSPMountPointsImplExt}, + rtsp_onvif_client::RTSPOnvifClientImpl, + rtsp_onvif_media::RTSPOnvifMediaImpl, + rtsp_onvif_media_factory::{RTSPOnvifMediaFactoryImpl, RTSPOnvifMediaFactoryImplExt}, + rtsp_onvif_server::RTSPOnvifServerImpl, + rtsp_server::{RTSPServerImpl, RTSPServerImplExt}, }; - pub use super::rtsp_onvif_server::RTSPOnvifServerImpl; - pub use super::rtsp_server::{RTSPServerImpl, RTSPServerImplExt}; } diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs index 4b2043eea..d99752630 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs @@ -1,11 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; - use std::mem; +use glib::{prelude::*, subclass::prelude::*, translate::*}; + use crate::RTSPClient; pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs index 3f997f8e9..f259ca78f 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs @@ -1,13 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; - use std::ptr; -use crate::RTSPMedia; -use crate::RTSPThread; +use glib::{prelude::*, subclass::prelude::*, translate::*}; + +use crate::{RTSPMedia, RTSPThread}; #[derive(Debug)] pub struct SDPInfo(ptr::NonNull); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index e6dea271f..1c06dbce4 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -1,13 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use std::mem::transmute; + +use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::RTSPMediaFactory; -use std::mem::transmute; - pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sync { fn gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option { self.parent_gen_key(url) diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs b/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs index 9fb3ce767..6ef069b71 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; use gst_rtsp::ffi::GstRTSPUrl; use crate::RTSPMountPoints; diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs index 69ccefcd9..35c309524 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::RTSPOnvifMediaFactory; diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs index 43965aa19..ca365b682 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::RTSPServer; diff --git a/gstreamer-rtsp/src/flag_serde.rs b/gstreamer-rtsp/src/flag_serde.rs index 6eed95e92..b0725ef17 100644 --- a/gstreamer-rtsp/src/flag_serde.rs +++ b/gstreamer-rtsp/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::RTSPEvent); diff --git a/gstreamer-sdp/src/sdp_attribute.rs b/gstreamer-sdp/src/sdp_attribute.rs index 333124b95..d48285b16 100644 --- a/gstreamer-sdp/src/sdp_attribute.rs +++ b/gstreamer-sdp/src/sdp_attribute.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; -use std::mem; +use std::{ffi::CStr, fmt, mem}; use glib::translate::*; diff --git a/gstreamer-sdp/src/sdp_bandwidth.rs b/gstreamer-sdp/src/sdp_bandwidth.rs index 3aa7524e6..95af12f7e 100644 --- a/gstreamer-sdp/src/sdp_bandwidth.rs +++ b/gstreamer-sdp/src/sdp_bandwidth.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; -use std::mem; +use std::{ffi::CStr, fmt, mem}; use glib::translate::*; diff --git a/gstreamer-sdp/src/sdp_connection.rs b/gstreamer-sdp/src/sdp_connection.rs index afdd2e560..8b0423f35 100644 --- a/gstreamer-sdp/src/sdp_connection.rs +++ b/gstreamer-sdp/src/sdp_connection.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; -use std::mem; +use std::{ffi::CStr, fmt, mem}; use glib::translate::*; diff --git a/gstreamer-sdp/src/sdp_key.rs b/gstreamer-sdp/src/sdp_key.rs index d781a4d14..757e83628 100644 --- a/gstreamer-sdp/src/sdp_key.rs +++ b/gstreamer-sdp/src/sdp_key.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; +use std::{ffi::CStr, fmt}; #[repr(transparent)] #[doc(alias = "GstSDPKey")] diff --git a/gstreamer-sdp/src/sdp_media.rs b/gstreamer-sdp/src/sdp_media.rs index d9159d033..acb71006c 100644 --- a/gstreamer-sdp/src/sdp_media.rs +++ b/gstreamer-sdp/src/sdp_media.rs @@ -1,18 +1,17 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::borrow::{Borrow, BorrowMut, ToOwned}; -use std::ffi::CStr; -use std::fmt; -use std::mem; -use std::ops; -use std::ptr; +use std::{ + borrow::{Borrow, BorrowMut, ToOwned}, + ffi::CStr, + fmt, mem, ops, ptr, +}; use glib::translate::*; -use crate::sdp_attribute::SDPAttribute; -use crate::sdp_bandwidth::SDPBandwidth; -use crate::sdp_connection::SDPConnection; -use crate::sdp_key::SDPKey; +use crate::{ + sdp_attribute::SDPAttribute, sdp_bandwidth::SDPBandwidth, sdp_connection::SDPConnection, + sdp_key::SDPKey, +}; glib::wrapper! { #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index 18e5f4723..e752bb6e7 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -1,24 +1,23 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::borrow::{Borrow, BorrowMut, ToOwned}; -use std::ffi::CStr; -use std::fmt; -use std::mem; -use std::ops; -use std::ptr; +use std::{ + borrow::{Borrow, BorrowMut, ToOwned}, + ffi::CStr, + fmt, mem, ops, ptr, +}; -use glib::translate::*; -use glib::StaticType; +use glib::{translate::*, StaticType}; -use crate::sdp_attribute::SDPAttribute; -use crate::sdp_bandwidth::SDPBandwidth; -use crate::sdp_connection::SDPConnection; -use crate::sdp_key::SDPKey; -use crate::sdp_media::SDPMedia; -use crate::sdp_media::SDPMediaRef; -use crate::sdp_origin::SDPOrigin; -use crate::sdp_time::SDPTime; -use crate::sdp_zone::SDPZone; +use crate::{ + sdp_attribute::SDPAttribute, + sdp_bandwidth::SDPBandwidth, + sdp_connection::SDPConnection, + sdp_key::SDPKey, + sdp_media::{SDPMedia, SDPMediaRef}, + sdp_origin::SDPOrigin, + sdp_time::SDPTime, + sdp_zone::SDPZone, +}; glib::wrapper! { #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] diff --git a/gstreamer-sdp/src/sdp_origin.rs b/gstreamer-sdp/src/sdp_origin.rs index 16e69fbbc..e51a87ee5 100644 --- a/gstreamer-sdp/src/sdp_origin.rs +++ b/gstreamer-sdp/src/sdp_origin.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; +use std::{ffi::CStr, fmt}; #[repr(transparent)] #[doc(alias = "GstSDPOrigin")] diff --git a/gstreamer-sdp/src/sdp_time.rs b/gstreamer-sdp/src/sdp_time.rs index cc9330f85..cc3ee4c78 100644 --- a/gstreamer-sdp/src/sdp_time.rs +++ b/gstreamer-sdp/src/sdp_time.rs @@ -1,10 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; -use std::mem; -use std::os::raw::c_char; -use std::ptr; +use std::{ffi::CStr, fmt, mem, os::raw::c_char, ptr}; use glib::translate::*; diff --git a/gstreamer-sdp/src/sdp_zone.rs b/gstreamer-sdp/src/sdp_zone.rs index d707ec304..3aff1fd64 100644 --- a/gstreamer-sdp/src/sdp_zone.rs +++ b/gstreamer-sdp/src/sdp_zone.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; -use std::mem; +use std::{ffi::CStr, fmt, mem}; use glib::translate::*; diff --git a/gstreamer-utils/src/streamproducer.rs b/gstreamer-utils/src/streamproducer.rs index 409e4f2b2..59294fee0 100644 --- a/gstreamer-utils/src/streamproducer.rs +++ b/gstreamer-utils/src/streamproducer.rs @@ -1,11 +1,12 @@ -use std::collections::HashMap; -use std::mem; -use std::sync::{atomic, Arc, Mutex}; - -use once_cell::sync::Lazy; -use thiserror::Error; +use std::{ + collections::HashMap, + mem, + sync::{atomic, Arc, Mutex}, +}; use gst::{glib, prelude::*}; +use once_cell::sync::Lazy; +use thiserror::Error; static CAT: Lazy = Lazy::new(|| { gst::DebugCategory::new( @@ -480,8 +481,10 @@ mod tests { sync::{Arc, Mutex}, }; - use futures::channel::mpsc; - use futures::{channel::mpsc::Receiver, SinkExt, StreamExt}; + use futures::{ + channel::{mpsc, mpsc::Receiver}, + SinkExt, StreamExt, + }; use gst::prelude::*; use crate::{ConsumptionLink, StreamProducer}; diff --git a/gstreamer-video/src/caps.rs b/gstreamer-video/src/caps.rs index d23d57d0e..e9ed75c47 100644 --- a/gstreamer-video/src/caps.rs +++ b/gstreamer-video/src/caps.rs @@ -1,7 +1,8 @@ -use crate::VideoFormat; +use std::ops::{Bound::*, RangeBounds}; + use gst::Caps; -use std::ops::Bound::*; -use std::ops::RangeBounds; + +use crate::VideoFormat; pub struct VideoCapsBuilder { builder: gst::caps::Builder, diff --git a/gstreamer-video/src/caps_features.rs b/gstreamer-video/src/caps_features.rs index 434d7e185..0b4918486 100644 --- a/gstreamer-video/src/caps_features.rs +++ b/gstreamer-video/src/caps_features.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use gst::CapsFeatures; use std::ffi::CStr; +use gst::CapsFeatures; use once_cell::sync::Lazy; #[cfg(any(feature = "v1_16", feature = "dox"))] diff --git a/gstreamer-video/src/color_balance_channel.rs b/gstreamer-video/src/color_balance_channel.rs index 14f0408fd..9044fe285 100644 --- a/gstreamer-video/src/color_balance_channel.rs +++ b/gstreamer-video/src/color_balance_channel.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::{prelude::*, translate::*}; + use crate::ColorBalanceChannel; -use glib::prelude::*; -use glib::translate::*; impl ColorBalanceChannel { pub fn label(&self) -> glib::GString { diff --git a/gstreamer-video/src/flag_serde.rs b/gstreamer-video/src/flag_serde.rs index 7a51873d4..46a676295 100644 --- a/gstreamer-video/src/flag_serde.rs +++ b/gstreamer-video/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; use gst::bitflags_serde_impl; bitflags_serde_impl!(crate::NavigationModifierType, "v1_22"); diff --git a/gstreamer-video/src/functions.rs b/gstreamer-video/src/functions.rs index b6747b856..b1dd6ea6d 100644 --- a/gstreamer-video/src/functions.rs +++ b/gstreamer-video/src/functions.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}; +use std::{i32, mem, ptr}; -use std::i32; -use std::mem; -use std::ptr; +use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}; #[doc(alias = "gst_video_convert_sample")] pub fn convert_sample( @@ -227,9 +225,10 @@ pub fn video_make_raw_caps( #[cfg(test)] mod tests { - use super::*; use std::sync::{Arc, Mutex}; + use super::*; + #[test] fn test_convert_sample_async() { gst::init().unwrap(); diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index 53dbcaeef..922e2c56f 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -149,8 +149,6 @@ pub mod prelude { #[doc(hidden)] pub use gst_base::prelude::*; - pub use crate::auto::traits::*; - pub use crate::navigation::NavigationExtManual; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use crate::video_aggregator::VideoAggregatorExtManual; @@ -160,12 +158,12 @@ pub mod prelude { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use crate::video_aggregator_pad::VideoAggregatorPadExtManual; - pub use crate::video_buffer_pool::VideoBufferPoolConfig; - pub use crate::video_decoder::VideoDecoderExtManual; - pub use crate::video_encoder::VideoEncoderExtManual; - pub use crate::video_format::VideoFormatIteratorExt; - pub use crate::video_frame::VideoBufferExt; - pub use crate::video_overlay::VideoOverlayExtManual; + pub use crate::{ + auto::traits::*, navigation::NavigationExtManual, video_buffer_pool::VideoBufferPoolConfig, + video_decoder::VideoDecoderExtManual, video_encoder::VideoEncoderExtManual, + video_format::VideoFormatIteratorExt, video_frame::VideoBufferExt, + video_overlay::VideoOverlayExtManual, + }; } pub mod subclass; diff --git a/gstreamer-video/src/navigation.rs b/gstreamer-video/src/navigation.rs index 4a8d76e9d..10b50e617 100644 --- a/gstreamer-video/src/navigation.rs +++ b/gstreamer-video/src/navigation.rs @@ -1,6 +1,9 @@ +use glib::{ + object::IsA, + translate::{IntoGlibPtr, ToGlibPtr}, +}; + use crate::auto::Navigation; -use glib::object::IsA; -use glib::translate::{IntoGlibPtr, ToGlibPtr}; pub trait NavigationExtManual: 'static { #[doc(alias = "gst_navigation_send_event")] diff --git a/gstreamer-video/src/subclass/mod.rs b/gstreamer-video/src/subclass/mod.rs index eed409c9a..fa5003ecc 100644 --- a/gstreamer-video/src/subclass/mod.rs +++ b/gstreamer-video/src/subclass/mod.rs @@ -25,7 +25,6 @@ pub mod prelude { #[doc(hidden)] pub use gst_base::subclass::prelude::*; - pub use super::navigation::NavigationImpl; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use super::video_aggregator::{VideoAggregatorImpl, VideoAggregatorImplExt}; @@ -35,8 +34,11 @@ pub mod prelude { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use super::video_aggregator_pad::{VideoAggregatorPadImpl, VideoAggregatorPadImplExt}; - pub use super::video_decoder::{VideoDecoderImpl, VideoDecoderImplExt}; - pub use super::video_encoder::{VideoEncoderImpl, VideoEncoderImplExt}; - pub use super::video_filter::{VideoFilterImpl, VideoFilterImplExt}; - pub use super::video_sink::{VideoSinkImpl, VideoSinkImplExt}; + pub use super::{ + navigation::NavigationImpl, + video_decoder::{VideoDecoderImpl, VideoDecoderImplExt}, + video_encoder::{VideoEncoderImpl, VideoEncoderImplExt}, + video_filter::{VideoFilterImpl, VideoFilterImplExt}, + video_sink::{VideoSinkImpl, VideoSinkImplExt}, + }; } diff --git a/gstreamer-video/src/subclass/navigation.rs b/gstreamer-video/src/subclass/navigation.rs index 04441f6e6..52bad573b 100644 --- a/gstreamer-video/src/subclass/navigation.rs +++ b/gstreamer-video/src/subclass/navigation.rs @@ -1,9 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - -use glib::subclass::prelude::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::Navigation; diff --git a/gstreamer-video/src/subclass/video_aggregator.rs b/gstreamer-video/src/subclass/video_aggregator.rs index bec769914..f587bbc60 100644 --- a/gstreamer-video/src/subclass/video_aggregator.rs +++ b/gstreamer-video/src/subclass/video_aggregator.rs @@ -1,12 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{mem, ptr}; + use glib::translate::*; - -use gst_base::prelude::*; -use gst_base::subclass::prelude::*; - -use std::mem; -use std::ptr; +use gst_base::{prelude::*, subclass::prelude::*}; use crate::VideoAggregator; diff --git a/gstreamer-video/src/subclass/video_aggregator_pad.rs b/gstreamer-video/src/subclass/video_aggregator_pad.rs index 095a0be7a..c1c9f6cbb 100644 --- a/gstreamer-video/src/subclass/video_aggregator_pad.rs +++ b/gstreamer-video/src/subclass/video_aggregator_pad.rs @@ -1,16 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{mem, ptr}; + use glib::translate::*; +use gst_base::{prelude::*, subclass::prelude::*}; -use gst_base::prelude::*; -use gst_base::subclass::prelude::*; - -use std::mem; -use std::ptr; - -use crate::subclass::AggregateFramesToken; -use crate::VideoAggregator; -use crate::VideoAggregatorPad; +use crate::{subclass::AggregateFramesToken, VideoAggregator, VideoAggregatorPad}; pub trait VideoAggregatorPadImpl: VideoAggregatorPadImplExt + AggregatorPadImpl { fn update_conversion_info(&self) { diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index 75a63c280..5cf30a031 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -1,13 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; - use gst::subclass::prelude::*; -use crate::prelude::*; -use crate::video_codec_state::{Readable, VideoCodecState}; -use crate::VideoCodecFrame; -use crate::VideoDecoder; +use crate::{ + prelude::*, + video_codec_state::{Readable, VideoCodecState}, + VideoCodecFrame, VideoDecoder, +}; pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl { fn open(&self) -> Result<(), gst::ErrorMessage> { diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 1b084e0d4..9a2d87851 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -1,13 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; - use gst::subclass::prelude::*; -use crate::prelude::*; -use crate::video_codec_state::{Readable, VideoCodecState}; -use crate::VideoCodecFrame; -use crate::VideoEncoder; +use crate::{ + prelude::*, + video_codec_state::{Readable, VideoCodecState}, + VideoCodecFrame, VideoEncoder, +}; pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl { fn open(&self) -> Result<(), gst::ErrorMessage> { diff --git a/gstreamer-video/src/subclass/video_filter.rs b/gstreamer-video/src/subclass/video_filter.rs index a23731831..d3f277ec1 100644 --- a/gstreamer-video/src/subclass/video_filter.rs +++ b/gstreamer-video/src/subclass/video_filter.rs @@ -1,13 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; +use gst_base::{prelude::*, subclass::prelude::*}; -use gst_base::prelude::*; -use gst_base::subclass::prelude::*; - -use crate::VideoFilter; -use crate::VideoFrameRef; -use crate::VideoInfo; +use crate::{VideoFilter, VideoFrameRef, VideoInfo}; pub trait VideoFilterImpl: VideoFilterImplExt + BaseTransformImpl { fn set_info( diff --git a/gstreamer-video/src/subclass/video_sink.rs b/gstreamer-video/src/subclass/video_sink.rs index 76e672a09..9683397d7 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - +use glib::{prelude::*, translate::*}; use gst_base::subclass::prelude::*; use crate::VideoSink; diff --git a/gstreamer-video/src/video_aggregator.rs b/gstreamer-video/src/video_aggregator.rs index f1f223b58..22c8b931a 100644 --- a/gstreamer-video/src/video_aggregator.rs +++ b/gstreamer-video/src/video_aggregator.rs @@ -1,6 +1,6 @@ +use glib::{object::IsA, translate::*}; + use crate::auto::VideoAggregator; -use glib::object::IsA; -use glib::translate::*; pub trait VideoAggregatorExtManual: 'static { fn video_info(&self) -> Option; diff --git a/gstreamer-video/src/video_aggregator_convert_pad.rs b/gstreamer-video/src/video_aggregator_convert_pad.rs index 158330939..9dbf4d356 100644 --- a/gstreamer-video/src/video_aggregator_convert_pad.rs +++ b/gstreamer-video/src/video_aggregator_convert_pad.rs @@ -1,11 +1,14 @@ -use crate::auto::VideoAggregatorConvertPad; -use glib::object::IsA; -use glib::signal::{connect_raw, SignalHandlerId}; -use glib::translate::*; -use glib::Cast; - use std::mem::transmute; +use glib::{ + object::IsA, + signal::{connect_raw, SignalHandlerId}, + translate::*, + Cast, +}; + +use crate::auto::VideoAggregatorConvertPad; + pub trait VideoAggregatorConvertPadExtManual: 'static { #[doc(alias = "converter-config")] fn converter_config(&self) -> Option; diff --git a/gstreamer-video/src/video_aggregator_pad.rs b/gstreamer-video/src/video_aggregator_pad.rs index 02b5e37e0..0bae51628 100644 --- a/gstreamer-video/src/video_aggregator_pad.rs +++ b/gstreamer-video/src/video_aggregator_pad.rs @@ -1,7 +1,6 @@ -use crate::auto::VideoAggregatorPad; -use crate::subclass::AggregateFramesToken; -use glib::object::IsA; -use glib::translate::*; +use glib::{object::IsA, translate::*}; + +use crate::{auto::VideoAggregatorPad, subclass::AggregateFramesToken}; pub trait VideoAggregatorPadExtManual: 'static { #[doc(alias = "gst_video_aggregator_pad_has_current_buffer")] diff --git a/gstreamer-video/src/video_buffer_pool.rs b/gstreamer-video/src/video_buffer_pool.rs index 6dfd04567..b019b8a60 100644 --- a/gstreamer-video/src/video_buffer_pool.rs +++ b/gstreamer-video/src/video_buffer_pool.rs @@ -1,11 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::marker::PhantomData; -use std::mem; +use std::{ffi::CStr, marker::PhantomData, mem}; use glib::translate::*; - use once_cell::sync::Lazy; pub static BUFFER_POOL_OPTION_VIDEO_AFFINE_TRANSFORMATION_META: Lazy<&'static str> = diff --git a/gstreamer-video/src/video_codec_frame.rs b/gstreamer-video/src/video_codec_frame.rs index a4d3c28c5..f645ea907 100644 --- a/gstreamer-video/src/video_codec_frame.rs +++ b/gstreamer-video/src/video_codec_frame.rs @@ -1,11 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::utils::HasStreamLock; -use crate::VideoCodecFrameFlags; +use std::{fmt, marker::PhantomData, mem}; + use glib::translate::*; -use std::fmt; -use std::marker::PhantomData; -use std::mem; + +use crate::{utils::HasStreamLock, VideoCodecFrameFlags}; pub struct VideoCodecFrame<'a> { frame: *mut ffi::GstVideoCodecFrame, diff --git a/gstreamer-video/src/video_codec_state.rs b/gstreamer-video/src/video_codec_state.rs index 32513fc45..a2f23ca5d 100644 --- a/gstreamer-video/src/video_codec_state.rs +++ b/gstreamer-video/src/video_codec_state.rs @@ -1,12 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::utils::HasStreamLock; -use glib::translate::*; -use std::fmt; -use std::marker::PhantomData; -use std::ptr; +use std::{fmt, marker::PhantomData, ptr}; -use crate::video_info::VideoInfo; +use glib::translate::*; + +use crate::{utils::HasStreamLock, video_info::VideoInfo}; pub trait VideoCodecStateContext<'a> { #[doc(alias = "get_element")] diff --git a/gstreamer-video/src/video_converter.rs b/gstreamer-video/src/video_converter.rs index 7bc1b9a9a..0339116e1 100644 --- a/gstreamer-video/src/video_converter.rs +++ b/gstreamer-video/src/video_converter.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; +use std::{ops, ptr}; -use std::ops; -use std::ptr; +use glib::translate::*; #[derive(Debug)] #[doc(alias = "GstVideoConverter")] diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index 461153b76..b0ef83665 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -1,17 +1,17 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::utils::HasStreamLock; -use crate::video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext}; -use crate::VideoCodecFrame; -use crate::VideoDecoder; -use crate::VideoFormat; +use std::{mem, ptr}; + +use glib::{prelude::*, translate::*}; + #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] use crate::VideoInterlaceMode; -use glib::prelude::*; -use glib::translate::*; -use std::mem; -use std::ptr; +use crate::{ + utils::HasStreamLock, + video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext}, + VideoCodecFrame, VideoDecoder, VideoFormat, +}; extern "C" { fn _gst_video_decoder_error( diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index 95b8a9e29..6bd2b430b 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -1,13 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::utils::HasStreamLock; -use crate::video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext}; -use crate::VideoCodecFrame; -use crate::VideoEncoder; -use glib::prelude::*; -use glib::translate::*; -use std::mem; -use std::ptr; +use std::{mem, ptr}; + +use glib::{prelude::*, translate::*}; + +use crate::{ + utils::HasStreamLock, + video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext}, + VideoCodecFrame, VideoEncoder, +}; pub trait VideoEncoderExtManual: 'static { #[doc(alias = "gst_video_encoder_allocate_output_frame")] diff --git a/gstreamer-video/src/video_event.rs b/gstreamer-video/src/video_event.rs index 17bef391d..f0982cfe6 100644 --- a/gstreamer-video/src/video_event.rs +++ b/gstreamer-video/src/video_event.rs @@ -1,13 +1,16 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::{NavigationCommand, NavigationEventType}; -use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}; -use glib::ToSendValue; -use gst::EventType; use std::mem; +use glib::{ + translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}, + ToSendValue, +}; +use gst::EventType; + #[cfg(any(feature = "v1_22", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))] use crate::NavigationModifierType; +use crate::{NavigationCommand, NavigationEventType}; // FIXME: Copy from gstreamer/src/event.rs macro_rules! event_builder_generic_impl { diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index 6970fde31..6d3ef5a0e 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -1,10 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use once_cell::sync::Lazy; -use std::ffi::CStr; -use std::str; +use std::{ffi::CStr, str}; use glib::translate::{from_glib, FromGlib, IntoGlib}; +use once_cell::sync::Lazy; #[cfg(feature = "v1_18")] pub static VIDEO_FORMATS_ALL: Lazy> = Lazy::new(|| unsafe { diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index 7b349a32b..ba0e436c5 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -1,10 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::cmp::Ordering; -use std::ffi::CStr; -use std::fmt; -use std::marker::PhantomData; -use std::str; +use std::{cmp::Ordering, ffi::CStr, fmt, marker::PhantomData, str}; use glib::translate::{from_glib, IntoGlib, ToGlibPtr}; diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 92c5ff42c..b29413e7b 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -1,13 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_none, Borrowed, ToGlibPtr}; +use std::{fmt, marker::PhantomData, mem, ops, ptr, slice}; -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ops; -use std::ptr; -use std::slice; +use glib::translate::{from_glib, from_glib_none, Borrowed, ToGlibPtr}; pub enum Readable {} pub enum Writable {} diff --git a/gstreamer-video/src/video_hdr.rs b/gstreamer-video/src/video_hdr.rs index eb7fcfb42..afc4d6efc 100644 --- a/gstreamer-video/src/video_hdr.rs +++ b/gstreamer-video/src/video_hdr.rs @@ -1,11 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; +use std::{fmt, mem, ptr, str}; -use std::fmt; -use std::mem; -use std::ptr; -use std::str; +use glib::translate::*; #[doc(alias = "GstVideoContentLightLevel")] #[derive(Copy, Clone)] diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 02ce2ee6d..521a10ab3 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -1,14 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{fmt, marker::PhantomData, mem, ptr, str}; + use glib::translate::*; use gst::prelude::*; -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ptr; -use std::str; - #[doc(alias = "GST_VIDEO_MAX_PLANES")] pub const VIDEO_MAX_PLANES: usize = ffi::GST_VIDEO_MAX_PLANES as usize; diff --git a/gstreamer-video/src/video_message.rs b/gstreamer-video/src/video_message.rs index e7a414053..de52f54e9 100644 --- a/gstreamer-video/src/video_message.rs +++ b/gstreamer-video/src/video_message.rs @@ -1,12 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::NavigationMessageType; -use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}; -use glib::ToSendValue; -use gst::ffi as gst_ffi; -use gst::{prelude::*, Message, Object, Seqnum}; use std::ptr; +use glib::{ + translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}, + ToSendValue, +}; +use gst::{ffi as gst_ffi, prelude::*, Message, Object, Seqnum}; + +use crate::NavigationMessageType; + macro_rules! message_builder_generic_impl { ($new_fn:expr) => { #[allow(clippy::needless_update)] diff --git a/gstreamer-video/src/video_meta.rs b/gstreamer-video/src/video_meta.rs index a8b136b07..12f078680 100644 --- a/gstreamer-video/src/video_meta.rs +++ b/gstreamer-video/src/video_meta.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::fmt; -use std::ptr; +use std::{fmt, ptr}; use glib::translate::{from_glib, from_glib_none, FromGlib, IntoGlib, IntoGlibPtr, ToGlibPtr}; use gst::prelude::*; diff --git a/gstreamer-video/src/video_overlay.rs b/gstreamer-video/src/video_overlay.rs index 70a212b02..1bb333a03 100644 --- a/gstreamer-video/src/video_overlay.rs +++ b/gstreamer-video/src/video_overlay.rs @@ -1,10 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::VideoOverlay; +use glib::{prelude::*, translate::*}; use libc::uintptr_t; -use glib::prelude::*; -use glib::translate::*; +use crate::VideoOverlay; pub trait VideoOverlayExtManual: 'static { unsafe fn set_window_handle(&self, handle: uintptr_t); diff --git a/gstreamer-video/src/video_overlay_composition.rs b/gstreamer-video/src/video_overlay_composition.rs index 308a7b4a6..7b9c39e22 100644 --- a/gstreamer-video/src/video_overlay_composition.rs +++ b/gstreamer-video/src/video_overlay_composition.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::fmt; -use std::mem; +use std::{fmt, mem}; use glib::translate::{from_glib, from_glib_full, from_glib_none, IntoGlib, ToGlibPtr}; diff --git a/gstreamer-video/src/video_rectangle.rs b/gstreamer-video/src/video_rectangle.rs index a4a7aba0a..81e1a1a19 100644 --- a/gstreamer-video/src/video_rectangle.rs +++ b/gstreamer-video/src/video_rectangle.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{marker::PhantomData, mem}; + use glib::translate::IntoGlib; -use std::marker::PhantomData; -use std::mem; #[repr(C)] #[derive(Clone, Debug, Eq, PartialEq, Hash)] diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 67e5b82c1..1b5767cfd 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -1,14 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{cmp, fmt, mem, str}; + use glib::translate::*; use gst::prelude::*; -use std::cmp; -use std::fmt; -use std::mem; -use std::str; -use crate::VideoTimeCodeFlags; -use crate::VideoTimeCodeInterval; +use crate::{VideoTimeCodeFlags, VideoTimeCodeInterval}; glib::wrapper! { #[doc(alias = "GstVideoTimeCode")] diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index 69170c1fb..2c6f6cf03 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{cmp, fmt, mem, str}; + use glib::translate::*; -use std::cmp; -use std::fmt; -use std::mem; -use std::str; glib::wrapper! { #[doc(alias = "GstVideoTimeCodeInterval")] diff --git a/gstreamer-webrtc/src/web_rtc_ice_candidate_stats.rs b/gstreamer-webrtc/src/web_rtc_ice_candidate_stats.rs index 0c0ecf01a..f1a2dfcfd 100644 --- a/gstreamer-webrtc/src/web_rtc_ice_candidate_stats.rs +++ b/gstreamer-webrtc/src/web_rtc_ice_candidate_stats.rs @@ -1,9 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::WebRTCICECandidateStats; -use glib::translate::*; use std::ffi::CStr; +use glib::translate::*; + +use crate::WebRTCICECandidateStats; + impl WebRTCICECandidateStats { pub fn ipaddr(&self) -> Option<&str> { unsafe { diff --git a/gstreamer-webrtc/src/web_rtc_session_description.rs b/gstreamer-webrtc/src/web_rtc_session_description.rs index 621ff7544..cd4aafdde 100644 --- a/gstreamer-webrtc/src/web_rtc_session_description.rs +++ b/gstreamer-webrtc/src/web_rtc_session_description.rs @@ -1,10 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::WebRTCSDPType; -use crate::WebRTCSessionDescription; -use glib::translate::*; use std::mem; +use glib::translate::*; + +use crate::{WebRTCSDPType, WebRTCSessionDescription}; + impl WebRTCSessionDescription { #[doc(alias = "gst_webrtc_session_description_new")] pub fn new(type_: WebRTCSDPType, sdp: gst_sdp::SDPMessage) -> WebRTCSessionDescription { diff --git a/gstreamer/src/allocation_params.rs b/gstreamer/src/allocation_params.rs index 0db9fb1f6..6d370097e 100644 --- a/gstreamer/src/allocation_params.rs +++ b/gstreamer/src/allocation_params.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::marker::PhantomData; -use std::mem; +use std::{marker::PhantomData, mem}; use glib::translate::*; diff --git a/gstreamer/src/allocator.rs b/gstreamer/src/allocator.rs index 1a329ff77..4f32d95c9 100644 --- a/gstreamer/src/allocator.rs +++ b/gstreamer/src/allocator.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::{translate::*, IsA}; + use crate::Allocator; -use glib::translate::*; -use glib::IsA; impl Allocator { #[doc(alias = "gst_allocator_register")] diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 6df65366a..21a99e679 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -1,19 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Bin; -use crate::BinFlags; -use crate::Element; -use crate::LoggableError; +use std::{boxed::Box as Box_, mem::transmute, path}; -use glib::prelude::*; -use glib::signal::connect_raw; -use glib::signal::SignalHandlerId; -use glib::translate::*; -use glib::GString; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, + GString, +}; -use std::boxed::Box as Box_; -use std::mem::transmute; -use std::path; +use crate::{Bin, BinFlags, Element, LoggableError}; impl Bin { // rustdoc-stripper-ignore-next diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index 2a39ba1d8..3c1387e0c 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -1,27 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ops; -use std::ops::ControlFlow; -use std::ptr; -use std::slice; -use std::u64; -use std::usize; - -use crate::meta::*; -use crate::BufferCursor; -use crate::BufferFlags; -use crate::BufferRefCursor; -use crate::ClockTime; -use crate::Memory; -use crate::MemoryRef; +use std::{fmt, marker::PhantomData, mem, ops, ops::ControlFlow, ptr, slice, u64, usize}; use glib::translate::{ from_glib, from_glib_full, FromGlib, FromGlibPtrFull, IntoGlib, IntoGlibPtr, }; +use crate::{meta::*, BufferCursor, BufferFlags, BufferRefCursor, ClockTime, Memory, MemoryRef}; + pub enum Readable {} pub enum Writable {} @@ -1048,9 +1034,10 @@ impl PartialEq for BufferRef { impl fmt::Debug for BufferRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use crate::utils::Displayable; use std::cell::RefCell; + use crate::utils::Displayable; + struct DebugIter(RefCell); impl fmt::Debug for DebugIter where diff --git a/gstreamer/src/buffer_cursor.rs b/gstreamer/src/buffer_cursor.rs index 89265a4f3..bef2f6f10 100644 --- a/gstreamer/src/buffer_cursor.rs +++ b/gstreamer/src/buffer_cursor.rs @@ -1,17 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::fmt; -use std::io; -use std::marker::PhantomData; -use std::mem; -use std::ptr; -use std::u64; -use std::usize; +use std::{fmt, io, marker::PhantomData, mem, ptr, u64, usize}; -use crate::Buffer; -use crate::BufferRef; - -use crate::buffer::{Readable, Writable}; +use crate::{ + buffer::{Readable, Writable}, + Buffer, BufferRef, +}; pub struct BufferCursor { buffer: Option, diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index b12f9479f..4723de517 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -1,20 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::AllocationParams; -use crate::Allocator; -use crate::BufferPool; -use crate::Structure; -use crate::StructureRef; +use std::{ + marker::PhantomData, + mem, ops, + ops::{Deref, DerefMut}, + ptr, +}; -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; -use std::marker::PhantomData; -use std::mem; -use std::ops; -use std::ops::Deref; -use std::ops::DerefMut; -use std::ptr; +use crate::{AllocationParams, Allocator, BufferPool, Structure, StructureRef}; #[derive(Debug, Clone, PartialEq, Eq)] #[repr(transparent)] diff --git a/gstreamer/src/buffer_serde.rs b/gstreamer/src/buffer_serde.rs index cbf40466a..a011d46a9 100644 --- a/gstreamer/src/buffer_serde.rs +++ b/gstreamer/src/buffer_serde.rs @@ -1,14 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de::{Deserialize, Deserializer}; -use serde::ser; -use serde::ser::{Serialize, SerializeStruct, Serializer}; +use serde::{ + de::{Deserialize, Deserializer}, + ser, + ser::{Serialize, SerializeStruct, Serializer}, +}; use serde_bytes::{ByteBuf, Bytes}; -use crate::Buffer; -use crate::BufferFlags; -use crate::BufferRef; -use crate::ClockTime; +use crate::{Buffer, BufferFlags, BufferRef, ClockTime}; // TODO: try `Either` to merge the base reprensentations for ser and de // while avoiding unneeded copy @@ -75,9 +74,7 @@ impl<'de> Deserialize<'de> for Buffer { #[cfg(test)] mod tests { - use crate::Buffer; - use crate::BufferFlags; - use crate::ClockTime; + use crate::{Buffer, BufferFlags, ClockTime}; #[test] fn test_serialize() { diff --git a/gstreamer/src/bufferlist.rs b/gstreamer/src/bufferlist.rs index ab7a9cc09..4ea62be79 100644 --- a/gstreamer/src/bufferlist.rs +++ b/gstreamer/src/bufferlist.rs @@ -1,12 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, from_glib_full, from_glib_none, IntoGlib, IntoGlibPtr}; -use std::fmt; -use std::ops::ControlFlow; -use std::ptr; +use std::{fmt, ops::ControlFlow, ptr}; -use crate::Buffer; -use crate::BufferRef; +use glib::translate::{from_glib, from_glib_full, from_glib_none, IntoGlib, IntoGlibPtr}; + +use crate::{Buffer, BufferRef}; mini_object_wrapper!(BufferList, BufferListRef, ffi::GstBufferList, || { ffi::gst_buffer_list_get_type() @@ -191,8 +189,7 @@ impl fmt::Debug for BufferList { impl fmt::Debug for BufferListRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use crate::utils::Displayable; - use crate::ClockTime; + use crate::{utils::Displayable, ClockTime}; let size = self.iter().map(|b| b.size()).sum::(); let (pts, dts) = self diff --git a/gstreamer/src/bufferlist_serde.rs b/gstreamer/src/bufferlist_serde.rs index b46a85a98..bc701728b 100644 --- a/gstreamer/src/bufferlist_serde.rs +++ b/gstreamer/src/bufferlist_serde.rs @@ -1,13 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de::{Deserialize, Deserializer, SeqAccess, Visitor}; -use serde::ser::{Serialize, SerializeSeq, Serializer}; - use std::fmt; -use crate::Buffer; -use crate::BufferList; -use crate::BufferListRef; +use serde::{ + de::{Deserialize, Deserializer, SeqAccess, Visitor}, + ser::{Serialize, SerializeSeq, Serializer}, +}; + +use crate::{Buffer, BufferList, BufferListRef}; impl Serialize for BufferListRef { fn serialize(&self, serializer: S) -> Result { @@ -61,8 +61,7 @@ impl<'de> Deserialize<'de> for BufferList { #[cfg(test)] mod tests { - use crate::BufferList; - use crate::ClockTime; + use crate::{BufferList, ClockTime}; #[test] fn test_serialize() { diff --git a/gstreamer/src/bus.rs b/gstreamer/src/bus.rs index 21bba98ad..742a4f788 100644 --- a/gstreamer/src/bus.rs +++ b/gstreamer/src/bus.rs @@ -1,21 +1,23 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{ + future, + mem::transmute, + pin::Pin, + task::{Context, Poll}, +}; + use futures_channel::mpsc::{self, UnboundedReceiver}; use futures_core::Stream; use futures_util::{stream::FusedStream, StreamExt}; -use glib::ffi::{gboolean, gpointer}; -use glib::prelude::*; -use glib::source::{Continue, Priority, SourceId}; -use glib::translate::*; -use std::future; -use std::mem::transmute; -use std::pin::Pin; -use std::task::{Context, Poll}; +use glib::{ + ffi::{gboolean, gpointer}, + prelude::*, + source::{Continue, Priority, SourceId}, + translate::*, +}; -use crate::Bus; -use crate::BusSyncReply; -use crate::Message; -use crate::MessageType; +use crate::{Bus, BusSyncReply, Message, MessageType}; unsafe extern "C" fn trampoline_watch Continue + Send + 'static>( bus: *mut ffi::GstBus, @@ -377,9 +379,10 @@ impl FusedStream for BusStream { #[cfg(test)] mod tests { - use super::*; use std::sync::{Arc, Mutex}; + use super::*; + #[test] fn test_sync_handler() { crate::init().unwrap(); diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index bfb0d6f71..0a12097c7 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -1,19 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::caps_features::*; -use crate::structure::*; -use std::fmt; -use std::marker::PhantomData; -use std::ptr; -use std::str; +use std::{fmt, marker::PhantomData, ptr, str}; -use crate::CapsIntersectMode; - -use glib::translate::{ - from_glib, from_glib_full, FromGlibPtrFull, IntoGlib, IntoGlibPtr, ToGlibPtr, +use glib::{ + translate::{from_glib, from_glib_full, FromGlibPtrFull, IntoGlib, IntoGlibPtr, ToGlibPtr}, + value::ToSendValue, + StaticType, }; -use glib::value::ToSendValue; -use glib::StaticType; + +use crate::{caps_features::*, structure::*, CapsIntersectMode}; mini_object_wrapper!(Caps, CapsRef, ffi::GstCaps, || { ffi::gst_caps_get_type() }); @@ -1068,8 +1063,7 @@ impl BuilderFull { #[cfg(test)] mod tests { use super::*; - use crate::Array; - use crate::Fraction; + use crate::{Array, Fraction}; #[test] fn test_simple() { diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 04e14ee21..14fc10247 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -1,19 +1,18 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::borrow::{Borrow, BorrowMut, ToOwned}; -use std::ffi::CStr; -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ops::{Deref, DerefMut}; -use std::ptr; -use std::str; +use std::{ + borrow::{Borrow, BorrowMut, ToOwned}, + ffi::CStr, + fmt, + marker::PhantomData, + mem, + ops::{Deref, DerefMut}, + ptr, str, +}; +use glib::{translate::*, StaticType}; use once_cell::sync::Lazy; -use glib::translate::*; -use glib::StaticType; - #[doc(alias = "GstCapsFeatures")] #[repr(transparent)] pub struct CapsFeatures(ptr::NonNull); diff --git a/gstreamer/src/caps_features_serde.rs b/gstreamer/src/caps_features_serde.rs index 372f1cb8c..fb966ad52 100644 --- a/gstreamer/src/caps_features_serde.rs +++ b/gstreamer/src/caps_features_serde.rs @@ -1,13 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de; -use serde::de::{Deserialize, Deserializer, EnumAccess, SeqAccess, VariantAccess, Visitor}; -use serde::ser::{Serialize, SerializeSeq, Serializer}; - use std::fmt; -use crate::CapsFeatures; -use crate::CapsFeaturesRef; +use serde::{ + de, + de::{Deserialize, Deserializer, EnumAccess, SeqAccess, VariantAccess, Visitor}, + ser::{Serialize, SerializeSeq, Serializer}, +}; + +use crate::{CapsFeatures, CapsFeaturesRef}; enum CapsFeaturesVariantKinds { Any, diff --git a/gstreamer/src/caps_serde.rs b/gstreamer/src/caps_serde.rs index c39df77e3..f3ef31c90 100644 --- a/gstreamer/src/caps_serde.rs +++ b/gstreamer/src/caps_serde.rs @@ -1,17 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de; -use serde::de::{Deserialize, Deserializer, EnumAccess, SeqAccess, VariantAccess, Visitor}; -use serde::ser::{Serialize, SerializeSeq, SerializeTuple, Serializer}; - use std::fmt; -use crate::Caps; -use crate::CapsFeatures; -use crate::CapsFeaturesRef; -use crate::CapsRef; -use crate::Structure; -use crate::StructureRef; +use serde::{ + de, + de::{Deserialize, Deserializer, EnumAccess, SeqAccess, VariantAccess, Visitor}, + ser::{Serialize, SerializeSeq, SerializeTuple, Serializer}, +}; + +use crate::{Caps, CapsFeatures, CapsFeaturesRef, CapsRef, Structure, StructureRef}; enum CapsVariantKinds { Any, @@ -223,10 +220,7 @@ impl<'de> Deserialize<'de> for Caps { #[cfg(test)] mod tests { - use crate::Array; - use crate::Caps; - use crate::CapsFeatures; - use crate::Fraction; + use crate::{Array, Caps, CapsFeatures, Fraction}; #[test] fn test_serialize() { diff --git a/gstreamer/src/child_proxy.rs b/gstreamer/src/child_proxy.rs index e1738b89a..e4b4cd2a1 100644 --- a/gstreamer/src/child_proxy.rs +++ b/gstreamer/src/child_proxy.rs @@ -1,10 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::ChildProxy; -use glib::prelude::*; -use glib::translate::*; use std::ptr; +use glib::{prelude::*, translate::*}; + +use crate::ChildProxy; + pub trait ChildProxyExtManual: 'static { #[doc(alias = "gst_child_proxy_lookup")] fn lookup(&self, name: &str) -> Result<(glib::Object, glib::ParamSpec), glib::BoolError>; diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index b494f6c48..8a8af3894 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -1,25 +1,25 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Clock; -use crate::ClockEntryType; -use crate::ClockError; -use crate::ClockFlags; -use crate::ClockReturn; -use crate::ClockSuccess; -use crate::ClockTime; -use crate::ClockTimeDiff; -use glib::ffi::{gboolean, gpointer}; -use glib::prelude::*; -use glib::translate::*; -use libc::c_void; -use std::cmp; -use std::ptr; +use std::{ + cmp, + marker::Unpin, + pin::Pin, + ptr, + sync::{atomic, atomic::AtomicI32}, +}; use futures_core::{Future, Stream}; -use std::marker::Unpin; -use std::pin::Pin; -use std::sync::atomic; -use std::sync::atomic::AtomicI32; +use glib::{ + ffi::{gboolean, gpointer}, + prelude::*, + translate::*, +}; +use libc::c_void; + +use crate::{ + Clock, ClockEntryType, ClockError, ClockFlags, ClockReturn, ClockSuccess, ClockTime, + ClockTimeDiff, +}; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] @@ -527,11 +527,13 @@ impl> ClockExtManual for O { #[cfg(test)] mod tests { - use super::super::prelude::*; - use super::super::*; - use super::*; use std::sync::mpsc::channel; + use super::{ + super::{prelude::*, *}, + *, + }; + #[test] fn test_wait() { crate::init().unwrap(); diff --git a/gstreamer/src/context.rs b/gstreamer/src/context.rs index 151bf4a89..ae6fb612f 100644 --- a/gstreamer/src/context.rs +++ b/gstreamer/src/context.rs @@ -1,7 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; +use std::{ffi::CStr, fmt}; use glib::translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}; diff --git a/gstreamer/src/control_binding.rs b/gstreamer/src/control_binding.rs index 9160cfe21..4c0fa1532 100644 --- a/gstreamer/src/control_binding.rs +++ b/gstreamer/src/control_binding.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::ClockTime; -use crate::ControlBinding; -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; + +use crate::{ClockTime, ControlBinding}; pub trait ControlBindingExtManual: 'static { #[doc(alias = "get_g_value_array")] diff --git a/gstreamer/src/control_source.rs b/gstreamer/src/control_source.rs index e5c77b2e4..58d3a59c6 100644 --- a/gstreamer/src/control_source.rs +++ b/gstreamer/src/control_source.rs @@ -1,9 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::ClockTime; -use crate::ControlSource; -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; + +use crate::{ClockTime, ControlSource}; pub trait ControlSourceExtManual: 'static { #[doc(alias = "get_value_array")] diff --git a/gstreamer/src/date_time.rs b/gstreamer/src/date_time.rs index 3dba92bd8..9a7066794 100644 --- a/gstreamer/src/date_time.rs +++ b/gstreamer/src/date_time.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{cmp, fmt}; + use glib::translate::*; -use std::cmp; -use std::fmt; use crate::DateTime; diff --git a/gstreamer/src/date_time_serde.rs b/gstreamer/src/date_time_serde.rs index 9601a71a9..24344b33b 100644 --- a/gstreamer/src/date_time_serde.rs +++ b/gstreamer/src/date_time_serde.rs @@ -2,14 +2,18 @@ #![allow(clippy::upper_case_acronyms)] -use glib::translate::{FromGlib, IntoGlib}; -use glib::value::{ToValue, ToValueOptional}; -use glib::StaticType; +use glib::{ + translate::{FromGlib, IntoGlib}, + value::{ToValue, ToValueOptional}, + StaticType, +}; +use serde::{ + de::{Deserialize, Deserializer, Error}, + ser, + ser::{Serialize, Serializer}, +}; use crate::DateTime; -use serde::de::{Deserialize, Deserializer, Error}; -use serde::ser; -use serde::ser::{Serialize, Serializer}; #[derive(serde::Serialize, serde::Deserialize)] enum DateTimeVariants { diff --git a/gstreamer/src/device_monitor.rs b/gstreamer/src/device_monitor.rs index 4265d6e9a..ca657ac85 100644 --- a/gstreamer/src/device_monitor.rs +++ b/gstreamer/src/device_monitor.rs @@ -1,13 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Caps; -use crate::DeviceMonitor; - -use glib::prelude::*; -use glib::translate::*; - use std::num::NonZeroU32; +use glib::{prelude::*, translate::*}; + +use crate::{Caps, DeviceMonitor}; + #[derive(Debug, PartialEq, Eq)] pub struct DeviceMonitorFilterId(NonZeroU32); diff --git a/gstreamer/src/device_provider.rs b/gstreamer/src/device_provider.rs index 6a3f4dfc0..8c669ff68 100644 --- a/gstreamer/src/device_provider.rs +++ b/gstreamer/src/device_provider.rs @@ -1,14 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::DeviceProvider; -use crate::Plugin; -use crate::Rank; - -use glib::prelude::*; -use glib::translate::*; - use std::ffi::CStr; +use glib::{prelude::*, translate::*}; + +use crate::{DeviceProvider, Plugin, Rank}; + impl DeviceProvider { #[doc(alias = "gst_device_provider_register")] pub fn register( diff --git a/gstreamer/src/device_provider_factory.rs b/gstreamer/src/device_provider_factory.rs index 2b3a7a6b4..5c318e3bb 100644 --- a/gstreamer/src/device_provider_factory.rs +++ b/gstreamer/src/device_provider_factory.rs @@ -1,15 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::DeviceProviderFactory; -use crate::ELEMENT_METADATA_AUTHOR; -use crate::ELEMENT_METADATA_DESCRIPTION; -use crate::ELEMENT_METADATA_DOC_URI; -use crate::ELEMENT_METADATA_ICON_NAME; -use crate::ELEMENT_METADATA_KLASS; -use crate::ELEMENT_METADATA_LONGNAME; -use glib::translate::*; use std::ffi::CStr; +use glib::translate::*; + +use crate::{ + DeviceProviderFactory, ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, + ELEMENT_METADATA_DOC_URI, ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, + ELEMENT_METADATA_LONGNAME, +}; + impl DeviceProviderFactory { #[doc(alias = "gst_device_provider_factory_list_get_device_providers")] pub fn factories(minrank: crate::Rank) -> glib::List { diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 149f1137c..439750976 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -1,32 +1,19 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Element; - -use once_cell::sync::Lazy; - -use crate::format::{ - CompatibleFormattedValue, FormattedValue, SpecificFormattedValueFullRange, - SpecificFormattedValueIntrinsic, -}; -use crate::prelude::*; -use crate::ClockTime; -use crate::ElementFlags; -use crate::Event; -use crate::Pad; -use crate::PadTemplate; -use crate::Plugin; -use crate::QueryRef; -use crate::Rank; -use crate::State; -use crate::{Format, GenericFormattedValue}; +use std::{ffi::CStr, future::Future, mem, num::NonZeroU64, pin::Pin}; use glib::translate::*; +use once_cell::sync::Lazy; -use std::ffi::CStr; -use std::future::Future; -use std::mem; -use std::num::NonZeroU64; -use std::pin::Pin; +use crate::{ + format::{ + CompatibleFormattedValue, FormattedValue, SpecificFormattedValueFullRange, + SpecificFormattedValueIntrinsic, + }, + prelude::*, + ClockTime, Element, ElementFlags, Event, Format, GenericFormattedValue, Pad, PadTemplate, + Plugin, QueryRef, Rank, State, +}; impl Element { #[doc(alias = "gst_element_link_many")] @@ -1752,10 +1739,12 @@ macro_rules! element_imp_info( #[cfg(test)] mod tests { - use super::*; - use glib::GString; use std::sync::mpsc::channel; + use glib::GString; + + use super::*; + #[test] fn test_get_pads() { crate::init().unwrap(); diff --git a/gstreamer/src/element_factory.rs b/gstreamer/src/element_factory.rs index a3a2364e1..dfe953d39 100644 --- a/gstreamer/src/element_factory.rs +++ b/gstreamer/src/element_factory.rs @@ -1,21 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::ELEMENT_METADATA_AUTHOR; -use crate::ELEMENT_METADATA_DESCRIPTION; -use crate::ELEMENT_METADATA_DOC_URI; -use crate::ELEMENT_METADATA_ICON_NAME; -use crate::ELEMENT_METADATA_KLASS; -use crate::ELEMENT_METADATA_LONGNAME; use std::ffi::CStr; -use crate::CapsRef; -use crate::Element; -use crate::ElementFactory; -use crate::Rank; -use crate::StaticPadTemplate; +use glib::{prelude::*, translate::*}; -use glib::prelude::*; -use glib::translate::*; +use crate::{ + CapsRef, Element, ElementFactory, Rank, StaticPadTemplate, ELEMENT_METADATA_AUTHOR, + ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI, ELEMENT_METADATA_ICON_NAME, + ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME, +}; impl ElementFactory { #[doc(alias = "gst_element_factory_create_with_properties")] diff --git a/gstreamer/src/enums.rs b/gstreamer/src/enums.rs index 48194ba41..c4efe2c9d 100644 --- a/gstreamer/src/enums.rs +++ b/gstreamer/src/enums.rs @@ -1,20 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::ClockReturn; -use crate::FlowReturn; -use crate::PadLinkReturn; -use crate::State; -use crate::StateChange; -use crate::StateChangeReturn; use std::{cmp, ops}; + +use glib::{ + translate::*, + value::{FromValue, ToValue, Value}, + StaticType, Type, +}; use thiserror::Error; -use glib::translate::*; -use glib::value::FromValue; -use glib::value::ToValue; -use glib::value::Value; -use glib::StaticType; -use glib::Type; +use crate::{ClockReturn, FlowReturn, PadLinkReturn, State, StateChange, StateChangeReturn}; macro_rules! impl_return_result_traits { ($ffi_type:ident, $ret_type:ident, $ok_type:ident, $err_type:ident) => { diff --git a/gstreamer/src/error.rs b/gstreamer/src/error.rs index 62b5ed53a..ae3ed057e 100644 --- a/gstreamer/src/error.rs +++ b/gstreamer/src/error.rs @@ -1,8 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use thiserror::Error; - use glib::{prelude::*, IntoGStr}; +use thiserror::Error; #[macro_export] macro_rules! error_msg( diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 195c33a1a..22d453ff4 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -1,26 +1,19 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::format::{ - CompatibleFormattedValue, FormattedValue, FormattedValueIntrinsic, GenericFormattedValue, +use std::{borrow::Borrow, cmp, ffi::CStr, fmt, mem, num::NonZeroU32, ops::Deref, ptr}; + +use glib::{ + translate::{FromGlibPtrContainer, *}, + value::ToSendValue, }; -use crate::structure::*; -use crate::ClockTime; -use std::borrow::Borrow; -use std::cmp; -use std::ffi::CStr; -use std::fmt; -use std::mem; -use std::num::NonZeroU32; -use std::ops::Deref; -use std::ptr; - -use glib::translate::*; -use glib::value::ToSendValue; - -use glib::translate::FromGlibPtrContainer; - -use crate::EventType; +use crate::{ + format::{ + CompatibleFormattedValue, FormattedValue, FormattedValueIntrinsic, GenericFormattedValue, + }, + structure::*, + ClockTime, EventType, +}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Seqnum(pub(crate) NonZeroU32); diff --git a/gstreamer/src/flag_serde.rs b/gstreamer/src/flag_serde.rs index ebb5eddd1..4fe2ca632 100644 --- a/gstreamer/src/flag_serde.rs +++ b/gstreamer/src/flag_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{FlagsClass, StaticType, ToValue}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + FlagsClass, StaticType, ToValue, +}; bitflags_serde_impl!(crate::BinFlags); bitflags_serde_impl!(crate::BufferCopyFlags); diff --git a/gstreamer/src/format/clock_time.rs b/gstreamer/src/format/clock_time.rs index cd065da2f..61ac6a734 100644 --- a/gstreamer/src/format/clock_time.rs +++ b/gstreamer/src/format/clock_time.rs @@ -1,16 +1,17 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; -use glib::StaticType; +use std::{ + fmt, + io::{self, prelude::*}, + time::Duration, +}; -use std::fmt; -use std::io::{self, prelude::*}; -use std::time::Duration; +use glib::{translate::*, StaticType}; -use super::{Format, FormattedValueError, GenericFormattedValue, Signed}; use super::{ - FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, FormattedValueNoneBuilder, - SpecificFormattedValue, SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic, + Format, FormattedValue, FormattedValueError, FormattedValueFullRange, FormattedValueIntrinsic, + FormattedValueNoneBuilder, GenericFormattedValue, Signed, SpecificFormattedValue, + SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic, }; #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)] @@ -405,9 +406,10 @@ enum Sign { /// contain the sign; that will be added by this method. fn pad_clocktime(f: &mut fmt::Formatter<'_>, sign: Sign, buf: &str) -> fmt::Result { skip_assert_initialized!(); - use self::Sign::*; use std::fmt::{Alignment, Write}; + use self::Sign::*; + // Start by determining how we're padding, gathering // settings from the Formatter and the Sign @@ -584,9 +586,10 @@ impl std::iter::Sum for ClockTime { #[cfg(test)] mod tests { + use opt_ops::prelude::*; + use super::*; use crate::format::{Signed, UnsignedIntoSigned}; - use opt_ops::prelude::*; const CT_1: ClockTime = ClockTime::from_nseconds(1); const CT_2: ClockTime = ClockTime::from_nseconds(2); diff --git a/gstreamer/src/format/clock_time_serde.rs b/gstreamer/src/format/clock_time_serde.rs index 3f100bcaf..b3588fc9c 100644 --- a/gstreamer/src/format/clock_time_serde.rs +++ b/gstreamer/src/format/clock_time_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de::{Deserialize, Deserializer}; -use serde::ser::{Serialize, Serializer}; +use serde::{ + de::{Deserialize, Deserializer}, + ser::{Serialize, Serializer}, +}; use crate::ClockTime; diff --git a/gstreamer/src/format/compatible.rs b/gstreamer/src/format/compatible.rs index 661a52d6e..6657fcc43 100644 --- a/gstreamer/src/format/compatible.rs +++ b/gstreamer/src/format/compatible.rs @@ -1,7 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::{Format, FormattedValueError, GenericFormattedValue}; -use super::{FormattedValue, SpecificFormattedValue}; +use super::{ + Format, FormattedValue, FormattedValueError, GenericFormattedValue, SpecificFormattedValue, +}; // rustdoc-stripper-ignore-next /// A trait implemented on types which can hold [`FormattedValue`]s compatible with parameter `F`. diff --git a/gstreamer/src/format/format_serde.rs b/gstreamer/src/format/format_serde.rs index fcbd9aa9b..632085411 100644 --- a/gstreamer/src/format/format_serde.rs +++ b/gstreamer/src/format/format_serde.rs @@ -1,7 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de::{Deserialize, Deserializer}; -use serde::ser::{Serialize, Serializer}; +use serde::{ + de::{Deserialize, Deserializer}, + ser::{Serialize, Serializer}, +}; use crate::format::{Buffers, Bytes, Default, Other, Percent, Undefined}; @@ -59,11 +61,10 @@ impl<'de> Deserialize<'de> for Undefined { #[cfg(test)] mod tests { - use crate::format::prelude::*; - use crate::format::{Default, Other, Undefined}; - use crate::ClockTime; - use crate::Format; - use crate::GenericFormattedValue; + use crate::{ + format::{prelude::*, Default, Other, Undefined}, + ClockTime, Format, GenericFormattedValue, + }; #[test] fn test_serialize() { diff --git a/gstreamer/src/format/generic.rs b/gstreamer/src/format/generic.rs index b592130a6..4d2eb9f8a 100644 --- a/gstreamer/src/format/generic.rs +++ b/gstreamer/src/format/generic.rs @@ -1,17 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::{FromGlib, GlibNoneError, IntoGlib, OptionIntoGlib, TryFromGlib}; use std::fmt; -use crate::utils::Displayable; +use glib::translate::{FromGlib, GlibNoneError, IntoGlib, OptionIntoGlib, TryFromGlib}; use super::{ - Buffers, Bytes, ClockTime, Default, Format, FormattedValueError, Percent, Signed, Undefined, -}; -use super::{ - CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, - FormattedValueNoneBuilder, SignedIntrinsic, UnsignedIntoSigned, + Buffers, Bytes, ClockTime, CompatibleFormattedValue, Default, Format, FormattedValue, + FormattedValueError, FormattedValueFullRange, FormattedValueIntrinsic, + FormattedValueNoneBuilder, Percent, Signed, SignedIntrinsic, Undefined, UnsignedIntoSigned, }; +use crate::utils::Displayable; #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug, Default)] pub struct Other(u64); diff --git a/gstreamer/src/format/undefined.rs b/gstreamer/src/format/undefined.rs index 9515f93b0..09bb6f4af 100644 --- a/gstreamer/src/format/undefined.rs +++ b/gstreamer/src/format/undefined.rs @@ -1,10 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::TryFromGlib; use std::ops::{Deref, DerefMut}; -use super::{FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic}; -use super::{FormattedValueError, GenericFormattedValue, Signed}; +use glib::translate::TryFromGlib; + +use super::{ + FormattedValue, FormattedValueError, FormattedValueFullRange, FormattedValueIntrinsic, + GenericFormattedValue, Signed, +}; use crate::Format; #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug, Default)] diff --git a/gstreamer/src/functions.rs b/gstreamer/src/functions.rs index 3c10ff069..ae154da87 100644 --- a/gstreamer/src/functions.rs +++ b/gstreamer/src/functions.rs @@ -1,18 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::auto::functions::parse_bin_from_description; -use glib::prelude::*; -use glib::translate::*; use std::ptr; -use crate::Bin; -use crate::Element; -use crate::Object; -use crate::ParseContext; -use crate::ParseFlags; +use glib::{prelude::*, translate::*}; + #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] use crate::Tracer; +use crate::{ + auto::functions::parse_bin_from_description, Bin, Element, Object, ParseContext, ParseFlags, +}; pub fn parse_bin_from_description_with_name( bin_description: &str, diff --git a/gstreamer/src/ghost_pad.rs b/gstreamer/src/ghost_pad.rs index a93aef4c9..36237fb09 100644 --- a/gstreamer/src/ghost_pad.rs +++ b/gstreamer/src/ghost_pad.rs @@ -1,18 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::prelude::*; -use crate::FlowError; -use crate::FlowSuccess; -use crate::GhostPad; -use crate::LoggableError; -use crate::Pad; -use crate::PadBuilder; -use crate::PadFlags; -use crate::PadGetRangeSuccess; -use crate::PadMode; -use crate::StaticPadTemplate; use glib::translate::*; +use crate::{ + prelude::*, FlowError, FlowSuccess, GhostPad, LoggableError, Pad, PadBuilder, PadFlags, + PadGetRangeSuccess, PadMode, StaticPadTemplate, +}; + impl GhostPad { #[doc(alias = "gst_ghost_pad_activate_mode_default")] pub fn activate_mode_default>( diff --git a/gstreamer/src/gobject.rs b/gstreamer/src/gobject.rs index 85dd04099..cb8ff40f1 100644 --- a/gstreamer/src/gobject.rs +++ b/gstreamer/src/gobject.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::value::GstValueExt; use glib::prelude::*; +use crate::value::GstValueExt; + pub trait GObjectExtManualGst: 'static { #[doc(alias = "gst_util_set_object_arg")] fn set_property_from_str(&self, name: &str, value: &str); diff --git a/gstreamer/src/gtype.rs b/gstreamer/src/gtype.rs index 485edd27e..288d21392 100644 --- a/gstreamer/src/gtype.rs +++ b/gstreamer/src/gtype.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; use std::ffi::c_void; +use glib::translate::*; + pub trait PluginApiExt { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_type_mark_as_plugin_api")] @@ -63,9 +64,10 @@ impl PluginApiExt for glib::Type { #[cfg(test)] mod tests { - use super::*; use glib::StaticType; + use super::*; + #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] #[enum_type(name = "GstTestEnum")] diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index 9e27f0806..23b2f9261 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -1,17 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::ffi::{gconstpointer, gpointer}; -use glib::translate::*; -use glib::value::{FromValue, ToValue}; -use glib::StaticType; -use glib::Value; -use std::ffi::CString; -use std::fmt; -use std::iter; -use std::marker::PhantomData; -use std::mem; -use std::ptr; -use std::sync::Arc; +use std::{ffi::CString, fmt, iter, marker::PhantomData, mem, ptr, sync::Arc}; + +use glib::{ + ffi::{gconstpointer, gpointer}, + translate::*, + value::{FromValue, ToValue}, + StaticType, Value, +}; use thiserror::Error; #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Error)] @@ -355,9 +351,9 @@ unsafe extern "C" fn filter_boxed_unref(boxed: gpointer) { } unsafe extern "C" fn filter_boxed_get_type() -> glib::ffi::GType { + use std::{collections::HashMap, sync::Mutex}; + use once_cell::sync::Lazy; - use std::collections::HashMap; - use std::sync::Mutex; static mut TYPES: Lazy>> = Lazy::new(|| Mutex::new(HashMap::new())); @@ -806,9 +802,10 @@ mod tests { #[test] fn test_std_resync_collect() { - use crate::prelude::*; use std::collections::BTreeSet; + use crate::prelude::*; + crate::init().unwrap(); let bin = crate::Bin::new(None); diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 0d3de51db..344c19b38 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -10,9 +10,8 @@ // Re-exported for the subclass gst_plugin_define! macro pub use ffi; pub use glib; -pub use paste; - use glib::translate::{from_glib, from_glib_full}; +pub use paste; #[doc(hidden)] pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); @@ -43,8 +42,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::let_unit_value)] #[allow(unused_imports)] mod auto; -pub use crate::auto::functions::*; -pub use crate::auto::*; +pub use crate::auto::{functions::*, *}; #[macro_use] #[cfg(feature = "serde")] @@ -106,8 +104,9 @@ pub mod meta; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] pub use crate::meta::MetaSeqnum; -pub use crate::meta::ReferenceTimestampMeta; -pub use crate::meta::{Meta, MetaAPI, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta}; +pub use crate::meta::{ + Meta, MetaAPI, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta, ReferenceTimestampMeta, +}; pub mod buffer; pub use crate::buffer::{ Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_ALL, BUFFER_COPY_METADATA, @@ -194,20 +193,21 @@ mod tag_setter; pub mod task; pub use task::{TaskLock, TaskLockGuard}; mod task_pool; -pub use crate::element::{ElementMessageType, NotifyWatchId}; -pub use crate::element::{ - ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI, - ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME, -}; -pub use crate::task_pool::{TaskHandle, TaskPoolTaskHandle}; - pub use self::iterator::{Iterator, IteratorError, IteratorImpl, StdIterator}; -pub use crate::device_monitor::DeviceMonitorFilterId; -pub use crate::enums::{ - ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess, - StateChangeError, StateChangeSuccess, TagError, +pub use crate::{ + device_monitor::DeviceMonitorFilterId, + element::{ + ElementMessageType, NotifyWatchId, ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, + ELEMENT_METADATA_DOC_URI, ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, + ELEMENT_METADATA_LONGNAME, + }, + enums::{ + ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess, + StateChangeError, StateChangeSuccess, TagError, + }, + parse_context::ParseContext, + task_pool::{TaskHandle, TaskPoolTaskHandle}, }; -pub use crate::parse_context::ParseContext; mod plugin_feature; mod plugin; @@ -241,8 +241,7 @@ mod pad_template; pub use pad_template::PadTemplateBuilder; pub mod param_spec; -pub use crate::param_spec::ParamSpecArray; -pub use crate::param_spec::ParamSpecFraction; +pub use crate::param_spec::{ParamSpecArray, ParamSpecFraction}; pub mod functions; pub use crate::functions::*; @@ -297,51 +296,44 @@ pub const PARAM_FLAG_CONDITIONALLY_AVAILABLE: glib::ParamFlags = glib::ParamFlag pub mod prelude { #[doc(hidden)] pub use glib::prelude::*; + pub use muldiv::MulDiv; pub use opt_ops::prelude::*; - pub use crate::auto::traits::*; - - pub use crate::meta::MetaAPI; - // OS dependent Bus extensions (also import the other platform trait for doc) #[cfg(any(unix, feature = "dox"))] pub use crate::bus_unix::UnixBusExtManual; #[cfg(any(windows, feature = "dox"))] pub use crate::bus_windows::WindowsBusExtManual; - - pub use crate::bin::GstBinExtManual; - pub use crate::buffer_pool::BufferPoolExtManual; - pub use crate::child_proxy::ChildProxyExtManual; - pub use crate::clock::ClockExtManual; - pub use crate::device_monitor::DeviceMonitorExtManual; - pub use crate::device_provider::DeviceProviderExtManual; - pub use crate::element::{ElementClassExt, ElementExtManual}; - pub use crate::gobject::GObjectExtManualGst; #[cfg(any(feature = "v1_18", feature = "dox"))] pub use crate::gtype::PluginApiExt; - pub use crate::message::MessageErrorDomain; - pub use crate::object::GstObjectExtManual; - pub use crate::pad::PadExtManual; - pub use crate::pipeline::GstPipelineExtManual; - pub use crate::plugin::GstPluginExtManual; - pub use crate::plugin_feature::PluginFeatureExtManual; - pub use crate::tag_setter::TagSetterExtManual; - pub use crate::task_pool::{TaskHandle, TaskPoolExtManual}; - pub use crate::typefind::TypeFindImpl; - pub use crate::value::GstValueExt; - - pub use crate::miniobject::IsMiniObject; - - pub use crate::tags::{CustomTag, Tag}; - - pub use crate::param_spec::GstParamSpecBuilderExt; - - pub use muldiv::MulDiv; - - pub use crate::format::prelude::*; - pub use crate::utils::Displayable; - - pub use crate::memory::MemoryType; + pub use crate::{ + auto::traits::*, + bin::GstBinExtManual, + buffer_pool::BufferPoolExtManual, + child_proxy::ChildProxyExtManual, + clock::ClockExtManual, + device_monitor::DeviceMonitorExtManual, + device_provider::DeviceProviderExtManual, + element::{ElementClassExt, ElementExtManual}, + format::prelude::*, + gobject::GObjectExtManualGst, + memory::MemoryType, + message::MessageErrorDomain, + meta::MetaAPI, + miniobject::IsMiniObject, + object::GstObjectExtManual, + pad::PadExtManual, + param_spec::GstParamSpecBuilderExt, + pipeline::GstPipelineExtManual, + plugin::GstPluginExtManual, + plugin_feature::PluginFeatureExtManual, + tag_setter::TagSetterExtManual, + tags::{CustomTag, Tag}, + task_pool::{TaskHandle, TaskPoolExtManual}, + typefind::TypeFindImpl, + utils::Displayable, + value::GstValueExt, + }; } #[macro_use] diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index 2b4812817..c6c535657 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -1,19 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::DebugLevel; +use std::{borrow::Cow, ffi::CStr, fmt, ptr}; -use glib::IntoGStr; +use glib::{ffi::gpointer, prelude::*, translate::*, IntoGStr}; use libc::c_char; -use std::borrow::Cow; -use std::ffi::CStr; -use std::fmt; -use std::ptr; - use once_cell::sync::Lazy; -use glib::ffi::gpointer; -use glib::prelude::*; -use glib::translate::*; +use crate::DebugLevel; #[derive(PartialEq, Eq)] #[doc(alias = "GstDebugMessage")] @@ -1188,9 +1181,9 @@ pub fn debug_remove_log_function(log_fn: DebugLogFunction) { #[cfg(test)] mod tests { + use std::sync::{mpsc, Arc, Mutex}; + use super::*; - use std::sync::mpsc; - use std::sync::{Arc, Mutex}; #[test] #[doc(alias = "get_existing")] diff --git a/gstreamer/src/memory.rs b/gstreamer/src/memory.rs index aae275d0c..376297155 100644 --- a/gstreamer/src/memory.rs +++ b/gstreamer/src/memory.rs @@ -1,17 +1,16 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ops::{Deref, DerefMut}; -use std::ptr; -use std::slice; +use std::{ + fmt, + marker::PhantomData, + mem, + ops::{Deref, DerefMut}, + ptr, slice, +}; use glib::translate::{from_glib, from_glib_full, from_glib_none, IntoGlibPtr, ToGlibPtr}; -use crate::AllocationParams; -use crate::Allocator; -use crate::MemoryFlags; +use crate::{AllocationParams, Allocator, MemoryFlags}; mini_object_wrapper!(Memory, MemoryRef, ffi::GstMemory, || { ffi::gst_memory_get_type() diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 01af9a2a5..8a8763c98 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -1,25 +1,16 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::format::{CompatibleFormattedValue, FormattedValue}; -use crate::prelude::*; -use crate::structure::*; -use crate::GenericFormattedValue; -use crate::GroupId; -use crate::MessageType; -use crate::Object; -use crate::Seqnum; -use crate::TagList; - -use std::borrow::Borrow; -use std::ffi::CStr; -use std::fmt; -use std::mem; -use std::num::NonZeroU32; -use std::ops::Deref; -use std::ptr; +use std::{borrow::Borrow, ffi::CStr, fmt, mem, num::NonZeroU32, ops::Deref, ptr}; use glib::translate::*; +use crate::{ + format::{CompatibleFormattedValue, FormattedValue}, + prelude::*, + structure::*, + GenericFormattedValue, GroupId, MessageType, Object, Seqnum, TagList, +}; + mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, || { ffi::gst_message_get_type() }); diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index 0f135987a..ce18988e4 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -1,21 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::fmt; -use std::marker::PhantomData; -use std::ops; - #[cfg(any(feature = "v1_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] use std::ptr; - -use crate::Buffer; -use crate::BufferRef; -use crate::Caps; -use crate::CapsRef; -use crate::ClockTime; +use std::{fmt, marker::PhantomData, ops}; use glib::translate::*; +use crate::{Buffer, BufferRef, Caps, CapsRef, ClockTime}; + pub unsafe trait MetaAPI: Sync + Send + Sized { type GstType; diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 8fdd0dd81..df6c949f0 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::translate::*; use std::fmt; +use glib::translate::*; + pub trait IsMiniObject: AsRef + FromGlibPtrFull<*mut Self::FfiType> + Send + Sync + 'static { diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index 62ac57524..a827b6742 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -1,11 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::signal::SignalHandlerId; -use glib::translate::*; +use glib::{prelude::*, signal::SignalHandlerId, translate::*}; -use crate::ClockTime; -use crate::ObjectFlags; +use crate::{ClockTime, ObjectFlags}; pub trait GstObjectExtManual: 'static { #[doc(alias = "deep-notify")] @@ -127,9 +124,10 @@ impl> GstObjectExtManual for O { #[cfg(test)] mod tests { + use std::sync::{Arc, Mutex}; + use super::*; use crate::prelude::*; - use std::sync::{Arc, Mutex}; #[test] fn test_deep_notify() { diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 64776210e..de48995ae 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -1,35 +1,22 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::element::ElementExtManual; -use crate::format::{ - FormattedValue, SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic, +use std::{ + mem, + num::NonZeroU64, + ops::ControlFlow, + panic::{self, AssertUnwindSafe}, + ptr, }; -use crate::prelude::PadExt; -use crate::Buffer; -use crate::BufferList; -use crate::Event; -use crate::FlowError; -use crate::FlowReturn; -use crate::FlowSuccess; -use crate::LoggableError; -use crate::Pad; -use crate::PadFlags; -use crate::PadProbeReturn; -use crate::PadProbeType; -use crate::Query; -use crate::QueryRef; -use crate::StaticPadTemplate; -use crate::{Format, GenericFormattedValue}; -use std::mem; -use std::num::NonZeroU64; -use std::ops::ControlFlow; -use std::panic::{self, AssertUnwindSafe}; -use std::ptr; +use glib::{ffi::gpointer, prelude::*, translate::*}; -use glib::ffi::gpointer; -use glib::prelude::*; -use glib::translate::*; +use crate::{ + element::ElementExtManual, + format::{FormattedValue, SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic}, + prelude::PadExt, + Buffer, BufferList, Event, FlowError, FlowReturn, FlowSuccess, Format, GenericFormattedValue, + LoggableError, Pad, PadFlags, PadProbeReturn, PadProbeType, Query, QueryRef, StaticPadTemplate, +}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct PadProbeId(NonZeroU64); @@ -1928,10 +1915,10 @@ impl + IsA + glib::object::IsClass> PadBuilder { #[cfg(test)] mod tests { + use std::sync::{atomic::AtomicUsize, mpsc::channel, Arc, Mutex}; + use super::*; use crate::prelude::*; - use std::sync::{atomic::AtomicUsize, mpsc::channel}; - use std::sync::{Arc, Mutex}; #[test] fn test_event_chain_functions() { diff --git a/gstreamer/src/pad_template.rs b/gstreamer/src/pad_template.rs index d86828119..dad95e34c 100644 --- a/gstreamer/src/pad_template.rs +++ b/gstreamer/src/pad_template.rs @@ -1,14 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Caps; -use crate::PadDirection; -use crate::PadPresence; -use crate::PadTemplate; -use crate::StaticPadTemplate; -use glib::prelude::*; -use glib::translate::*; use std::ffi::CStr; +use glib::{prelude::*, translate::*}; + +use crate::{Caps, PadDirection, PadPresence, PadTemplate, StaticPadTemplate}; + impl PadTemplate { #[doc(alias = "gst_pad_template_new_from_static_pad_template_with_gtype")] pub fn from_static_pad_template_with_gtype( diff --git a/gstreamer/src/param_spec.rs b/gstreamer/src/param_spec.rs index ad323ccb5..00b1394dc 100644 --- a/gstreamer/src/param_spec.rs +++ b/gstreamer/src/param_spec.rs @@ -1,8 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::gobject_ffi; -use glib::translate::*; -use glib::ParamSpec; +use glib::{gobject_ffi, translate::*, ParamSpec}; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -366,9 +364,10 @@ impl<'a, T: glib::prelude::ParamSpecBuilderExt<'a>> GstParamSpecBuilderExt<'a> f #[cfg(test)] mod tests { - use super::*; use glib::prelude::*; + use super::*; + #[test] fn test_trait() { crate::init().unwrap(); diff --git a/gstreamer/src/pipeline.rs b/gstreamer/src/pipeline.rs index f8e21d561..ebb33a557 100644 --- a/gstreamer/src/pipeline.rs +++ b/gstreamer/src/pipeline.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; -use crate::Pipeline; -use crate::PipelineFlags; +use crate::{Pipeline, PipelineFlags}; impl Pipeline { // rustdoc-stripper-ignore-next diff --git a/gstreamer/src/plugin.rs b/gstreamer/src/plugin.rs index dc42b5887..48105df09 100644 --- a/gstreamer/src/plugin.rs +++ b/gstreamer/src/plugin.rs @@ -1,12 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Plugin; -use crate::PluginFlags; -use crate::Structure; -use crate::StructureRef; +use glib::{prelude::*, translate::*}; -use glib::prelude::*; -use glib::translate::*; +use crate::{Plugin, PluginFlags, Structure, StructureRef}; impl Plugin { #[doc(alias = "get_cache_data")] diff --git a/gstreamer/src/plugin_feature.rs b/gstreamer/src/plugin_feature.rs index d6b76d0ef..ed62d00e0 100644 --- a/gstreamer/src/plugin_feature.rs +++ b/gstreamer/src/plugin_feature.rs @@ -1,10 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::PluginFeature; -use crate::Rank; +use glib::{ + prelude::*, + translate::{from_glib, FromGlibPtrFull, IntoGlib, ToGlibPtr}, +}; -use glib::prelude::*; -use glib::translate::{from_glib, FromGlibPtrFull, IntoGlib, ToGlibPtr}; +use crate::{PluginFeature, Rank}; pub trait PluginFeatureExtManual: Sized + 'static { #[doc(alias = "get_rank")] diff --git a/gstreamer/src/promise.rs b/gstreamer/src/promise.rs index 6afbbeb26..1c107ed53 100644 --- a/gstreamer/src/promise.rs +++ b/gstreamer/src/promise.rs @@ -1,13 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::PromiseResult; -use crate::Structure; -use crate::StructureRef; +use std::{ + ops::Deref, + pin::Pin, + ptr, + task::{Context, Poll}, +}; + use glib::translate::*; -use std::ptr; -use std::task::{Context, Poll}; -use std::{ops::Deref, pin::Pin}; +use crate::{PromiseResult, Structure, StructureRef}; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -209,9 +211,9 @@ impl std::fmt::Debug for PromiseReply { #[cfg(test)] mod tests { + use std::{sync::mpsc::channel, thread}; + use super::*; - use std::sync::mpsc::channel; - use std::thread; #[test] fn test_change_func() { diff --git a/gstreamer/src/proxy_pad.rs b/gstreamer/src/proxy_pad.rs index 86bdc32e7..eab816ce8 100644 --- a/gstreamer/src/proxy_pad.rs +++ b/gstreamer/src/proxy_pad.rs @@ -1,15 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Buffer; -use crate::BufferList; -use crate::FlowError; -use crate::FlowSuccess; -use crate::Pad; -use crate::ProxyPad; use std::ptr; -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; + +use crate::{Buffer, BufferList, FlowError, FlowSuccess, Pad, ProxyPad}; impl ProxyPad { #[doc(alias = "gst_proxy_pad_chain_default")] diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index 05957ab3b..2f70134dc 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -1,17 +1,19 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::format::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue}; -use crate::structure::*; +use std::{ + borrow::{Borrow, BorrowMut}, + ffi::CStr, + fmt, mem, + ops::{Deref, DerefMut}, + ptr, +}; -use std::borrow::{Borrow, BorrowMut}; -use std::ffi::CStr; -use std::fmt; -use std::mem; -use std::ops::{Deref, DerefMut}; -use std::ptr; +use glib::{object::IsA, translate::*}; -use glib::object::IsA; -use glib::translate::*; +use crate::{ + format::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue}, + structure::*, +}; mini_object_wrapper!(Query, QueryRef, ffi::GstQuery, || { ffi::gst_query_get_type() diff --git a/gstreamer/src/registry.rs b/gstreamer/src/registry.rs index e3bd90c9d..24a9789bb 100644 --- a/gstreamer/src/registry.rs +++ b/gstreamer/src/registry.rs @@ -1,11 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Plugin; -use crate::PluginFeature; -use crate::Registry; - use glib::translate::*; +use crate::{Plugin, PluginFeature, Registry}; + impl Registry { #[doc(alias = "gst_registry_feature_filter")] pub fn features_filtered bool>( diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index c62b6d645..c4e62515c 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -1,21 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::fmt; -use std::ptr; +use std::{fmt, ptr}; use glib::translate::{from_glib_full, from_glib_none, mut_override, IntoGlibPtr, ToGlibPtr}; -use crate::format::FormattedValueIntrinsic; -use crate::Buffer; -use crate::BufferList; -use crate::BufferListRef; -use crate::BufferRef; -use crate::Caps; -use crate::CapsRef; -use crate::FormattedSegment; -use crate::Segment; -use crate::Structure; -use crate::StructureRef; +use crate::{ + format::FormattedValueIntrinsic, Buffer, BufferList, BufferListRef, BufferRef, Caps, CapsRef, + FormattedSegment, Segment, Structure, StructureRef, +}; mini_object_wrapper!(Sample, SampleRef, ffi::GstSample, || { ffi::gst_sample_get_type() @@ -253,8 +245,7 @@ impl fmt::Debug for SampleRef { mod tests { #[test] fn test_sample_new_with_info() { - use crate::Sample; - use crate::Structure; + use crate::{Sample, Structure}; crate::init().unwrap(); diff --git a/gstreamer/src/sample_serde.rs b/gstreamer/src/sample_serde.rs index 148feec74..cd06621af 100644 --- a/gstreamer/src/sample_serde.rs +++ b/gstreamer/src/sample_serde.rs @@ -1,15 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de::{Deserialize, Deserializer}; -use serde::ser::{Serialize, SerializeStruct, Serializer}; +use serde::{ + de::{Deserialize, Deserializer}, + ser::{Serialize, SerializeStruct, Serializer}, +}; -use crate::Buffer; -use crate::BufferList; -use crate::Caps; -use crate::Sample; -use crate::SampleRef; -use crate::Segment; -use crate::Structure; +use crate::{Buffer, BufferList, Caps, Sample, SampleRef, Segment, Structure}; impl Serialize for SampleRef { fn serialize(&self, serializer: S) -> Result { @@ -76,15 +72,10 @@ impl<'de> Deserialize<'de> for Sample { #[cfg(test)] mod tests { - use crate::Buffer; - use crate::Caps; - use crate::ClockTime; - use crate::Format; - use crate::GenericFormattedValue; - use crate::Sample; - use crate::Segment; - use crate::SegmentFlags; - use crate::Structure; + use crate::{ + Buffer, Caps, ClockTime, Format, GenericFormattedValue, Sample, Segment, SegmentFlags, + Structure, + }; #[test] fn test_serialize() { diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index efd584c75..29a09a223 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -1,18 +1,16 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::format::{ - CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, - FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned, +use std::{fmt, marker::PhantomData, mem}; + +use glib::{translate::*, StaticType}; + +use crate::{ + format::{ + CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, + FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned, + }, + Format, GenericFormattedValue, SeekFlags, SeekType, }; -use crate::Format; -use crate::GenericFormattedValue; -use crate::SeekFlags; -use crate::SeekType; -use glib::translate::*; -use glib::StaticType; -use std::fmt; -use std::marker::PhantomData; -use std::mem; pub type Segment = FormattedSegment; diff --git a/gstreamer/src/segment_serde.rs b/gstreamer/src/segment_serde.rs index de25d1508..0347981a6 100644 --- a/gstreamer/src/segment_serde.rs +++ b/gstreamer/src/segment_serde.rs @@ -1,11 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de; -use serde::de::{Deserialize, Deserializer}; -use serde::ser::{Serialize, Serializer}; +use serde::{ + de, + de::{Deserialize, Deserializer}, + ser::{Serialize, Serializer}, +}; -use crate::format::{FormattedValue, FormattedValueIntrinsic, SpecificFormattedValueIntrinsic}; -use crate::{Format, FormattedSegment, GenericFormattedValue, Segment, SegmentFlags}; +use crate::{ + format::{FormattedValue, FormattedValueIntrinsic, SpecificFormattedValueIntrinsic}, + Format, FormattedSegment, GenericFormattedValue, Segment, SegmentFlags, +}; #[derive(serde::Serialize, serde::Deserialize)] struct FormattedSegmentSerde { @@ -103,11 +107,7 @@ impl<'de, T: SpecificFormattedValueIntrinsic> Deserialize<'de> for FormattedSegm #[cfg(test)] mod tests { - use crate::ClockTime; - use crate::Format; - use crate::GenericFormattedValue; - use crate::Segment; - use crate::SegmentFlags; + use crate::{ClockTime, Format, GenericFormattedValue, Segment, SegmentFlags}; #[test] fn test_serialize() { @@ -211,8 +211,7 @@ mod tests { #[test] fn test_deserialize_formatted() { - use crate::format::Time; - use crate::FormattedSegment; + use crate::{format::Time, FormattedSegment}; crate::init().unwrap(); diff --git a/gstreamer/src/static_caps.rs b/gstreamer/src/static_caps.rs index ae28d7740..eebd02aa8 100644 --- a/gstreamer/src/static_caps.rs +++ b/gstreamer/src/static_caps.rs @@ -1,15 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{ffi::CStr, fmt, marker::PhantomData, ptr}; + +use glib::{translate::*, StaticType}; + use crate::Caps; -use glib::translate::*; -use glib::StaticType; - -use std::ffi::CStr; -use std::fmt; -use std::marker::PhantomData; -use std::ptr; - #[doc(alias = "GstStaticCaps")] #[derive(Clone, Copy)] pub struct StaticCaps(ptr::NonNull); diff --git a/gstreamer/src/static_pad_template.rs b/gstreamer/src/static_pad_template.rs index aa5751e14..9bad41844 100644 --- a/gstreamer/src/static_pad_template.rs +++ b/gstreamer/src/static_pad_template.rs @@ -1,15 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Caps; -use crate::PadTemplate; +use std::{ffi::CStr, fmt, marker::PhantomData, ptr}; -use glib::translate::*; -use glib::StaticType; -use std::ffi::CStr; +use glib::{translate::*, StaticType}; -use std::fmt; -use std::marker::PhantomData; -use std::ptr; +use crate::{Caps, PadTemplate}; #[doc(alias = "GstStaticPadTemplate")] #[derive(Clone, Copy)] diff --git a/gstreamer/src/stream.rs b/gstreamer/src/stream.rs index 3f015178d..505a422e9 100644 --- a/gstreamer/src/stream.rs +++ b/gstreamer/src/stream.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Stream; use std::fmt; +use crate::Stream; + impl Stream { pub fn debug(&self) -> Debug { Debug(self) diff --git a/gstreamer/src/stream_collection.rs b/gstreamer/src/stream_collection.rs index 5d64b574a..d3f20f333 100644 --- a/gstreamer/src/stream_collection.rs +++ b/gstreamer/src/stream_collection.rs @@ -1,14 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Stream; -use crate::StreamCollection; -use glib::object::ObjectType as ObjectType_; -use glib::signal::connect_raw; -use glib::signal::SignalHandlerId; -use glib::translate::*; -use std::boxed::Box as Box_; -use std::fmt; -use std::mem::transmute; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +use glib::{ + object::ObjectType as ObjectType_, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; + +use crate::{Stream, StreamCollection}; #[derive(Debug)] pub struct Iter<'a> { diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index e67127cd9..5388c3b33 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -1,20 +1,23 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::borrow::{Borrow, BorrowMut, ToOwned}; -use std::ffi::CStr; -use std::fmt; -use std::marker::PhantomData; -use std::mem; -use std::ops::{Deref, DerefMut}; -use std::ptr; -use std::str; +use std::{ + borrow::{Borrow, BorrowMut, ToOwned}, + ffi::CStr, + fmt, + marker::PhantomData, + mem, + ops::{Deref, DerefMut}, + ptr, str, +}; + +use glib::{ + translate::*, + value::{FromValue, SendValue, ToSendValue}, + StaticType, +}; use crate::Fraction; -use glib::translate::*; -use glib::value::{FromValue, SendValue, ToSendValue}; -use glib::StaticType; - #[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)] pub enum GetError { #[error("GetError: Structure field with name {name} not found")] diff --git a/gstreamer/src/structure_serde.rs b/gstreamer/src/structure_serde.rs index 25ea9fbe0..500c8bcc3 100644 --- a/gstreamer/src/structure_serde.rs +++ b/gstreamer/src/structure_serde.rs @@ -2,25 +2,19 @@ #![allow(clippy::upper_case_acronyms)] -use glib::{Date, ToValue}; - -use serde::de; -use serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}; -use serde::ser; -use serde::ser::{Serialize, SerializeSeq, SerializeTuple, Serializer}; - use std::fmt; -use crate::Buffer; -use crate::DateTime; -use crate::Sample; +use glib::{Date, ToValue}; +use serde::{ + de, + de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}, + ser, + ser::{Serialize, SerializeSeq, SerializeTuple, Serializer}, +}; -use crate::date_time_serde; -use crate::value::*; -use crate::value_serde::*; - -use crate::Structure; -use crate::StructureRef; +use crate::{ + date_time_serde, value::*, value_serde::*, Buffer, DateTime, Sample, Structure, StructureRef, +}; struct FieldSe<'a>(&'static str, &'a glib::SendValue); impl<'a> Serialize for FieldSe<'a> { @@ -166,10 +160,7 @@ impl<'de> Deserialize<'de> for Structure { mod tests { use glib::{Date, DateMonth}; - use crate::Array; - use crate::DateTime; - use crate::Fraction; - use crate::Structure; + use crate::{Array, DateTime, Fraction, Structure}; #[test] fn test_serialize() { diff --git a/gstreamer/src/subclass/allocator.rs b/gstreamer/src/subclass/allocator.rs index c7671e26a..90f42da0c 100644 --- a/gstreamer/src/subclass/allocator.rs +++ b/gstreamer/src/subclass/allocator.rs @@ -1,9 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::ptr; + +use glib::{bool_error, prelude::*, subclass::prelude::*, translate::*, BoolError}; + use super::prelude::*; use crate::{AllocationParams, Allocator, Memory}; -use glib::{bool_error, prelude::*, subclass::prelude::*, translate::*, BoolError}; -use std::ptr; pub trait AllocatorImpl: AllocatorImplExt + GstObjectImpl + Send + Sync { fn alloc(&self, size: usize, params: Option<&AllocationParams>) -> Result { diff --git a/gstreamer/src/subclass/bin.rs b/gstreamer/src/subclass/bin.rs index 3e312bb93..3b5cbb42a 100644 --- a/gstreamer/src/subclass/bin.rs +++ b/gstreamer/src/subclass/bin.rs @@ -1,15 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; -use glib::subclass::prelude::*; - -use crate::Bin; -use crate::Element; -use crate::LoggableError; -use crate::Message; +use crate::{Bin, Element, LoggableError, Message}; pub trait BinImpl: BinImplExt + ElementImpl { fn add_element(&self, element: &Element) -> Result<(), LoggableError> { diff --git a/gstreamer/src/subclass/buffer_pool.rs b/gstreamer/src/subclass/buffer_pool.rs index 3bfd3f937..bc329de00 100644 --- a/gstreamer/src/subclass/buffer_pool.rs +++ b/gstreamer/src/subclass/buffer_pool.rs @@ -1,14 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; +use std::ptr; + use glib::{ subclass::{prelude::*, InitializingObject}, translate::*, Cast, StaticType, }; use libc::c_char; -use std::ptr; +use super::prelude::*; use crate::{BufferPool, BufferPoolAcquireParams, BufferPoolConfigRef}; pub trait BufferPoolImpl: BufferPoolImplExt + GstObjectImpl + Send + Sync { diff --git a/gstreamer/src/subclass/child_proxy.rs b/gstreamer/src/subclass/child_proxy.rs index 94a5eb6e2..4f24a85d4 100644 --- a/gstreamer/src/subclass/child_proxy.rs +++ b/gstreamer/src/subclass/child_proxy.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; +use super::prelude::*; use crate::ChildProxy; pub trait ChildProxyImpl: GstObjectImpl + Send + Sync { diff --git a/gstreamer/src/subclass/clock.rs b/gstreamer/src/subclass/clock.rs index 1c1d6d405..6d3bbe924 100644 --- a/gstreamer/src/subclass/clock.rs +++ b/gstreamer/src/subclass/clock.rs @@ -1,17 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; -use crate::Clock; -use crate::ClockError; -use crate::ClockId; -use crate::ClockReturn; -use crate::ClockSuccess; -use crate::ClockTime; -use crate::ClockTimeDiff; +use super::prelude::*; +use crate::{Clock, ClockError, ClockId, ClockReturn, ClockSuccess, ClockTime, ClockTimeDiff}; pub trait ClockImpl: ClockImplExt + GstObjectImpl + Send + Sync { fn change_resolution(&self, old_resolution: ClockTime, new_resolution: ClockTime) -> ClockTime { diff --git a/gstreamer/src/subclass/device.rs b/gstreamer/src/subclass/device.rs index c808dcaad..0574ba19b 100644 --- a/gstreamer/src/subclass/device.rs +++ b/gstreamer/src/subclass/device.rs @@ -1,16 +1,12 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; - -use crate::Device; -use crate::Element; -use crate::LoggableError; - use std::ptr; +use glib::{prelude::*, subclass::prelude::*, translate::*}; + +use super::prelude::*; +use crate::{Device, Element, LoggableError}; + pub trait DeviceImpl: DeviceImplExt + GstObjectImpl + Send + Sync { fn create_element(&self, name: Option<&str>) -> Result { self.parent_create_element(name) diff --git a/gstreamer/src/subclass/device_provider.rs b/gstreamer/src/subclass/device_provider.rs index 9a1d31a23..c84919ec4 100644 --- a/gstreamer/src/subclass/device_provider.rs +++ b/gstreamer/src/subclass/device_provider.rs @@ -1,15 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; - use std::borrow::Cow; -use crate::Device; -use crate::DeviceProvider; -use crate::LoggableError; +use glib::{prelude::*, subclass::prelude::*, translate::*}; + +use super::prelude::*; +use crate::{Device, DeviceProvider, LoggableError}; #[derive(Debug, Clone)] pub struct DeviceProviderMetadata { diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 0394eff29..b43b64079 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -1,21 +1,14 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{borrow::Cow, sync::atomic}; + +use glib::{subclass::prelude::*, translate::*}; + use super::prelude::*; -use crate::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; - -use crate::Element; -use crate::Event; -use crate::PadTemplate; -use crate::QueryRef; -use crate::StateChange; -use crate::StateChangeError; -use crate::StateChangeReturn; -use crate::StateChangeSuccess; - -use std::borrow::Cow; -use std::sync::atomic; +use crate::{ + prelude::*, Element, Event, PadTemplate, QueryRef, StateChange, StateChangeError, + StateChangeReturn, StateChangeSuccess, +}; #[derive(Debug, Clone)] pub struct ElementMetadata { @@ -562,9 +555,9 @@ unsafe extern "C" fn element_post_message( #[cfg(test)] mod tests { - use super::*; use std::sync::atomic; + use super::*; use crate::ElementFactory; pub mod imp { diff --git a/gstreamer/src/subclass/error.rs b/gstreamer/src/subclass/error.rs index 20d864b64..99414538f 100644 --- a/gstreamer/src/subclass/error.rs +++ b/gstreamer/src/subclass/error.rs @@ -2,8 +2,7 @@ use thiserror::Error; -use crate::ErrorMessage; -use crate::FlowReturn; +use crate::{ErrorMessage, FlowReturn}; #[macro_export] macro_rules! panic_to_error( diff --git a/gstreamer/src/subclass/ghost_pad.rs b/gstreamer/src/subclass/ghost_pad.rs index 267c2a278..76238f3f3 100644 --- a/gstreamer/src/subclass/ghost_pad.rs +++ b/gstreamer/src/subclass/ghost_pad.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; use glib::subclass::prelude::*; +use super::prelude::*; use crate::GhostPad; pub trait GhostPadImpl: ProxyPadImpl {} diff --git a/gstreamer/src/subclass/mod.rs b/gstreamer/src/subclass/mod.rs index 6b6561a08..da5d398cc 100644 --- a/gstreamer/src/subclass/mod.rs +++ b/gstreamer/src/subclass/mod.rs @@ -31,35 +31,37 @@ mod preset; mod tag_setter; mod uri_handler; -pub use self::device_provider::DeviceProviderMetadata; -pub use self::element::ElementMetadata; - -pub use self::error::FlowError; -pub use self::plugin::{MAJOR_VERSION, MINOR_VERSION}; - -pub use self::task_pool::TaskPoolFunction; +pub use self::{ + device_provider::DeviceProviderMetadata, + element::ElementMetadata, + error::FlowError, + plugin::{MAJOR_VERSION, MINOR_VERSION}, + task_pool::TaskPoolFunction, +}; pub mod prelude { #[doc(hidden)] pub use glib::subclass::prelude::*; - pub use super::allocator::{AllocatorImpl, AllocatorImplExt}; - pub use super::bin::{BinImpl, BinImplExt}; - pub use super::buffer_pool::{BufferPoolImpl, BufferPoolImplExt}; - pub use super::child_proxy::{ChildProxyImpl, ChildProxyImplExt}; - pub use super::clock::{ClockImpl, ClockImplExt}; - pub use super::device::{DeviceImpl, DeviceImplExt}; - pub use super::device_provider::{DeviceProviderImpl, DeviceProviderImplExt}; - pub use super::element::{ElementImpl, ElementImplExt}; - pub use super::ghost_pad::GhostPadImpl; - pub use super::object::GstObjectImpl; - pub use super::pad::{PadImpl, PadImplExt}; - pub use super::pipeline::PipelineImpl; - pub use super::preset::PresetImpl; - pub use super::proxy_pad::ProxyPadImpl; - pub use super::system_clock::SystemClockImpl; - pub use super::tag_setter::TagSetterImpl; - pub use super::task_pool::TaskPoolImpl; - pub use super::tracer::{TracerHook, TracerImpl, TracerImplExt}; - pub use super::uri_handler::{URIHandlerImpl, URIHandlerImplExt}; + pub use super::{ + allocator::{AllocatorImpl, AllocatorImplExt}, + bin::{BinImpl, BinImplExt}, + buffer_pool::{BufferPoolImpl, BufferPoolImplExt}, + child_proxy::{ChildProxyImpl, ChildProxyImplExt}, + clock::{ClockImpl, ClockImplExt}, + device::{DeviceImpl, DeviceImplExt}, + device_provider::{DeviceProviderImpl, DeviceProviderImplExt}, + element::{ElementImpl, ElementImplExt}, + ghost_pad::GhostPadImpl, + object::GstObjectImpl, + pad::{PadImpl, PadImplExt}, + pipeline::PipelineImpl, + preset::PresetImpl, + proxy_pad::ProxyPadImpl, + system_clock::SystemClockImpl, + tag_setter::TagSetterImpl, + task_pool::TaskPoolImpl, + tracer::{TracerHook, TracerImpl, TracerImplExt}, + uri_handler::{URIHandlerImpl, URIHandlerImplExt}, + }; } diff --git a/gstreamer/src/subclass/pad.rs b/gstreamer/src/subclass/pad.rs index 0972a13c1..3800fa34b 100644 --- a/gstreamer/src/subclass/pad.rs +++ b/gstreamer/src/subclass/pad.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; -use glib::prelude::*; -use glib::subclass::prelude::*; -use glib::translate::*; +use glib::{prelude::*, subclass::prelude::*, translate::*}; +use super::prelude::*; use crate::Pad; pub trait PadImpl: PadImplExt + GstObjectImpl + Send + Sync { @@ -84,11 +82,10 @@ unsafe extern "C" fn pad_unlinked(ptr: *mut ffi::GstPad, peer: *mut #[cfg(test)] mod tests { - use super::*; - use crate::prelude::*; use std::sync::atomic; - use crate::PadDirection; + use super::*; + use crate::{prelude::*, PadDirection}; pub mod imp { use super::*; diff --git a/gstreamer/src/subclass/pipeline.rs b/gstreamer/src/subclass/pipeline.rs index af56a58c7..294f9c483 100644 --- a/gstreamer/src/subclass/pipeline.rs +++ b/gstreamer/src/subclass/pipeline.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; use glib::subclass::prelude::*; +use super::prelude::*; use crate::Pipeline; pub trait PipelineImpl: BinImpl {} diff --git a/gstreamer/src/subclass/proxy_pad.rs b/gstreamer/src/subclass/proxy_pad.rs index 1a1d686f6..7178eb996 100644 --- a/gstreamer/src/subclass/proxy_pad.rs +++ b/gstreamer/src/subclass/proxy_pad.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; use glib::subclass::prelude::*; +use super::prelude::*; use crate::ProxyPad; pub trait ProxyPadImpl: PadImpl {} diff --git a/gstreamer/src/subclass/system_clock.rs b/gstreamer/src/subclass/system_clock.rs index 9c46b4e3b..929eb3cb5 100644 --- a/gstreamer/src/subclass/system_clock.rs +++ b/gstreamer/src/subclass/system_clock.rs @@ -1,8 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use super::prelude::*; use glib::subclass::prelude::*; +use super::prelude::*; use crate::SystemClock; pub trait SystemClockImpl: ClockImpl {} diff --git a/gstreamer/src/subclass/task_pool.rs b/gstreamer/src/subclass/task_pool.rs index 9192e658e..4b1002bf9 100644 --- a/gstreamer/src/subclass/task_pool.rs +++ b/gstreamer/src/subclass/task_pool.rs @@ -1,16 +1,16 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{ + hash::{Hash, Hasher}, + ptr, + sync::{Arc, Mutex}, +}; + +use glib::{ffi::gpointer, subclass::prelude::*, translate::*}; + use super::prelude::*; use crate::{TaskHandle, TaskPool}; -use std::hash::{Hash, Hasher}; -use std::ptr; -use std::sync::{Arc, Mutex}; - -use glib::ffi::gpointer; -use glib::subclass::prelude::*; -use glib::translate::*; - pub trait TaskPoolImpl: GstObjectImpl + Send + Sync { // rustdoc-stripper-ignore-next /// Handle to be returned from the `push` function to allow the caller to wait for the task's @@ -231,11 +231,16 @@ impl Hash for TaskPoolFunction { #[cfg(test)] mod tests { + use std::{ + sync::{ + atomic, + mpsc::{channel, TryRecvError}, + }, + thread, + }; + use super::*; use crate::prelude::*; - use std::sync::atomic; - use std::sync::mpsc::{channel, TryRecvError}; - use std::thread; pub mod imp { use super::*; diff --git a/gstreamer/src/subclass/tracer.rs b/gstreamer/src/subclass/tracer.rs index dfd867788..f2a448811 100644 --- a/gstreamer/src/subclass/tracer.rs +++ b/gstreamer/src/subclass/tracer.rs @@ -1,12 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use glib::{prelude::*, subclass::prelude::*, translate::*}; + use super::prelude::*; use crate::{ ffi, Bin, Buffer, BufferList, Element, Event, FlowError, FlowSuccess, Message, MiniObject, Object, Pad, PadLinkError, PadLinkSuccess, QueryRef, StateChange, StateChangeError, StateChangeSuccess, Tracer, }; -use glib::{prelude::*, subclass::prelude::*, translate::*}; #[allow(unused_variables)] pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync { diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index ccfa87e70..ca6239020 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -1,15 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use glib::prelude::*; -use glib::translate::*; - -use glib::subclass::prelude::*; - -use crate::URIHandler; -use crate::URIType; - use std::ptr; +use glib::{prelude::*, subclass::prelude::*, translate::*}; + +use crate::{URIHandler, URIType}; + pub trait URIHandlerImpl: super::element::ElementImpl { const URI_TYPE: URIType; fn protocols() -> &'static [&'static str]; diff --git a/gstreamer/src/tag_setter.rs b/gstreamer/src/tag_setter.rs index b30d61605..1dc700194 100644 --- a/gstreamer/src/tag_setter.rs +++ b/gstreamer/src/tag_setter.rs @@ -1,10 +1,8 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::tags::*; -use crate::TagMergeMode; -use crate::TagSetter; -use glib::prelude::*; -use glib::translate::*; +use glib::{prelude::*, translate::*}; + +use crate::{tags::*, TagMergeMode, TagSetter}; pub trait TagSetterExtManual: 'static { #[doc(alias = "gst_tag_setter_add_tag_value")] diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index a3275418c..94b71d344 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -1,20 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; -use std::marker::PhantomData; -use std::mem; +use std::{ffi::CStr, fmt, marker::PhantomData, mem}; +use glib::{ + translate::*, + value::{FromValue, SendValue, ToSendValue, Value}, + StaticType, +}; use once_cell::sync::Lazy; -use glib::translate::*; -use glib::value::{FromValue, SendValue, ToSendValue, Value}; -use glib::StaticType; - -use crate::Sample; -use crate::TagError; -use crate::TagMergeMode; -use crate::TagScope; +use crate::{Sample, TagError, TagMergeMode, TagScope}; pub trait Tag<'a> { type TagType: StaticType + FromValue<'a> + ToSendValue + Send + Sync; diff --git a/gstreamer/src/tags_serde.rs b/gstreamer/src/tags_serde.rs index 6efbafdcf..8f2ddbe29 100644 --- a/gstreamer/src/tags_serde.rs +++ b/gstreamer/src/tags_serde.rs @@ -2,26 +2,25 @@ #![allow(clippy::upper_case_acronyms)] -use glib::translate::{from_glib, ToGlibPtr}; -use glib::{Date, SendValue, ToValue}; +use std::{cell::RefCell, cmp, fmt, rc::Rc}; -use serde::de; -use serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}; -use serde::ser; -use serde::ser::{Serialize, SerializeSeq, SerializeStruct, SerializeTuple, Serializer}; +use glib::{ + translate::{from_glib, ToGlibPtr}, + Date, SendValue, ToValue, +}; +use serde::{ + de, + de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}, + ser, + ser::{Serialize, SerializeSeq, SerializeStruct, SerializeTuple, Serializer}, +}; -use std::cell::RefCell; -use std::cmp; -use std::fmt; -use std::rc::Rc; - -use crate::date_time_serde; -use crate::tags::{GenericTagIter, TagList, TagListRef}; -use crate::value_serde::{DATE_OTHER_TYPE_ID, DATE_TIME_OTHER_TYPE_ID, SAMPLE_OTHER_TYPE_ID}; -use crate::DateTime; -use crate::Sample; -use crate::TagMergeMode; -use crate::TagScope; +use crate::{ + date_time_serde, + tags::{GenericTagIter, TagList, TagListRef}, + value_serde::{DATE_OTHER_TYPE_ID, DATE_TIME_OTHER_TYPE_ID, SAMPLE_OTHER_TYPE_ID}, + DateTime, Sample, TagMergeMode, TagScope, +}; macro_rules! ser_tag ( ($value:ident, $seq:ident, $t:ty) => ( @@ -311,12 +310,7 @@ impl<'de> Deserialize<'de> for TagList { #[cfg(test)] mod tests { - use crate::tags::*; - use crate::Buffer; - use crate::ClockTime; - use crate::Sample; - use crate::TagMergeMode; - use crate::TagScope; + use crate::{tags::*, Buffer, ClockTime, Sample, TagMergeMode, TagScope}; #[test] fn test_serialize() { diff --git a/gstreamer/src/task.rs b/gstreamer/src/task.rs index 7c40a3814..550980828 100644 --- a/gstreamer/src/task.rs +++ b/gstreamer/src/task.rs @@ -1,14 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::{mem, ptr, sync::Arc}; + +use glib::{prelude::*, translate::*}; + use crate::Task; -use std::mem; -use std::ptr; -use std::sync::Arc; - -use glib::prelude::*; -use glib::translate::*; - #[allow(clippy::type_complexity)] pub struct TaskBuilder { func: Box<(F, *mut ffi::GstTask)>, @@ -178,9 +175,10 @@ impl<'a> Drop for TaskLockGuard<'a> { #[cfg(test)] mod tests { + use std::sync::mpsc::channel; + use super::*; use crate::prelude::*; - use std::sync::mpsc::channel; #[test] fn test_simple() { diff --git a/gstreamer/src/task_pool.rs b/gstreamer/src/task_pool.rs index 094158372..a7015dcc1 100644 --- a/gstreamer/src/task_pool.rs +++ b/gstreamer/src/task_pool.rs @@ -1,12 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::TaskPool; - use std::ptr; -use glib::ffi::gpointer; -use glib::prelude::*; -use glib::translate::*; +use glib::{ffi::gpointer, prelude::*, translate::*}; + +use crate::TaskPool; unsafe extern "C" fn task_pool_trampoline(data: gpointer) { let func = Box::from_raw(data as *mut P); @@ -125,9 +123,10 @@ impl Drop for TaskPoolTaskHandle { #[cfg(test)] mod tests { + use std::sync::mpsc::{channel, RecvError}; + use super::*; use crate::prelude::*; - use std::sync::mpsc::{channel, RecvError}; #[test] fn test_simple() { diff --git a/gstreamer/src/toc.rs b/gstreamer/src/toc.rs index 88ae14bfe..b5be6e08b 100644 --- a/gstreamer/src/toc.rs +++ b/gstreamer/src/toc.rs @@ -1,20 +1,13 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use std::ffi::CStr; -use std::fmt; -use std::mem; -use std::ptr; +use std::{ffi::CStr, fmt, mem, ptr}; use glib::translate::{ from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, IntoGlib, IntoGlibPtr, ToGlibPtr, }; -use crate::TagList; -use crate::TagMergeMode; -use crate::TocEntryType; -use crate::TocLoopType; -use crate::TocScope; +use crate::{TagList, TagMergeMode, TocEntryType, TocLoopType, TocScope}; mini_object_wrapper!(Toc, TocRef, ffi::GstToc, || { ffi::gst_toc_get_type() }); diff --git a/gstreamer/src/toc_serde.rs b/gstreamer/src/toc_serde.rs index 4717d7390..d1637df2e 100644 --- a/gstreamer/src/toc_serde.rs +++ b/gstreamer/src/toc_serde.rs @@ -1,13 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use serde::de::{Deserialize, Deserializer}; -use serde::ser::{Serialize, SerializeStruct, Serializer}; +use serde::{ + de::{Deserialize, Deserializer}, + ser::{Serialize, SerializeStruct, Serializer}, +}; -use crate::toc::*; -use crate::TagList; -use crate::TocEntryType; -use crate::TocLoopType; -use crate::TocScope; +use crate::{toc::*, TagList, TocEntryType, TocLoopType, TocScope}; impl Serialize for TocRef { fn serialize(&self, serializer: S) -> Result { @@ -117,12 +115,7 @@ impl<'de> Deserialize<'de> for TocEntry { #[cfg(test)] mod tests { - use crate::tags::Title; - use crate::toc::*; - use crate::TagList; - use crate::TagMergeMode; - use crate::TocEntryType; - use crate::TocScope; + use crate::{tags::Title, toc::*, TagList, TagMergeMode, TocEntryType, TocScope}; #[test] fn test_serialize() { diff --git a/gstreamer/src/tracer.rs b/gstreamer/src/tracer.rs index e2edb4d85..cd2bd9edf 100644 --- a/gstreamer/src/tracer.rs +++ b/gstreamer/src/tracer.rs @@ -1,8 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::{Plugin, Tracer}; use glib::translate::*; +use crate::{Plugin, Tracer}; + impl Tracer { #[doc(alias = "gst_tracer_register")] pub fn register( diff --git a/gstreamer/src/tracer_factory.rs b/gstreamer/src/tracer_factory.rs index 93fc6fa12..b8573d302 100644 --- a/gstreamer/src/tracer_factory.rs +++ b/gstreamer/src/tracer_factory.rs @@ -1,9 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::TracerFactory; - use glib::translate::*; +use crate::TracerFactory; + impl TracerFactory { #[doc(alias = "gst_tracer_factory_get_list")] #[doc(alias = "get_list")] diff --git a/gstreamer/src/typefind.rs b/gstreamer/src/typefind.rs index cf5bb5c7f..bdbd2aeaa 100644 --- a/gstreamer/src/typefind.rs +++ b/gstreamer/src/typefind.rs @@ -1,14 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::Caps; -use crate::Plugin; -use crate::Rank; -use crate::TypeFindFactory; -use crate::TypeFindProbability; +use std::{ptr, slice}; use glib::translate::*; -use std::ptr; -use std::slice; + +use crate::{Caps, Plugin, Rank, TypeFindFactory, TypeFindProbability}; #[repr(transparent)] #[derive(Debug)] diff --git a/gstreamer/src/typefind_factory.rs b/gstreamer/src/typefind_factory.rs index a7c950a67..0b8d523a6 100644 --- a/gstreamer/src/typefind_factory.rs +++ b/gstreamer/src/typefind_factory.rs @@ -1,9 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use crate::TypeFindFactory; - use glib::translate::*; +use crate::TypeFindFactory; + impl TypeFindFactory { #[doc(alias = "gst_type_find_factory_get_list")] #[doc(alias = "get_list")] diff --git a/gstreamer/src/value.rs b/gstreamer/src/value.rs index 34c97f6bd..5cd175810 100644 --- a/gstreamer/src/value.rs +++ b/gstreamer/src/value.rs @@ -1,13 +1,9 @@ // Take a look at the license at the top of the repository in the LICENSE file. -use num_rational::Rational32; -use std::cmp; -use std::fmt; -use std::ops; -use std::slice; +use std::{cmp, fmt, ops, slice}; -use glib::translate::*; -use glib::StaticType; +use glib::{translate::*, StaticType}; +use num_rational::Rational32; #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] pub struct Fraction(pub Rational32); diff --git a/gstreamer/src/value_serde.rs b/gstreamer/src/value_serde.rs index bbe686111..b4330f53b 100644 --- a/gstreamer/src/value_serde.rs +++ b/gstreamer/src/value_serde.rs @@ -2,27 +2,19 @@ #![allow(clippy::upper_case_acronyms)] -use glib::{Date, StaticType, ToValue}; - -use num_rational::Rational32; - -use serde::de; -use serde::de::{Deserialize, Deserializer, SeqAccess, Visitor}; -use serde::ser; -use serde::ser::{Serialize, SerializeTuple, Serializer}; - use std::{fmt, mem}; +use glib::{Date, StaticType, ToValue}; +use num_rational::Rational32; use once_cell::sync::Lazy; +use serde::{ + de, + de::{Deserialize, Deserializer, SeqAccess, Visitor}, + ser, + ser::{Serialize, SerializeTuple, Serializer}, +}; -use crate::Buffer; -use crate::DateTime; -use crate::List; -use crate::Sample; -use crate::Structure; - -use crate::date_time_serde; -use crate::value::*; +use crate::{date_time_serde, value::*, Buffer, DateTime, List, Sample, Structure}; pub(crate) static ARRAY_OTHER_TYPE_ID: Lazy = Lazy::new(Array::static_type); pub(crate) static BITMASK_OTHER_TYPE_ID: Lazy = Lazy::new(Bitmask::static_type); @@ -293,17 +285,10 @@ impl_de_send_value_collection!(List); #[cfg(test)] mod tests { - use crate::Array; - use crate::Bitmask; - use crate::DateTime; - use crate::Fraction; - use crate::FractionRange; - use crate::IntRange; - use crate::List; - use crate::Structure; - use glib::{Date, DateMonth}; + use crate::{Array, Bitmask, DateTime, Fraction, FractionRange, IntRange, List, Structure}; + #[test] fn test_serialize_simple() { crate::init().unwrap(); diff --git a/tutorials/src/bin/basic-tutorial-12.rs b/tutorials/src/bin/basic-tutorial-12.rs index c2fd7e698..6186b8f25 100644 --- a/tutorials/src/bin/basic-tutorial-12.rs +++ b/tutorials/src/bin/basic-tutorial-12.rs @@ -1,7 +1,7 @@ -use gst::prelude::*; use std::io::Write; use anyhow::Error; +use gst::prelude::*; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/basic-tutorial-13.rs b/tutorials/src/bin/basic-tutorial-13.rs index de90d17e2..c01230bed 100644 --- a/tutorials/src/bin/basic-tutorial-13.rs +++ b/tutorials/src/bin/basic-tutorial-13.rs @@ -1,14 +1,12 @@ -use gst::event::{Seek, Step}; -use gst::prelude::*; -use gst::{Element, SeekFlags, SeekType, State}; +use std::{io, thread, time}; use anyhow::Error; - -use termion::event::Key; -use termion::input::TermRead; -use termion::raw::IntoRawMode; - -use std::{io, thread, time}; +use gst::{ + event::{Seek, Step}, + prelude::*, + Element, SeekFlags, SeekType, State, +}; +use termion::{event::Key, input::TermRead, raw::IntoRawMode}; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/basic-tutorial-4.rs b/tutorials/src/bin/basic-tutorial-4.rs index 47d9832bb..4e9077333 100644 --- a/tutorials/src/bin/basic-tutorial-4.rs +++ b/tutorials/src/bin/basic-tutorial-4.rs @@ -1,6 +1,6 @@ +use std::{io, io::Write}; + use gst::prelude::*; -use std::io; -use std::io::Write; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/basic-tutorial-5.rs b/tutorials/src/bin/basic-tutorial-5.rs index 41b7cd67c..336e0c145 100644 --- a/tutorials/src/bin/basic-tutorial-5.rs +++ b/tutorials/src/bin/basic-tutorial-5.rs @@ -1,14 +1,10 @@ #[cfg(feature = "tutorial5")] mod tutorial5 { - use std::os::raw::c_void; - use std::process; + use std::{ops, os::raw::c_void, process}; use gdk::prelude::*; - use gtk::prelude::*; - use gst_video::prelude::*; - - use std::ops; + use gtk::prelude::*; // Custom struct to keep our window reference alive // and to store the timeout id so that we can remove diff --git a/tutorials/src/bin/basic-tutorial-8.rs b/tutorials/src/bin/basic-tutorial-8.rs index e7822bb67..a6b9d483a 100644 --- a/tutorials/src/bin/basic-tutorial-8.rs +++ b/tutorials/src/bin/basic-tutorial-8.rs @@ -1,7 +1,6 @@ use std::sync::{Arc, Mutex}; use byte_slice_cast::*; - use glib::source::SourceId; use gst::prelude::*; use gst_app::{AppSink, AppSrc}; diff --git a/tutorials/src/bin/basic-tutorial-9.rs b/tutorials/src/bin/basic-tutorial-9.rs index 52bf4ab55..c8d645255 100644 --- a/tutorials/src/bin/basic-tutorial-9.rs +++ b/tutorials/src/bin/basic-tutorial-9.rs @@ -1,12 +1,11 @@ -use anyhow::Error; +use std::env; +use anyhow::Error; use gst_pbutils::{ prelude::*, Discoverer, DiscovererContainerInfo, DiscovererInfo, DiscovererResult, DiscovererStreamInfo, }; -use std::env; - #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/playback-tutorial-1.rs b/tutorials/src/bin/playback-tutorial-1.rs index 2ae670c2b..468e8c14b 100644 --- a/tutorials/src/bin/playback-tutorial-1.rs +++ b/tutorials/src/bin/playback-tutorial-1.rs @@ -1,12 +1,9 @@ -use glib::FlagsClass; -use gst::prelude::*; +use std::{thread, time}; use anyhow::Error; - -use termion::event::Key; -use termion::input::TermRead; - -use std::{thread, time}; +use glib::FlagsClass; +use gst::prelude::*; +use termion::{event::Key, input::TermRead}; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/playback-tutorial-2.rs b/tutorials/src/bin/playback-tutorial-2.rs index 4858edf32..ba4fc2939 100644 --- a/tutorials/src/bin/playback-tutorial-2.rs +++ b/tutorials/src/bin/playback-tutorial-2.rs @@ -1,12 +1,9 @@ -use glib::FlagsClass; -use gst::prelude::*; +use std::{thread, time}; use anyhow::Error; - -use termion::event::Key; -use termion::input::TermRead; - -use std::{thread, time}; +use glib::FlagsClass; +use gst::prelude::*; +use termion::{event::Key, input::TermRead}; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/playback-tutorial-3.rs b/tutorials/src/bin/playback-tutorial-3.rs index 8281b218f..ccd017c8c 100644 --- a/tutorials/src/bin/playback-tutorial-3.rs +++ b/tutorials/src/bin/playback-tutorial-3.rs @@ -2,7 +2,6 @@ use std::sync::{Arc, Mutex}; use anyhow::Error; use byte_slice_cast::*; - use glib::source::SourceId; use gst::prelude::*; use gst_app::AppSrc; diff --git a/tutorials/src/bin/playback-tutorial-4.rs b/tutorials/src/bin/playback-tutorial-4.rs index 1643e3572..9b3b22858 100644 --- a/tutorials/src/bin/playback-tutorial-4.rs +++ b/tutorials/src/bin/playback-tutorial-4.rs @@ -1,11 +1,11 @@ -use gst::prelude::*; - -use glib::FlagsClass; +use std::{ + io::Write, + sync::{Arc, Mutex}, +}; use anyhow::Error; - -use std::io::Write; -use std::sync::{Arc, Mutex}; +use glib::FlagsClass; +use gst::prelude::*; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/playback-tutorial-5.rs b/tutorials/src/bin/playback-tutorial-5.rs index 5371576fd..cf697dd80 100644 --- a/tutorials/src/bin/playback-tutorial-5.rs +++ b/tutorials/src/bin/playback-tutorial-5.rs @@ -1,12 +1,9 @@ -use gst::prelude::*; -use gst_video::prelude::ColorBalanceExt; +use std::{cmp, thread, time}; use anyhow::Error; - -use termion::event::Key; -use termion::input::TermRead; - -use std::{cmp, thread, time}; +use gst::prelude::*; +use gst_video::prelude::ColorBalanceExt; +use termion::{event::Key, input::TermRead}; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/playback-tutorial-6.rs b/tutorials/src/bin/playback-tutorial-6.rs index cac0e5f74..a7101476b 100644 --- a/tutorials/src/bin/playback-tutorial-6.rs +++ b/tutorials/src/bin/playback-tutorial-6.rs @@ -1,8 +1,7 @@ +use anyhow::Error; use glib::FlagsClass; use gst::prelude::*; -use anyhow::Error; - #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/playback-tutorial-7.rs b/tutorials/src/bin/playback-tutorial-7.rs index 8e3fc8c36..b452e80d3 100644 --- a/tutorials/src/bin/playback-tutorial-7.rs +++ b/tutorials/src/bin/playback-tutorial-7.rs @@ -1,6 +1,5 @@ -use gst::prelude::*; - use anyhow::Error; +use gst::prelude::*; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/tutorials-common.rs b/tutorials/src/tutorials-common.rs index 76db893d0..cac316fff 100644 --- a/tutorials/src/tutorials-common.rs +++ b/tutorials/src/tutorials-common.rs @@ -17,11 +17,11 @@ pub fn run T + Send + 'static>(main: F) -> T where T: Send + 'static, { + use std::thread; + use cocoa::appkit::NSApplication; use objc::{msg_send, sel, sel_impl}; - use std::thread; - unsafe { let app = cocoa::appkit::NSApp(); let t = thread::spawn(|| {