summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/cam_helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/raspberrypi/cam_helper.cpp')
-rw-r--r--src/ipa/raspberrypi/cam_helper.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
index 90498c37..e6d2258c 100644
--- a/src/ipa/raspberrypi/cam_helper.cpp
+++ b/src/ipa/raspberrypi/cam_helper.cpp
@@ -159,32 +159,34 @@ unsigned int CamHelper::MistrustFramesModeSwitch() const
void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,
Metadata &metadata)
{
+ MdParser::RegisterMap registers;
+ Metadata parsedMetadata;
+
if (buffer.empty())
return;
- uint32_t exposureLines, gainCode;
-
- if (parser_->Parse(buffer) != MdParser::Status::OK ||
- parser_->GetExposureLines(exposureLines) != MdParser::Status::OK ||
- parser_->GetGainCode(gainCode) != MdParser::Status::OK) {
+ if (parser_->Parse(buffer, registers) != MdParser::Status::OK) {
LOG(IPARPI, Error) << "Embedded data buffer parsing failed";
return;
}
+ PopulateMetadata(registers, parsedMetadata);
+ metadata.Merge(parsedMetadata);
+
/*
- * Overwrite the exposure/gain values in the DeviceStatus, as
- * we know better. Fetch it first in case any other fields were
- * set meaningfully.
+ * Overwrite the exposure/gain values in the existing DeviceStatus with
+ * values from the parsed embedded buffer. Fetch it first in case any
+ * other fields were set meaningfully.
*/
- DeviceStatus deviceStatus;
-
- if (metadata.Get("device.status", deviceStatus) != 0) {
+ DeviceStatus deviceStatus, parsedDeviceStatus;
+ if (metadata.Get("device.status", deviceStatus) ||
+ parsedMetadata.Get("device.status", parsedDeviceStatus)) {
LOG(IPARPI, Error) << "DeviceStatus not found";
return;
}
- deviceStatus.shutter_speed = Exposure(exposureLines);
- deviceStatus.analogue_gain = Gain(gainCode);
+ deviceStatus.shutter_speed = parsedDeviceStatus.shutter_speed;
+ deviceStatus.analogue_gain = parsedDeviceStatus.analogue_gain;
LOG(IPARPI, Debug) << "Metadata updated - Exposure : "
<< deviceStatus.shutter_speed
@@ -194,6 +196,11 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,
metadata.Set("device.status", deviceStatus);
}
+void CamHelper::PopulateMetadata([[maybe_unused]] const MdParser::RegisterMap &registers,
+ [[maybe_unused]] Metadata &metadata) const
+{
+}
+
RegisterCamHelper::RegisterCamHelper(char const *cam_name,
CamHelperCreateFunc create_func)
{