| synopsis || arguments || prev || next |
void open( const char * filename, int phld_threshold, int per_client_cache, FILE * cache_fp, bool cache_exists, kdu_long sub_start=0, kdu_long sub_lim=KDU_LONG_MAX)
[Declared in "../apps/kdu_server/jp2_serve_target.h"]
Opens the target file, which must either be a JP2-compatible file or a raw JPEG2000 code-stream. You may, optionally qualify the target file with a byte-range (a sub-range). In this case, the raw code-stream or set of JP2-family boxes which make up the target are found at the sub_start position and sub_lim- sub_start is the maximum length of the target byte range. Note, however, that the supplied byte range will be ignored if the structure of the target has already been cached in an existing cache file (see cache_fp and cache_exists).
This argument is used to control the way in which meta-data is partitioned into meta data-bins. Specifically, any JP2 box whose total size exceeds the supplied phld_threshold is automatically replaced by a placeholder ( phld) box in the streaming representation. The placeholder box references another data-bin which holds the contents of the box. By selecting a small threshold, the meta-data may be split across numerous meta data-bins each of which will be delivered to the client only if it is relevant to the client's request. Note, however, that this argument has no effect if the cache_exists argument is true, since then the partitioning of meta-data to data-bins has already taken place and the results have been stored in the cache_fp file. It is important that the server use whatever partition was previously created so that the client will encounter a consistent representation each time it receives information from the file.
This argument is used to control the size of the cache internally managed by each kdu_codestream object created by this function. Each time a kdu_serve object invokes attach_to_codestream, the code-stream's maximum cache size is augmented by this amount (see kdu_codestream::augment_cache_threshold). Each time the detach_from_codestream function is invoked, the cache threshold is reduced by this amount.
If NULL, there will be no caching of the meta-data or stream identification structure created by this object, so no unique target identifier will be issued to the client. Otherwise, this argument points to a file which is open either for reading or for writing. If cache_exists is true, the file is open for reading and the meta-data and stream identification structure should be recovered by parsing the file's contents. Otherwise, the file is open for writing; after generating the meta-data and stream identification structure, the object should save this structure to the supplied file for later re-use. This ensures that the file will be presented in exactly the same way every time. Cache files are associated by the "kdu_server" application with a unique target identifier. Note that the present function will not close an open cache file.
True if a non-NULL cache_fp argument refers to a file which is open for reading.