提交 afc6cd4e 编写于 作者: O openharmony_ci 提交者: Gitee

!36 修改camera问题

Merge pull request !36 from harmony_zhangjian/master
...@@ -503,9 +503,7 @@ void CameraAbilitySlice::OnStart(const Want &want) ...@@ -503,9 +503,7 @@ void CameraAbilitySlice::OnStart(const Want &want)
SetHead(); SetHead();
SetBottom(); SetBottom();
#ifndef __LINUX__
scroll->Add(bttnLeft); scroll->Add(bttnLeft);
#endif
scroll->Add(bttnMidle); scroll->Add(bttnMidle);
scroll->Add(bttnRight); scroll->Add(bttnRight);
scroll->Add(bttnRecord); scroll->Add(bttnRecord);
......
...@@ -455,7 +455,7 @@ void SampleCameraStateMng::StartRecord(Surface *mSurface) ...@@ -455,7 +455,7 @@ void SampleCameraStateMng::StartRecord(Surface *mSurface)
} }
} }
Surface *surface = (recorder_->GetSurface(0)).get(); auto surface = recorder_->GetSurface(0);
if (surface == nullptr) { if (surface == nullptr) {
return; return;
} }
...@@ -597,16 +597,8 @@ int SampleCameraManager::SampleCameraCreate() ...@@ -597,16 +597,8 @@ int SampleCameraManager::SampleCameraCreate()
list<string> camList = camKit->GetCameraIds(); list<string> camList = camKit->GetCameraIds();
for (auto &cam : camList) { for (auto &cam : camList) {
cout << "camera name:" << cam << endl; camId = cam;
const CameraAbility *ability = camKit->GetCameraAbility(cam); break;
/* find camera which fits user's ability */
list<CameraPicSize> sizeList = ability->GetSupportedSizes(0);
for (auto &pic : sizeList) {
if (pic.width == PIC_WIDTH && pic.height == PIC_HEIGHT) {
camId = cam;
break;
}
}
} }
if (camId.empty()) { if (camId.empty()) {
......
...@@ -255,7 +255,7 @@ public: ...@@ -255,7 +255,7 @@ public:
return; return;
} }
FrameConfig *fc = new FrameConfig(FRAME_CONFIG_RECORD); FrameConfig *fc = new FrameConfig(FRAME_CONFIG_RECORD);
Surface *surface = (recorder_->GetSurface(0)).get(); auto surface = recorder_->GetSurface(0);
surface->SetWidthAndHeight(1920, 1080); surface->SetWidthAndHeight(1920, 1080);
surface->SetQueueSize(3); surface->SetQueueSize(3);
surface->SetSize(1024 * 1024); surface->SetSize(1024 * 1024);
...@@ -300,7 +300,6 @@ public: ...@@ -300,7 +300,6 @@ public:
cout << "camera start preview failed. ret=" << ret << endl; cout << "camera start preview failed. ret=" << ret << endl;
return; return;
} }
delete surface;
previewState_ = STATE_RUNNING; previewState_ = STATE_RUNNING;
cout << "camera start preview succeed." << endl; cout << "camera start preview succeed." << endl;
} }
...@@ -372,16 +371,8 @@ int main() ...@@ -372,16 +371,8 @@ int main()
list<string> camList = camKit->GetCameraIds(); list<string> camList = camKit->GetCameraIds();
string camId; string camId;
for (auto &cam : camList) { for (auto &cam : camList) {
cout << "camera name:" << cam << endl; camId = cam;
const CameraAbility *ability = camKit->GetCameraAbility(cam); break;
/* find camera which fits user's ability */
list<CameraPicSize> sizeList = ability->GetSupportedSizes(0);
for (auto &pic : sizeList) {
if (pic.width == 1920 && pic.height == 1080) {
camId = cam;
break;
}
}
} }
if (camId.empty()) { if (camId.empty()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册