Skip to main content

JxlDecoderProcessInput

Function JxlDecoderProcessInput 

Source
pub unsafe extern "C" fn JxlDecoderProcessInput(
    dec: *mut JxlDecoder,
) -> JxlDecoderStatus
Expand description

Decodes JPEG XL file using the available bytes. Requires input has been set with @ref JxlDecoderSetInput. After @ref JxlDecoderProcessInput, input can optionally be released with @ref JxlDecoderReleaseInput and then set again to next bytes in the stream. @ref JxlDecoderReleaseInput returns how many bytes are not yet processed, before a next call to @ref JxlDecoderProcessInput all unprocessed bytes must be provided again (the address need not match, but the contents must), and more bytes may be concatenated after the unprocessed bytes.

The returned status indicates whether the decoder needs more input bytes, or more output buffer for a certain type of output data. No matter what the returned status is (other than ::JXL_DEC_ERROR), new information, such as @ref JxlDecoderGetBasicInfo, may have become available after this call. When the return value is not ::JXL_DEC_ERROR or ::JXL_DEC_SUCCESS, the decoding requires more @ref JxlDecoderProcessInput calls to continue.

@param dec decoder object @return ::JXL_DEC_SUCCESS when decoding finished and all events handled. If you still have more unprocessed input data anyway, then you can still continue by using @ref JxlDecoderSetInput and calling @ref JxlDecoderProcessInput again, similar to handling @ref JXL_DEC_NEED_MORE_INPUT. ::JXL_DEC_SUCCESS can occur instead of @ref JXL_DEC_NEED_MORE_INPUT when, for example, the input data ended right at the boundary of a box of the container format, all essential codestream boxes were already decoded, but extra metadata boxes are still present in the next data. @ref JxlDecoderProcessInput cannot return success if all codestream boxes have not been seen yet. @return ::JXL_DEC_ERROR when decoding failed, e.g. invalid codestream. TODO(lode): document the input data mechanism @return ::JXL_DEC_NEED_MORE_INPUT when more input data is necessary. @return ::JXL_DEC_BASIC_INFO when basic info such as image dimensions is available and this informative event is subscribed to. @return ::JXL_DEC_COLOR_ENCODING when color profile information is available and this informative event is subscribed to. @return ::JXL_DEC_PREVIEW_IMAGE when preview pixel information is available and output in the preview buffer. @return ::JXL_DEC_FULL_IMAGE when all pixel information at highest detail is available and has been output in the pixel buffer.