How to use libyuriThere are two basic ways, how to use libyuri. You can either compile your own application that uses libyuri API a links agains it, or the much easier way is to create an XML configuration file a let the binary yuri2 to parse it and execute for you. Using yuri2the basic syntax to run your application from an XML file is: yuri2 app.xml Simple, right? More advanced usage is in form: yuri2 [options] app.xml [variable=value] ... The options are described bellow. Interesting part are the variables. This let's you configure the application without modifying the XML file. Supported options are:
XML file formatLet's look at a sample file first:
As you can see, it's an ordinary XML file. comments work the usual way, between <!-- and -->. The root element is <app> and has optional parameter name. Then you can specify <variable>. These are the variables that can be specified from a command line. They should have a name and a default value. Next, there is <general> element. This specified some global <parameter>s for the whole application, like run time limit (parameter 'run_limit') or global debug level. The you specify <node>s. These are the nodes of oriented graph representing the application. Each node has a class (the “type” of the node) and a unique name used to refer to this node. The name has to be unique! It won't format your hard drive if it isn't, but it probably won't do what you wanted it to do. Inside each node element, you can specify <parameter>s, just like in the <global> element. Each of the parameters should correspond to some parameter of the class that the node represents.(TIP: You can get list of there parameters by running yuri2 -l). Instead of specifying a value for the parameter, you can use syntax @variable to have the value be set pro a variable at execution time (either with user specified value or with the default value). The variable has to be declared using <variable> element. Last but not least, there is the <link> element. This element defines oriented links between nodes, thus defining the structure of the application graph. it has to have a name specified (unique among the links) and the source and target node port specification. The syntax for these ports is simple: node_name:port_number. For simple nodes the port number is always 0, some more complicated one may have more than a single input or output ports. so to run this sample application, just run: yuri2 webcam.xml and you should get a window with picture from your web camera. You can also specify to use other camera using variables. For example to use camera on /dev/video1 use: yuri2 webcam.xml device=/dev/video1 Additional XML filesYou can find some testing config files in the source distrubution under directory configs/ |