| // 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_JPEG_BOX_HEADER_H_ |
| #define THIRD_PARTY_CREDENTIO_FORMATS_JPEG_BOX_HEADER_H_ |
| |
| #include <cstdint> |
| #include <iosfwd> |
| #include <string> |
| |
| #include "absl/status/statusor.h" |
| #include "riegeli/bytes/reader.h" |
| |
| namespace credentio { |
| struct JpegBoxHeader { |
| uint16_t type; // The marker of the box. |
| uint64_t offset; // The offset of the box in the file. |
| uint64_t size; // The size of the box (including the marker). |
| std::string label() const; // The human-readable box type (marker). |
| |
| friend bool operator==(const JpegBoxHeader&, const JpegBoxHeader&) = default; |
| }; |
| |
| void PrintTo(const JpegBoxHeader& x, ::std::ostream* os); |
| |
| // Reads and returns the box header. |
| absl::StatusOr<JpegBoxHeader> ConsumeJpegBoxHeader(riegeli::Reader& input); |
| } // namespace credentio |
| |
| #endif // THIRD_PARTY_CREDENTIO_FORMATS_JPEG_BOX_HEADER_H_ |