DGS Driver
Application Program Interface
2-85
DGS_Params is defined in dgs.h as follows:
/* ======== DGS_Params ======== */
typedef struct DGS_Params { /* device parameters */
Fxn createFxn;
Fxn deleteFxn;
Fxn transFxn;
Arg arg;
Int num;
Int den;
} DGS_Params;
The device parameters are:
❏
create function
. Optional, default is NULL. Specifies a function that
is called to create and/or initialize a transform specific object. If non-
NULL, the create function is called in DGS_open upon creating the
stream with argument as its only parameter. The return value of the
create function is passed to the transform function.
❏
delete function.
Optional, default is NULL. Specifies a function to be
called when the device is closed. It should be used to free the object
created by the create function.
❏
transform function
. Required, default is localcopy. Specifies the
transform function that is called before calling the underlying device's
output function in output mode and after calling the underlying
device’s input function in input mode. Your transform function should
have the following interface:
dstsize = myTrans(Arg arg, Void *src, Void *dst, Int srcsize)
where arg is an optional argument (either argument or created by the
create function), and *src and *dst specify the source and destination
buffers, respectively. srcsize specifies the size of the source buffer
and dstsize specifies the size of the resulting transformed buffer
(srcsize * numerator/denominator).
❏
arg
. Optional argument, default is 0. If the create function is non-
NULL, the arg parameter is passed to the create function and the
create function's return value is passed as a parameter to the
transform function; otherwise, argument is passed to the transform
function.
❏
num
and
den
(numerator and denominator). Required, default is 1
for both parameters. These parameters specify the size of the
transformed buffer. For example, a transformation that compresses
two 32-bit words into a single 32-bit word would have numerator = 1
and denominator = 2 since the buffer resulting from the
transformation is 1/2 the size of the original buffer.