mirror of
https://github.com/openharmony/distributed_camera.git
synced 2026-07-19 16:43:57 -04:00
@@ -90,6 +90,8 @@ 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(const std::shared_ptr<CaptureInfo>& srcCaptureInfo,
|
||||
std::vector<std::shared_ptr<DCStreamInfo>>& srcStreamInfo);
|
||||
|
||||
private:
|
||||
std::shared_ptr<DMetadataProcessor> dMetadataProcessor_;
|
||||
|
||||
@@ -699,12 +699,7 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr<
|
||||
bool isStreaming)
|
||||
{
|
||||
std::vector<std::shared_ptr<DCStreamInfo>> srcStreamInfo;
|
||||
for (auto &id : srcCaptureInfo->streamIds_) {
|
||||
auto iter = dcStreamInfoMap_.find(id);
|
||||
if (iter != dcStreamInfoMap_.end()) {
|
||||
srcStreamInfo.push_back(iter->second);
|
||||
}
|
||||
}
|
||||
SetSrcStreamInfo(srcCaptureInfo, srcStreamInfo);
|
||||
if (srcStreamInfo.empty()) {
|
||||
DHLOGE("Input source stream info vector is empty.");
|
||||
return DCamRetCode::INVALID_ARGUMENT;
|
||||
@@ -751,6 +746,17 @@ DCamRetCode DStreamOperator::NegotiateSuitableCaptureInfo(const std::shared_ptr<
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
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);
|
||||
if (iter != dcStreamInfoMap_.end()) {
|
||||
srcStreamInfo.push_back(iter->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<DCCaptureInfo> DStreamOperator::BuildSuitableCaptureInfo(const shared_ptr<CaptureInfo>& srcCaptureInfo,
|
||||
std::vector<std::shared_ptr<DCStreamInfo>> &srcStreamInfo)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ private:
|
||||
int32_t StartVideoOutput();
|
||||
void SetQualityAndGpsLocation(const std::shared_ptr<Camera::CameraMetadata>& cameraMetadata,
|
||||
std::shared_ptr<CameraStandard::PhotoCaptureSetting>& photoCaptureSettings);
|
||||
void ReleasCaptureSession();
|
||||
|
||||
bool isInit_;
|
||||
std::string cameraId_;
|
||||
|
||||
@@ -167,19 +167,7 @@ int32_t DCameraClient::StopCapture()
|
||||
photoOutput_->Release();
|
||||
photoOutput_ = nullptr;
|
||||
}
|
||||
|
||||
if (captureSession_ != nullptr) {
|
||||
DHLOGI("DCameraClient::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str());
|
||||
int32_t ret = captureSession_->Stop();
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d",
|
||||
GetAnonyString(cameraId_).c_str(), ret);
|
||||
}
|
||||
DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str());
|
||||
captureSession_->Release();
|
||||
captureSession_ = nullptr;
|
||||
}
|
||||
|
||||
ReleasCaptureSession();
|
||||
if (cameraInput_ != nullptr) {
|
||||
DHLOGI("DCameraClient::StopCapture %s release cameraInput", GetAnonyString(cameraId_).c_str());
|
||||
cameraInput_->Release();
|
||||
@@ -214,6 +202,22 @@ int32_t DCameraClient::StopCapture()
|
||||
return DCAMERA_OK;
|
||||
}
|
||||
|
||||
void DCameraClient::ReleasCaptureSession()
|
||||
{
|
||||
if (captureSession_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
DHLOGI("DCameraClient::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str());
|
||||
int32_t ret = captureSession_->Stop();
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraClient::StopCapture captureSession stop failed, cameraId: %s, ret: %d",
|
||||
GetAnonyString(cameraId_).c_str(), ret);
|
||||
}
|
||||
DHLOGI("DCameraClient::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str());
|
||||
captureSession_->Release();
|
||||
captureSession_ = nullptr;
|
||||
}
|
||||
|
||||
int32_t DCameraClient::SetStateCallback(std::shared_ptr<StateCallback>& callback)
|
||||
{
|
||||
DHLOGI("DCameraClient::SetStateCallback cameraId: %s", GetAnonyString(cameraId_).c_str());
|
||||
|
||||
@@ -146,17 +146,7 @@ int32_t DCameraClient::StartCapture(std::vector<std::shared_ptr<DCameraCaptureIn
|
||||
int32_t DCameraClient::StopCapture()
|
||||
{
|
||||
DHLOGI("DCameraClientCommon::StopCapture cameraId: %s", GetAnonyString(cameraId_).c_str());
|
||||
if (captureSession_ != nullptr) {
|
||||
DHLOGI("DCameraClientCommon::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str());
|
||||
int32_t ret = captureSession_->Stop();
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d",
|
||||
GetAnonyString(cameraId_).c_str(), ret);
|
||||
}
|
||||
DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str());
|
||||
captureSession_->Release();
|
||||
captureSession_ = nullptr;
|
||||
}
|
||||
ReleasCaptureSession();
|
||||
|
||||
if (cameraInput_ != nullptr) {
|
||||
DHLOGI("DCameraClientCommon::StopCapture %s release cameraInput", GetAnonyString(cameraId_).c_str());
|
||||
@@ -194,6 +184,22 @@ int32_t DCameraClient::StopCapture()
|
||||
return DCAMERA_OK;
|
||||
}
|
||||
|
||||
void DCameraClient::ReleasCaptureSession()
|
||||
{
|
||||
if (captureSession_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
DHLOGI("DCameraClientCommon::StopCapture %s stop captureSession", GetAnonyString(cameraId_).c_str());
|
||||
int32_t ret = captureSession_->Stop();
|
||||
if (ret != DCAMERA_OK) {
|
||||
DHLOGE("DCameraClientCommon::StopCapture captureSession stop failed, cameraId: %s, ret: %d",
|
||||
GetAnonyString(cameraId_).c_str(), ret);
|
||||
}
|
||||
DHLOGI("DCameraClientCommon::StopCapture %s release captureSession", GetAnonyString(cameraId_).c_str());
|
||||
captureSession_->Release();
|
||||
captureSession_ = nullptr;
|
||||
}
|
||||
|
||||
int32_t DCameraClient::SetStateCallback(std::shared_ptr<StateCallback>& callback)
|
||||
{
|
||||
DHLOGI("DCameraClientCommon::SetStateCallback cameraId: %s", GetAnonyString(cameraId_).c_str());
|
||||
|
||||
Reference in New Issue
Block a user