diff --git a/crates/iced-video/src/source.rs b/crates/iced-video/src/source.rs index 9e76348..c9e69e0 100644 --- a/crates/iced-video/src/source.rs +++ b/crates/iced-video/src/source.rs @@ -5,7 +5,7 @@ use gst::{ caps::{Caps, CapsType}, element::ElementExt, pipeline::PipelineExt, - playback::{PlayFlags, Playbin, Playbin3}, + playback::{PlayFlags, Playbin3}, videoconvertscale::VideoConvert, }; use std::sync::{Arc, Mutex, atomic::AtomicBool}; @@ -48,7 +48,7 @@ impl VideoSource { .with_buffer_duration(core::time::Duration::from_secs(2)) .with_buffer_size(4096 * 4096 * 4 * 3) .with_ring_buffer_max_size(4096 * 4096 * 4 * 3) - .with_flags(PlayFlags::default() | PlayFlags::DOWNLOAD) + .with_flags(Playbin3::default_flags() | PlayFlags::DOWNLOAD) .with_video_sink(&video_sink); let bus = playbin.bus().change_context(Error)?; playbin.pause().change_context(Error)?; diff --git a/gst/src/pipeline.rs b/gst/src/pipeline.rs index dd3291a..b9dc57d 100644 --- a/gst/src/pipeline.rs +++ b/gst/src/pipeline.rs @@ -1,5 +1,4 @@ -use crate::{playback::Playbin3, priv_prelude::*}; -use gstreamer::State; +use crate::priv_prelude::*; wrap_gst!(Pipeline); parent_child!(Element, Pipeline); diff --git a/gst/src/plugins/app/appsink.rs b/gst/src/plugins/app/appsink.rs index 3b333b7..a61e219 100644 --- a/gst/src/plugins/app/appsink.rs +++ b/gst/src/plugins/app/appsink.rs @@ -16,7 +16,6 @@ impl AppSink { } pub fn new(name: impl AsRef) -> Result { - use gstreamer::prelude::*; let inner = gstreamer::ElementFactory::make("appsink") .name(name.as_ref()) .build() @@ -133,7 +132,7 @@ fn test_appsink() { .build(), ); - let mut video_sink = video_convert + let video_sink = video_convert .link(&appsink) .expect("Link videoconvert to appsink"); diff --git a/gst/src/plugins/autodetect/autovideosink.rs b/gst/src/plugins/autodetect/autovideosink.rs index 6138fcb..459f3d8 100644 --- a/gst/src/plugins/autodetect/autovideosink.rs +++ b/gst/src/plugins/autodetect/autovideosink.rs @@ -8,7 +8,6 @@ impl Sink for AutoVideoSink {} impl AutoVideoSink { pub fn new(name: impl AsRef) -> Result { - use gstreamer::prelude::*; let element = gstreamer::ElementFactory::make("autovideosink") .name(name.as_ref()) .build() diff --git a/gst/src/plugins/playback.rs b/gst/src/plugins/playback.rs index c42062c..4d0587b 100644 --- a/gst/src/plugins/playback.rs +++ b/gst/src/plugins/playback.rs @@ -36,19 +36,6 @@ bitflags::bitflags! { } } -impl Default for PlayFlags { - /// Flags "GstPlayFlags" Default: 0x00000717, "soft-colorbalance+deinterlace+buffering+soft-volume+text+audio+video" - fn default() -> Self { - Self::SOFT_COLORBALANCE - | Self::DEINTERLACE - | Self::BUFFERING - | Self::SOFT_VOLUME - | Self::TEXT - | Self::AUDIO - | Self::VIDEO - } -} - const _: () = { use glib::types::StaticType; impl glib::types::StaticType for PlayFlags { diff --git a/gst/src/plugins/playback/playbin3.rs b/gst/src/plugins/playback/playbin3.rs index a8f123d..cd1014e 100644 --- a/gst/src/plugins/playback/playbin3.rs +++ b/gst/src/plugins/playback/playbin3.rs @@ -1,4 +1,5 @@ use crate::priv_prelude::*; +use playback::PlayFlags; wrap_gst!(Playbin3, gstreamer::Element); parent_child!(Element, Playbin3); @@ -80,3 +81,15 @@ impl Playbin3 { self } } + +impl Playbin3 { + pub fn default_flags() -> PlayFlags { + PlayFlags::SOFT_COLORBALANCE + | PlayFlags::DEINTERLACE + | PlayFlags::BUFFERING + | PlayFlags::SOFT_VOLUME + | PlayFlags::TEXT + | PlayFlags::AUDIO + | PlayFlags::VIDEO + } +} diff --git a/gst/src/plugins/videoconvertscale/videoconvert.rs b/gst/src/plugins/videoconvertscale/videoconvert.rs index b986e3b..035f3a7 100644 --- a/gst/src/plugins/videoconvertscale/videoconvert.rs +++ b/gst/src/plugins/videoconvertscale/videoconvert.rs @@ -10,7 +10,6 @@ impl Source for VideoConvert {} impl VideoConvert { pub fn new(name: impl AsRef) -> Result { - use gstreamer::prelude::*; let element = gstreamer::ElementFactory::make("videoconvert") .name(name.as_ref()) .build()