img_codec_list_byext()

Enumerate codecs by file extension

Synopsis:

#include <img/img.h>

size_t img_codec_list_byext( img_lib_t      ilib,
                             const char*    string,
                             img_codec_t*   buf,
                             size_t         nbuf);


Arguments:

ilib
The handle for the image library, returned by img_lib_attach() .
string
A string containing the file extension to identify. For example jpg for files named filename .jpg.
buf
The address of an array that the function populates with handles for the available codecs.
nbuf
The number of items in the buf array.

Library:

libimg

Use the -l img option to qcc to link against this library.

Description:

This function enumerates codecs that handle files with the specified extension.

While there are no standards defining what extensions are and how they should be named, there seems to be a de facto standard governing their use. The term extension originates as an intrinsic filename property although most contemporary implementations no longer treat them as separate components of the filename. Thus the term has evolved to loosely describe the portion of characters in a filename that follow the last occurrence of the . character. This principle can be seen in use throughout the world wide web, and through many OSs that use extensions as a content-recognition mechanism. Although extensions do not in themselves impose any guarantee on the nature of data a file contains, they are generally appropriately assigned from a well-known set, and as such, they represent reasonable criteria in deciding which codec should handle the data, at least in an initial pass.

The function copies up to nbuf handles into the array specified by buf. No copying is done if nbuf is 0. This function returns the total number of matching codecs, which may be larger than nbuf if your buffer was not big enough to store all the matched codecs.

Returns:

The total number of matching codecs.

Classification:

Image library

Safety:
Interrupt handler No
Signal handler No
Thread No