opening gstreamer window from cl

This commit is contained in:
efim 2024-08-15 15:25:44 +00:00
parent e991200a8e
commit 1e06e2e476
5 changed files with 64 additions and 1 deletions

View File

@ -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'
];
};

View File

@ -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

View File

@ -1,4 +1,5 @@
(load (sb-ext:posix-getenv "ASDF"))
(asdf:load-system 'cl-cffi-gtk)
(defpackage :video-processor

View File

@ -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

View File

@ -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?