| // Copyright 2026 Google LLC |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // https://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| // |
| |
| #ifndef THIRD_PARTY_CREDENTIO_FORMATS_ASSET_BYTE_INFO_H_ |
| #define THIRD_PARTY_CREDENTIO_FORMATS_ASSET_BYTE_INFO_H_ |
| |
| #include <cstddef> |
| #include <ostream> |
| #include <vector> |
| |
| #include "formats/asset_box.h" |
| #include "formats/byte_range.h" |
| |
| namespace credentio { |
| |
| // Metadata about the bytes in the asset. |
| struct AssetByteInfo { |
| // The location of the C2PA Manifest Store in the asset. |
| ByteRange manifest_store_location; |
| // A list of the file format's native boxes/segments within the asset. This |
| // vector will be populated for file formats that are based upon box |
| // structures. Eg: JPEG, PNG |
| std::vector<AssetBox> boxes; |
| |
| bool operator==(const AssetByteInfo& other) const { |
| return manifest_store_location == other.manifest_store_location && |
| boxes == other.boxes; |
| } |
| bool operator!=(const AssetByteInfo& other) const { |
| return !(*this == other); |
| } |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& os, const AssetByteInfo& info) { |
| os << "AssetByteInfo{manifest_store_location: {" |
| << info.manifest_store_location.offset << ", " |
| << info.manifest_store_location.length << "}, boxes: ["; |
| for (size_t i = 0; i < info.boxes.size(); ++i) { |
| if (i > 0) os << ", "; |
| os << info.boxes[i]; |
| } |
| return os << "]}"; |
| } |
| |
| } // namespace credentio |
| |
| #endif // THIRD_PARTY_CREDENTIO_FORMATS_ASSET_BYTE_INFO_H_ |