img_codec_get_criteria()

Get the extension and mime information for a given codec

Synopsis:

#include <img/img.h>

void img_codec_get_criteria( img_codec_t codec, 
                             const char **ext, 
                             const char **mime );


Arguments:

codec
The codec for which to return the criteria.
ext
A pointer to the codec's extension type.
mime
A pointer to the codec's mime type.

Library:

libimg

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

Description:

This function gets the extension type and mime type for a given codec.

Examples:

#include <stdio.h>
#include <stdlib.h>
#include <img/img.h>

int main (int argc, char *argv[])
{
  img_lib_t  ilib = NULL;

  if(img_lib_attach(&ilib) == IMG_ERR_OK) 
  {
    int count = img_codec_list(ilib, NULL, NULL, NULL, 0);
    if( count > 0) 
    {
       img_codec_t     *codecs;
       if((codecs = (img_codec_t *)calloc(count, sizeof(img_codec_t))) != NULL) 
       {
         if((count = img_codec_list(ilib, codecs, count, NULL, 0)) > 0) 
         {
            int i;

            for( i = 0; i < count; i++) 
            {
               char const * mime;
               char const * ext;

               img_codec_get_criteria(codecs[i], &ext, &mime);
               printf("codecs[%d]: ext = %s: mime = %s\n", i, ext, mime);
            }
          }
          free(codecs);
        }
      }
    }

    return (0);
}

Running this example produces the following output:

codecs[0]: ext = pcx: mime = application/pcx
codecs[1]: ext = tga: mime = application/tga
codecs[2]: ext = sgi: mime = image/sgi
codecs[3]: ext = png: mime = image/png
codecs[4]: ext = jpg: mime = image/jpeg
codecs[5]: ext = gif: mime = image/gif
codecs[6]: ext = bmp: mime = image/bmp

Classification:

Image library

Safety:
Interrupt handler No
Signal handler No
Thread No