aboutsummaryrefslogtreecommitdiffstats
path: root/utils/qvidcap
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-08-17 13:25:17 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2018-08-17 13:25:17 +0200
commit61e220672c4bacdd78778f1c835c2ac272878fc8 (patch)
tree082ed87d6218f7dd38e0ee5dabbe2061603a777e /utils/qvidcap
parent8e18caca01fed71f04bea41c038bb168db3b20d4 (diff)
qvidcap: support -P for video devices
Use -P to select a specific pixel format. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils/qvidcap')
-rw-r--r--utils/qvidcap/capture-win-gl.cpp4
-rw-r--r--utils/qvidcap/qvidcap.1.in13
-rw-r--r--utils/qvidcap/qvidcap.cpp24
3 files changed, 30 insertions, 11 deletions
diff --git a/utils/qvidcap/capture-win-gl.cpp b/utils/qvidcap/capture-win-gl.cpp
index 2e639d77..59117ab6 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 6ff0ca0e..bc1d1113 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 68536139..d29b4405 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);

Privacy Policy