mirror of https://github.com/dsoprea/go-exif.git
parent
a6301f85c8
commit
41dc97a713
13
v3/tags.go
13
v3/tags.go
|
@ -176,6 +176,7 @@ func (it *IndexedTag) DoesSupportType(tagType exifcommon.TagTypePrimitive) bool
|
||||||
|
|
||||||
// TagIndex is a tag-lookup facility.
|
// TagIndex is a tag-lookup facility.
|
||||||
type TagIndex struct {
|
type TagIndex struct {
|
||||||
|
tagsInit sync.Once
|
||||||
tagsByIfd map[string]map[uint16]*IndexedTag
|
tagsByIfd map[string]map[uint16]*IndexedTag
|
||||||
tagsByIfdR map[string]map[string]*IndexedTag
|
tagsByIfdR map[string]map[string]*IndexedTag
|
||||||
|
|
||||||
|
@ -253,10 +254,8 @@ func (ti *TagIndex) getOne(ifdPath string, id uint16) (it *IndexedTag, err error
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if len(ti.tagsByIfd) == 0 {
|
err = LoadStandardTags(ti)
|
||||||
err := LoadStandardTags(ti)
|
|
||||||
log.PanicIf(err)
|
log.PanicIf(err)
|
||||||
}
|
|
||||||
|
|
||||||
ti.mutex.Lock()
|
ti.mutex.Lock()
|
||||||
defer ti.mutex.Unlock()
|
defer ti.mutex.Unlock()
|
||||||
|
@ -384,10 +383,8 @@ func (ti *TagIndex) GetWithName(ii *exifcommon.IfdIdentity, name string) (it *In
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if len(ti.tagsByIfdR) == 0 {
|
err = LoadStandardTags(ti)
|
||||||
err := LoadStandardTags(ti)
|
|
||||||
log.PanicIf(err)
|
log.PanicIf(err)
|
||||||
}
|
|
||||||
|
|
||||||
ifdPath := ii.UnindexedString()
|
ifdPath := ii.UnindexedString()
|
||||||
|
|
||||||
|
@ -408,6 +405,8 @@ func LoadStandardTags(ti *TagIndex) (err error) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
ti.tagsInit.Do(func() {
|
||||||
|
|
||||||
// Read static data.
|
// Read static data.
|
||||||
|
|
||||||
encodedIfds := make(map[string][]encodedTag)
|
encodedIfds := make(map[string][]encodedTag)
|
||||||
|
@ -471,5 +470,7 @@ func LoadStandardTags(ti *TagIndex) (err error) {
|
||||||
|
|
||||||
tagsLogger.Debugf(nil, "(%d) tags loaded.", count)
|
tagsLogger.Debugf(nil, "(%d) tags loaded.", count)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue