chore: thumbnails and patches

This commit is contained in:
Ashley Wulber 2026-03-20 18:06:17 -04:00
parent 6c401d7030
commit 00395d27dc
5 changed files with 786 additions and 1053 deletions

1786
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -37,14 +37,7 @@ default-features = false
[dependencies.libcosmic] [dependencies.libcosmic]
git = "https://github.com/pop-os/libcosmic.git" git = "https://github.com/pop-os/libcosmic.git"
default-features = false default-features = false
features = [ features = ["tokio", "winit", "multi-window"]
"tokio",
"winit",
"multi-window",
"surface-message",
"wayland",
"x11",
]
[dependencies.mpris-server] [dependencies.mpris-server]
version = "0.8.1" version = "0.8.1"
@ -62,13 +55,13 @@ wgpu = ["iced_video_player/wgpu", "libcosmic/wgpu"]
inherits = "release" inherits = "release"
debug = true debug = true
[patch.'https://github.com/wash2/iced_video_player'] # [patch.'https://github.com/wash2/iced_video_player']
iced_video_player = { path = "../iced_video_player" } # iced_video_player = { path = "../iced_video_player" }
# [patch.'https://github.com/pop-os/libcosmic'] [patch.'https://github.com/pop-os/libcosmic']
# libcosmic = { path = "../libcosmic" } # libcosmic = { path = "../libcosmic" }
# cosmic-config = { path = "../libcosmic/cosmic-config" } # cosmic-config = { path = "../libcosmic/cosmic-config" }
# cosmic-theme = { path = "../libcosmic/cosmic-theme" } # cosmic-theme = { path = "../libcosmic/cosmic-theme" }
# libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "iced-rebase" } libcosmic = { git = "https://github.com/pop-os/libcosmic//", branch = "iced-rebase" }
# cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "iced-rebase" } cosmic-config = { git = "https://github.com/pop-os/libcosmic//", branch = "iced-rebase" }
# cosmic-theme = { git = "https://github.com/pop-os/libcosmic//", branch = "iced-rebase" } cosmic-theme = { git = "https://github.com/pop-os/libcosmic//", branch = "iced-rebase" }

View file

@ -1348,7 +1348,7 @@ impl Application for App {
if self.flags.config_state.player_state.repeat == RepeatState::Track { if self.flags.config_state.player_state.repeat == RepeatState::Track {
// we hook Message::PlayNext to the EOS signal. iced_video_player always emits EOS regardless of // we hook Message::PlayNext to the EOS signal. iced_video_player always emits EOS regardless of
// looping state, so do nothing if repeat is set. // looping state, so do nothing if repeat is set.
return Command::none(); return Task::none();
} }
//first we get info about current media id & position in nav_bar //first we get info about current media id & position in nav_bar
@ -1733,10 +1733,10 @@ impl Application for App {
RepeatState::Track => RepeatState::Disabled, RepeatState::Track => RepeatState::Disabled,
}, },
)), )),
match self.flags.config_state.player_state.repeat { widget::text(match self.flags.config_state.player_state.repeat {
RepeatState::Disabled => fl!("repeat-disabled"), RepeatState::Disabled => fl!("repeat-disabled"),
RepeatState::Track => fl!("repeat-track"), RepeatState::Track => fl!("repeat-track"),
}, }),
widget::tooltip::Position::Top, widget::tooltip::Position::Top,
)); ));
if self.core.is_condensed() { if self.core.is_condensed() {

View file

@ -1,4 +1,3 @@
use cosmic::iced_core::image::Data;
use iced_video_player::Position; use iced_video_player::Position;
use image::{DynamicImage, ImageFormat, RgbaImage}; use image::{DynamicImage, ImageFormat, RgbaImage};
use std::{error::Error, num::NonZero, path::Path, time::Duration}; use std::{error::Error, num::NonZero, path::Path, time::Duration};
@ -29,9 +28,10 @@ pub fn main(
}; };
video.thumbnails([position], NonZero::new(1).unwrap())? video.thumbnails([position], NonZero::new(1).unwrap())?
}; };
//TODO: do not require clone of pixels data // TODO: do not require clone of pixels data
match thumbnails[0].data() { match &thumbnails[0] {
Data::Rgba { cosmic::widget::image::Handle::Rgba {
id: _,
width, width,
height, height,
pixels, pixels,
@ -42,11 +42,11 @@ pub fn main(
} }
}?; }?;
// if let Some((width, height)) = size_opt { if let Some((width, height)) = size_opt {
// image = image.thumbnail(width, height); image = image.thumbnail(width, height);
// } }
// image.save_with_format(output, ImageFormat::Png)?; image.save_with_format(output, ImageFormat::Png)?;
Ok(()) Ok(())
} }

View file

@ -4,7 +4,7 @@ use iced_video_player::{
gst_app, gst_pbutils, gst_app, gst_pbutils,
}; };
use cosmic::app::{Command, message}; use cosmic::{action, app::Task};
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct VideoSettings { pub struct VideoSettings {
@ -14,7 +14,7 @@ pub struct VideoSettings {
pub fn new_video( pub fn new_video(
url: &url::Url, url: &url::Url,
settings: VideoSettings, settings: VideoSettings,
) -> Result<Video, cosmic::Command<cosmic::app::Message<super::Message>>> { ) -> Result<Video, cosmic::Task<cosmic::Action<super::Message>>> {
//TODO: this code came from iced_video_player::Video::new and has been modified to stop the pipeline on error //TODO: this code came from iced_video_player::Video::new and has been modified to stop the pipeline on error
//TODO: remove unwraps and enable playback of files with only audio. //TODO: remove unwraps and enable playback of files with only audio.
gst::init().unwrap(); gst::init().unwrap();
@ -68,8 +68,8 @@ pub fn new_video(
match msg.view() { match msg.view() {
gst::MessageView::Element(element) => { gst::MessageView::Element(element) => {
if gst_pbutils::MissingPluginMessage::is(&element) { if gst_pbutils::MissingPluginMessage::is(&element) {
commands.push(Command::perform( commands.push(Task::perform(
async { message::app(super::Message::MissingPlugin(msg)) }, async { action::app(super::Message::MissingPlugin(msg)) },
|x| x, |x| x,
)); ));
// Do one codec install at a time // Do one codec install at a time
@ -80,7 +80,7 @@ pub fn new_video(
} }
} }
pipeline.set_state(gst::State::Null).unwrap(); pipeline.set_state(gst::State::Null).unwrap();
Err(Command::batch(commands)) Err(Task::batch(commands))
} }
} }
} }