exif 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 "libjpeg/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__ */
@@ -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
+
@@ -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__ */
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'exif/version'
2
4
  require 'exif/exif'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Exif
2
- VERSION = "1.0.1"
4
+ VERSION = '2.0.0'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exif
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jian Weihang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-30 00:00:00.000000000 Z
11
+ date: 2017-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,83 +16,74 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: 1.15.4
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: 1.15.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.0.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake-compiler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 1.0.4
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 1.0.4
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 5.10.3
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 5.10.3
69
69
  description: Ruby EXIF reader written in C extension.
70
- email:
71
- - tonytonyjan@gmail.com
70
+ email: tonytonyjan@gmail.com
72
71
  executables: []
73
72
  extensions:
74
73
  - ext/exif/extconf.rb
75
74
  extra_rdoc_files: []
76
75
  files:
77
- - ".gitignore"
78
- - ".rspec"
79
- - ".travis.yml"
80
- - Gemfile
81
- - LICENSE.txt
82
- - README.md
83
- - Rakefile
84
- - benchmark/benchmark.rb
85
- - exif.gemspec
86
76
  - ext/exif/data.c
87
77
  - ext/exif/data.h
88
78
  - ext/exif/exif.c
89
- - ext/exif/exif.h
79
+ - ext/exif/exif_entry_to_ivar.c
90
80
  - ext/exif/extconf.rb
81
+ - ext/exif/libjpeg/jpeg-data.c
82
+ - ext/exif/libjpeg/jpeg-data.h
83
+ - ext/exif/libjpeg/jpeg-marker.c
84
+ - ext/exif/libjpeg/jpeg-marker.h
91
85
  - lib/exif.rb
92
86
  - lib/exif/version.rb
93
- - spec/exif_spec.rb
94
- - spec/sample.jpg
95
- - spec/spec_helper.rb
96
87
  homepage: https://github.com/tonytonyjan/exif
97
88
  licenses:
98
89
  - MIT
@@ -113,12 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
104
  version: '0'
114
105
  requirements: []
115
106
  rubyforge_project:
116
- rubygems_version: 2.4.5
107
+ rubygems_version: 2.6.12
117
108
  signing_key:
118
109
  specification_version: 4
119
110
  summary: Ruby EXIF reader written in C extension.
120
- test_files:
121
- - spec/exif_spec.rb
122
- - spec/sample.jpg
123
- - spec/spec_helper.rb
124
- has_rdoc:
111
+ test_files: []