summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-04-26 13:02:56 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-04-26 13:02:56 +0300
commit1edb19130f3025498e387e385e6692546d1287eb (patch)
tree77e5e23f6f08bf8cd783d5801f469c13a92321d3 /tests
parent5c020532fa63a6686047537fa368b15b195208ee (diff)
kmscapture: separate step to enable streaming
Diffstat (limited to 'tests')
-rw-r--r--tests/kmscapture.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/kmscapture.cpp b/tests/kmscapture.cpp
index 965d32e..ff62678 100644
--- a/tests/kmscapture.cpp
+++ b/tests/kmscapture.cpp
@@ -37,6 +37,7 @@ public:
void show_next_frame(AtomicReq &req);
int fd() const { return m_fd; }
+ void start_streaming();
private:
ExtFramebuffer* GetExtFrameBuffer(Card& card, uint32_t i, PixelFormat pixfmt);
int m_fd; /* camera file descriptor */
@@ -186,11 +187,6 @@ CameraPipeline::CameraPipeline(int cam_fd, Card& card, Crtc *crtc, Plane* plane,
m_fb.push_back(fb);
}
- enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-
- r = ioctl(m_fd, VIDIOC_STREAMON, &type);
- ASSERT(r == 0);
-
m_plane = plane;
// Do initial plane setup with first fb, so that we only need to
@@ -220,7 +216,6 @@ CameraPipeline::CameraPipeline(int cam_fd, Card& card, Crtc *crtc, Plane* plane,
FAIL_IF(r, "initial plane setup failed");
}
-
CameraPipeline::~CameraPipeline()
{
for (unsigned i = 0; i < m_fb.size(); i++)
@@ -232,6 +227,14 @@ CameraPipeline::~CameraPipeline()
::close(m_fd);
}
+void CameraPipeline::start_streaming()
+{
+ enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+ int r = ioctl(m_fd, VIDIOC_STREAMON, &type);
+ FAIL_IF(r, "Failed to enable camera stream: %d", r);
+}
+
void CameraPipeline::show_next_frame(AtomicReq& req)
{
int r;
@@ -402,6 +405,9 @@ int main(int argc, char** argv)
fds[nr_cameras].fd = 0;
fds[nr_cameras].events = POLLIN;
+ for (auto cam : cameras)
+ cam->start_streaming();
+
while (true) {
int r = poll(fds.data(), nr_cameras + 1, -1);
ASSERT(r > 0);