The video module provides functions to load in a movie file via Quicktime in OSX or GStreamer in Linux, and offers various controls to play or control the properties of the movie. The module also provides access to live cameras.
(clear) (video-clear-cache) (define vt (video-load "/path/to/movie")) (video-play vt) (let ([p (build-plane)] [tcoords (video-tcoords vt)]) (with-primitive p (texture vt) (pdata-index-map! (lambda (i t) (list-ref tcoords (remainder i 4))) "t"))) (every-frame (video-update vt))
Returns void
The video loading is memory cached, so repeatedly calling (video-load) will not cause the file to be loaded again. (video-clear-cache) clears the video cache, meaning the videos will be reloaded from disk.
Example
(video-clear-cache)
Returns videoid-number
Loads a movie file. The video loading is memory cached, so repeatedly calling this will not cause the file to be loaded again. The cache can be cleared with (video-clear-cache). Returns a video-id that can be used directly in (texture) calls, and in other video functions.
Example
(define movie (video-load "/path/to/movie"))
Returns list-of-texture-coordinates
Returns the texture coordinates of the video texture. This is necessary, because video images are usually rectangular non-power-of-two textures, while fluxus uses GL_TEXTURE_2D power-of-two textures.
Example
(define vt (video-load "/path/to/movie")) (video-play vt) (let ([p (build-plane)] [tcoords (video-tcoords vt)]) (with-primitive p (texture vt) (pdata-index-map! (lambda (i t) (list-ref tcoords (remainder i 4))) "t"))) (every-frame (video-update vt))
Returns void
Updates the movie player, so that the movie can play.
Example
(define vt (video-load "/path/to/movie")) (video-play vt) (let ([p (build-plane)] [tcoords (video-tcoords vt)]) (with-primitive p (texture vt) (pdata-index-map! (lambda (i t) (list-ref tcoords (remainder i 4))) "t"))) (every-frame (video-update vt))
Returns void
Plays the movie.
Example
(define vt (video-load "/path/to/movie")) (video-play vt)
Returns void
Stops the movie.
Example
(define vt (video-load "/path/to/movie")) (video-play vt)
Returns void
Sets the position of the playhead to a given percentage through the movie. Position is between 0 and 1.
Example
(define vt (video-load "/path/to/movie")) (video-play vt) (video-seek vt 0.5)
Returns width-number
Returns the width of the video zero if the video id is invalid.
Example
(define vt (video-load "/path/to/movie")) (video-width vt)
Returns height-number
Returns the height of the video or zero if the video id is invalid.
Example
(define vt (video-load "/path/to/movie")) (video-height vt)
Returns cpointer:imgptr
Returns a tagged cpointer to the video pixel buffer to be passed to other modules. The data is stored as RGB in an array of width*height*3 size.
Example
(define vt (video-load "/path/to/movie")) (video-imgptr vt)
Returns void
Prints the available camera devices to the console.
Example
(camera-list-devices)
Returns void
The initialized cameras are stored in cache, so they are not getting reinited every time the script is recompiled. The function clears the camera cache.
Example
(camera-clear-cache)
Returns cameraid-number
Initializes the camera with the given device-id and resolution. Returns a camera-id that can be used directly in (texture) calls, and in other camera functions to reference the device. The camera-id is different from the device-id.
Example
(define cam (camera-init 0 320 240)) (printf "camera resolution: ~ax~a~n" (camera-width cam) (camera-height cam)) (texture cam) (build-cube)
Returns void
This function should be called regularly to get new data from the camera.
Example
(define cam (camera-init 0 320 240)) (texture cam) (build-cube) (every-frame (camera-update cam))
Returns list-of-texture-coordinates
Returns the texture coordinates of the camera image. This is necessary, because camera images are rectangular non-power-of-two textures, while fluxus uses GL_TEXTURE_2D power-of-two textures.
Example
(define cam (camera-init 0 320 240)) (let ([p (build-cube)] [tcoords (camera-tcoords cam)]) (with-primitive p (texture cam) (pdata-index-map! (lambda (i t) (list-ref tcoords (remainder i 4))) "t"))) (every-frame (camera-update cam))
Returns width-number
Returns the width of the camera image or zero if the camera id is invalid.
Example
(define cam (camera-init 0 320 240)) (camera-width cam)
Returns height-number
Returns the height of the camera image or zero if the camera id is invalid.
Example
(define cam (camera-init 0 320 240)) (camera-height cam)
Returns cpointer:imgptr
Returns a tagged cpointer to the camera image pixel buffer to be passed to other modules. The data is stored as RGB in an array of width*height*3 size.
Example
(define cam (camera-init 0 320 240)) (camera-imgptr cam)