Workaround
All checks were successful
PostmarketOS Build / Build for aarch64 (push) Successful in 55s
PostmarketOS Build / Build for x86_64 (push) Successful in 12s

Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
Vasiliy Doylov 2025-06-11 20:08:27 +03:00
parent be1177bd5f
commit 4763aea337
Signed by: NekoCWD
GPG key ID: B7BE22D44474A582
2 changed files with 14 additions and 10 deletions

View file

@ -83,7 +83,9 @@ public class EyeNeko.Gstreamer : Object {
foreach (var device in pwprovider.get_devices ()) {
if (device.has_classes ("Video/Source")) {
cameras += new Camera (device);
message ("Camera appended %s:", device.display_name);
var id = Value (typeof (string));
device.get_property ("serial", ref id);
message ("Camera appended %s:", id.get_string ());
}
}
}
@ -127,7 +129,7 @@ public class EyeNeko.Gstreamer : Object {
public void start_stream_from (Camera camera) {
camerabin.set_state (Gst.State.NULL);
message ("Stream start");
current_camera = camera;
camerasrc_wrapper.set_property
("video-source",
@ -163,9 +165,11 @@ public class EyeNeko.Gstreamer : Object {
Gst.ElementFactory.make ("glupload"),
color_correction_matrix,
downscale,
Gst.ElementFactory.make ("gldownload")
Gst.ElementFactory.make ("gldownload"),
Gst.ElementFactory.make ("videoconvert")
));
camerabin.set_property ("image-filter", Gst.ElementFactory.make ("queue"));
camerabin.set_property ("viewfinder-filter", Gst.ElementFactory.make ("videoconvert"));
camerabin.set_property ("image-filter", Gst.ElementFactory.make ("videoconvert"));
camerabin.set_property ("video-filter",
@ -185,7 +189,8 @@ public class EyeNeko.Gstreamer : Object {
notify["camerabin-mode"].connect (() => {
downscale.max_size = camerabin_mode == CameraBinMode.VIDEO ? downscale_video_to : downscale_photo_to;
start_stream_from (current_camera);
if (current_camera != null)
start_stream_from (current_camera);
});
camerabin.bus.add_watch (0, bus_callback);

View file

@ -48,7 +48,7 @@ public class EyeNeko.Window : Adw.ApplicationWindow {
});
if (Gstreamer.Camera.get_all ().length > 0)
camera_path = Gstreamer.Camera.get_all ()[0].device.get_path_string ();
camera_path = Gstreamer.Camera.get_all ()[int.parse (Env.get_variable_or ("CAM_N", "0"))].device.get_path_string ();
var change_video_source_action = new PropertyAction ("change-video-source", this, "camera-path");
add_action (change_video_source_action);
@ -77,13 +77,9 @@ public class EyeNeko.Window : Adw.ApplicationWindow {
overlay.add_overlay (toolbar);
setup_video_source_changer ();
viewfinder.set_paintable (Gstreamer.instance.viewfinder_paintable);
Gstreamer.instance.start_stream_from (Gstreamer.Camera.get_all ()[0]);
capture_btn.clicked.connect (() => {
message ("%d %d", Gstreamer.instance.camerabin_mode, (int) Gstreamer.instance.ready);
if (Gstreamer.instance.camerabin_mode == Gstreamer.CameraBinMode.VIDEO && !Gstreamer.instance.ready) {
Gstreamer.instance.stop_capture ();
} else {
@ -103,5 +99,8 @@ public class EyeNeko.Window : Adw.ApplicationWindow {
break;
}
});
camera_mode.active_name = Env.get_variable_or ("CAM_M", "photo");
setup_video_source_changer ();
}
}