summaryrefslogtreecommitdiff
path: root/src/qcam
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcam')
-rw-r--r--src/qcam/main_window.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index 0c7ca61a..0a353e8b 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -8,6 +8,7 @@
#include <iomanip>
#include <iostream>
#include <string>
+#include <sys/mman.h>
#include <QCoreApplication>
#include <QInputDialog>
@@ -296,13 +297,18 @@ void MainWindow::requestComplete(Request *request)
int MainWindow::display(Buffer *buffer)
{
- BufferMemory *mem = buffer->mem();
- if (mem->planes().size() != 1)
+ if (buffer->mem()->planes().size() != 1)
return -EINVAL;
- Plane &plane = mem->planes().front();
- unsigned char *raw = static_cast<unsigned char *>(plane.mem());
+ /* \todo Once the FrameBuffer is done cache mapped memory. */
+ const FrameBuffer::Plane &plane = buffer->mem()->planes().front();
+ void *memory = mmap(NULL, plane.length, PROT_READ, MAP_SHARED,
+ plane.fd.fd(), 0);
+
+ unsigned char *raw = static_cast<unsigned char *>(memory);
viewfinder_->display(raw, buffer->bytesused());
+ munmap(memory, plane.length);
+
return 0;
}