Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_codec_get_criteria.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_codec_get_criteria.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_codec_get_criteria.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_codec_get_criteria.html on line 8

img_codec_get_criteria()

Gets 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:

img

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

See also:

img_codec_list_byext(), img_codec_listby_mime(), img_codec_list()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_codec_get_criteria.html on line 164

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_codec_get_criteria.html on line 164