From 1e06e2e476368ad4e6176af48c3a9ab3f0dabe5e Mon Sep 17 00:00:00 2001 From: efim Date: Thu, 15 Aug 2024 15:25:44 +0000 Subject: [PATCH] opening gstreamer window from cl --- flake.nix | 1 + gstreamer/tutorial-hello-world.lisp | 30 +++++++++++++++++++++++++++++ gtk-maybe-video.lisp | 1 + maybe-screencast.lisp | 5 ++++- notes.org | 28 +++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 3b795d7..5635b09 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,7 @@ pkgs.gst_all_1.gstreamer pkgs.gst_all_1.gst-plugins-base pkgs.gst_all_1.gst-plugins-good + pkgs.pipewire sbcl' ]; }; diff --git a/gstreamer/tutorial-hello-world.lisp b/gstreamer/tutorial-hello-world.lisp index 62ad4d6..c350d17 100644 --- a/gstreamer/tutorial-hello-world.lisp +++ b/gstreamer/tutorial-hello-world.lisp @@ -35,6 +35,10 @@ (gir:invoke (pipeline 'set-state) (gir:nget *gstreamer* "State" :playing)))) +;; from here? +;; https://github.com/irsbugs/GStreaming?tab=readme-ov-file#gstparse_launch +;; and docs searched with underscore +;; https://gstreamer.freedesktop.org/documentation/gstreamer/gstparse.html?gi-language=python#gst_parse_launch (defun tutorial-main () (gir:invoke (*gstreamer* 'init) '()) (let ((pipeline (gir:invoke (*gstreamer* 'parse-launch) @@ -57,3 +61,29 @@ ;; videotestsc worked ;; and error i got was from trying to set :null ? but it should be correct enum ;; oh well, ok +(defun for-screencast () + (gir:invoke (*gstreamer* 'init) '()) + (let ((pipeline (gir:invoke (*gstreamer* 'parse-launch) + "pipewiresrc path=46 ! videoconvert ! autovideosink" + ;"playbin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm" + ))) + (gir:invoke (pipeline 'set-state) + (gir:nget *gstreamer* "State" :playing)) + ;; (let* ((bus (gir:invoke (pipeline 'get-bus))) + ;; (msg (gir:invoke (bus 'timed-pop-filtered) + ;; (gir:nget *gstreamer* :clock-time-none) + ;; (list + ;; (gir:nget *gstreamer* "MessageType" :error) + ;; (gir:nget *gstreamer* "MessageType" :eos)))))) + ;; (gir:invoke (pipeline 'set-state) + ;; (gir:nget *gstreamer* "State" :paused)) + )) + +;; well, pipewire is not part of what's added to env +;; not sure if i can add it +;; trying to run without env gstreamer doesn't work, installing +;; $ sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev +;; still results in error for (defvar *gstreamer* (gir:require-namespace "Gst")) +;; i can try to add pipewire, but then would it work with the screen share running on system server? +;; it did work. wowy. ok +;; cool. now i'm kind of at the point of python example :D diff --git a/gtk-maybe-video.lisp b/gtk-maybe-video.lisp index 39527e6..4e1f6a9 100644 --- a/gtk-maybe-video.lisp +++ b/gtk-maybe-video.lisp @@ -1,4 +1,5 @@ (load (sb-ext:posix-getenv "ASDF")) + (asdf:load-system 'cl-cffi-gtk) (defpackage :video-processor diff --git a/maybe-screencast.lisp b/maybe-screencast.lisp index 3b2e3bb..52c1ccb 100644 --- a/maybe-screencast.lisp +++ b/maybe-screencast.lisp @@ -1,7 +1,10 @@ (load (sb-ext:posix-getenv "ASDF")) (asdf:load-system 'dbus) -(defpackage #:screencasting (:use #:cl)) +(defpackage + #:screencasting + (:use #:cl) + (:export call-with-all-predefined)) (in-package #:screencasting) ;; https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.ScreenCast.html diff --git a/notes.org b/notes.org index 3c811ff..c963c0c 100644 --- a/notes.org +++ b/notes.org @@ -182,3 +182,31 @@ https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance they are packaged in nix, this is just unbelievable how much is done by humanity, omg + +* [2024-08-15 Thu] + +** getting back after a long while. +so, i was at the creating a window, not knowing how to stream video from pipewire out node +so. what to do, huh +i think gtk3 bindings library was separate from gobject and glib + +but maybe it doesn't matter? +or maybe i should figure out glib bindings and use gtk3 though it? + +** well, there's something simple with opening a window +[[file:gtk-playground.lisp::defun example-window-simple (]] + +** and something extra simple with gstreamer opening separate window for test video source +[[file:gstreamer/tutorial-hello-world.lisp]] + +** maybe try to open gstreamer window with screen share? + +ok, when i try example of pipewire window on screenshare source +i get error that pipewiresrc is not found +and that's right, i used system-wide gst-launch-1.0 +and when i tried with one in flake shell - it also didn't work + +so. tried removing all from shell env, then not found namespace Gst +(defvar *gstreamer* (gir:require-namespace "Gst")) + +so. yeah. maybe i need to install dev headers or something?