| 848 | } // QuickTimeVideo::CameraTagsDecoder |
| 849 | |
| 850 | void QuickTimeVideo::userDataDecoder(size_t size_external, size_t recursion_depth) { |
| 851 | enforce(recursion_depth < max_recursion_depth_, Exiv2::ErrorCode::kerCorruptedMetadata); |
| 852 | size_t cur_pos = io_->tell(); |
| 853 | const TagVocabulary* td; |
| 854 | const TagVocabulary* tv; |
| 855 | const TagVocabulary* tv_internal; |
| 856 | |
| 857 | const long bufMinSize = 100; |
| 858 | DataBuf buf(bufMinSize); |
| 859 | size_t size_internal = size_external; |
| 860 | std::memset(buf.data(), 0x0, buf.size()); |
| 861 | |
| 862 | while ((size_internal / 4 != 0) && (size_internal > 0)) { |
| 863 | buf.data()[4] = '\0'; |
| 864 | io_->readOrThrow(buf.data(), 4); |
| 865 | const size_t size = buf.read_uint32(0, bigEndian); |
| 866 | if (size > size_internal) |
| 867 | break; |
| 868 | size_internal -= size; |
| 869 | io_->readOrThrow(buf.data(), 4); |
| 870 | |
| 871 | if (buf.data()[0] == 169) |
| 872 | buf.data()[0] = ' '; |
| 873 | td = Exiv2::find(userDatatags, Exiv2::toString(buf.data())); |
| 874 | |
| 875 | tv = Exiv2::find(userDataReferencetags, Exiv2::toString(buf.data())); |
| 876 | |
| 877 | if (size <= 12) |
| 878 | break; |
| 879 | |
| 880 | if (equalsQTimeTag(buf, "DcMD") || equalsQTimeTag(buf, "NCDT")) |
| 881 | userDataDecoder(size - 8, recursion_depth + 1); |
| 882 | |
| 883 | else if (equalsQTimeTag(buf, "NCTG")) |
| 884 | NikonTagsDecoder(size - 8); |
| 885 | |
| 886 | else if (equalsQTimeTag(buf, "TAGS")) |
| 887 | CameraTagsDecoder(size - 8); |
| 888 | |
| 889 | else if (equalsQTimeTag(buf, "CNCV") || equalsQTimeTag(buf, "CNFV") || equalsQTimeTag(buf, "CNMN") || |
| 890 | equalsQTimeTag(buf, "NCHD") || equalsQTimeTag(buf, "FFMV")) { |
| 891 | enforce(tv, Exiv2::ErrorCode::kerCorruptedMetadata); |
| 892 | xmpData_[exvGettext(tv->label_)] = readString(*io_, size - 8); |
| 893 | } |
| 894 | |
| 895 | else if (equalsQTimeTag(buf, "CMbo") || equalsQTimeTag(buf, "Cmbo")) { |
| 896 | enforce(tv, Exiv2::ErrorCode::kerCorruptedMetadata); |
| 897 | io_->readOrThrow(buf.data(), 2); |
| 898 | buf.data()[2] = '\0'; |
| 899 | tv_internal = Exiv2::find(cameraByteOrderTags, Exiv2::toString(buf.data())); |
| 900 | |
| 901 | if (tv_internal) |
| 902 | xmpData_[exvGettext(tv->label_)] = exvGettext(tv_internal->label_); |
| 903 | else |
| 904 | xmpData_[exvGettext(tv->label_)] = Exiv2::toString(buf.data()); |
| 905 | } |
| 906 | |
| 907 | else if (tv) { |
nothing calls this directly
no test coverage detected