diff --git a/0001-aperture-Use-our-preference-for-caps.patch b/0001-aperture-Use-our-preference-for-caps.patch new file mode 100644 index 0000000..920e5fc --- /dev/null +++ b/0001-aperture-Use-our-preference-for-caps.patch @@ -0,0 +1,34 @@ +From e3a7d25e114ad2fe218b4f895f9a04507403b958 Mon Sep 17 00:00:00 2001 +From: Robert Mader +Date: Sat, 30 Mar 2024 17:05:50 +0100 +Subject: [PATCH] aperture: Use our preference for caps + +Prefere the caps we already compute as being best. This notably makes us +prefer jpeg encoded streams on many cameras, allowing higher frame +rates. + +On top of that, ensure we still signal support other caps. This is +important if the camera is already running because of another app - +e.g. Cheese. Right now that app has authority over the chosen mode and +if that doesn't match one of our preferred ones we'd break. +--- + aperture/src/camera.rs | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/aperture/src/camera.rs b/aperture/src/camera.rs +index 1be3c54..2f2daeb 100644 +--- a/aperture/src/camera.rs ++++ b/aperture/src/camera.rs +@@ -172,7 +172,8 @@ fn filter_caps(caps: &gst::Caps) -> gst::Caps { + } + }); + +- caps.intersect_with_mode(&best_caps, gst::CapsIntersectMode::First) ++ best_caps.merge(caps.clone()); ++ best_caps + } + + fn framerate_from_structure(structure: &gst::StructureRef) -> Option { +-- +2.44.0 + diff --git a/0001-camera-remove-portal-usage.patch b/0001-camera-remove-portal-usage.patch new file mode 100644 index 0000000..35fb005 --- /dev/null +++ b/0001-camera-remove-portal-usage.patch @@ -0,0 +1,80 @@ +From a7f7fabe6a8f7fef6b98724f9c73f6bdd9d19e3a Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Tue, 9 Apr 2024 14:55:02 -0700 +Subject: [PATCH] camera: remove portal usage + +This is just causing too many problems for Fedora 40 release +right now. + +Signed-off-by: Adam Williamson +--- + Cargo.toml | 1 - + src/widgets/camera.rs | 25 ------------------------- + 2 files changed, 26 deletions(-) + +diff --git a/Cargo.toml b/Cargo.toml +index 4405060..fc7ce26 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -12,7 +12,6 @@ lto = true + [dependencies] + adw = { package = "libadwaita", version = "0.6", features = ["v1_4"] } + anyhow = "1.0" +-ashpd = { version = "0.8", features = ["gtk4", "tracing"] } + futures-channel = "0.3.26" + gettext-rs = { version = "0.7", features = ["gettext-system"] } + gst = { package = "gstreamer", version = "0.22", features = ["v1_20"] } +diff --git a/src/widgets/camera.rs b/src/widgets/camera.rs +index 3f017ca..65843b8 100644 +--- a/src/widgets/camera.rs ++++ b/src/widgets/camera.rs +@@ -1,9 +1,7 @@ + // SPDX-License-Identifier: GPL-3.0-or-later +-use std::os::unix::io::OwnedFd; + + use adw::prelude::*; + use adw::subclass::prelude::*; +-use ashpd::desktop::camera; + use gettextrs::gettext; + use gtk::CompositeTemplate; + use gtk::{gio, glib}; +@@ -213,22 +211,6 @@ impl Camera { + + glib::spawn_future_local( + glib::clone!(@weak self as obj, @strong provider => async move { +- match stream().await { +- Ok(fd) => { +- if let Err(err) = provider.set_fd(fd) { +- log::error!("Could not use the camera portal: {err}"); +- }; +- } +- Err(ashpd::Error::Portal(ashpd::PortalError::NotAllowed(err))) => { +- // We don't start the device provider if we are not +- // allowed to use cameras. +- log::warn!("Permission to use the camera portal denied: {err}"); +- obj.imp().permission_denied.set(true); +- obj.update_state(); +- return; +- }, +- Err(err) => log::warn!("Could not use the camera portal: {err}"), +- } + if let Err(err) = provider.start_with_default(glib::clone!(@weak obj => @default-return false, move |camera| { + let stored_id = obj.imp().settings().string("last-camera-id"); + !stored_id.is_empty() && id_from_pw(camera) == stored_id +@@ -523,13 +505,6 @@ impl Camera { + } + } + +-async fn stream() -> ashpd::Result { +- let proxy = camera::Camera::new().await?; +- proxy.request_access().await?; +- +- proxy.open_pipe_wire_remote().await +-} +- + // Id used to identify the last-used camera. + fn id_from_pw(camera: &aperture::Camera) -> glib::GString { + camera.display_name() +-- +2.44.0 + diff --git a/snapshot.spec b/snapshot.spec index b6febbf..223ee0d 100644 --- a/snapshot.spec +++ b/snapshot.spec @@ -31,8 +31,18 @@ License: (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 OR MIT) URL: https://gitlab.gnome.org/GNOME/snapshot Source: https://download.gnome.org/sources/snapshot/46/snapshot-%{tarball_version}.tar.xz +# https://gitlab.gnome.org/GNOME/snapshot/-/commit/e3a7d25e114ad2fe218b4f895f9a04507403b958 +# Was supposed to be in 46.1 but accidentally omitted from the tarball +# Should fix framerates on some cameras +Patch0: 0001-aperture-Use-our-preference-for-caps.patch + # Downstream patch to disable linting as part of self tests -Patch: 0001-Disable-cargo-clippy-test.patch +Patch100: 0001-Disable-cargo-clippy-test.patch + +# Based on https://gitlab.gnome.org/GNOME/snapshot/-/merge_requests/194 +# Disable portal usage, it's causing too many problems right now +# Not applied to flatpak builds, as it'd render them useless +Patch200: 0001-camera-remove-portal-usage.patch # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} @@ -64,7 +74,13 @@ Take pictures and videos on your computer, tablet, or phone. %prep -%autosetup -p1 -n snapshot-%{tarball_version} +%setup -q -n snapshot-%{tarball_version} +%patch 0 -p1 +%patch 100 -p1 +%if ! 0%{?flatpak} +# this patch should not be applied to flatpaks +%patch 200 -p1 +%endif %if 0%{?bundled_rust_deps} %cargo_prep -v vendor