@@ -140,14 +140,48 @@ const std::map<int, const Camera3Format> camera3FormatsMap = {
*/
struct Camera3StreamConfig {
struct Camera3Stream {
- camera3_stream_t *stream;
- CameraStream::Type type;
+ Camera3Stream(camera3_stream_t *stream, CameraStream::Type type)
+ : stream(stream), type(type) {}
+
+ std::string toString() const;
+
+ camera3_stream_t *stream = nullptr;
+ CameraStream::Type type = CameraStream::Type::Direct;
};
+ std::string toString() const;
+
std::vector<Camera3Stream> streams;
StreamConfiguration config;
};
+std::string Camera3StreamConfig::Camera3Stream::toString() const {
+ std::ostringstream os;
+ os << "format: " << utils::hex(stream->format)
+ << ", size:" << stream->width << "x" << stream->height;
+ os << ", type: ";
+ switch (type) {
+ case CameraStream::Type::Direct:
+ os << "Direct"; break;
+ case CameraStream::Type::Internal:
+ os << "Internal"; break;
+ case CameraStream::Type::Mapped:
+ os << "Mapped"; break;
+ }
+
+ return os.str();
+}
+
+std::string Camera3StreamConfig::toString() const {
+ std::ostringstream os;
+ for (size_t i = 0; i < streams.size(); ++i) {
+ os << "Stream #" << i << ": " << streams[i].toString() << "}, ";
+ }
+
+ os << "config: " << config.toString();
+ return os.str();
+}
+
/*
* Reorder the configurations so that libcamera::Camera can accept them as much
* as possible. The sort rule is as follows.
This adds toString() function in Camera3StreamConfig and Camera3StreamConfig::Camera3Stream for logging. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> --- src/android/camera_device.cpp | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) -- 2.30.0.365.g02bc693789-goog