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

View file

@ -1348,7 +1348,7 @@ impl Application for App {
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
// 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
@ -1733,10 +1733,10 @@ impl Application for App {
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::Track => fl!("repeat-track"),
},
}),
widget::tooltip::Position::Top,
));
if self.core.is_condensed() {

View file

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

View file

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