summaryrefslogtreecommitdiff
path: root/src/qcam/viewfinder.h
AgeCommit message (Collapse)Author
2020-01-20qcam: Support scaling of the viewfinderLaurent Pinchart
The viewfinder is drawn using a QLabel. This could support scaling through QLabel::setScaledContents(), but in a very inefficient way. To maintain reasonable efficiency, turn the viewfinder into a QWidget and draw the image directly using a QPainter. No performance change was noticed running on a fast x86 machine, and performance was 60% higher when scaling up to full screen compared to QLabel. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-09-24qcam: Fix ViewFinder memory leakKieran Bingham
When setting the format on the ViewFinder, a new image_ is allocated. Any change in format deletes the existing allocation, but it is not cleaned up on shutdown: Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7f0bf8a7e17f in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10e17f) #1 0x564c7205f7b0 in ViewFinder::setFormat(unsigned int, unsigned int, unsigned int) ../src/qcam/viewfinder.cpp:43 #2 0x564c71fec467 in MainWindow::startCapture() ../src/qcam/main_window.cpp:152 #3 0x564c71fe6c1a in MainWindow::MainWindow(libcamera::CameraManager*, OptionsParser::Options const&) ../src/qcam/main_window.cpp:40 #4 0x564c71fdf133 in main ../src/qcam/main.cpp:76 #5 0x7f0bf5944b6a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26b6a) Provide a ViewFinder destructor, and delete the allocation as appropriate. Fixes: 97e8b3a2eb32 ("qcam: Add Qt-based GUI application") Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-04-02qcam: Add JPEG format supportLaurent Pinchart
When the camera provides MJPEG, use the QImage JPEG decompression code to convert that to RGB. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-03-29qcam: Add Qt-based GUI applicationLaurent Pinchart
qcam is a sample camera GUI application based on Qt. It demonstrates integration of the Qt event loop with libcamera. The application lets the user select a camera through the GUI, and then captures a single stream from the camera and displays it in a window. Only streams in YUYV formats are supported for now. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>