mirror of
https://github.com/openharmony/distributed_camera.git
synced 2026-07-19 16:43:57 -04:00
@@ -90,7 +90,7 @@ private:
|
||||
void ExtractStreamInfo(DCStreamInfo &dstStreamInfo, const std::shared_ptr<DCStreamInfo> &srcStreamInfo);
|
||||
void ExtractCaptureInfo(std::vector<DCCaptureInfo> &captureInfos);
|
||||
void ExtractCameraAttr(Json::Value &rootValue, std::set<int> &allFormats, std::vector<int> &photoFormats);
|
||||
void SetSrcStreamInfo(std::vector<std::shared_ptr<DCStreamInfo>>& srcStreamInfo);
|
||||
void SetSrcStreamInfo(const std::shared_ptr<CaptureInfo>& srcCaptureInfo, std::vector<std::shared_ptr<DCStreamInfo>>& srcStreamInfo);
|
||||
|
||||
private:
|
||||
std::shared_ptr<DMetadataProcessor> dMetadataProcessor_;
|
||||
|
||||
@@ -699,7 +699,7 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr<
|
||||
bool isStreaming)
|
||||
{
|
||||
std::vector<std::shared_ptr<DCStreamInfo>> srcStreamInfo;
|
||||
SetSrcStreamInfo(srcStreamInfo);
|
||||
SetSrcStreamInfo(srcCaptureInfo, srcStreamInfo);
|
||||
if (srcStreamInfo.empty()) {
|
||||
DHLOGE("Input source stream info vector is empty.");
|
||||
return DCamRetCode::INVALID_ARGUMENT;
|
||||
@@ -746,7 +746,7 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr<
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void DStreamOperator::SetSrcStreamInfo(std::vector<std::shared_ptr<DCStreamInfo>>& srcStreamInfo)
|
||||
void DStreamOperator::SetSrcStreamInfo(const std::shared_ptr<CaptureInfo>& srcCaptureInfo, std::vector<std::shared_ptr<DCStreamInfo>>& srcStreamInfo)
|
||||
{
|
||||
for (auto &id : srcCaptureInfo->streamIds_) {
|
||||
auto iter = dcStreamInfoMap_.find(id);
|
||||
|
||||
@@ -58,6 +58,9 @@ typedef enum {
|
||||
DCAMERA_EVENT_START_CAPTURE_ERROR = -6,
|
||||
DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7,
|
||||
DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8,
|
||||
DCAMERA_EVENT_DEVICE_PREEMPT = -9,
|
||||
DCAMERA_EVENT_DEVICE_IN_USE = -10,
|
||||
DCAMERA_EVENT_NO_PERMISSION = -11,
|
||||
} DCameraEventResult;
|
||||
|
||||
typedef enum {
|
||||
|
||||
+5
-2
@@ -31,10 +31,13 @@ void DCameraInputCallback::OnError(const int32_t errorType, const int32_t errorM
|
||||
DHLOGE("DCameraInputCallback::OnError StateCallback is null");
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<DCameraEvent> event = std::make_shared<DCameraEvent>();
|
||||
event->eventType_ = DCAMERA_MESSAGE;
|
||||
event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR;
|
||||
if (errorType == CamServiceError::) {
|
||||
event->eventResult_ = DCAMERA_DEVICE_PREEMPT;
|
||||
} else {
|
||||
event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR;
|
||||
}
|
||||
callback_->OnStateChanged(event);
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ void DCameraPhotoCallback::OnCaptureError(const int32_t captureId, const int32_t
|
||||
|
||||
std::shared_ptr<DCameraEvent> event = std::make_shared<DCameraEvent>();
|
||||
event->eventType_ = DCAMERA_MESSAGE;
|
||||
event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR;
|
||||
event->eventResult_ = DCAMERA_DEVICE_ERROR;
|
||||
callback_->OnStateChanged(event);
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
|
||||
+9
-5
@@ -79,7 +79,7 @@ int32_t DCameraSinkController::StopCapture()
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraSinkController::StopCapture client stop capture failed, dhId: %s, ret: %d",
|
||||
GetAnonyString(dhId_).c_str(), ret);
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("operator stop capture failed"));
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("operator stop capture failed"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int32_t DCameraSinkController::StopCapture()
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraSinkController::StopCapture output stop capture failed, dhId: %s, ret: %d",
|
||||
GetAnonyString(dhId_).c_str(), ret);
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("output stop capture failed"));
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("output stop capture failed"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -309,7 +309,11 @@ void DCameraSinkController::OnStateChanged(std::shared_ptr<DCameraEvent>& event)
|
||||
{
|
||||
DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d",
|
||||
GetAnonyString(dhId_).c_str(), event->eventResult_);
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error"));
|
||||
if (event->eventResult_ == CamServiceError::) {
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera preempted"));
|
||||
} else {
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error"));
|
||||
}
|
||||
}
|
||||
|
||||
void DCameraSinkController::OnMetadataResult()
|
||||
@@ -387,7 +391,7 @@ int32_t DCameraSinkController::StartCaptureInner(std::vector<std::shared_ptr<DCa
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraSinkController::StartCaptureInner output start capture failed, dhId: %s, ret: %d",
|
||||
GetAnonyString(dhId_).c_str(), ret);
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("output start capture failed"));
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("output start capture failed"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -395,7 +399,7 @@ int32_t DCameraSinkController::StartCaptureInner(std::vector<std::shared_ptr<DCa
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraSinkController::StartCaptureInner camera client start capture failed, dhId: %s, ret: %d",
|
||||
GetAnonyString(dhId_).c_str(), ret);
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("operator start capture failed"));
|
||||
DCameraNotifyInner(DCAMERA_MESSAGE, ret, std::string("operator start capture failed"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user