The life of a Op
- 00 · gggl_op_db_register (GgglOpInfo *info)
- GgglOpInfo about Op is registered in gggl's Op database
- 01 · GgglOpInfo->open (GgglOp *op)
- calls the open function registered in the info block, this function
should fill in a datastructure for a new instance, the GgglOp structure
is already allocated.
Actions done here:
- Allocating additional instance memory (for instance properties)
- Overriding default methods (process, pad pixel representation queries,
pad pixel representation setting)
- Setting up properties with types, setting default value of properties
- doing library initizalization if using an external library
- 02 · property setting / getting
- Gggl uses utility functions to access and/or modify the properties
that have been registered in 03.
- 03 · GgglOp->init (GgglOp *op)
- Prepare to do processing, at this stage properties are known, but
input pixel formats are not known. Sources typically set the GgglOp->out_pad_fmt[N]
here based on the file being used.
- 04 · GgglOp->query_in_pad_fmt (GgglOp *op, int pad_no, int fmt)
-
Query whether fmt is a valid pixel representation for the given input pad,
returns 1 if true 0 otherwize, default implementation allows all formats, convenience
functions exsist for some common sets of pixel representations.
- 05 · GgglOp->set_in_pad_fmt (GgglOp *op, int pad_no, int fmt)
-
Sets the pixel format a pad will receive on an input pad. The default implementation
will set op->out_pad_fmt[0] as well as op->in_pad_fmt[0] if
pad_no is 0.
- 06 · GgglOp->query_out_pad_fmt (GgglOp *op, int pad_no, int fmt)
-
Queries whether fmt id a valid pixel representation is a valid request for
output pad pad_no.
of the Op.
- 07 · GgglOp->set_out_pad_fmt (GgglOp *op, int pad_no, int fmt)
-
Sets the pixel format that the Op should produce, will be one that the Op already has
accepted; as figured out in step 06.
- 08 · GgglOp->process (GgglOp *op)
-
Process image, pads are set with pointers to image buffers, and you should fill
set the output pads pointing to image buffers, either some of those passed in,
or ones allocated as part of this Op instance.
- 09 · GgglOp->close
-
Free up all resources related to Op, this means temporary storage for variables,
deintialize instance of library (beware of libraries using globals, that shut down)
The default implementation frees all data that has been registered with gggl_malloc,
gggl_strdup and gggl_calloc. This is mandated, thus you should call gggl_op_default_close
as the last step if you are overriding.