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: qvidcap: support -P for video devices
Author:  Hans Verkuil <hans.verk...@cisco.com>
Date:    Fri Aug 17 13:25:17 2018 +0200

Use -P to select a specific pixel format.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

 utils/qvidcap/capture-win-gl.cpp |  4 ++--
 utils/qvidcap/qvidcap.1.in       | 13 ++++++++-----
 utils/qvidcap/qvidcap.cpp        | 24 ++++++++++++++++++++----
 3 files changed, 30 insertions(+), 11 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=61e220672c4bacdd78778f1c835c2ac272878fc8
diff --git a/utils/qvidcap/capture-win-gl.cpp b/utils/qvidcap/capture-win-gl.cpp
index 2e639d773944..59117ab6edd5 100644
--- a/utils/qvidcap/capture-win-gl.cpp
+++ b/utils/qvidcap/capture-win-gl.cpp
@@ -333,8 +333,7 @@ void CaptureGLWin::showCurrentOverrides()
        if (m_mode == AppModeTest)
                return;
 
-       firstTime = false;
-       if (m_canOverrideResolution) {
+       if (m_canOverrideResolution || firstTime) {
                printf("%sPixel Format: '%s' %s\n", prefix,
                       fcc2s(m_origPixelFormat).c_str(),
                       pixfmt2s(m_origPixelFormat).c_str());
@@ -347,6 +346,7 @@ void CaptureGLWin::showCurrentOverrides()
        else if (!m_is_rgb)
                printf("%sY'CbCr Encoding: %s\n", prefix, 
ycbcr_enc2s(m_origYCbCrEnc).c_str());
        printf("%sQuantization Range: %s\n", prefix, 
quantization2s(m_origQuantization).c_str());
+       firstTime = false;
 }
 
 void CaptureGLWin::restoreAll(bool checked)
diff --git a/utils/qvidcap/qvidcap.1.in b/utils/qvidcap/qvidcap.1.in
index 6ff0ca0e9423..bc1d1113a3fe 100644
--- a/utils/qvidcap/qvidcap.1.in
+++ b/utils/qvidcap/qvidcap.1.in
@@ -45,7 +45,13 @@ Override Y'CbCr encoding. <y> can be one of the following 
Y'CbCr encodings: defa
 \fB\-Q\fR, \fB\-\-quant\fR=\fI<q>\fR
 Override quantization. <q> can be one of the following quantization methods: 
default, full-range, lim-range
 .TP
-\fB\-l\fR, \fB\-\-list-format\fRs
+\fB\-P\fR, \fB-\-pixelformat\fR=\fI<p>\fR
+For video devices: set the format to this pixel format.
+For reading from a file: interpret the data using this pixel format setting.
+Ignored for other modes.
+Use -l to see the list of supported pixel formats.
+.TP
+\fB\-l\fR, \fB\-\-list-formats\fR
 Display all supported formats
 .TP
 \fB\-h\fR, \fB\-\-help\fR
@@ -77,14 +83,11 @@ Set frame (not field!) height
 \fB--fps\fR=\fI<fps>\fR
 Set frames-per-second (default is 30)
 .TP
-The following options are only valid when reading from a file:
+The following option is only valid when reading from a file:
 .TP
 \fB\-F\fR, \fB-\-field\fR=\fI<f>\fR
 Override field setting. <f> can be one of the following field layouts: any, 
none, top, bottom, interlaced, seq_tb, seq_bt, alternate, interlaced_tb, 
interlaced_bt
 .TP
-\fB\-P\fR, \fB-\-pixelformat\fR=\fI<p>\fR
-Override pixel format setting. use -l to see the list of supported pixel 
formats
-.TP
 The following options are specific to the test pattern generator:
 .TP
 \fB--list-patterns\fR
diff --git a/utils/qvidcap/qvidcap.cpp b/utils/qvidcap/qvidcap.cpp
index 685361397810..d29b44057f3a 100644
--- a/utils/qvidcap/qvidcap.cpp
+++ b/utils/qvidcap/qvidcap.cpp
@@ -54,6 +54,11 @@ static void usage()
               "  -Q, --quant=<q>          override quantization\n"
               "                           <q> can be one of the following 
quantization methods:\n"
               "                               default, full-range, lim-range\n"
+              "  -P, --pixelformat=<p>    For video devices: set the format to 
this pixel format.\n"
+              "                           For reading from a file: interpret 
the data using this\n"
+              "                           pixel format setting.\n"
+              "                           Use -l to see the list of supported 
pixel formats.\n"
+              "\n"
               "  -l, --list-formats       display all supported formats\n"
               "  -h, --help               display this help message\n"
               "  -t, --timings            report frame render timings\n"
@@ -69,15 +74,12 @@ static void usage()
               "  -H, --height=<height>    set frame (not field!) height\n"
               "  --fps=<fps>              set frames-per-second (default is 
30)\n"
               "\n"
-              "  The following options are only valid when reading from a 
file:\n"
+              "  The following option is only valid when reading from a 
file:\n"
               "\n"
               "  -F, --field=<f>          override field setting\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"
-              "  -P, --pixelformat=<p>    override pixel format setting\n"
-              "                           use -l to see the list of supported 
pixel formats\n"
-              "\n"
               "  The following options are specific to the test pattern 
generator:\n"
               "\n"
               "  --list-patterns          list available patterns for use with 
--pattern\n"
@@ -674,6 +676,20 @@ int main(int argc, char **argv)
                }
                fd.g_fmt(fmt);
 
+               if (overridePixelFormat) {
+                       fmt.s_pixelformat(overridePixelFormat);
+                       fd.s_fmt(fmt);
+                       fd.g_fmt(fmt);
+                       if (fmt.g_pixelformat() != overridePixelFormat) {
+                               fprintf(stderr, "Could not set format: '%s' 
%s\n",
+                                       fcc2s(overridePixelFormat).c_str(),
+                                       pixfmt2s(overridePixelFormat).c_str());
+                               fprintf(stderr, "Fall back to format: '%s' 
%s\n",
+                                       fcc2s(fmt.g_pixelformat()).c_str(),
+                                       pixfmt2s(fmt.g_pixelformat()).c_str());
+                       }
+               }
+
                unsigned tmp_w, tmp_h;
 
                pixelaspect = fd.g_pixel_aspect(tmp_w, tmp_h);

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to