summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilian Peev <epeev@google.com>2019-01-28 10:44:07 -0800
committerEmilian Peev <epeev@google.com>2019-02-06 17:41:33 +0000
commit7e8ff987a6d808b25198d6ab7ebee21dd3255274 (patch)
tree77f69ac1dfd95637405e723d2195bda738f5e87a
parent1a5387f472b510232e0fd3af0b06e350341c334d (diff)
downloaddynamic_depth-7e8ff987a6d808b25198d6ab7ebee21dd3255274.tar.gz
Sync libdynamic_depth to CL #231067980
Changes included: - [ddepth] Add GetItemPayload for istream Bug: 123316622 Test: Camera CTS Change-Id: Idcc517dd0cc3b38a1ca28f348de4543d736f7146
-rw-r--r--includes/dynamic_depth/dynamic_depth.h8
-rw-r--r--internal/dynamic_depth/dynamic_depth.cc12
2 files changed, 17 insertions, 3 deletions
diff --git a/includes/dynamic_depth/dynamic_depth.h b/includes/dynamic_depth/dynamic_depth.h
index 966fc1f..4b75207 100644
--- a/includes/dynamic_depth/dynamic_depth.h
+++ b/includes/dynamic_depth/dynamic_depth.h
@@ -1,6 +1,8 @@
#ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_DYNAMIC_DEPTH_H_ // NOLINT
#define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_DYNAMIC_DEPTH_H_ // NOLINT
+#include <iostream>
+
#include "dynamic_depth/device.h"
#include "xmpmeta/xmp_writer.h"
@@ -31,6 +33,12 @@ bool GetItemPayload(const string& input_image_filename,
// Convenience method for the aboove.
bool GetItemPayload(const string& input_image_filename, const Device* device,
const string& item_uri, string* out_payload);
+
+// Used by AOSP.
+// Same as the above, but for an istream.
+bool GetItemPayload(const Container* container, const string& item_uri,
+ std::istream& input_jpeg_stream, string* out_payload);
+
} // namespace dynamic_depth
#endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_DYNAMIC_DEPTH_H_ // NOLINT
diff --git a/internal/dynamic_depth/dynamic_depth.cc b/internal/dynamic_depth/dynamic_depth.cc
index 2294289..67b5fb4 100644
--- a/internal/dynamic_depth/dynamic_depth.cc
+++ b/internal/dynamic_depth/dynamic_depth.cc
@@ -82,6 +82,12 @@ bool GetItemPayload(const string& input_image_filename, const Device* device,
bool GetItemPayload(const string& input_image_filename,
const Container* container, const string& item_uri,
string* out_payload) {
+ std::ifstream input_stream(input_image_filename);
+ return GetItemPayload(container, item_uri, input_stream, out_payload);
+}
+
+bool GetItemPayload(const Container* container, const string& item_uri,
+ std::istream& input_jpeg_stream, string* out_payload) {
if (container == nullptr) {
LOG(ERROR) << "Container cannot be null";
return false;
@@ -121,9 +127,9 @@ bool GetItemPayload(const string& input_image_filename,
}
std::string std_payload;
- bool success =
- ::photos_editing_formats::image_io::gcontainer::ParseFileAfterImage(
- input_image_filename, file_offset, file_length, &std_payload);
+ bool success = ::photos_editing_formats::image_io::gcontainer::
+ ParseFileAfterImageFromStream(file_offset, file_length, input_jpeg_stream,
+ &std_payload);
*out_payload = std_payload;
return success;
}