| synopsis || return value || arguments || prev || next |
int push_extra_data( kdu_byte * data, int num_bytes, kds_chunk * chunk_list=NULL)
[Declared in "../apps/kdu_server/kdu_serve.h"]
This function may be used by server applications to insert additional data into the list of chunks which are served by the object's generate_increments function.
The object maintains an internal queue of outstanding data which must be delivered prior to any further compressed data. When generate_increments is called, it first pulls data from the head of this outstanding data queue; only once it is empty, can compressed data increments be generated and included in the list of data chunks which it returns. Calling the present function augments this internal outstanding data queue.
If the chunk_list argument is non-NULL, the function behaves slightly differently, appending the data to the existing list of kds_chunk buffers, all of which were previously returned by one or more calls to generate_increments, and augmenting this list as necessary. In this case, the data is not added to the internal queue of outstanding data.
The extra data supplied to this function is always written as a single contiguous block, which must be contained in a single data chunk. If the data cannot be appended to an existing chunk without overflowing, a new chunk is created. If the data is too long to fit in a single chunk at all, the function generates an error through kdu_error. Of course, this is undesirable, so you should make sure the amount of data you supply does not exceed the maximum chunk length, minus the chunk prefix size, as supplied to the present object's constructor.
The number of bytes which are left in the last chunk written by this function. If num_bytes is 0, the function does nothing except return the number of bytes which are left in the last element of the internal extra data chunk list, or the chunk_list, if non-NULL. The return value could be 0, if the last chunk in the list is full.
Points to a memory block containing the extra data. This may be null only if num_bytes is 0.
Number of bytes of extra data in the data buffer. May be zero, if you are only interested in the return value.
List of kds_chunk objects returned by one or more previous calls to generate_increments, which have not been returned to the object using release_chunks. This list may be NULL, if you want the extra data to be appended to the object's internal extra data queue, for inclusion in the chunk lists returned by subsequent calls to generate_increments.
| top || synopsis || return value || arguments || prev || next |