summaryrefslogtreecommitdiff
path: root/simple-cam.cpp
AgeCommit message (Collapse)Author
2022-07-19simple-cam: Update to the new ControList::get() APILaurent Pinchart
The ControlList::get() function has changed and now returns a std::optional<T>. Adapt simple-cam accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-22simple-cam: processRequest: Report Request metadataKieran Bingham
The completed Request can contain extra data associated with the completed capture to report IPA state or properties of the capture to the application. Process and report any metadata that is associated with the request when it completes, to demonstrate the extra metadata available to be processed. Now that there is substantially more information than one line per completed request, start each completed Request with a blank line to separate from previous completions and report the state of the Request itself with its .toString() helper. Suggested-by: Nejc Galof <galof.nejc@gmail.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-22simple-cam: processRequest: Report timestamp and enhance descriptionKieran Bingham
Report the timestamp of the completed buffers when the processRequest() call handles a request and improve the description to discuss more of the operations that can be done here. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-28simple-cam: Use matching type to store stream sizeDorota Czaplejewicz
Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-28simple-cam: Turn globals staticDorota Czaplejewicz
This fixes a warning from QtCreator. Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-28simple-cam: Move camera detection check to where it belongsLaurent Pinchart
Commit 14529b6d1c4a ("simple-cam: Early return if no cameras are found on the system") added a check to ensure that at least one camera is present in the system to avoid a crash otherwise. The check was however placed towards the end of the main() function, way after the camera is accessed, possibly due to a rebase conflict. Move it before accessing the first camera. While at it, replace usage of std::vector::size() with std::vector::empty() which expresses the intent better. Fixes: 14529b6d1c4a ("simple-cam: Early return if no cameras are found on the system") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-09simple-cam: Use new metadata APIKieran Bingham
In libcamera commit 32635054bc76 ("libcamera: framebuffer: Prevent modifying the number of metadata planes"), the planes are returned as a const span rather than a vector from the metadata. This provides better protection on the underlying structures, but was a break in the API. Update simple-cam to use the new API. Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-25simple-cam: Correct the capitalisation of 'libcamera'Kieran Bingham
Even when used at the beginning of a sentence, the 'libcamera' name always starts with a lower case 'l'. Fix the incorrect usages of the name. While here, fix the spacing between code blocks. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-25simple-cam: Fix the Buffer Allocation guidanceKieran Bingham
The Buffer Allocation notes contains a TODO. Improve the notes regarding the FrameBufferAllocation and remove the todo. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-25simple-cam: Improve documentation of validate/configureKieran Bingham
The validation and configure phase has a couple of grammatical errors. Fix them and reflow the text accordingly. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-25simple-cam: Use a unique_ptr for the CameraManagerKieran Bingham
The CameraManager should be released when it is no longer used. A unique_ptr will handle this automatically, and convey the lifetime of the object. Update simple-cam to show that managing the lifetime of the CameraManager is recommended practice. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-12-04simple-cam: Use friendly camera namesKieran Bingham
Take the example code for generating a camera name from 'cam' and use it when reporting cameras within the simple-cam application. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-12-04simple-cam: Provide event-loop backed by libeventUmang Jain
libcamera moved its EventDispatcher and Timer API to its internal API, since providing an event loop to applications should not be the job of libcamera. Application utility like cam, were ported to use libevent, hence inspired from that, un-break simple-cam by using the similar implementation to replace the EventDispatcher and Timer functionality by libevent. Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-12-04simple-cam: Early return if no cameras are found on the systemUmang Jain
Failing to do so, the codepath will segfault while trying to acquire a non-existent camera. Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-12-04simple-cam: Make return codes consistent for main()Umang Jain
Use EXIT_FAILURE or EXIT_SUCCESS to indicate program execution status. These are the return codes that should be used for main() as per the C++ standard. Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-11-19simple-cam: Fix documentation typoUmang Jain
Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-16simple-cam: Reuse RequestsPaul Elder
Update simple-cam to reuse Request objects, and use the new API with unique pointers. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran@bingham.xyz>
2020-09-24simple-cam: Use a const streamKieran Bingham
The API was updated to ensure the Stream pointer referenced from the BufferMap is const. Update accordingly. Reported-by: Erkan Diken <erkandiken@gmail.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24simple-cam: Use the new BufferMap interfaceKieran Bingham
The Request object has been updated to specify a BufferMap type. Utilise it. Reported-by: Erkan Diken <erkandiken@gmail.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-14simple-cam: Update to new camera ID APIKieran Bingham
The cameras can no longer be obtained by their 'name', but have an ID instead. Update the code to reflect this and improve the documentation there. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-01simple-cam: Add setting of a controlKieran Bingham
Remove the todo action and add setting of a simple control. More control handling can still be added later. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-19simple-cam: Delete allocatorKieran Bingham
It is important to delete the created allocator, otherwise it holds on to references of the media-device, and complains at shutdown. Clean up neatly by deleting the object before after the stream resources are free. That could potentially all be done by the destructor anyway. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-19simple-cam: Fix code for new APIsKieran Bingham
The elce-cam application was based on an old version of libcamera and the APIs have changed in the short time since then. Fix the bitrot and get back to a point where the code compiles and runs. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-19simple-cam: Fix trivial pluralisationKieran Bingham
'a list of cameras' Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-19simple-cam: Rename example applicationKieran Bingham
The example app started out as a demo at elce, thus was named: elce-cam. Rename it to 'simple-cam' for longevity. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>