| XDF_SET_CONF(3) | xdffileio library manual | XDF_SET_CONF(3) |
xdf_set_conf, xdf_get_conf - set or get the configuration of xDF file
#include <xdfio.h>
int xdf_set_conf(struct xdf* xdf, enum xdffield
field, ...);
int xdf_get_conf(const struct xdf* xdf, enum xdffield
field, ...);
xdf_set_conf() sets the configuration (usually one of the field file header) of a xDF file referenced by xdf according to the variable list of arguments. This list is composed of successive couple grouping one variable of type enum xdffield defining the feature to be set and a value whose type depends on the previous field type. The list must finish by XDF_NOF.
xdf_get_conf() gets the configuration of the channel referenced by xdf according to the variable list of argument. The variable list is the same list terminated by XDF_NOF as for xdf_set_conf() excepting that the second part of the couple is not that value but a pointer to the value.
Both functions process the argument list from left to right. This means that if a particular field request provokes an error, none of the field requests on its right will be processed. The order of processing is also important for field requests that influences the value of other fields (like XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ).
The functions accepts two types of field value. The first one are file configuration field (XDF_F_*) which set different aspects of the general configuration of the file. The second type are the channel configuration fields (XDF_CF_*). When used in xdf_set_conf(), those fields set the default values that will be used for the creation of the next channel (see xdf_add_channel(3)). The list of channel configuration fields and their meaning are specified in the documentation of xdf_set_chconf(3).
If the file is opened for writing, each field is initialized to sensible or non-informative values in case of optional field or incorrect values in the case of "must be set" field (only XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ). The default value are specified in squared bracked in the list.
Here is the list of file configuration field value. The type of value expected is provided in the parenthesis (the expected type of the value for xdf_set_conf(), or a pointer to this type for xdf_get_conf()). If a list of data formats is specified in curl brackets, it means that the field is supported only in those formats (no list means that all formats support the field):
The two functions returns 0 in case of success. Otherwise -1 is returned and errno is set appropriately.
Example of usage of xdf_set_conf() and xdf_get_conf():
/* Assume xdfr and xdfw reference 2 XDF files opened respectively
* for reading and for writing */
const char *subjstr, *sessstr;
xdf_get_conf(xdfr, XDF_F_SUBJ_DESC, &subjstr,
XDF_F_SESS_DESC, &sessstr,
XDF_NOF);
printf("subject: %s\nrecording: %s\n", subjstr, sessstr);
xdf_set_conf(xdfw, XDF_F_SUBJ_DESC, subjstr,
XDF_F_SESS_DESC, sessstr,
XDF_NOF);
xdf_copy_conf(3), xdf_set_chconf(3), xdf_add_channel(3)
| 2010 | EPFL |