|
NAMElaunch_target - Setup and launch an external program.SYNOPSISvid:new_vid, aid:new_aid, int:cookie, int:return_code, int:elapsedlaunch_target( string:target ) launch_target( string:target, string:config=default ) launch_target( string:target, int:mode=LAUNCH_INTERNAL ) launch_target( string:target, string:config=default, int:mode ) launch_target( string:target, string:config=default, int:mode=LAUNCH_INTERNAL ) launch_target( string:target, string:config=default, int:mode=LAUNCH_INTERNAL ) launch_target( ) DESCRIPTIONLaunch Target uses the database to build an execution environment for the specific tuple of target and config and launch a matching external client. The mode can be set to either LAUNCH_INTERNAL (default) or LAUNCH_EXTERNAL .if ( LAUNCH_INTERNAL ) is set, arcan will set up a frameserver container, launch the config and continue executing as normal. The callback specified with handler will be used to receive events connected with the new frameserver, and the returned vid handle can be used to control and communicate with the frameserver. The notes section below covers events related to this callback. if ( LAUNCH_EXTERNAL ) is set, arcan will minimize its execution and resource footprint and wait for the specified program to finish executing. The return code of the program will be returned as the function return along with the elapsed time in milliseconds. This call is blocking and is intended for suspend/resume and similar situations. It only works if the binary format in the database entry has also been set explicitly to EXTERNAL . If the target:config tuple does not exist (if config is not specified, it will be forced to 'default') or the config does not support the requested mode, BADID will be returned. Every argument combination takes a callback function argument at the end. If this is not set, it should be defined through target_updatehandler or there may be a terminal state transition on the first event received from the target . The initial states a client goes through are as follow: "connected" (when using target_alloc ) -> "registered" (type information available) -> "preroll" (client waiting for initial state information) -> "resized" (first frame and subsequent resizes) -> [tblents below] -> "terminated". Do note that the returned new_vid has no guaranteed initial size, and will be invisible regardless of resize_image blend_image calls until the first "resized" event has been delivered through the handler . While it can be constrained, the client can always initiate resizes within a valid range and layout, animations and so on need to be able to adapt. Possible statustbl.kind values: "preroll", "resized", "ident", "coreopt", "message", "failure", "framestatus", "streaminfo", "streamstatus", "segment_request", "state_size", "viewport", "alert", "content_state", "registered", "clock", "cursor", "bchunkstate", "proto_update", "mask_input", "ramp_update" EXAMPLEfunction launch_target0() local tgts = list_targets(); if (#tgts == 0) then return shutdown("no targets found, check database", -1); end return shutdown(string.format("%s returned %d0, tgts[1], launch_target(tgts[1], LAUNCH_EXTERNAL))); end EXAMPLEfunction launch_target1() local tgts = list_targets(); if (#tgts == 0) then return shutdown("no targets found, check database", -1); end local img = launch_target(tgts[1], LAUNCH_INTERNAL, function(src, stat) print(src, stat); end ); if (valid_vid(img)) then show_image(img); else return shutdown(string.format("internal launch of %s failed.0, tgts[1]), -1); end end MISUSEfunction launch_target0() local tgts = list_targets(); if (#tgts == 0) then return shutdown("no targets found, check database", -1); end launch_target("noexist", -1, launch_target); end SEE ALSO:target_accept(3) target_alloc(3)
Visit the GSP FreeBSD Man Page Interface. |