FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavformat
img2.c
Go to the documentation of this file.
1
/*
2
* Image format
3
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4
* Copyright (c) 2004 Michael Niedermayer
5
*
6
* This file is part of FFmpeg.
7
*
8
* FFmpeg is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
12
*
13
* FFmpeg is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with FFmpeg; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*/
22
23
#include "
libavutil/avstring.h
"
24
#include "
internal.h
"
25
#include "
img2.h
"
26
27
const
IdStrMap
ff_img_tags
[] = {
28
{
AV_CODEC_ID_MJPEG
,
"jpeg"
},
29
{
AV_CODEC_ID_MJPEG
,
"jpg"
},
30
{
AV_CODEC_ID_MJPEG
,
"jps"
},
31
{
AV_CODEC_ID_MJPEG
,
"mpo"
},
32
{
AV_CODEC_ID_LJPEG
,
"ljpg"
},
33
{
AV_CODEC_ID_JPEGLS
,
"jls"
},
34
{
AV_CODEC_ID_PNG
,
"png"
},
35
{
AV_CODEC_ID_PNG
,
"pns"
},
36
{
AV_CODEC_ID_PNG
,
"mng"
},
37
{
AV_CODEC_ID_PPM
,
"ppm"
},
38
{
AV_CODEC_ID_PPM
,
"pnm"
},
39
{
AV_CODEC_ID_PGM
,
"pgm"
},
40
{
AV_CODEC_ID_PGMYUV
,
"pgmyuv"
},
41
{
AV_CODEC_ID_PBM
,
"pbm"
},
42
{
AV_CODEC_ID_PAM
,
"pam"
},
43
{
AV_CODEC_ID_ALIAS_PIX
,
"pix"
},
44
{
AV_CODEC_ID_DDS
,
"dds"
},
45
{
AV_CODEC_ID_MPEG1VIDEO
,
"mpg1-img"
},
46
{
AV_CODEC_ID_MPEG2VIDEO
,
"mpg2-img"
},
47
{
AV_CODEC_ID_MPEG4
,
"mpg4-img"
},
48
{
AV_CODEC_ID_RAWVIDEO
,
"y"
},
49
{
AV_CODEC_ID_RAWVIDEO
,
"raw"
},
50
{
AV_CODEC_ID_BMP
,
"bmp"
},
51
{
AV_CODEC_ID_TARGA
,
"tga"
},
52
{
AV_CODEC_ID_TIFF
,
"tiff"
},
53
{
AV_CODEC_ID_TIFF
,
"tif"
},
54
{
AV_CODEC_ID_SGI
,
"sgi"
},
55
{
AV_CODEC_ID_PTX
,
"ptx"
},
56
{
AV_CODEC_ID_PCX
,
"pcx"
},
57
{
AV_CODEC_ID_QDRAW
,
"pic"
},
58
{
AV_CODEC_ID_QDRAW
,
"pct"
},
59
{
AV_CODEC_ID_QDRAW
,
"pict"
},
60
{
AV_CODEC_ID_SUNRAST
,
"sun"
},
61
{
AV_CODEC_ID_SUNRAST
,
"ras"
},
62
{
AV_CODEC_ID_SUNRAST
,
"rs"
},
63
{
AV_CODEC_ID_SUNRAST
,
"im1"
},
64
{
AV_CODEC_ID_SUNRAST
,
"im8"
},
65
{
AV_CODEC_ID_SUNRAST
,
"im24"
},
66
{
AV_CODEC_ID_SUNRAST
,
"im32"
},
67
{
AV_CODEC_ID_SUNRAST
,
"sunras"
},
68
{
AV_CODEC_ID_JPEG2000
,
"j2c"
},
69
{
AV_CODEC_ID_JPEG2000
,
"jp2"
},
70
{
AV_CODEC_ID_JPEG2000
,
"jpc"
},
71
{
AV_CODEC_ID_JPEG2000
,
"j2k"
},
72
{
AV_CODEC_ID_DPX
,
"dpx"
},
73
{
AV_CODEC_ID_EXR
,
"exr"
},
74
{
AV_CODEC_ID_PICTOR
,
"pic"
},
75
{
AV_CODEC_ID_V210X
,
"yuv10"
},
76
{
AV_CODEC_ID_WEBP
,
"webp"
},
77
{
AV_CODEC_ID_XBM
,
"xbm"
},
78
{
AV_CODEC_ID_XFACE
,
"xface"
},
79
{
AV_CODEC_ID_XWD
,
"xwd"
},
80
{
AV_CODEC_ID_NONE
,
NULL
}
81
};
82
83
static
enum
AVCodecID
str2id
(
const
IdStrMap
*tags,
const
char
*str)
84
{
85
str = strrchr(str,
'.'
);
86
if
(!str)
87
return
AV_CODEC_ID_NONE
;
88
str++;
89
90
while
(tags->
id
) {
91
if
(!
av_strcasecmp
(str, tags->
str
))
92
return
tags->
id
;
93
94
tags++;
95
}
96
return
AV_CODEC_ID_NONE
;
97
}
98
99
enum
AVCodecID
ff_guess_image2_codec
(
const
char
*filename)
100
{
101
return
str2id
(ff_img_tags, filename);
102
}
AV_CODEC_ID_DDS
Definition:
avcodec.h:387
NULL
#define NULL
Definition:
coverity.c:32
AV_CODEC_ID_NONE
Definition:
avcodec.h:192
AV_CODEC_ID_ALIAS_PIX
Definition:
avcodec.h:374
IdStrMap
Definition:
img2.h:66
IdStrMap::id
enum AVCodecID id
Definition:
img2.h:67
AV_CODEC_ID_PNG
Definition:
avcodec.h:258
AV_CODEC_ID_PBM
Definition:
avcodec.h:260
AV_CODEC_ID_LJPEG
Definition:
avcodec.h:206
AV_CODEC_ID_MPEG4
Definition:
avcodec.h:209
avstring.h
AV_CODEC_ID_EXR
Definition:
avcodec.h:377
AV_CODEC_ID_PAM
Definition:
avcodec.h:263
AV_CODEC_ID_MJPEG
Definition:
avcodec.h:204
img2.h
AV_CODEC_ID_PCX
Definition:
avcodec.h:306
AV_CODEC_ID_MPEG1VIDEO
Definition:
avcodec.h:195
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition:
avcodec.h:191
AV_CODEC_ID_WEBP
Definition:
avcodec.h:369
AV_CODEC_ID_BMP
Definition:
avcodec.h:275
internal.h
AV_CODEC_ID_XBM
Definition:
avcodec.h:357
AV_CODEC_ID_V210X
Definition:
avcodec.h:322
IdStrMap::str
const char * str
Definition:
img2.h:68
av_strcasecmp
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition:
avstring.c:213
AV_CODEC_ID_XFACE
Definition:
avcodec.h:403
AV_CODEC_ID_SUNRAST
Definition:
avcodec.h:307
AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition:
avcodec.h:196
AV_CODEC_ID_XWD
Definition:
avcodec.h:355
AV_CODEC_ID_PICTOR
Definition:
avcodec.h:338
AV_CODEC_ID_PGMYUV
Definition:
avcodec.h:262
AV_CODEC_ID_TARGA
Definition:
avcodec.h:290
str2id
static enum AVCodecID str2id(const IdStrMap *tags, const char *str)
Definition:
img2.c:83
ff_img_tags
const IdStrMap ff_img_tags[]
Definition:
img2.c:27
AV_CODEC_ID_DPX
Definition:
avcodec.h:325
AV_CODEC_ID_PGM
Definition:
avcodec.h:261
AV_CODEC_ID_JPEG2000
Definition:
avcodec.h:285
AV_CODEC_ID_TIFF
Definition:
avcodec.h:293
AV_CODEC_ID_QDRAW
Definition:
avcodec.h:255
AV_CODEC_ID_PTX
Definition:
avcodec.h:301
ff_guess_image2_codec
enum AVCodecID ff_guess_image2_codec(const char *filename)
Definition:
img2.c:99
AV_CODEC_ID_PPM
Definition:
avcodec.h:259
AV_CODEC_ID_JPEGLS
Definition:
avcodec.h:208
AV_CODEC_ID_RAWVIDEO
Definition:
avcodec.h:210
AV_CODEC_ID_SGI
Definition:
avcodec.h:298
Generated on Thu Oct 27 2016 19:33:39 for FFmpeg by
1.8.6