@@ -111,12 +111,13 @@ impl TiffMetadataReader {
111
111
pub async fn read_next_ifd < F : MetadataFetch > (
112
112
& mut self ,
113
113
fetch : & F ,
114
+ extra_tags_registry : ExtraTagsRegistry ,
114
115
) -> AsyncTiffResult < Option < ImageFileDirectory > > {
115
116
if let Some ( ifd_start) = self . next_ifd_offset {
116
117
let ifd_reader =
117
118
ImageFileDirectoryReader :: open ( fetch, ifd_start, self . bigtiff , self . endianness )
118
119
. await ?;
119
- let ifd = ifd_reader. read ( fetch) . await ?;
120
+ let ifd = ifd_reader. read ( fetch, extra_tags_registry ) . await ?;
120
121
let next_ifd_offset = ifd_reader. finish ( fetch) . await ?;
121
122
self . next_ifd_offset = next_ifd_offset;
122
123
Ok ( Some ( ifd) )
@@ -129,9 +130,11 @@ impl TiffMetadataReader {
129
130
pub async fn read_all_ifds < F : MetadataFetch > (
130
131
& mut self ,
131
132
fetch : & F ,
133
+ extra_tags_registry : ExtraTagsRegistry ,
132
134
) -> AsyncTiffResult < Vec < ImageFileDirectory > > {
133
135
let mut ifds = vec ! [ ] ;
134
- while let Some ( ifd) = self . read_next_ifd ( fetch) . await ? {
136
+ // deep clone the extra_tags_registry so we can have different values
137
+ while let Some ( ifd) = self . read_next_ifd ( fetch, extra_tags_registry. deep_clone ( ) ) . await ? {
135
138
ifds. push ( ifd) ;
136
139
}
137
140
Ok ( ifds)
@@ -158,8 +161,6 @@ pub struct ImageFileDirectoryReader {
158
161
ifd_entry_byte_size : u64 ,
159
162
/// The number of bytes that the value for the number of tags takes up.
160
163
tag_count_byte_size : u64 ,
161
- /// Registry for parsing extra tags
162
- extra_tags_registry : ExtraTagsRegistry ,
163
164
}
164
165
165
166
impl ImageFileDirectoryReader {
@@ -169,7 +170,6 @@ impl ImageFileDirectoryReader {
169
170
ifd_start_offset : u64 ,
170
171
bigtiff : bool ,
171
172
endianness : Endianness ,
172
- extra_tags_registry : ExtraTagsRegistry ,
173
173
) -> AsyncTiffResult < Self > {
174
174
let mut cursor = MetadataCursor :: new_with_offset ( fetch, endianness, ifd_start_offset) ;
175
175
@@ -198,7 +198,6 @@ impl ImageFileDirectoryReader {
198
198
tag_count,
199
199
tag_count_byte_size,
200
200
ifd_start_offset,
201
- extra_tags_registry,
202
201
} )
203
202
}
204
203
@@ -225,13 +224,13 @@ impl ImageFileDirectoryReader {
225
224
///
226
225
/// Keep in mind that you'll still need to call [`finish`][Self::finish] to get the byte offset
227
226
/// of the next IFD.
228
- pub async fn read < F : MetadataFetch > ( & self , fetch : & F ) -> AsyncTiffResult < ImageFileDirectory > {
227
+ pub async fn read < F : MetadataFetch > ( & self , fetch : & F , extra_tags_registry : ExtraTagsRegistry ) -> AsyncTiffResult < ImageFileDirectory > {
229
228
let mut tags = HashMap :: with_capacity ( self . tag_count as usize ) ;
230
229
for tag_idx in 0 ..self . tag_count {
231
230
let ( tag, value) = self . read_tag ( fetch, tag_idx) . await ?;
232
231
tags. insert ( tag, value) ;
233
232
}
234
- ImageFileDirectory :: from_tags ( tags, self . endianness , self . extra_tags_registry )
233
+ ImageFileDirectory :: from_tags ( tags, self . endianness , extra_tags_registry)
235
234
}
236
235
237
236
/// Finish this reader, reading the byte offset of the next IFD
0 commit comments