exercise_7
Time for a gentle introduction to the most complex part of Arcan - Frameservers. For this set, you will want a second terminal from which to try things. You also need to verify that your build of arcan includes a binary called afsrv_decode.
From a terminal of your choice, run:
afsrv_decode
With the environment variable ARCAN_ARG set to help. In bash, this would be something like:
ARCAN_ARG=help afsrv_decode
This is not a user facing binary in itself, we will work with it using only Lua functions for now, but pay attention to the part of the output that says 'accepted media arguments'.
afsrv_decode consolidates media 'source' access. The ones it has access to depends on your installation and can range from video files and networked video streams to webcam devices.
Create an arcan appl with a media file inside of it. Use ref:launch_avfeed to launch a frameserver in 'decode' mode and provide the media file as argument.
Dump the members of the cb(source, status) handler functions during playback. Start arcan with the environment ARCAN_LOGPATH set to somewhere, e.g. /tmp.
Re-run your script from #1, look at the logfile being created. Use target_verbose on the vid to enable more verbose output, compare running with verbose mode enabled versus not.
Continue with the example from #1 and start it in a suspended playback state. See suspend_target and resume_target for controls. Add an input handler so that when you press a button, it advances one frame. See stepframe_target for how to achieve that.
Use target_seek to move playback to the middle of the clip before resuming playback.
Add a transform cycle that moves the playback vid around the screen endlessly. Implement it so that when the playback terminates, the same video file relaunches and the object resumes its position and transform from where the previous one stopped.
Hint: copy_image_transform might be useful.
Create a visible null surface and share the storage from your decode playback. Add a clock pulse handler, and after a few seconds destroy the source vid and note what happens.