creating pipeline by elements & videobox
but it crops symmetrically
This commit is contained in:
parent
32451a783f
commit
6465818d3b
|
@ -81,16 +81,57 @@
|
|||
;; it did work. wowy. ok
|
||||
;; 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))
|
||||
|
||||
|
||||
;; huh. how the heck can i check all valid functions to call?
|
||||
;; i don't understand. let's try creation of pipeline "by element"
|
||||
(gir:invoke (*gstreamer* 'pipeline-new))
|
||||
|
||||
(gir:nget *gstreamer* 'init) ; this directly exists
|
||||
|
||||
(gir:nget *gstreamer* 'pipeline-new) ; doesn't work
|
||||
(gir:nget *gstreamer* "Pipeline" 'new)
|
||||
;; https://gstreamer.freedesktop.org/documentation/gstreamer/gstpipeline.html?gi-language=python#gst_pipeline_new
|
||||
;; well, i guess it should be in namespace "Pipeline", so, huh
|
||||
|
||||
|
||||
;;https://gstreamer.freedesktop.org/documentation/gstreamer/gstelementfactory.html?gi-language=python
|
||||
(gir:nget *gstreamer* 'element-factory-make)
|
||||
(gir:nget *gstreamer* "ElementFactory" 'make) ; and now this exists
|
||||
|
||||
;; OKOK
|
||||
|
||||
;; let's generalize, when stream is not passed, use the testsrc
|
||||
(defun cast-with-videobox (&optional stream-num)
|
||||
(gir:invoke (*gstreamer* 'init) '())
|
||||
(let* ((pipeline (gir:invoke (*gstreamer* "Pipeline" 'new) "video-pipeline"))
|
||||
(source (gir:invoke (*gstreamer* "ElementFactory" 'make) (if stream-num
|
||||
"pipewiresrc"
|
||||
"videotestsrc") "source"))
|
||||
(convert (gir:invoke (*gstreamer* "ElementFactory" 'make) "videoconvert" "convert"))
|
||||
(box (gir:invoke (*gstreamer* "ElementFactory" 'make) "videobox" "box"))
|
||||
(sink (gir:invoke (*gstreamer* "ElementFactory" 'make) "autovideosink" "sink")))
|
||||
(when stream-num
|
||||
;; Set pipewiresrc properties, such as the path
|
||||
(gir:invoke (source 'set-property) 'path stream-num))
|
||||
|
||||
;; Add and link elements in the pipeline
|
||||
(gir:invoke (pipeline 'add) source)
|
||||
(gir:invoke (pipeline 'add) convert)
|
||||
(gir:invoke (pipeline 'add) box)
|
||||
(gir:invoke (pipeline 'add) sink)
|
||||
|
||||
(gir:invoke (source 'link) convert)
|
||||
(gir:invoke (convert 'link) box)
|
||||
(gir:invoke (box 'link) sink)
|
||||
|
||||
(gir:invoke (pipeline 'set-state) (gir:nget *gstreamer* "State" :playing))
|
||||
;(format t ">> arhg ~A" (gir:property box 'top))
|
||||
(defun move-video (top left)
|
||||
(setf (gir:property box 'top) top
|
||||
(gir:property box 'left) left))
|
||||
|
||||
;; Example: Move the video 10 pixels down and 20 pixels to the right
|
||||
(move-video 100 200)
|
||||
pipeline))
|
||||
;; now this works, but padding is symmetrical
|
||||
|
|
Loading…
Reference in New Issue