History

avcodec/exif: Move tag_list out of header

It is only used by exif.c (and e.g. EXIF_TAG_NAME_LENGTH is an implementation detail anyway). Also remove the sentinel, as it is used in conjunction with FF_ARRAY_ELEMS.

Andreas Rheinhardt committed 4 years ago

Commit 2c882f41 parent ca2c60b2 files · +127 −130Browse files

Unified · Split

2 files
  1. libavcodec/exif.c +127 −0
  2. libavcodec/exif.h +0 −130
libavcodec/exif.c+127−0
@@ -28,6 +28,133 @@ · 27 unmodified lines
28#include "exif.h"28#include "exif.h"
29#include "tiff_common.h"29#include "tiff_common.h"
30 30
31#define EXIF_TAG_NAME_LENGTH 32
32
33struct exif_tag {
34 char name[EXIF_TAG_NAME_LENGTH];
35 uint16_t id;
36};
37
38static const struct exif_tag tag_list[] = { // JEITA CP-3451 EXIF specification:
39 {"GPSVersionID", 0x00}, // <- Table 12 GPS Attribute Information
40 {"GPSLatitudeRef", 0x01},
41 {"GPSLatitude", 0x02},
42 {"GPSLongitudeRef", 0x03},
43 {"GPSLongitude", 0x04},
44 {"GPSAltitudeRef", 0x05},
45 {"GPSAltitude", 0x06},
46 {"GPSTimeStamp", 0x07},
47 {"GPSSatellites", 0x08},
48 {"GPSStatus", 0x09},
49 {"GPSMeasureMode", 0x0A},
50 {"GPSDOP", 0x0B},
51 {"GPSSpeedRef", 0x0C},
52 {"GPSSpeed", 0x0D},
53 {"GPSTrackRef", 0x0E},
54 {"GPSTrack", 0x0F},
55 {"GPSImgDirectionRef", 0x10},
56 {"GPSImgDirection", 0x11},
57 {"GPSMapDatum", 0x12},
58 {"GPSDestLatitudeRef", 0x13},
59 {"GPSDestLatitude", 0x14},
60 {"GPSDestLongitudeRef", 0x15},
61 {"GPSDestLongitude", 0x16},
62 {"GPSDestBearingRef", 0x17},
63 {"GPSDestBearing", 0x18},
64 {"GPSDestDistanceRef", 0x19},
65 {"GPSDestDistance", 0x1A},
66 {"GPSProcessingMethod", 0x1B},
67 {"GPSAreaInformation", 0x1C},
68 {"GPSDateStamp", 0x1D},
69 {"GPSDifferential", 0x1E},
70 {"ImageWidth", 0x100}, // <- Table 3 TIFF Rev. 6.0 Attribute Information Used in Exif
71 {"ImageLength", 0x101},
72 {"BitsPerSample", 0x102},
73 {"Compression", 0x103},
74 {"PhotometricInterpretation", 0x106},
75 {"Orientation", 0x112},
76 {"SamplesPerPixel", 0x115},
77 {"PlanarConfiguration", 0x11C},
78 {"YCbCrSubSampling", 0x212},
79 {"YCbCrPositioning", 0x213},
80 {"XResolution", 0x11A},
81 {"YResolution", 0x11B},
82 {"ResolutionUnit", 0x128},
83 {"StripOffsets", 0x111},
84 {"RowsPerStrip", 0x116},
85 {"StripByteCounts", 0x117},
86 {"JPEGInterchangeFormat", 0x201},
87 {"JPEGInterchangeFormatLength",0x202},
88 {"TransferFunction", 0x12D},
89 {"WhitePoint", 0x13E},
90 {"PrimaryChromaticities", 0x13F},
91 {"YCbCrCoefficients", 0x211},
92 {"ReferenceBlackWhite", 0x214},
93 {"DateTime", 0x132},
94 {"ImageDescription", 0x10E},
95 {"Make", 0x10F},
96 {"Model", 0x110},
97 {"Software", 0x131},
98 {"Artist", 0x13B},
99 {"Copyright", 0x8298},
100 {"ExifVersion", 0x9000}, // <- Table 4 Exif IFD Attribute Information (1)
101 {"FlashpixVersion", 0xA000},
102 {"ColorSpace", 0xA001},
103 {"ComponentsConfiguration", 0x9101},
104 {"CompressedBitsPerPixel", 0x9102},
105 {"PixelXDimension", 0xA002},
106 {"PixelYDimension", 0xA003},
107 {"MakerNote", 0x927C},
108 {"UserComment", 0x9286},
109 {"RelatedSoundFile", 0xA004},
110 {"DateTimeOriginal", 0x9003},
111 {"DateTimeDigitized", 0x9004},
112 {"SubSecTime", 0x9290},
113 {"SubSecTimeOriginal", 0x9291},
114 {"SubSecTimeDigitized", 0x9292},
115 {"ImageUniqueID", 0xA420},
116 {"ExposureTime", 0x829A}, // <- Table 5 Exif IFD Attribute Information (2)
117 {"FNumber", 0x829D},
118 {"ExposureProgram", 0x8822},
119 {"SpectralSensitivity", 0x8824},
120 {"ISOSpeedRatings", 0x8827},
121 {"OECF", 0x8828},
122 {"ShutterSpeedValue", 0x9201},
123 {"ApertureValue", 0x9202},
124 {"BrightnessValue", 0x9203},
125 {"ExposureBiasValue", 0x9204},
126 {"MaxApertureValue", 0x9205},
127 {"SubjectDistance", 0x9206},
128 {"MeteringMode", 0x9207},
129 {"LightSource", 0x9208},
130 {"Flash", 0x9209},
131 {"FocalLength", 0x920A},
132 {"SubjectArea", 0x9214},
133 {"FlashEnergy", 0xA20B},
134 {"SpatialFrequencyResponse", 0xA20C},
135 {"FocalPlaneXResolution", 0xA20E},
136 {"FocalPlaneYResolution", 0xA20F},
137 {"FocalPlaneResolutionUnit", 0xA210},
138 {"SubjectLocation", 0xA214},
139 {"ExposureIndex", 0xA215},
140 {"SensingMethod", 0xA217},
141 {"FileSource", 0xA300},
142 {"SceneType", 0xA301},
143 {"CFAPattern", 0xA302},
144 {"CustomRendered", 0xA401},
145 {"ExposureMode", 0xA402},
146 {"WhiteBalance", 0xA403},
147 {"DigitalZoomRatio", 0xA404},
148 {"FocalLengthIn35mmFilm", 0xA405},
149 {"SceneCaptureType", 0xA406},
150 {"GainControl", 0xA407},
151 {"Contrast", 0xA408},
152 {"Saturation", 0xA409},
153 {"Sharpness", 0xA40A},
154 {"DeviceSettingDescription", 0xA40B},
155 {"SubjectDistanceRange", 0xA40C}
156// {"InteroperabilityIndex", 0x1}, // <- Table 13 Interoperability IFD Attribute Information
157};
31 158
32static const char *exif_get_tag_name(uint16_t id)159static const char *exif_get_tag_name(uint16_t id)
33{160{
libavcodec/exif.h+0−130
@@ -32,136 +32,6 @@ · 31 unmodified lines
32#include "libavutil/dict.h"32#include "libavutil/dict.h"
33#include "bytestream.h"33#include "bytestream.h"
34 34
35#define EXIF_MAX_IFD_RECURSION 2
36#define EXIF_TAG_NAME_LENGTH 32
37
38struct exif_tag {
39 char name[EXIF_TAG_NAME_LENGTH];
40 uint16_t id;
41};
42
43static const struct exif_tag tag_list[] = { // JEITA CP-3451 EXIF specification:
44 {"GPSVersionID", 0x00}, // <- Table 12 GPS Attribute Information
45 {"GPSLatitudeRef", 0x01},
46 {"GPSLatitude", 0x02},
47 {"GPSLongitudeRef", 0x03},
48 {"GPSLongitude", 0x04},
49 {"GPSAltitudeRef", 0x05},
50 {"GPSAltitude", 0x06},
51 {"GPSTimeStamp", 0x07},
52 {"GPSSatellites", 0x08},
53 {"GPSStatus", 0x09},
54 {"GPSMeasureMode", 0x0A},
55 {"GPSDOP", 0x0B},
56 {"GPSSpeedRef", 0x0C},
57 {"GPSSpeed", 0x0D},
58 {"GPSTrackRef", 0x0E},
59 {"GPSTrack", 0x0F},
60 {"GPSImgDirectionRef", 0x10},
61 {"GPSImgDirection", 0x11},
62 {"GPSMapDatum", 0x12},
63 {"GPSDestLatitudeRef", 0x13},
64 {"GPSDestLatitude", 0x14},
65 {"GPSDestLongitudeRef", 0x15},
66 {"GPSDestLongitude", 0x16},
67 {"GPSDestBearingRef", 0x17},
68 {"GPSDestBearing", 0x18},
69 {"GPSDestDistanceRef", 0x19},
70 {"GPSDestDistance", 0x1A},
71 {"GPSProcessingMethod", 0x1B},
72 {"GPSAreaInformation", 0x1C},
73 {"GPSDateStamp", 0x1D},
74 {"GPSDifferential", 0x1E},
75 {"ImageWidth", 0x100}, // <- Table 3 TIFF Rev. 6.0 Attribute Information Used in Exif
76 {"ImageLength", 0x101},
77 {"BitsPerSample", 0x102},
78 {"Compression", 0x103},
79 {"PhotometricInterpretation", 0x106},
80 {"Orientation", 0x112},
81 {"SamplesPerPixel", 0x115},
82 {"PlanarConfiguration", 0x11C},
83 {"YCbCrSubSampling", 0x212},
84 {"YCbCrPositioning", 0x213},
85 {"XResolution", 0x11A},
86 {"YResolution", 0x11B},
87 {"ResolutionUnit", 0x128},
88 {"StripOffsets", 0x111},
89 {"RowsPerStrip", 0x116},
90 {"StripByteCounts", 0x117},
91 {"JPEGInterchangeFormat", 0x201},
92 {"JPEGInterchangeFormatLength",0x202},
93 {"TransferFunction", 0x12D},
94 {"WhitePoint", 0x13E},
95 {"PrimaryChromaticities", 0x13F},
96 {"YCbCrCoefficients", 0x211},
97 {"ReferenceBlackWhite", 0x214},
98 {"DateTime", 0x132},
99 {"ImageDescription", 0x10E},
100 {"Make", 0x10F},
101 {"Model", 0x110},
102 {"Software", 0x131},
103 {"Artist", 0x13B},
104 {"Copyright", 0x8298},
105 {"ExifVersion", 0x9000}, // <- Table 4 Exif IFD Attribute Information (1)
106 {"FlashpixVersion", 0xA000},
107 {"ColorSpace", 0xA001},
108 {"ComponentsConfiguration", 0x9101},
109 {"CompressedBitsPerPixel", 0x9102},
110 {"PixelXDimension", 0xA002},
111 {"PixelYDimension", 0xA003},
112 {"MakerNote", 0x927C},
113 {"UserComment", 0x9286},
114 {"RelatedSoundFile", 0xA004},
115 {"DateTimeOriginal", 0x9003},
116 {"DateTimeDigitized", 0x9004},
117 {"SubSecTime", 0x9290},
118 {"SubSecTimeOriginal", 0x9291},
119 {"SubSecTimeDigitized", 0x9292},
120 {"ImageUniqueID", 0xA420},
121 {"ExposureTime", 0x829A}, // <- Table 5 Exif IFD Attribute Information (2)
122 {"FNumber", 0x829D},
123 {"ExposureProgram", 0x8822},
124 {"SpectralSensitivity", 0x8824},
125 {"ISOSpeedRatings", 0x8827},
126 {"OECF", 0x8828},
127 {"ShutterSpeedValue", 0x9201},
128 {"ApertureValue", 0x9202},
129 {"BrightnessValue", 0x9203},
130 {"ExposureBiasValue", 0x9204},
131 {"MaxApertureValue", 0x9205},
132 {"SubjectDistance", 0x9206},
133 {"MeteringMode", 0x9207},
134 {"LightSource", 0x9208},
135 {"Flash", 0x9209},
136 {"FocalLength", 0x920A},
137 {"SubjectArea", 0x9214},
138 {"FlashEnergy", 0xA20B},
139 {"SpatialFrequencyResponse", 0xA20C},
140 {"FocalPlaneXResolution", 0xA20E},
141 {"FocalPlaneYResolution", 0xA20F},
142 {"FocalPlaneResolutionUnit", 0xA210},
143 {"SubjectLocation", 0xA214},
144 {"ExposureIndex", 0xA215},
145 {"SensingMethod", 0xA217},
146 {"FileSource", 0xA300},
147 {"SceneType", 0xA301},
148 {"CFAPattern", 0xA302},
149 {"CustomRendered", 0xA401},
150 {"ExposureMode", 0xA402},
151 {"WhiteBalance", 0xA403},
152 {"DigitalZoomRatio", 0xA404},
153 {"FocalLengthIn35mmFilm", 0xA405},
154 {"SceneCaptureType", 0xA406},
155 {"GainControl", 0xA407},
156 {"Contrast", 0xA408},
157 {"Saturation", 0xA409},
158 {"Sharpness", 0xA40A},
159 {"DeviceSettingDescription", 0xA40B},
160 {"SubjectDistanceRange", 0xA40C}
161// {"InteroperabilityIndex", 0x1}, // <- Table 13 Interoperability IFD Attribute Information
162// {"", 0x0}
163};
164
165/** Recursively decodes all IFD's and35/** Recursively decodes all IFD's and
166 * adds included TAGS into the metadata dictionary. */36 * adds included TAGS into the metadata dictionary. */
167int avpriv_exif_decode_ifd(void *logctx, const uint8_t *buf, int size,37int avpriv_exif_decode_ifd(void *logctx, const uint8_t *buf, int size,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t