exif_geo_tag 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/jpeg-data.h ADDED
@@ -0,0 +1,92 @@
1
+ /* jpeg-data.h
2
+ *
3
+ * Copyright � 2001 Lutz M�ller <lutz@users.sourceforge.net>
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the
17
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
+ * Boston, MA 02110-1301 USA.
19
+ */
20
+
21
+ #ifndef __JPEG_DATA_H__
22
+ #define __JPEG_DATA_H__
23
+
24
+ #include "jpeg-marker.h"
25
+
26
+ #include <libexif/exif-data.h>
27
+ #include <libexif/exif-log.h>
28
+
29
+ typedef ExifData * JPEGContentAPP1;
30
+
31
+ typedef struct _JPEGContentGeneric JPEGContentGeneric;
32
+ struct _JPEGContentGeneric
33
+ {
34
+ unsigned char *data;
35
+ unsigned int size;
36
+ };
37
+
38
+ typedef union _JPEGContent JPEGContent;
39
+ union _JPEGContent
40
+ {
41
+ JPEGContentGeneric generic;
42
+ JPEGContentAPP1 app1;
43
+ };
44
+
45
+ typedef struct _JPEGSection JPEGSection;
46
+ struct _JPEGSection
47
+ {
48
+ JPEGMarker marker;
49
+ JPEGContent content;
50
+ };
51
+
52
+ typedef struct _JPEGData JPEGData;
53
+ typedef struct _JPEGDataPrivate JPEGDataPrivate;
54
+
55
+ struct _JPEGData
56
+ {
57
+ JPEGSection *sections;
58
+ unsigned int count;
59
+
60
+ unsigned char *data;
61
+ unsigned int size;
62
+
63
+ JPEGDataPrivate *priv;
64
+ };
65
+
66
+ JPEGData *jpeg_data_new (void);
67
+ JPEGData *jpeg_data_new_from_file (const char *path);
68
+ JPEGData *jpeg_data_new_from_data (const unsigned char *data,
69
+ unsigned int size);
70
+
71
+ void jpeg_data_ref (JPEGData *data);
72
+ void jpeg_data_unref (JPEGData *data);
73
+ void jpeg_data_free (JPEGData *data);
74
+
75
+ void jpeg_data_load_data (JPEGData *data, const unsigned char *d,
76
+ unsigned int size);
77
+ void jpeg_data_save_data (JPEGData *data, unsigned char **d,
78
+ unsigned int *size);
79
+
80
+ void jpeg_data_load_file (JPEGData *data, const char *path);
81
+ int jpeg_data_save_file (JPEGData *data, const char *path);
82
+
83
+ void jpeg_data_set_exif_data (JPEGData *data, ExifData *exif_data);
84
+ ExifData *jpeg_data_get_exif_data (JPEGData *data);
85
+
86
+ void jpeg_data_dump (JPEGData *data);
87
+
88
+ void jpeg_data_append_section (JPEGData *data);
89
+
90
+ void jpeg_data_log (JPEGData *data, ExifLog *log);
91
+
92
+ #endif /* __JPEG_DATA_H__ */
data/ext/jpeg-marker.c ADDED
@@ -0,0 +1,122 @@
1
+ /* jpeg-marker.c
2
+ *
3
+ * Copyright � 2001-2008 Lutz M�ller <lutz@users.sourceforge.net>
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the
17
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
+ * Boston, MA 02110-1301 USA.
19
+ */
20
+ #include "config.h"
21
+ #include "jpeg-marker.h"
22
+
23
+ #include <stdlib.h>
24
+
25
+ static const struct {
26
+ JPEGMarker marker;
27
+ const char *name;
28
+ const char *description;
29
+ } JPEGMarkerTable[] = {
30
+ {JPEG_MARKER_SOF0, "SOF0", "Encoding (baseline)"},
31
+ {JPEG_MARKER_SOF1, "SOF1", "Encoding (extended sequential)"},
32
+ {JPEG_MARKER_SOF2, "SOF2", "Encoding (progressive)"},
33
+ {JPEG_MARKER_SOF3, "SOF3", "Encoding (lossless)"},
34
+ {JPEG_MARKER_SOF5, "SOF5", "Encoding (differential sequential)"},
35
+ {JPEG_MARKER_SOF6, "SOF6", "Encoding (differential progressive)"},
36
+ {JPEG_MARKER_SOF7, "SOF7", "Encoding (differential lossless)"},
37
+ {JPEG_MARKER_SOF9, "SOF9",
38
+ "Encoding (extended sequential, arithmetic)"},
39
+ {JPEG_MARKER_SOF10, "SOF10", "Encoding (progressive, arithmetic)"},
40
+ {JPEG_MARKER_SOF11, "SOF11", "Encoding (lossless, arithmetic)"},
41
+ {JPEG_MARKER_SOF13, "SOF13",
42
+ "Encoding (differential sequential, arithmetic)"},
43
+ {JPEG_MARKER_SOF14, "SOF14",
44
+ "Encoding (differential progressive, arithmetic)"},
45
+ {JPEG_MARKER_SOF15, "SOF15",
46
+ "Encoding (differential lossless, arithmetic)"},
47
+ {JPEG_MARKER_SOI, "SOI", "Start of image"},
48
+ {JPEG_MARKER_EOI, "EOI", "End of image"},
49
+ {JPEG_MARKER_SOS, "SOS", "Start of scan"},
50
+ {JPEG_MARKER_COM, "COM", "Comment"},
51
+ {JPEG_MARKER_DHT, "DHT", "Define Huffman table"},
52
+ {JPEG_MARKER_JPG, "JPG", "Extension"},
53
+ {JPEG_MARKER_DAC, "DAC", "Define arithmetic coding conditioning"},
54
+ {JPEG_MARKER_RST1, "RST1", "Restart 1"},
55
+ {JPEG_MARKER_RST2, "RST2", "Restart 2"},
56
+ {JPEG_MARKER_RST3, "RST3", "Restart 3"},
57
+ {JPEG_MARKER_RST4, "RST4", "Restart 4"},
58
+ {JPEG_MARKER_RST5, "RST5", "Restart 5"},
59
+ {JPEG_MARKER_RST6, "RST6", "Restart 6"},
60
+ {JPEG_MARKER_RST7, "RST7", "Restart 7"},
61
+ {JPEG_MARKER_DQT, "DQT", "Define quantization table"},
62
+ {JPEG_MARKER_DNL, "DNL", "Define number of lines"},
63
+ {JPEG_MARKER_DRI, "DRI", "Define restart interval"},
64
+ {JPEG_MARKER_DHP, "DHP", "Define hierarchical progression"},
65
+ {JPEG_MARKER_EXP, "EXP", "Expand reference component"},
66
+ {JPEG_MARKER_APP0, "APP0", "Application segment 0"},
67
+ {JPEG_MARKER_APP1, "APP1", "Application segment 1"},
68
+ {JPEG_MARKER_APP2, "APP2", "Application segment 2"},
69
+ {JPEG_MARKER_APP3, "APP3", "Application segment 3"},
70
+ {JPEG_MARKER_APP4, "APP4", "Application segment 4"},
71
+ {JPEG_MARKER_APP5, "APP5", "Application segment 5"},
72
+ {JPEG_MARKER_APP6, "APP6", "Application segment 6"},
73
+ {JPEG_MARKER_APP7, "APP7", "Application segment 7"},
74
+ {JPEG_MARKER_APP8, "APP8", "Application segment 8"},
75
+ {JPEG_MARKER_APP9, "APP9", "Application segment 9"},
76
+ {JPEG_MARKER_APP10, "APP10", "Application segment 10"},
77
+ {JPEG_MARKER_APP11, "APP11", "Application segment 11"},
78
+ {JPEG_MARKER_APP12, "APP12", "Application segment 12"},
79
+ {JPEG_MARKER_APP13, "APP13", "Application segment 13"},
80
+ {JPEG_MARKER_APP14, "APP14", "Application segment 14"},
81
+ {JPEG_MARKER_APP15, "APP15", "Application segment 15"},
82
+ {JPEG_MARKER_JPG0, "JPG0", "Extension 0"},
83
+ {JPEG_MARKER_JPG1, "JPG1", "Extension 1"},
84
+ {JPEG_MARKER_JPG2, "JPG2", "Extension 2"},
85
+ {JPEG_MARKER_JPG3, "JPG3", "Extension 3"},
86
+ {JPEG_MARKER_JPG4, "JPG4", "Extension 4"},
87
+ {JPEG_MARKER_JPG5, "JPG5", "Extension 5"},
88
+ {JPEG_MARKER_JPG6, "JPG6", "Extension 6"},
89
+ {JPEG_MARKER_JPG7, "JPG7", "Extension 7"},
90
+ {JPEG_MARKER_JPG8, "JPG8", "Extension 8"},
91
+ {JPEG_MARKER_JPG9, "JPG9", "Extension 9"},
92
+ {JPEG_MARKER_JPG10, "JPG10", "Extension 10"},
93
+ {JPEG_MARKER_JPG11, "JPG11", "Extension 11"},
94
+ {JPEG_MARKER_JPG12, "JPG12", "Extension 12"},
95
+ {JPEG_MARKER_JPG13, "JPG13", "Extension 13"},
96
+ {0, NULL, NULL}
97
+ };
98
+
99
+ const char *
100
+ jpeg_marker_get_name (JPEGMarker marker)
101
+ {
102
+ unsigned int i;
103
+
104
+ for (i = 0; JPEGMarkerTable[i].name; i++)
105
+ if (JPEGMarkerTable[i].marker == marker)
106
+ break;
107
+
108
+ return (JPEGMarkerTable[i].name);
109
+ }
110
+
111
+ const char *
112
+ jpeg_marker_get_description (JPEGMarker marker)
113
+ {
114
+ unsigned int i;
115
+
116
+ for (i = 0; JPEGMarkerTable[i].description; i++)
117
+ if (JPEGMarkerTable[i].marker == marker)
118
+ break;
119
+
120
+ return (JPEGMarkerTable[i].description);
121
+ }
122
+
data/ext/jpeg-marker.h ADDED
@@ -0,0 +1,103 @@
1
+ /* jpeg-marker.h
2
+ *
3
+ * Copyright � 2001 Lutz M�ller <lutz@users.sourceforge.net>
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the
17
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
+ * Boston, MA 02110-1301 USA.
19
+ */
20
+ #ifndef __JPEG_MARKER_H__
21
+ #define __JPEG_MARKER_H__
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif /* __cplusplus */
26
+
27
+ typedef enum {
28
+ JPEG_MARKER_SOF0 = 0xc0,
29
+ JPEG_MARKER_SOF1 = 0xc1,
30
+ JPEG_MARKER_SOF2 = 0xc2,
31
+ JPEG_MARKER_SOF3 = 0xc3,
32
+ JPEG_MARKER_DHT = 0xc4,
33
+ JPEG_MARKER_SOF5 = 0xc5,
34
+ JPEG_MARKER_SOF6 = 0xc6,
35
+ JPEG_MARKER_SOF7 = 0xc7,
36
+ JPEG_MARKER_JPG = 0xc8,
37
+ JPEG_MARKER_SOF9 = 0xc9,
38
+ JPEG_MARKER_SOF10 = 0xca,
39
+ JPEG_MARKER_SOF11 = 0xcb,
40
+ JPEG_MARKER_DAC = 0xcc,
41
+ JPEG_MARKER_SOF13 = 0xcd,
42
+ JPEG_MARKER_SOF14 = 0xce,
43
+ JPEG_MARKER_SOF15 = 0xcf,
44
+ JPEG_MARKER_RST0 = 0xd0,
45
+ JPEG_MARKER_RST1 = 0xd1,
46
+ JPEG_MARKER_RST2 = 0xd2,
47
+ JPEG_MARKER_RST3 = 0xd3,
48
+ JPEG_MARKER_RST4 = 0xd4,
49
+ JPEG_MARKER_RST5 = 0xd5,
50
+ JPEG_MARKER_RST6 = 0xd6,
51
+ JPEG_MARKER_RST7 = 0xd7,
52
+ JPEG_MARKER_SOI = 0xd8,
53
+ JPEG_MARKER_EOI = 0xd9,
54
+ JPEG_MARKER_SOS = 0xda,
55
+ JPEG_MARKER_DQT = 0xdb,
56
+ JPEG_MARKER_DNL = 0xdc,
57
+ JPEG_MARKER_DRI = 0xdd,
58
+ JPEG_MARKER_DHP = 0xde,
59
+ JPEG_MARKER_EXP = 0xdf,
60
+ JPEG_MARKER_APP0 = 0xe0,
61
+ JPEG_MARKER_APP1 = 0xe1,
62
+ JPEG_MARKER_APP2 = 0xe2,
63
+ JPEG_MARKER_APP3 = 0xe3,
64
+ JPEG_MARKER_APP4 = 0xe4,
65
+ JPEG_MARKER_APP5 = 0xe5,
66
+ JPEG_MARKER_APP6 = 0xe6,
67
+ JPEG_MARKER_APP7 = 0xe7,
68
+ JPEG_MARKER_APP8 = 0xe8,
69
+ JPEG_MARKER_APP9 = 0xe9,
70
+ JPEG_MARKER_APP10 = 0xea,
71
+ JPEG_MARKER_APP11 = 0xeb,
72
+ JPEG_MARKER_APP12 = 0xec,
73
+ JPEG_MARKER_APP13 = 0xed,
74
+ JPEG_MARKER_APP14 = 0xee,
75
+ JPEG_MARKER_APP15 = 0xef,
76
+ JPEG_MARKER_JPG0 = 0xf0,
77
+ JPEG_MARKER_JPG1 = 0xf1,
78
+ JPEG_MARKER_JPG2 = 0xf2,
79
+ JPEG_MARKER_JPG3 = 0xf3,
80
+ JPEG_MARKER_JPG4 = 0xf4,
81
+ JPEG_MARKER_JPG5 = 0xf5,
82
+ JPEG_MARKER_JPG6 = 0xf6,
83
+ JPEG_MARKER_JPG7 = 0xf7,
84
+ JPEG_MARKER_JPG8 = 0xf8,
85
+ JPEG_MARKER_JPG9 = 0xf9,
86
+ JPEG_MARKER_JPG10 = 0xfa,
87
+ JPEG_MARKER_JPG11 = 0xfb,
88
+ JPEG_MARKER_JPG12 = 0xfc,
89
+ JPEG_MARKER_JPG13 = 0xfd,
90
+ JPEG_MARKER_COM = 0xfe
91
+ } JPEGMarker;
92
+
93
+ #define JPEG_IS_MARKER(m) (((m) >= JPEG_MARKER_SOF0) && \
94
+ ((m) <= JPEG_MARKER_COM))
95
+
96
+ const char *jpeg_marker_get_name (JPEGMarker marker);
97
+ const char *jpeg_marker_get_description (JPEGMarker marker);
98
+
99
+ #ifdef __cplusplus
100
+ }
101
+ #endif /* __cplusplus */
102
+
103
+ #endif /* __JPEG_MARKER_H__ */
@@ -0,0 +1,5 @@
1
+ require 'exif/version'
2
+ require 'exif_geo_tag_ext'
3
+
4
+ module ExifGeoTag
5
+ end
@@ -0,0 +1,3 @@
1
+ module ExifGeoTag
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: exif_geo_tag
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sergey Avseyev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake-compiler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Ruby EXIF geo tagger based on libexif.
42
+ email: sergey.avseyev@gmail.com
43
+ executables: []
44
+ extensions:
45
+ - ext/extconf.rb
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ext/exif-i18n.c
49
+ - ext/exif-i18n.h
50
+ - ext/exif_geo_tag.c
51
+ - ext/extconf.rb
52
+ - ext/jpeg-data.c
53
+ - ext/jpeg-data.h
54
+ - ext/jpeg-marker.c
55
+ - ext/jpeg-marker.h
56
+ - lib/exif_geo_tag.rb
57
+ - lib/exif_geo_tag/version.rb
58
+ homepage: https://github.com/avsej/exif_geo_tag
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.5.1
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Ruby EXIF geo tagger.
82
+ test_files: []