39 #include "UniquePointer.h"
43 #include "Validator.h"
44 #include <Argus/Ext/BayerSharpnessMap.h>
45 #include <Argus/Ext/DebugCaptureSession.h>
46 #include <Argus/Ext/DeFog.h>
47 #include <Argus/Ext/FaceDetect.h>
48 #include <Argus/Ext/InternalFrameCount.h>
49 #include <Argus/Ext/SensorPrivateMetadata.h>
50 #include <Argus/Ext/DebugCaptureSession.h>
51 #include <Argus/Ext/PwlWdrSensorMode.h>
53 namespace ArgusSamples
69 virtual bool isInterface(Argus::Interface *interface)
const = 0;
83 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_denoiseMode.registerObserver(
this,
84 static_cast<IObserver::CallbackFunction>(
87 static_cast<IObserver::CallbackFunction>(
96 static_cast<IObserver::CallbackFunction>(
98 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_denoiseMode.unregisterObserver(
this,
99 static_cast<IObserver::CallbackFunction>(
116 ORIGINATE_ERROR(
"Failed to set the denoising mode");
132 ORIGINATE_ERROR(
"Failed to set the denoise strength");
155 static_cast<IObserver::CallbackFunction>(
158 static_cast<IObserver::CallbackFunction>(
167 static_cast<IObserver::CallbackFunction>(
170 static_cast<IObserver::CallbackFunction>(
189 ORIGINATE_ERROR(
"Failed to set the edge enhancement mode");
206 ORIGINATE_ERROR(
"Failed to set the edge enhancement strength");
228 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_vstabMode.registerObserver(
this,
229 static_cast<IObserver::CallbackFunction>(
237 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_vstabMode.unregisterObserver(
this,
238 static_cast<IObserver::CallbackFunction>(
257 ORIGINATE_ERROR(
"Failed to set the video stabilization mode");
281 static_cast<IObserver::CallbackFunction>(
283 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_gainRange.registerObserver(
this,
284 static_cast<IObserver::CallbackFunction>(
287 static_cast<IObserver::CallbackFunction>(
289 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_frameRate.registerObserver(
this,
290 static_cast<IObserver::CallbackFunction>(
292 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_focusPosition.registerObserver(
this,
293 static_cast<IObserver::CallbackFunction>(
301 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_focusPosition.unregisterObserver(
this,
302 static_cast<IObserver::CallbackFunction>(
304 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_frameRate.unregisterObserver(
this,
305 static_cast<IObserver::CallbackFunction>(
308 static_cast<IObserver::CallbackFunction>(
310 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_gainRange.unregisterObserver(
this,
311 static_cast<IObserver::CallbackFunction>(
314 static_cast<IObserver::CallbackFunction>(
333 ORIGINATE_ERROR(
"Failed to set exposure time range");
348 ORIGINATE_ERROR(
"Failed to set gain range");
361 Argus::SensorMode *sensorMode = NULL;
365 ORIGINATE_ERROR(
"Failed to set sensor mode");
381 ORIGINATE_ERROR(
"Failed to set focus position");
395 Argus::Range<uint64_t> frameDurationRangeNs(0);
401 Argus::SensorMode *sensorMode = NULL;
405 Argus::ISensorMode *iSensorMode =
406 Argus::interface_cast<Argus::ISensorMode>(sensorMode);
408 frameDurationRangeNs = iSensorMode->getFrameDurationRange();
413 frameDurationRangeNs =
417 if (
m_iSourceSettings->setFrameDurationRange(frameDurationRangeNs) != Argus::STATUS_OK)
418 ORIGINATE_ERROR(
"Failed to set frame duration range");
441 static_cast<IObserver::CallbackFunction>(
443 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_aeLock.registerObserver(
this,
444 static_cast<IObserver::CallbackFunction>(
446 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbLock.registerObserver(
this,
447 static_cast<IObserver::CallbackFunction>(
449 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbMode.registerObserver(
this,
450 static_cast<IObserver::CallbackFunction>(
453 static_cast<IObserver::CallbackFunction>(
456 static_cast<IObserver::CallbackFunction>(
466 static_cast<IObserver::CallbackFunction>(
469 static_cast<IObserver::CallbackFunction>(
471 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbMode.unregisterObserver(
this,
472 static_cast<IObserver::CallbackFunction>(
474 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_awbLock.unregisterObserver(
this,
475 static_cast<IObserver::CallbackFunction>(
477 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_aeLock.unregisterObserver(
this,
478 static_cast<IObserver::CallbackFunction>(
481 static_cast<IObserver::CallbackFunction>(
500 ORIGINATE_ERROR(
"Failed to set the AE antibanding mode");
512 assert(&source == &dispatcher.
m_aeLock);
515 ORIGINATE_ERROR(
"Failed to set the AE lock");
526 assert(&source == &dispatcher.
m_awbLock);
529 ORIGINATE_ERROR(
"Failed to set the AWB lock");
540 assert(&source == &dispatcher.
m_awbMode);
543 ORIGINATE_ERROR(
"Failed to set the AWB mode");
559 ORIGINATE_ERROR(
"Failed to set the exposure compensation");
576 ORIGINATE_ERROR(
"Failed to set the Isp Digital Gain Range");
598 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogEnable.registerObserver(
this,
600 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogAmount.registerObserver(
this,
602 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogQuality.registerObserver(
this,
610 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogQuality.unregisterObserver(
this,
612 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogAmount.unregisterObserver(
this,
614 PROPAGATE_ERROR_CONTINUE(dispatcher.
m_deFogEnable.unregisterObserver(
this,
644 ORIGINATE_ERROR(
"Failed to set the DeFog amount");
658 ORIGINATE_ERROR(
"Failed to set the DeFog quality");
669 static const ValidatorEnum<Argus::DenoiseMode>::ValueStringPair s_denoiseModes[] =
671 { Argus::DENOISE_MODE_OFF,
"off" },
672 { Argus::DENOISE_MODE_FAST,
"fast" },
673 { Argus::DENOISE_MODE_HIGH_QUALITY,
"highquality" }
677 static const ValidatorEnum<Argus::EdgeEnhanceMode>::ValueStringPair s_edgeEnhanceModes[] =
679 { Argus::EDGE_ENHANCE_MODE_OFF,
"off" },
680 { Argus::EDGE_ENHANCE_MODE_FAST,
"fast" },
681 { Argus::EDGE_ENHANCE_MODE_HIGH_QUALITY,
"highquality" }
685 static const ValidatorEnum<Argus::VideoStabilizationMode>::ValueStringPair s_vstabModes[] =
687 { Argus::VIDEO_STABILIZATION_MODE_OFF,
"off" },
688 { Argus::VIDEO_STABILIZATION_MODE_ON,
"on" }
692 static const ValidatorEnum<Argus::AeAntibandingMode>::ValueStringPair s_aeAntibandingModes[] =
694 { Argus::AE_ANTIBANDING_MODE_OFF,
"off" },
695 { Argus::AE_ANTIBANDING_MODE_AUTO,
"auto" },
696 { Argus::AE_ANTIBANDING_MODE_50HZ,
"50hz" },
697 { Argus::AE_ANTIBANDING_MODE_60HZ,
"60hz" }
701 static const ValidatorEnum<Argus::AwbMode>::ValueStringPair s_awbModes[] =
703 { Argus::AWB_MODE_OFF,
"off" },
704 { Argus::AWB_MODE_AUTO,
"auto" },
705 { Argus::AWB_MODE_INCANDESCENT,
"incandescent" },
706 { Argus::AWB_MODE_FLUORESCENT,
"fluorescent" },
707 { Argus::AWB_MODE_WARM_FLUORESCENT,
"warmfluorescent" },
708 { Argus::AWB_MODE_DAYLIGHT,
"daylight" },
709 { Argus::AWB_MODE_CLOUDY_DAYLIGHT,
"cloudydaylight" },
710 { Argus::AWB_MODE_TWILIGHT,
"twilight" },
711 { Argus::AWB_MODE_SHADE,
"shade" },
712 { Argus::AWB_MODE_MANUAL,
"manual" }
716 static const ValidatorEnum<VideoPipeline::VideoFormat>::ValueStringPair s_videoFormats[] =
725 static const ValidatorEnum<VideoPipeline::VideoFileType>::ValueStringPair s_videoFileTypes[] =
734 static const Argus::Size2D<uint32_t> s_outputSizes[] =
736 Argus::Size2D<uint32_t>(0, 0),
737 Argus::Size2D<uint32_t>(176, 144),
738 Argus::Size2D<uint32_t>(320, 240),
739 Argus::Size2D<uint32_t>(640, 480),
740 Argus::Size2D<uint32_t>(1280, 720),
741 Argus::Size2D<uint32_t>(1920, 1080),
742 Argus::Size2D<uint32_t>(3840, 2160),
746 : m_deviceFocusPositionRange(0)
747 , m_deviceExposureCompensationRange(0.0f)
748 , m_deviceIspDigitalGainRange(Argus::Range<float>(0.0f))
749 , m_sensorExposureTimeRange(Argus::Range<uint64_t>(0))
750 , m_sensorAnalogGainRange(Argus::Range<float>(0.0f))
751 , m_sensorFrameRateRange(0.0f)
752 , m_deviceIndex(new ValidatorStdVector<uint32_t, Argus::CameraDevice*>(&m_cameraDevices), 0)
753 , m_deviceOpen(false)
754 , m_sensorModeValid(false)
757 , m_exposureTimeRange(new ValidatorRange<Argus::Range<uint64_t> >(&m_sensorExposureTimeRange),
758 Argus::Range<uint64_t>(0))
759 , m_gainRange(new ValidatorRange<Argus::Range<float > >(&m_sensorAnalogGainRange),
760 Argus::Range<float>(0.0f))
761 , m_sensorModeIndex(new ValidatorEnum<uint32_t>(), 0)
762 , m_frameRate(new ValidatorRange<float>(&m_sensorFrameRateRange), 0.0f)
763 , m_focusPosition(new ValidatorRange<int32_t>(&m_deviceFocusPositionRange), 0)
764 , m_denoiseMode(new ValidatorEnum<Argus::DenoiseMode>(
765 s_denoiseModes, sizeof(s_denoiseModes) / sizeof(s_denoiseModes[0])),
766 Argus::DENOISE_MODE_FAST)
767 , m_denoiseStrength(new ValidatorRange<float>(-1.0f, 1.0f), -1.0f)
768 , m_edgeEnhanceMode(new ValidatorEnum<Argus::EdgeEnhanceMode>(
769 s_edgeEnhanceModes, sizeof(s_edgeEnhanceModes) / sizeof(s_edgeEnhanceModes[0])),
770 Argus::EDGE_ENHANCE_MODE_FAST)
771 , m_edgeEnhanceStrength(new ValidatorRange<float>(-1.0f, 1.0f), -1.0f)
772 , m_vstabMode(new ValidatorEnum<Argus::VideoStabilizationMode>(
773 s_vstabModes, sizeof(s_vstabModes) / sizeof(s_vstabModes[0])),
774 Argus::VIDEO_STABILIZATION_MODE_OFF)
775 , m_aeAntibandingMode(new ValidatorEnum<Argus::AeAntibandingMode>(
776 s_aeAntibandingModes, sizeof(s_aeAntibandingModes) / sizeof(s_aeAntibandingModes[0])),
777 Argus::AE_ANTIBANDING_MODE_AUTO)
780 , m_awbMode(new ValidatorEnum<Argus::AwbMode>(
781 s_awbModes, sizeof(s_awbModes) / sizeof(s_awbModes[0])),
782 Argus::AWB_MODE_AUTO)
783 , m_exposureCompensation(new ValidatorRange<float>(&m_deviceExposureCompensationRange), 0.0f)
784 , m_ispDigitalGainRange(new ValidatorRange<Argus::Range<float> >(&m_deviceIspDigitalGainRange),
785 Argus::Range<float>(1.0f))
786 , m_videoFormat(new ValidatorEnum<
VideoPipeline::VideoFormat>(
787 s_videoFormats, sizeof(s_videoFormats) / sizeof(s_videoFormats[0])),
789 , m_videoFileType(new ValidatorEnum<
VideoPipeline::VideoFileType>(
790 s_videoFileTypes, sizeof(s_videoFileTypes) / sizeof(s_videoFileTypes[0])),
792 , m_videoBitRate(new ValidatorRange<uint32_t>(0,
VideoPipeline::VIDEO_BITRATE_MAX),0)
793 , m_outputSize(new ValidatorSize2D<uint32_t>(s_outputSizes,
794 sizeof(s_outputSizes) / sizeof(s_outputSizes[0]), true ),
795 Argus::Size2D<uint32_t>(0, 0))
797 , m_deFogEnable(false)
798 , m_deFogAmount(new ValidatorRange<float>(0.0f, 1.0f), 0.9f)
799 , m_deFogQuality(new ValidatorRange<float>(0.0f, 1.0f), 0.14285f)
800 , m_initialized(false)
801 , m_iCameraProvider(NULL)
809 REPORT_ERROR(
"Failed to shutdown");
814 static InitOnce initOnce;
817 if (initOnce.begin())
826 REPORT_ERROR(
"Initalization failed");
839 m_cameraProvider = Argus::UniqueObj<Argus::CameraProvider>(Argus::CameraProvider::create());
841 if (!m_iCameraProvider)
842 ORIGINATE_ERROR(
"Failed to create CameraProvider");
843 printf(
"Argus Version: %s\n", m_iCameraProvider->getVersion().c_str());
850 ORIGINATE_ERROR(
"No cameras available");
857 PROPAGATE_ERROR_CONTINUE(
m_deviceIndex.registerObserver(
this,
873 PROPAGATE_ERROR_CONTINUE(
m_deviceIndex.unregisterObserver(
this,
887 assert(
static_cast<const Value<uint32_t>&
>(source).
get() ==
m_deviceIndex);
901 const Argus::ICameraProperties *iCameraProperties =
903 if (!iCameraProperties)
904 ORIGINATE_ERROR(
"Failed to get ICameraProperties interface");
907 if (iCameraProperties->getAllSensorModes(&
m_sensorModes) != Argus::STATUS_OK)
908 ORIGINATE_ERROR(
"Failed to get sensor modes");
911 ORIGINATE_ERROR(
"No sensor modes found");
917 Argus::Range<float> digitalGainRange = iCameraProperties->getIspDigitalGainRange();
918 Argus::Range<float> deviceExposureCompensationRange =
919 iCameraProperties->getExposureCompensationRange();
928 Argus::Range<float> unifiedDigitalGainRange(0);
929 unifiedDigitalGainRange.min() =
931 unifiedDigitalGainRange.max() =
934 Argus::Range<float> unifiedExposureCompensationRange(0);
935 unifiedExposureCompensationRange.min() =
937 deviceExposureCompensationRange.min());
938 unifiedExposureCompensationRange.max() =
940 deviceExposureCompensationRange.max());
943 Argus::Range<Argus::Range<float> >(unifiedDigitalGainRange)));
945 Argus::Range<float> (unifiedExposureCompensationRange)));
953 digitalGainRange, digitalGainRange)));
955 deviceExposureCompensationRange)));
959 std::vector<ValidatorEnum<uint32_t>::ValueStringPair> valueStringPairs;
961 for (
size_t index = 0; index <
m_sensorModes.size(); ++index)
963 Argus::ISensorMode *sensorMode =
964 Argus::interface_cast<Argus::ISensorMode>(
m_sensorModes[index]);
966 valueStringPairs[index].value = (uint32_t)index;
968 std::ostringstream stream;
969 stream << index <<
": "
970 << sensorMode->getResolution().width() <<
"x" << sensorMode->getResolution().height();
972 Argus::Ext::IPwlWdrSensorMode* pwlMode =
973 Argus::interface_cast<Argus::Ext::IPwlWdrSensorMode>(
m_sensorModes[index]);
976 stream <<
" @" << sensorMode->getInputBitDepth() <<
"bpp -> " <<
977 sensorMode->getOutputBitDepth() <<
"bpp";
981 stream <<
" @" << sensorMode->getOutputBitDepth() <<
"bpp";
983 valueStringPairs[index].string = stream.str();
986 ValidatorEnum<uint32_t> *validator =
988 PROPAGATE_ERROR(validator->setValidValues(valueStringPairs.data(), valueStringPairs.size()));
1005 Argus::ISensorMode *iSensorMode =
1008 ORIGINATE_ERROR(
"Failed to get ISensorMode interface");
1011 Argus::Range<uint64_t> sensorExposureTimeRange = iSensorMode->getExposureTimeRange();
1012 Argus::Range<float> sensorAnalogGainRange = iSensorMode->getAnalogGainRange();
1013 Argus::Range<TimeValue> sensorFrameDurationRange(
1016 Argus::Range<float> sensorFrameRateRange(
1017 sensorFrameDurationRange.max().toCyclesPerSec(),
1018 sensorFrameDurationRange.min().toCyclesPerSec());
1021 Argus::Range<uint64_t> unifiedSensorExposureTimeRange(0);
1022 unifiedSensorExposureTimeRange.min() =
1024 unifiedSensorExposureTimeRange.max() =
1026 Argus::Range<float> unifiedSensorAnalogGainRange(0);
1027 unifiedSensorAnalogGainRange.min() =
1029 unifiedSensorAnalogGainRange.max() =
1031 Argus::Range<float> unifiedSensorFrameRateRange(0.0f);
1032 unifiedSensorFrameRateRange.min() =
1034 unifiedSensorFrameRateRange.max() =
1038 Argus::Range<Argus::Range<uint64_t> >(unifiedSensorExposureTimeRange)));
1040 Argus::Range<Argus::Range<float> >(unifiedSensorAnalogGainRange)));
1045 PROPAGATE_ERROR(
m_gainRange.set(sensorAnalogGainRange));
1046 PROPAGATE_ERROR(
m_frameRate.set(sensorFrameRateRange.max()));
1050 sensorExposureTimeRange, sensorExposureTimeRange)));
1052 sensorAnalogGainRange, sensorAnalogGainRange)));
1066 std::ostringstream stream;
1070 stream <<
"Argus extensions:" << std::endl;
1071 stream <<
" BayerSharpnessMap: " <<
1073 "supported" :
"not supported") << std::endl;
1074 stream <<
" DebugCaptureSession: " <<
1076 "supported" :
"not supported") << std::endl;
1077 stream <<
" DeFog: " <<
1079 "supported" :
"not supported") << std::endl;
1080 stream <<
" FaceDetect: " <<
1082 "supported" :
"not supported") << std::endl;
1083 stream <<
" InternalFrameCount: " <<
1085 "supported" :
"not supported") << std::endl;
1086 stream <<
" SensorPrivateMetadata: " <<
1088 "supported" :
"not supported") << std::endl;
1090 stream <<
"Number of camera devices: " <<
m_cameraDevices.size() << std::endl;
1092 for (uint32_t deviceIndex = 0; deviceIndex <
m_cameraDevices.size(); ++deviceIndex)
1094 stream <<
"Device: " << deviceIndex << std::endl;
1096 const Argus::ICameraProperties *iCameraProperties =
1097 Argus::interface_cast<Argus::ICameraProperties>(
m_cameraDevices[deviceIndex]);
1098 if (!iCameraProperties)
1099 ORIGINATE_ERROR(
"Failed to get ICameraProperties interface");
1101 stream <<
" Max AE Regions: " <<
1102 iCameraProperties->getMaxAeRegions() << std::endl;
1103 stream <<
" Max AWB Regions: " <<
1104 iCameraProperties->getMaxAwbRegions() << std::endl;
1105 stream <<
" Focus Position Range: " <<
1106 iCameraProperties->getFocusPositionRange().min() <<
" - " <<
1107 iCameraProperties->getFocusPositionRange().max() << std::endl;
1108 stream <<
" Lens Aperture Range: " <<
1109 iCameraProperties->getLensApertureRange().min() <<
" - " <<
1110 iCameraProperties->getLensApertureRange().max() << std::endl;
1111 stream <<
" Isp Digital Gain Range: " <<
1112 iCameraProperties->getIspDigitalGainRange().min() <<
" - " <<
1113 iCameraProperties->getIspDigitalGainRange().max() << std::endl;
1116 std::vector<Argus::SensorMode*> sensorModes;
1117 iCameraProperties->getAllSensorModes(&sensorModes);
1118 stream <<
" Number of sensor modes: " << sensorModes.size() << std::endl;
1119 for (uint32_t sensorModeIndex = 0; sensorModeIndex < sensorModes.size(); ++sensorModeIndex)
1121 Argus::ISensorMode *sensorMode =
1122 Argus::interface_cast<Argus::ISensorMode>(sensorModes[sensorModeIndex]);
1124 ORIGINATE_ERROR(
"Failed to get ISensorMode interface");
1128 sensorMode->getFrameDurationRange().min()).toCyclesPerSec();
1130 sensorMode->getFrameDurationRange().max()).toCyclesPerSec();
1132 stream <<
" Sensor mode: " << sensorModeIndex << std::endl;
1133 stream <<
" Resolution: " <<
1134 sensorMode->getResolution().width() <<
"x" <<
1135 sensorMode->getResolution().height() << std::endl;
1136 stream <<
" Exposure time range: " <<
1137 sensorMode->getExposureTimeRange().min() <<
" - " <<
1138 sensorMode->getExposureTimeRange().max() <<
" ns" << std::endl;
1139 stream <<
" Frame duration range: " <<
1140 sensorMode->getFrameDurationRange().min() <<
" - " <<
1141 sensorMode->getFrameDurationRange().max() <<
" ns" << std::endl;
1142 stream <<
" Framerate range: " <<
1143 minimum_fps <<
" - " <<
1144 maximum_fps <<
" fps" << std::endl;
1145 stream <<
" InputBitDepth: " <<
1146 sensorMode->getInputBitDepth() << std::endl;
1147 stream <<
" OutputBitDepth: " <<
1148 sensorMode->getOutputBitDepth() << std::endl;
1149 stream <<
" Analog gain range: " <<
1150 sensorMode->getAnalogGainRange().min() <<
" - " <<
1151 sensorMode->getAnalogGainRange().max() << std::endl;
1153 stream <<
" SensorModeType: " <<
1154 sensorMode->getSensorModeType().getName() << std::endl;
1156 Argus::Ext::IPwlWdrSensorMode* pwlMode =
1157 Argus::interface_cast<Argus::Ext::IPwlWdrSensorMode>(sensorModes[sensorModeIndex]);
1160 stream <<
" Piecewise Linear WDR Extension supported with: " <<
1161 pwlMode->getControlPointCount() <<
" control points." << std::endl;
1162 std::vector< Argus::Point2D<float> > points;
1163 Argus::Status status = pwlMode->getControlPoints(&points);
1164 if (status != Argus::STATUS_OK)
1165 ORIGINATE_ERROR(
"Error obtaining control points");
1166 stream <<
" Control Points: " << std::endl;
1167 for (uint32_t j = 0; j < pwlMode->getControlPointCount(); j++)
1169 stream <<
" (" << points[j].x() <<
", " <<
1170 points[j].y() <<
")" << std::endl;
1174 stream << std::endl;
1178 info = stream.str();
1188 ORIGINATE_ERROR(
"Invalid sensor mode index");
1208 uint32_t deviceIndex)
1213 ORIGINATE_ERROR(
"Invalid device index");
1220 Argus::UniqueObj<Argus::CaptureSession> newSession(
1223 ORIGINATE_ERROR(
"Failed to create CaptureSession");
1225 PROPAGATE_ERROR(session.
reset(newSession.release(),
this));
1235 Argus::Ext::IDebugCaptureSession *iDebugCaptureSession =
1236 Argus::interface_cast<Argus::Ext::IDebugCaptureSession>(it->m_session);
1237 if (!iDebugCaptureSession)
1238 ORIGINATE_ERROR(
"DebugCaptureSession extension not supported");
1240 const Argus::Status status = iDebugCaptureSession->dump(STDOUT_FILENO);
1241 if (status != Argus::STATUS_OK)
1242 ORIGINATE_ERROR(
"Failed to get dump runtime info");
1281 if (it->m_session == session)
1288 ORIGINATE_ERROR(
"Session not found");
1292 Argus::CaptureSession *session)
1301 Argus::IEventProvider *iEventProvider = Argus::interface_cast<Argus::IEventProvider>(session);
1302 if (!iEventProvider)
1303 ORIGINATE_ERROR(
"Failed to get iEventProvider interface");
1306 const Argus::Status status = iEventProvider->waitForEvents(eventQueue, timeout.
toNSec());
1307 if ((status != Argus::STATUS_OK) && (status != Argus::STATUS_TIMEOUT))
1308 ORIGINATE_ERROR(
"Failed to get events");
1314 Argus::CaptureIntent captureIntent, Argus::CaptureSession *session)
1323 Argus::ICaptureSession *iCaptureSession =
1324 Argus::interface_cast<Argus::ICaptureSession>(session);
1325 if (!iCaptureSession)
1326 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1329 Argus::UniqueObj<Argus::Request> newRequest =
1330 Argus::UniqueObj<Argus::Request>(iCaptureSession->createRequest(captureIntent));
1332 ORIGINATE_ERROR(
"Failed to create request");
1335 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(newRequest);
1337 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1340 Argus::ISourceSettings *iSourceSettings =
1341 Argus::interface_cast<Argus::ISourceSettings>(iRequest->getSourceSettings());
1342 if (!iSourceSettings)
1343 ORIGINATE_ERROR(
"Failed to get ISourceSettings interface");
1349 Argus::IAutoControlSettings *iAutoControlSettings =
1350 Argus::interface_cast<Argus::IAutoControlSettings>(iRequest->getAutoControlSettings());
1351 if (!iAutoControlSettings)
1352 ORIGINATE_ERROR(
"Failed to get IAutoControlSettings interface");
1358 Argus::IDenoiseSettings *iDenoiseSettings =
1359 Argus::interface_cast<Argus::IDenoiseSettings>(newRequest);
1360 if (!iDenoiseSettings)
1361 ORIGINATE_ERROR(
"Failed to get IDenoiseSettings interface");
1365 Argus::IEdgeEnhanceSettings *iEdgeEnhanceSettings =
1366 Argus::interface_cast<Argus::IEdgeEnhanceSettings>(newRequest);
1367 if (!iEdgeEnhanceSettings)
1368 ORIGINATE_ERROR(
"Failed to get IEdgeEnhanceSettings interface");
1372 Argus::IVideoStabilizationSettings *iVideoStabilizationSettings =
1373 Argus::interface_cast<Argus::IVideoStabilizationSettings>(newRequest);
1374 if (!iVideoStabilizationSettings)
1375 ORIGINATE_ERROR(
"Failed to get IVideoStabilizationSettings interface");
1381 Argus::Ext::IDeFogSettings *iDeFogSettings =
1382 Argus::interface_cast<Argus::Ext::IDeFogSettings>(newRequest);
1390 PROPAGATE_ERROR(request.
reset(newRequest.release(),
this));
1402 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
1404 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1407 Argus::ISourceSettings *iSourceSettings =
1408 Argus::interface_cast<Argus::ISourceSettings>(iRequest->getSourceSettings());
1409 if (!iSourceSettings)
1410 ORIGINATE_ERROR(
"Failed to get ISourceSettings interface");
1416 Argus::IAutoControlSettings *iAutoControlSettings =
1417 Argus::interface_cast<Argus::IAutoControlSettings>(iRequest->getAutoControlSettings());
1418 if (!iAutoControlSettings)
1419 ORIGINATE_ERROR(
"Failed to get IAutoControlSettings interface");
1425 Argus::IDenoiseSettings *iDenoiseSettings =
1426 Argus::interface_cast<Argus::IDenoiseSettings>(request);
1427 if (!iDenoiseSettings)
1428 ORIGINATE_ERROR(
"Failed to get IDenoiseSettings interface");
1432 Argus::IEdgeEnhanceSettings *iEdgeEnhanceSettings =
1433 Argus::interface_cast<Argus::IEdgeEnhanceSettings>(request);
1434 if (!iEdgeEnhanceSettings)
1435 ORIGINATE_ERROR(
"Failed to get IEdgeEnhanceSettings interface");
1439 Argus::IVideoStabilizationSettings *iVideoStabilizationSettings =
1440 Argus::interface_cast<Argus::IVideoStabilizationSettings>(request);
1441 if (!iVideoStabilizationSettings)
1442 ORIGINATE_ERROR(
"Failed to get IVideoStabilizationSettings interface");
1448 Argus::Ext::IDeFogSettings *iDeFogSettings =
1449 Argus::interface_cast<Argus::Ext::IDeFogSettings>(request);
1461 Argus::UniqueObj<Argus::EventQueue>& eventQueue, Argus::CaptureSession *session)
1470 Argus::IEventProvider *iEventProvider =
1471 Argus::interface_cast<Argus::IEventProvider>(session);
1472 if (!iEventProvider)
1473 ORIGINATE_ERROR(
"Failed to get IEventProvider interface");
1475 Argus::EventQueue *newEventQueue = iEventProvider->createEventQueue(eventTypes);
1477 ORIGINATE_ERROR(
"Failed to create eventQueue");
1479 eventQueue.reset(newEventQueue);
1493 Argus::ICaptureSession *iCaptureSession =
1494 Argus::interface_cast<Argus::ICaptureSession>(session);
1495 if (!iCaptureSession)
1496 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1498 if (iCaptureSession->capture(request, Argus::TIMEOUT_INFINITE) == 0)
1499 ORIGINATE_ERROR(
"Failed to submit the still capture request");
1513 Argus::ICaptureSession *iCaptureSession =
1514 Argus::interface_cast<Argus::ICaptureSession>(session);
1515 if (!iCaptureSession)
1516 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1518 if (iCaptureSession->repeat(request) != Argus::STATUS_OK)
1519 ORIGINATE_ERROR(
"Failed to submit repeating capture request");
1526 if (it->m_session == session)
1528 it->m_requests.push_back(request);
1534 ORIGINATE_ERROR(
"Did not find the session in the list of active sessions");
1540 Argus::CaptureSession *session)
1549 Argus::ICaptureSession *iCaptureSession =
1550 Argus::interface_cast<Argus::ICaptureSession>(session);
1551 if (!iCaptureSession)
1552 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1554 if (iCaptureSession->repeatBurst(requestList) != Argus::STATUS_OK)
1555 ORIGINATE_ERROR(
"Failed to submit repeating burst request");
1562 if (it->m_session == session)
1564 it->m_requests.insert(it->m_requests.end(), requestList.begin(), requestList.end());
1570 ORIGINATE_ERROR(
"Did not find the session in the list of active sessions");
1584 Argus::ICaptureSession *iCaptureSession =
1585 Argus::interface_cast<Argus::ICaptureSession>(session);
1586 if (!iCaptureSession)
1587 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1589 iCaptureSession->stopRepeat();
1596 if (it->m_session == session)
1598 it->m_requests.clear();
1604 ORIGINATE_ERROR(
"Did not find the session in the list of active sessions");
1614 if (!it->m_requests.empty())
1616 Argus::ICaptureSession *iCaptureSession =
1617 Argus::interface_cast<Argus::ICaptureSession>(it->m_session);
1618 if (!iCaptureSession)
1619 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1621 iCaptureSession->stopRepeat();
1623 if (iCaptureSession->repeatBurst(it->m_requests) != Argus::STATUS_OK)
1624 ORIGINATE_ERROR(
"Failed to submit repeating burst request");
1640 Argus::ICaptureSession *iCaptureSession =
1641 Argus::interface_cast<Argus::ICaptureSession>(session);
1642 if (!iCaptureSession)
1644 REPORT_ERROR(
"Failed to get ICaptureSession interface");
1648 return iCaptureSession->maxBurstRequests();
1660 Argus::ICaptureSession *iCaptureSession =
1661 Argus::interface_cast<Argus::ICaptureSession>(session);
1662 if (!iCaptureSession)
1663 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1665 if (iCaptureSession->waitForIdle() != Argus::STATUS_OK)
1666 ORIGINATE_ERROR(
"Waiting for idle failed");
1679 Argus::ISensorMode *sensorMode =
1682 ORIGINATE_ERROR(
"Failed to get ISensorMode interface");
1683 *size = sensorMode->getResolution();
1694 Argus::UniqueObj<Argus::OutputStream> &stream, Argus::CaptureSession *session)
1703 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
1705 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1707 Argus::Size2D<uint32_t> outputSize;
1710 Argus::ICaptureSession *iCaptureSession =
1711 Argus::interface_cast<Argus::ICaptureSession>(session);
1712 if (!iCaptureSession)
1713 ORIGINATE_ERROR(
"Failed to get ICaptureSession interface");
1715 Argus::UniqueObj<Argus::OutputStreamSettings> outputStreamSettings(
1716 iCaptureSession->createOutputStreamSettings());
1717 Argus::IOutputStreamSettings* iOutputStreamSettings =
1718 Argus::interface_cast<Argus::IOutputStreamSettings>(outputStreamSettings);
1719 if (!iOutputStreamSettings)
1720 ORIGINATE_ERROR(
"Failed to get IOutputStreamSettings interface");
1722 iOutputStreamSettings->setPixelFormat(Argus::PIXEL_FMT_YCbCr_420_888);
1723 iOutputStreamSettings->setResolution(outputSize);
1725 iOutputStreamSettings->setMetadataEnable(enableMetadata);
1727 Argus::UniqueObj<Argus::OutputStream> outputStream(
1728 iCaptureSession->createOutputStream(outputStreamSettings.get()));
1730 ORIGINATE_ERROR(
"Failed to create OutputStream");
1732 stream.reset(outputStream.release());
1739 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
1741 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1744 if (iRequest->enableOutputStream(stream) != Argus::STATUS_OK)
1745 ORIGINATE_ERROR(
"Failed to enable the output stream");
1752 Argus::IRequest *iRequest = Argus::interface_cast<Argus::IRequest>(request);
1754 ORIGINATE_ERROR(
"Failed to get IRequest interface");
1757 if (iRequest->disableOutputStream(stream) != Argus::STATUS_OK)
1758 ORIGINATE_ERROR(
"Failed to disable the output stream");
1765 UniquePointer<DenoiseSettingsObserver> denoiseSettings;
1768 if (!denoiseSettings)
1769 ORIGINATE_ERROR(
"Out of memory");
1771 m_observers.push_front(denoiseSettings.release());
1777 UniquePointer<EdgeEnhanceSettingsObserver> edgeEnhanceSettings;
1780 if (!edgeEnhanceSettings)
1781 ORIGINATE_ERROR(
"Out of memory");
1783 m_observers.push_front(edgeEnhanceSettings.release());
1789 UniquePointer<VideoStabilizationSettingsObserver> vStabSettings;
1793 ORIGINATE_ERROR(
"Out of memory");
1801 UniquePointer<SourceSettingsObserver> sourceSettings;
1804 if (!sourceSettings)
1805 ORIGINATE_ERROR(
"Out of memory");
1813 UniquePointer<AutoControlSettingsObserver> autoControlSettings;
1816 if (!autoControlSettings)
1817 ORIGINATE_ERROR(
"Out of memory");
1819 m_observers.push_front(autoControlSettings.release());
1825 UniquePointer<DeFogSettingsObserver> deFogSettings;
1829 ORIGINATE_ERROR(
"Out of memory");
1837 for (std::list<IObserverForInterface*>::iterator it =
m_observers.begin();
1840 if ((*it)->isInterface(interface))
1848 ORIGINATE_ERROR(
"Observer not found");
1857 va_start(list, msg);
1859 if (vprintf(msg, list) < 0)
1862 ORIGINATE_ERROR(
"Failed to print message");