public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna3@gmail.com>
To: linux-media@vger.kernel.org
Cc: hverkuil@xs4all.nl, helen.koike@collabora.com,
	Dafna Hirschfeld <dafna3@gmail.com>
Subject: [v4l-utils PATCH v5 3/6] v4l2-ctl: set the in/out fmt variables in streaming_set_m2m
Date: Wed,  6 Mar 2019 13:17:49 -0800	[thread overview]
Message-ID: <20190306211752.15531-3-dafna3@gmail.com> (raw)
In-Reply-To: <20190306211752.15531-1-dafna3@gmail.com>

set the in/out fmt variables in streaming_set_m2m
This is needed later to check for stateless
fwht pixel format.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
---
 utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 465ba50c..9bb58a0b 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1949,7 +1949,8 @@ static int capture_setup(cv4l_fd &fd, cv4l_queue &in, cv4l_fd *exp_fd)
 }
 
 static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, cv4l_queue &out,
-			 FILE *fin, FILE *fout, cv4l_fd *exp_fd_p)
+			 FILE *fin, FILE *fout, cv4l_fmt &fmt_in,
+			 cv4l_fmt &fmt_out, cv4l_fd *exp_fd_p)
 {
 	int fd_flags = fcntl(fd.g_fd(), F_GETFL);
 	fps_timestamps fps_ts[2];
@@ -1959,10 +1960,6 @@ static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, cv4l_queue &out,
 	fd_set *ex_fds = &fds[1]; /* for capture */
 	fd_set *wr_fds = &fds[2]; /* for output */
 	bool cap_streaming = false;
-	cv4l_fmt fmt[2];
-
-	fd.g_fmt(fmt[OUT], out.g_type());
-	fd.g_fmt(fmt[CAP], in.g_type());
 
 	struct v4l2_event_subscription sub;
 
@@ -2040,7 +2037,7 @@ static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, cv4l_queue &out,
 
 		if (rd_fds && FD_ISSET(fd.g_fd(), rd_fds)) {
 			r = do_handle_cap(fd, in, fin, NULL,
-					  count[CAP], fps_ts[CAP], fmt[CAP]);
+					  count[CAP], fps_ts[CAP], fmt_in);
 			if (r < 0) {
 				rd_fds = NULL;
 				if (!have_eos) {
@@ -2052,7 +2049,7 @@ static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, cv4l_queue &out,
 
 		if (wr_fds && FD_ISSET(fd.g_fd(), wr_fds)) {
 			r = do_handle_out(fd, out, fout, NULL,
-					  count[OUT], fps_ts[OUT], fmt[OUT]);
+					  count[OUT], fps_ts[OUT], fmt_out);
 			if (r < 0)  {
 				wr_fds = NULL;
 
@@ -2103,8 +2100,8 @@ static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, cv4l_queue &out,
 				last_buffer = false;
 				if (capture_setup(fd, in, exp_fd_p))
 					return;
-				fd.g_fmt(fmt[OUT], out.g_type());
-				fd.g_fmt(fmt[CAP], in.g_type());
+				fd.g_fmt(fmt_out, out.g_type());
+				fd.g_fmt(fmt_in, in.g_type());
 				cap_streaming = true;
 			} else {
 				break;
@@ -2129,6 +2126,10 @@ static void streaming_set_m2m(cv4l_fd &fd, cv4l_fd &exp_fd)
 	cv4l_queue exp_q(exp_fd.g_type(), V4L2_MEMORY_MMAP);
 	cv4l_fd *exp_fd_p = NULL;
 	FILE *file[2] = {NULL, NULL};
+	cv4l_fmt fmt[2];
+
+	fd.g_fmt(fmt[OUT], out.g_type());
+	fd.g_fmt(fmt[CAP], in.g_type());
 
 	if (!fd.has_vid_m2m()) {
 		fprintf(stderr, "unsupported m2m stream type\n");
-- 
2.17.1


  parent reply	other threads:[~2019-03-06 21:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 21:17 [v4l-utils PATCH v5 1/6] v4l2-ctl: in streaming_set_m2m, close file pointers upon error Dafna Hirschfeld
2019-03-06 21:17 ` [v4l-utils PATCH v5 2/6] v4l2-ctl: check that the size read/write fit the buffer size Dafna Hirschfeld
2019-03-06 21:17 ` Dafna Hirschfeld [this message]
2019-03-06 21:17 ` [v4l-utils PATCH v5 4/6] v4l-utils: copy fwht-ctrls.h from kernel dir Dafna Hirschfeld
2019-03-06 21:17 ` [v4l-utils PATCH v5 5/6] v4l2-ctl: Add functions and variables to support fwht stateless decoder Dafna Hirschfeld
2019-03-06 21:17 ` [v4l-utils PATCH v5 6/6] v4l2-ctl: Add implementation for the stateless fwht decoder Dafna Hirschfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190306211752.15531-3-dafna3@gmail.com \
    --to=dafna3@gmail.com \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox