00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "libavutil/avstring.h"
00024 #include "internal.h"
00025
00026 typedef struct {
00027 enum CodecID id;
00028 const char *str;
00029 } IdStrMap;
00030
00031 static const IdStrMap img_tags[] = {
00032 { CODEC_ID_MJPEG , "jpeg"},
00033 { CODEC_ID_MJPEG , "jpg"},
00034 { CODEC_ID_MJPEG , "jps"},
00035 { CODEC_ID_LJPEG , "ljpg"},
00036 { CODEC_ID_JPEGLS , "jls"},
00037 { CODEC_ID_PNG , "png"},
00038 { CODEC_ID_PNG , "pns"},
00039 { CODEC_ID_PNG , "mng"},
00040 { CODEC_ID_PPM , "ppm"},
00041 { CODEC_ID_PPM , "pnm"},
00042 { CODEC_ID_PGM , "pgm"},
00043 { CODEC_ID_PGMYUV , "pgmyuv"},
00044 { CODEC_ID_PBM , "pbm"},
00045 { CODEC_ID_PAM , "pam"},
00046 { CODEC_ID_MPEG1VIDEO, "mpg1-img"},
00047 { CODEC_ID_MPEG2VIDEO, "mpg2-img"},
00048 { CODEC_ID_MPEG4 , "mpg4-img"},
00049 { CODEC_ID_FFV1 , "ffv1-img"},
00050 { CODEC_ID_RAWVIDEO , "y"},
00051 { CODEC_ID_RAWVIDEO , "raw"},
00052 { CODEC_ID_BMP , "bmp"},
00053 { CODEC_ID_GIF , "gif"},
00054 { CODEC_ID_TARGA , "tga"},
00055 { CODEC_ID_TIFF , "tiff"},
00056 { CODEC_ID_TIFF , "tif"},
00057 { CODEC_ID_SGI , "sgi"},
00058 { CODEC_ID_PTX , "ptx"},
00059 { CODEC_ID_PCX , "pcx"},
00060 { CODEC_ID_SUNRAST , "sun"},
00061 { CODEC_ID_SUNRAST , "ras"},
00062 { CODEC_ID_SUNRAST , "rs"},
00063 { CODEC_ID_SUNRAST , "im1"},
00064 { CODEC_ID_SUNRAST , "im8"},
00065 { CODEC_ID_SUNRAST , "im24"},
00066 { CODEC_ID_SUNRAST , "im32"},
00067 { CODEC_ID_SUNRAST , "sunras"},
00068 { CODEC_ID_JPEG2000 , "j2c"},
00069 { CODEC_ID_JPEG2000 , "j2k"},
00070 { CODEC_ID_JPEG2000 , "jp2"},
00071 { CODEC_ID_JPEG2000 , "jpc"},
00072 { CODEC_ID_DPX , "dpx"},
00073 { CODEC_ID_EXR , "exr"},
00074 { CODEC_ID_PICTOR , "pic"},
00075 { CODEC_ID_XBM , "xbm"},
00076 { CODEC_ID_XWD , "xwd"},
00077 { CODEC_ID_NONE , NULL}
00078 };
00079
00080 static enum CodecID av_str2id(const IdStrMap *tags, const char *str)
00081 {
00082 str= strrchr(str, '.');
00083 if(!str) return CODEC_ID_NONE;
00084 str++;
00085
00086 while (tags->id) {
00087 if (!av_strcasecmp(str, tags->str))
00088 return tags->id;
00089
00090 tags++;
00091 }
00092 return CODEC_ID_NONE;
00093 }
00094
00095 enum CodecID ff_guess_image2_codec(const char *filename)
00096 {
00097 return av_str2id(img_tags, filename);
00098 }