img_decode_validate()

Find a codec for decoding

Synopsis:

#include <img.h>

int img_decode_validate(
        const img_codec_t*  codecs,
        size_t              ncodecs,
        io_stream_t*        input,
        unsigned*           codec );

Arguments:

codecs
A pointer to an array of img_codec_t handles providing a list of codecs to try. The function will try each codec in order until it finds one that validates the data in the stream.
ncodecs
The number of items in the codecs array.
input
The input source.
codec
The address of an unsigned value where the function stores the index of the codec that validated the datastream. This memory is left untouched if no such codec is found.

Library:

img

Description:

This function finds a suitable codec for decoding.

Returns:

Status of the operation:

IMG_ERR_OK
Success; an appropriate codec was found. Check codec for the index of the codec in the codecs array which validated the datastream.
IMG_ERR_DLL
An error occurred processing the DLL that handles the file type. Check to make sure that the DLL is not missing or corrupt.
IMG_ERR_FORMAT
No installed codec recognized the input data as a format it supports. This could mean the data is of a format that's not supported, or the datastream is corrupt.
IMG_ERR_NOTIMPL
The codec that recognized the input data as the format it supports doesn't have a validate method.

Classification:

Image library

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

img_decode_callouts_t, img_t, io_open()