aboutsummaryrefslogtreecommitdiffstats
path: root/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/v4l2-ctl/v4l2-ctl-streaming.cpp')
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp46
1 files changed, 38 insertions, 8 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 1383c5f..d74a6c0 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1833,6 +1833,36 @@ enum stream_type {
OUT,
};
+static int capture_setup(cv4l_fd &fd, cv4l_queue &in)
+{
+ if (fd.streamoff(in.g_type())) {
+ fprintf(stderr, "%s: fd.streamoff error\n", __func__);
+ return -1;
+ }
+ get_cap_compose_rect(fd);
+
+ /* release any buffer allocated */
+ if (in.reqbufs(&fd)) {
+ fprintf(stderr, "%s: in.reqbufs 0 error\n", __func__);
+ return -1;
+ }
+
+ if (in.reqbufs(&fd, reqbufs_count_cap)) {
+ fprintf(stderr, "%s: in.reqbufs %u error\n", __func__,
+ reqbufs_count_cap);
+ return -1;
+ }
+ if (in.obtain_bufs(&fd) || in.queue_all(&fd)) {
+ fprintf(stderr, "%s: in.obtain_bufs error\n", __func__);
+ return -1;
+ }
+ if (fd.streamon(in.g_type())) {
+ fprintf(stderr, "%s: fd.streamon error\n", __func__);
+ return -1;
+ }
+ return 0;
+}
+
static void streaming_set_m2m(cv4l_fd &fd)
{
int fd_flags = fcntl(fd.g_fd(), F_GETFL);
@@ -1897,21 +1927,21 @@ static void streaming_set_m2m(cv4l_fd &fd)
}
}
- if (in.reqbufs(&fd, reqbufs_count_cap) ||
- out.reqbufs(&fd, reqbufs_count_out))
+ if (out.reqbufs(&fd, reqbufs_count_out))
goto done;
- if (in.obtain_bufs(&fd) ||
- in.queue_all(&fd) ||
- do_setup_out_buffers(fd, out, file[OUT], true))
+ if (do_setup_out_buffers(fd, out, file[OUT], true))
goto done;
- fps_ts[CAP].determine_field(fd.g_fd(), in.g_type());
- fps_ts[OUT].determine_field(fd.g_fd(), out.g_type());
+ if (fd.streamon(out.g_type()))
+ goto done;
- if (fd.streamon(in.g_type()) || fd.streamon(out.g_type()))
+ if (capture_setup(fd, in))
goto done;
+ fps_ts[CAP].determine_field(fd.g_fd(), in.g_type());
+ fps_ts[OUT].determine_field(fd.g_fd(), out.g_type());
+
while (stream_sleep == 0)
sleep(100);

Privacy Policy