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 AVCodecID id;
00028 const char *str;
00029 } IdStrMap;
00030
00031 static const IdStrMap img_tags[] = {
00032 { AV_CODEC_ID_MJPEG , "jpeg"},
00033 { AV_CODEC_ID_MJPEG , "jpg"},
00034 { AV_CODEC_ID_MJPEG , "jps"},
00035 { AV_CODEC_ID_LJPEG , "ljpg"},
00036 { AV_CODEC_ID_JPEGLS , "jls"},
00037 { AV_CODEC_ID_PNG , "png"},
00038 { AV_CODEC_ID_PNG , "pns"},
00039 { AV_CODEC_ID_PNG , "mng"},
00040 { AV_CODEC_ID_PPM , "ppm"},
00041 { AV_CODEC_ID_PPM , "pnm"},
00042 { AV_CODEC_ID_PGM , "pgm"},
00043 { AV_CODEC_ID_PGMYUV , "pgmyuv"},
00044 { AV_CODEC_ID_PBM , "pbm"},
00045 { AV_CODEC_ID_PAM , "pam"},
00046 { AV_CODEC_ID_MPEG1VIDEO, "mpg1-img"},
00047 { AV_CODEC_ID_MPEG2VIDEO, "mpg2-img"},
00048 { AV_CODEC_ID_MPEG4 , "mpg4-img"},
00049 { AV_CODEC_ID_FFV1 , "ffv1-img"},
00050 { AV_CODEC_ID_RAWVIDEO , "y"},
00051 { AV_CODEC_ID_RAWVIDEO , "raw"},
00052 { AV_CODEC_ID_BMP , "bmp"},
00053 { AV_CODEC_ID_GIF , "gif"},
00054 { AV_CODEC_ID_TARGA , "tga"},
00055 { AV_CODEC_ID_TIFF , "tiff"},
00056 { AV_CODEC_ID_TIFF , "tif"},
00057 { AV_CODEC_ID_SGI , "sgi"},
00058 { AV_CODEC_ID_PTX , "ptx"},
00059 { AV_CODEC_ID_PCX , "pcx"},
00060 { AV_CODEC_ID_SUNRAST , "sun"},
00061 { AV_CODEC_ID_SUNRAST , "ras"},
00062 { AV_CODEC_ID_SUNRAST , "rs"},
00063 { AV_CODEC_ID_SUNRAST , "im1"},
00064 { AV_CODEC_ID_SUNRAST , "im8"},
00065 { AV_CODEC_ID_SUNRAST , "im24"},
00066 { AV_CODEC_ID_SUNRAST , "im32"},
00067 { AV_CODEC_ID_SUNRAST , "sunras"},
00068 { AV_CODEC_ID_JPEG2000 , "j2c"},
00069 { AV_CODEC_ID_JPEG2000 , "j2k"},
00070 { AV_CODEC_ID_JPEG2000 , "jp2"},
00071 { AV_CODEC_ID_JPEG2000 , "jpc"},
00072 { AV_CODEC_ID_DPX , "dpx"},
00073 { AV_CODEC_ID_EXR , "exr"},
00074 { AV_CODEC_ID_PICTOR , "pic"},
00075 { AV_CODEC_ID_V210X , "yuv10"},
00076 { AV_CODEC_ID_XBM , "xbm"},
00077 { AV_CODEC_ID_XWD , "xwd"},
00078 { AV_CODEC_ID_NONE , NULL}
00079 };
00080
00081 static enum AVCodecID av_str2id(const IdStrMap *tags, const char *str)
00082 {
00083 str= strrchr(str, '.');
00084 if(!str) return AV_CODEC_ID_NONE;
00085 str++;
00086
00087 while (tags->id) {
00088 if (!av_strcasecmp(str, tags->str))
00089 return tags->id;
00090
00091 tags++;
00092 }
00093 return AV_CODEC_ID_NONE;
00094 }
00095
00096 enum AVCodecID ff_guess_image2_codec(const char *filename)
00097 {
00098 return av_str2id(img_tags, filename);
00099 }