Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: adding method to access CameraManager #528

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

anjok
Copy link

@anjok anjok commented Jul 2, 2023

one way to fix issue #527

Copy link
Collaborator

@naushir naushir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes seems reasonable, so I am happy to merge something along these lines. However, from our discussion on #527, you will want to pass this pointer into LibcameraApp::GetCameras() which takes in a const std::unique_ptr<CameraManager> & as a parameter. Perhaps this function also needs to change to take in a const libcamera::CameraManager * instead?

@@ -773,6 +773,11 @@ libcamera::Stream *LibcameraApp::GetMainStream() const
return nullptr;
}

libcamera::CameraManager *LibcameraApp::GetCameraManager() const
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this function should return a const libcamera::CameraManager * value?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. as I said, my c++ is stuck in the late 90s...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ought to change to return const libcamera::CameraManager *

@naushir
Copy link
Collaborator

naushir commented Jul 3, 2023

One more thing, could you add a small description to the commit message, and end it with a Signed-off-by: tag?

@anjok anjok force-pushed the ak/camera_manager branch 2 times, most recently from 3aaaec2 to ac5a0f9 Compare July 5, 2023 16:00
Copy link
Collaborator

@naushir naushir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, in the commit message, could you please use your name and email on the Signed-off-by line?

Signed-off-by: Your Name <[email protected]>

@@ -773,6 +773,11 @@ libcamera::Stream *LibcameraApp::GetMainStream() const
return nullptr;
}

libcamera::CameraManager *LibcameraApp::GetCameraManager() const
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ought to change to return const libcamera::CameraManager *

{
return GetCameras(camera_manager_);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the GetCameras() override is needed right? Instead you need to change (below):

static std::vector<std::shared_ptr<libcamera::Camera>> GetCameras(const std::unique_ptr<CameraManager> &cm)

to

static std::vector<std::shared_ptr<libcamera::Camera>> GetCameras(const CameraManager> *cm)

Copy link
Author

@anjok anjok Jul 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right.

But I already have a LibCameraApp, so I might as well just use a new app->GetCameras() off of it and not deal with the camera manager at all? After all, I was only doing that because that's what the multiple other code pieces in LibCameraApp did and you didn't have a singular means to get at the list.

Also, you'd need to change "public", if interim, API.. I don't care one way or another, but given there's no way to get at the manager without an app in the first place, and there's not way to get a unique_ptr without having one first, I would recommend (again without knowing a lot about what all of this does or should do) to remove the static method and just have an instance method....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so the options use that method... why? I guess this is where our problems came from, as we're using the options when the app has already been created. So now you have two cam managers... at least I think so.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another place that uses GetCameras() with the camera manager already opened. This is why passing in an external camera manager must still be supported.

@anjok anjok force-pushed the ak/camera_manager branch from ac5a0f9 to 32f2c0d Compare July 7, 2023 16:21
Added the ability to get at the CameraManager to allow for access to the Camera list.
Also addded instance method to get the Camera list.

Signed-off-by: Anjo Krank <[email protected]>
@anjok anjok force-pushed the ak/camera_manager branch from 32f2c0d to f246e99 Compare July 7, 2023 19:08
@anjok
Copy link
Author

anjok commented Jul 7, 2023

Additionally, in the commit message, could you please use your name and email on the Signed-off-by line?

Signed-off-by: Your Name <[email protected]>

Fixed... but I was under the impression that this would be the committer who said "this is ok to merge"? Why can I sign off my own stuff as an external?

@naushir
Copy link
Collaborator

naushir commented Jul 10, 2023

Additionally, in the commit message, could you please use your name and email on the Signed-off-by line?

Signed-off-by: Your Name <[email protected]>

Fixed... but I was under the impression that this would be the committer who said "this is ok to merge"? Why can I sign off my own stuff as an external?

The Signed-off-by tag is signed by the author/submitter of the commit for traceability reasons.

@naushir naushir merged commit 69122be into raspberrypi:main Jul 10, 2023
@anjok anjok deleted the ak/camera_manager branch July 10, 2023 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants