1 #ifndef IMAGE_IO_GCONTAINER_GCONTAINER_H_ // NOLINT 2 #define IMAGE_IO_GCONTAINER_GCONTAINER_H_ // NOLINT 3 4 #include <iostream> 5 #include <string> 6 #include <vector> 7 8 namespace photos_editing_formats { 9 namespace image_io { 10 namespace gcontainer { 11 12 // Writes an image to a output_file_name, appending other_files (if they each 13 // exist) after the image's EOI marker. 14 // input_file_name must be a JPEG file. 15 bool WriteImageAndFiles(const std::string& input_file_name, 16 const std::vector<std::string>& other_files, 17 const std::string& output_file_name); 18 19 // Retrieves the bytes (of size file_length) starting at file_starT_offset 20 // bytes after the EOI marker in input_file_name. Returns true if parsing was 21 // successful, false otherwise. GContainer callers are expected to have 22 // file_start_offset and file_length from the image metadata. 23 // 24 // input_file_name must be a JPEG. 25 // file_start_offset is the nth byte after (and excluding) the EOI marker in 26 // input_file_name. file_length is the size (in bytes) of content to parse. 27 // out_file_contents is populated with the requsted contents only if parsing is 28 // successful. 29 bool ParseFileAfterImage(const std::string& input_file_name, 30 size_t file_start_offset, size_t file_length, 31 std::string* out_file_contents); 32 33 // Used by AOSP. 34 bool ParseFileAfterImageFromStream(size_t start_offset, size_t length, 35 std::istream& input_jpeg_stream, 36 std::string* out_contents); 37 38 } // namespace gcontainer 39 } // namespace image_io 40 } // namespace photos_editing_formats 41 42 #endif // IMAGE_IO_GCONTAINER_GCONTAINER_H_ // NOLINT 43