This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: v4l2-ctl: fix handling the premul-alpha sub-option
Author:  Hans Verkuil <[email protected]>
Date:    Fri Aug 11 10:20:36 2023 +0200

This suboption needs an argument, otherwise the option parser
will fail with an error. Change it to premul-alpha=<0/1>.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 4 ++--
 utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 4 ++--
 utils/v4l2-ctl/v4l2-ctl.cpp        | 5 ++++-
 3 files changed, 8 insertions(+), 5 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=07d462e6040cb4ebfb7b9c53986c335c3eaa04d4
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp 
b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
index cca2d4b42b53..d593b3b4f8e4 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
@@ -40,13 +40,13 @@ void vidcap_usage()
               "  -v, --set-fmt-video\n"
               "  --try-fmt-video 
width=<w>,height=<h>,pixelformat=<pf>,field=<f>,colorspace=<c>,\n"
               "                  
xfer=<xf>,ycbcr=<y>,hsv=<hsv>,quantization=<q>,\n"
-              "                  
premul-alpha,bytesperline=<bpl>,sizeimage=<sz>\n"
+              "                  
premul-alpha=<0/1>,bytesperline=<bpl>,sizeimage=<sz>\n"
               "                     set/try the video capture format 
[VIDIOC_S/TRY_FMT]\n"
               "                     pixelformat is either the format index as 
reported by\n"
               "                       --list-formats, or the fourcc value as a 
string.\n"
               "                     The bytesperline and sizeimage options can 
be used multiple times,\n"
               "                       once for each plane.\n"
-              "                     premul-alpha sets 
V4L2_PIX_FMT_FLAG_PREMUL_ALPHA.\n"
+              "                     premul-alpha sets (1) or clears (0) 
V4L2_PIX_FMT_FLAG_PREMUL_ALPHA.\n"
               "                     <f> can be one of the following field 
layouts:\n"
               "                       any, none, top, bottom, interlaced, 
seq_tb, seq_bt,\n"
               "                       alternate, interlaced_tb, 
interlaced_bt\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp 
b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
index 15bedc442249..0d06f7478529 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
@@ -23,11 +23,11 @@ void vidout_usage()
               "  -x, --set-fmt-video-out\n"
               "  --try-fmt-video-out 
width=<w>,height=<h>,pixelformat=<pf>,field=<f>,colorspace=<c>,\n"
               "                      
xfer=<xf>,ycbcr=<y>,hsv=<hsv>,quantization=<q>,\n"
-              "                      
premul-alpha,bytesperline=<bpl>,sizeimage=<sz>\n"
+              "                      
premul-alpha=<0/1>,bytesperline=<bpl>,sizeimage=<sz>\n"
               "                     set/try the video output format 
[VIDIOC_S/TRY_FMT]\n"
               "                     pixelformat is either the format index as 
reported by\n"
               "                       --list-formats-out, or the fourcc value 
as a string.\n"
-              "                     premul-alpha sets 
V4L2_PIX_FMT_FLAG_PREMUL_ALPHA.\n"
+              "                     premul-alpha sets (1) or clears (0) 
V4L2_PIX_FMT_FLAG_PREMUL_ALPHA.\n"
               "                     The bytesperline and sizeimage options can 
be used multiple times,\n"
               "                       once for each plane.\n"
               "                     <f> can be one of the following field 
layouts:\n"
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index 52974b400c38..4cd84f78e134 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -839,7 +839,10 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, 
__u32 &pixelformat,
                        fmts |= FmtBytesPerLine;
                        break;
                case 8:
-                       flags |= V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
+                       if (strtoul(value, nullptr, 0))
+                               flags |= V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
+                       else
+                               flags &= ~V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
                        fmts |= FmtFlags;
                        break;
                case 9:

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to