before trying to create elements separately

This commit is contained in:
efim 2024-08-16 10:34:42 +00:00
parent 1e06e2e476
commit 32451a783f
2 changed files with 85 additions and 16 deletions

View File

@ -61,23 +61,16 @@
;; videotestsc worked ;; videotestsc worked
;; and error i got was from trying to set :null ? but it should be correct enum ;; and error i got was from trying to set :null ? but it should be correct enum
;; oh well, ok ;; oh well, ok
(defun for-screencast () (defun for-screencast (stream-num)
(gir:invoke (*gstreamer* 'init) '()) (gir:invoke (*gstreamer* 'init) '())
(let ((pipeline (gir:invoke (*gstreamer* 'parse-launch) (let* ((pipeline
"pipewiresrc path=46 ! videoconvert ! autovideosink" (gir:invoke (*gstreamer* 'parse-launch)
;"playbin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm" (format nil "pipewiresrc path=~A ! videoconvert ! videobox name=move ! autovideosink" stream-num)
))) ;"playbin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm"
(gir:invoke (pipeline 'set-state) ))
(gir:nget *gstreamer* "State" :playing)) (move-element (gir:invoke (pipeline 'get-by-name) "move")))
;; (let* ((bus (gir:invoke (pipeline 'get-bus))) (gir:invoke (pipeline 'set-state) (gir:nget *gstreamer* "State" :playing))
;; (msg (gir:invoke (bus 'timed-pop-filtered) (values pipeline move-element)))
;; (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 ;; well, pipewire is not part of what's added to env
;; not sure if i can add it ;; not sure if i can add it
@ -87,3 +80,17 @@
;; i can try to add pipewire, but then would it work with the screen share running on system server? ;; i can try to add pipewire, but then would it work with the screen share running on system server?
;; it did work. wowy. ok ;; it did work. wowy. ok
;; cool. now i'm kind of at the point of python example :D ;; cool. now i'm kind of at the point of python example :D
;; let's generalize, when stream is not passed, use the testsrc
(defun moving-cast (&optional stream-num)
(gir:invoke (*gstreamer* 'init) '())
(let* ((source (if stream-num
(format nil "pipewiresrc path=~A" stream-num)
"videotestsrc"))
(pipeline
(gir:invoke (*gstreamer* 'parse-launch)
(format nil "~A ! videoconvert ! videobox name=move ! autovideosink" source))))
; (format t "~A" (gir:nget pipeline 'get-state))
(gir:invoke (pipeline 'set-state) (gir:nget *gstreamer* "State" :playing))
pipeline))

View File

@ -210,3 +210,65 @@ so. tried removing all from shell env, then not found namespace Gst
(defvar *gstreamer* (gir:require-namespace "Gst")) (defvar *gstreamer* (gir:require-namespace "Gst"))
so. yeah. maybe i need to install dev headers or something? so. yeah. maybe i need to install dev headers or something?
** so. for moving the video around. chatgpt recommended something named 'videobox'
like i can declare it in the pipeline and then get reference to it and use to set video coordinates, huh?
https://gstreamer.freedesktop.org/documentation/videobox/index.html?gi-language=python
the thing exists but i have zero idea whether it's accessible in a way that's recommended
#+begin_src lisp
(defun for-screencast ()
(gir:invoke (*gstreamer* 'init) '())
(let* ((pipeline (gir:invoke (*gstreamer* 'parse-launch)
"pipewiresrc path=49 ! videoconvert ! videobox top=0 left=0 right=0 bottom=0 ! videoconvert ! autovideosink"
))
(videobox (gir:invoke (pipeline 'get-element-by-name) "videobox")))
;; Set the initial state to playing
(gir:invoke (pipeline 'set-state) (gir:nget *gstreamer* "State" :playing))
;; Function to move the video
(defun move-video (top left)
(gir:invoke (videobox 'set-property) 'top top)
(gir:invoke (videobox 'set-property) 'left left))
;; Example: Move the video 10 pixels down and 20 pixels to the right
(move-video 10 20)))
#+end_src
and similar advice from claude, huh
#+begin_src lisp
(defun for-screencast ()
(gir:invoke (*gstreamer* 'init) '())
(let* ((pipeline (gir:invoke (*gstreamer* 'parse-launch)
"pipewiresrc path=49 ! videoconvert ! videobox name=move ! videoscale ! autovideosink"))
(move-element (gir:invoke (pipeline 'get-by-name) "move")))
(gir:invoke (pipeline 'set-state) (gir:nget *gstreamer* "State" :playing))
(values pipeline move-element)))
(defun move-video (move-element left top)
(gir:set-property move-element "left" left)
(gir:set-property move-element "top" top))
;; Usage:
(multiple-value-bind (pipeline move-element) (for-screencast)
;; Move video 50 pixels to the right and 30 pixels down
(move-video move-element 50 30)
;; Your main loop or other logic here
)
#+end_src
let's try this out
* [2024-08-16 Fri]
** new day of the vacation
the experiment with moving the video, right?
could it be that both examples are fake? i don't seem to find both 'get-element things
trying to find anything about dynamism in gstreamer
https://coaxion.net/blog/2014/01/gstreamer-dynamic-pipelines/
looks like this is about changing elements of the pipeline
and it's possible that parameters of the pipeline elements (pads?) are also static