|
16 | 16 |
|
17 | 17 | #include <array> |
18 | 18 |
|
19 | | -namespace Exiv2::Internal { |
| 19 | +namespace { |
20 | 20 |
|
21 | | -const std::map<std::string, std::string> infoTags = { |
| 21 | +constexpr struct tags { |
| 22 | + std::string_view first; |
| 23 | + const char* second; |
| 24 | + |
| 25 | + bool operator==(std::string_view tag) const { |
| 26 | + return tag == first; |
| 27 | + }; |
| 28 | +} infoTags[] = { |
22 | 29 | {"AGES", "Xmp.video.Rated"}, |
23 | 30 | {"CMNT", "Xmp.video.Comment"}, |
24 | 31 | {"CODE", "Xmp.video.EncodedBy"}, |
@@ -105,7 +112,14 @@ const std::map<std::string, std::string> infoTags = { |
105 | 112 | {"YEAR", "Xmp.video.Year"}, |
106 | 113 | }; |
107 | 114 |
|
108 | | -const std::map<uint16_t, std::string> audioEncodingValues = { |
| 115 | +constexpr struct encoding { |
| 116 | + uint16_t first; |
| 117 | + std::string_view second; |
| 118 | + |
| 119 | + bool operator==(uint16_t tag) const { |
| 120 | + return tag == first; |
| 121 | + }; |
| 122 | +} audioEncodingValues[] = { |
109 | 123 | {0x1, "Microsoft PCM"}, |
110 | 124 | {0x2, "Microsoft ADPCM"}, |
111 | 125 | {0x3, "Microsoft IEEE float"}, |
@@ -351,7 +365,7 @@ const std::map<uint16_t, std::string> audioEncodingValues = { |
351 | 365 | {0xffff, "Development"}, |
352 | 366 | }; |
353 | 367 |
|
354 | | -} // namespace Exiv2::Internal |
| 368 | +} // namespace |
355 | 369 | // ***************************************************************************** |
356 | 370 | // class member definitions |
357 | 371 |
|
@@ -625,7 +639,7 @@ void RiffVideo::readStreamFormat(uint64_t size_) { |
625 | 639 | xmpData_["Xmp.video.NumIfImpColours"] = "All"; |
626 | 640 | } else if (streamType_ == Audio) { |
627 | 641 | uint16_t format_tag = readWORDTag(io_); |
628 | | - if (auto it = Internal::audioEncodingValues.find(format_tag); it != Internal::audioEncodingValues.end()) |
| 642 | + if (auto it = Exiv2::find(audioEncodingValues, format_tag)) |
629 | 643 | xmpData_["Xmp.audio.Compressor"] = it->second; |
630 | 644 | else |
631 | 645 | xmpData_["Xmp.audio.Compressor"] = format_tag; |
@@ -657,7 +671,7 @@ void RiffVideo::readInfoListChunk(uint64_t size_) { |
657 | 671 | std::string type = readStringTag(io_); |
658 | 672 | size_t size = readDWORDTag(io_); |
659 | 673 | std::string content = readStringTag(io_, size); |
660 | | - if (auto it = Internal::infoTags.find(type); it != Internal::infoTags.end()) |
| 674 | + if (auto it = Exiv2::find(infoTags, type)) |
661 | 675 | xmpData_[it->second] = content; |
662 | 676 | current_size += DWORD * 2; |
663 | 677 | current_size += size; |
|
0 commit comments