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

Subject: v4l2-ctl: split off all input/output options.
Author:  Hans Verkuil <[email protected]>
Date:    Thu Jul 26 11:13:56 2012 +0200

Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 5a2d4d5a8860df386a5fe50579dd788d2fd64c2e)

Signed-off-by: Gregor Jasny <[email protected]>

 utils/v4l2-ctl/Makefile        |    2 +-
 utils/v4l2-ctl/v4l2-ctl-io.cpp |  254 ++++++++++++++++++++++++++++++++++++++++
 utils/v4l2-ctl/v4l2-ctl.cpp    |  225 ++----------------------------------
 utils/v4l2-ctl/v4l2-ctl.h      |    8 ++
 4 files changed, 271 insertions(+), 218 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=bcae1264b72312e0b78c50d26471b3367cc5d5c6

diff --git a/utils/v4l2-ctl/Makefile b/utils/v4l2-ctl/Makefile
index 7704dc0..e57d64e 100644
--- a/utils/v4l2-ctl/Makefile
+++ b/utils/v4l2-ctl/Makefile
@@ -12,7 +12,7 @@ cx18-ctl: cx18-ctl.o
 ivtv-ctl: ivtv-ctl.o
        $(CC) $(LDFLAGS) -o $@ $^ -lm
 
-v4l2-ctl: v4l2-ctl.o v4l2-ctl-common.o v4l2-ctl-tuner.o
+v4l2-ctl: v4l2-ctl.o v4l2-ctl-common.o v4l2-ctl-tuner.o v4l2-ctl-io.o
        $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt
 
 install: $(TARGETS)
diff --git a/utils/v4l2-ctl/v4l2-ctl-io.cpp b/utils/v4l2-ctl/v4l2-ctl-io.cpp
new file mode 100644
index 0000000..5f4feee
--- /dev/null
+++ b/utils/v4l2-ctl/v4l2-ctl-io.cpp
@@ -0,0 +1,254 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+#include <getopt.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <dirent.h>
+#include <math.h>
+
+#include <linux/videodev2.h>
+#include <libv4l2.h>
+#include <string>
+
+#include "v4l2-ctl.h"
+
+static struct v4l2_audio vaudio;       /* list audio inputs */
+static struct v4l2_audioout vaudout;           /* audio outputs */
+static int input;                      /* set_input/get_input */
+static int output;                     /* set_output/get_output */
+
+void io_usage(void)
+{
+       printf("\nInput/Output options:\n"
+              "  -I, --get-input    query the video input [VIDIOC_G_INPUT]\n"
+              "  -i, --set-input=<num>\n"
+              "                     set the video input to <num> 
[VIDIOC_S_INPUT]\n"
+              "  -N, --list-outputs display video outputs 
[VIDIOC_ENUMOUTPUT]\n"
+              "  -n, --list-inputs  display video inputs [VIDIOC_ENUMINPUT]\n"
+              "  -O, --get-output   query the video output [VIDIOC_G_OUTPUT]\n"
+              "  -o, --set-output=<num>\n"
+              "                     set the video output to <num> 
[VIDIOC_S_OUTPUT]\n"
+              "  --set-audio-output=<num>\n"
+              "                     set the audio output to <num> 
[VIDIOC_S_AUDOUT]\n"
+              "  --get-audio-input  query the audio input [VIDIOC_G_AUDIO]\n"
+              "  --set-audio-input=<num>\n"
+              "                     set the audio input to <num> 
[VIDIOC_S_AUDIO]\n"
+              "  --get-audio-output query the audio output [VIDIOC_G_AUDOUT]\n"
+              "  --set-audio-output=<num>\n"
+              "                     set the audio output to <num> 
[VIDIOC_S_AUDOUT]\n"
+              "  --list-audio-outputs\n"
+              "                     display audio outputs 
[VIDIOC_ENUMAUDOUT]\n"
+              "  --list-audio-inputs\n"
+              "                     display audio inputs [VIDIOC_ENUMAUDIO]\n"
+              );
+}
+
+static const flag_def in_status_def[] = {
+       { V4L2_IN_ST_NO_POWER,    "no power" },
+       { V4L2_IN_ST_NO_SIGNAL,   "no signal" },
+       { V4L2_IN_ST_NO_COLOR,    "no color" },
+       { V4L2_IN_ST_HFLIP,       "hflip" },
+       { V4L2_IN_ST_VFLIP,       "vflip" },
+       { V4L2_IN_ST_NO_H_LOCK,   "no hsync lock." },
+       { V4L2_IN_ST_COLOR_KILL,  "color kill" },
+       { V4L2_IN_ST_NO_SYNC,     "no sync lock" },
+       { V4L2_IN_ST_NO_EQU,      "no equalizer lock" },
+       { V4L2_IN_ST_NO_CARRIER,  "no carrier" },
+       { V4L2_IN_ST_MACROVISION, "macrovision" },
+       { V4L2_IN_ST_NO_ACCESS,   "no conditional access" },
+       { V4L2_IN_ST_VTR,         "VTR time constant" },
+       { 0, NULL }
+};
+
+static std::string status2s(__u32 status)
+{
+       return status ? flags2s(status, in_status_def) : "ok";
+}
+
+
+static const flag_def input_cap_def[] = {
+       {V4L2_IN_CAP_PRESETS, "DV presets" },
+       {V4L2_IN_CAP_CUSTOM_TIMINGS, "DV timings" },
+       {V4L2_IN_CAP_STD, "SD presets" },
+       { 0, NULL }
+};
+
+static std::string input_cap2s(__u32 capabilities)
+{
+       return capabilities ? flags2s(capabilities, input_cap_def) : "not 
defined";
+}
+
+static const flag_def output_cap_def[] = {
+       {V4L2_OUT_CAP_PRESETS, "DV presets" },
+       {V4L2_OUT_CAP_CUSTOM_TIMINGS, "DV timings" },
+       {V4L2_OUT_CAP_STD, "SD presets" },
+       { 0, NULL }
+};
+
+static std::string output_cap2s(__u32 capabilities)
+{
+       return capabilities ? flags2s(capabilities, output_cap_def) : "not 
defined";
+}
+
+void io_cmd(int ch, char *optarg)
+{
+       switch (ch) {
+               case OptSetInput:
+                       input = strtol(optarg, 0L, 0);
+                       break;
+               case OptSetOutput:
+                       output = strtol(optarg, 0L, 0);
+                       break;
+               case OptSetAudioInput:
+                       vaudio.index = strtol(optarg, 0L, 0);
+                       break;
+               case OptSetAudioOutput:
+                       vaudout.index = strtol(optarg, 0L, 0);
+                       break;
+       }
+}
+
+void io_set(int fd)
+{
+       if (options[OptSetInput]) {
+               if (doioctl(fd, VIDIOC_S_INPUT, &input) == 0) {
+                       struct v4l2_input vin;
+
+                       printf("Video input set to %d", input);
+                       vin.index = input;
+                       if (test_ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
+                               printf(" (%s: %s)", vin.name, 
status2s(vin.status).c_str());
+                       printf("\n");
+               }
+       }
+
+       if (options[OptSetOutput]) {
+               if (doioctl(fd, VIDIOC_S_OUTPUT, &output) == 0)
+                       printf("Output set to %d\n", output);
+       }
+
+       if (options[OptSetAudioInput]) {
+               if (doioctl(fd, VIDIOC_S_AUDIO, &vaudio) == 0)
+                       printf("Audio input set to %d\n", vaudio.index);
+       }
+
+       if (options[OptSetAudioOutput]) {
+               if (doioctl(fd, VIDIOC_S_AUDOUT, &vaudout) == 0)
+                       printf("Audio output set to %d\n", vaudout.index);
+       }
+}
+
+void io_get(int fd)
+{
+       if (options[OptGetInput]) {
+               if (doioctl(fd, VIDIOC_G_INPUT, &input) == 0) {
+                       struct v4l2_input vin;
+
+                       printf("Video input : %d", input);
+                       vin.index = input;
+                       if (test_ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
+                               printf(" (%s: %s)", vin.name, 
status2s(vin.status).c_str());
+                       printf("\n");
+               }
+       }
+
+       if (options[OptGetOutput]) {
+               if (doioctl(fd, VIDIOC_G_OUTPUT, &output) == 0) {
+                       struct v4l2_output vout;
+
+                       printf("Video output: %d", output);
+                       vout.index = output;
+                       if (test_ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
+                               printf(" (%s)", vout.name);
+                       }
+                       printf("\n");
+               }
+       }
+
+       if (options[OptGetAudioInput]) {
+               if (doioctl(fd, VIDIOC_G_AUDIO, &vaudio) == 0)
+                       printf("Audio input : %d (%s)\n", vaudio.index, 
vaudio.name);
+       }
+
+       if (options[OptGetAudioOutput]) {
+               if (doioctl(fd, VIDIOC_G_AUDOUT, &vaudout) == 0)
+                       printf("Audio output: %d (%s)\n", vaudout.index, 
vaudout.name);
+       }
+}
+
+void io_list(int fd)
+{
+       if (options[OptListInputs]) {
+               struct v4l2_input vin;
+
+               vin.index = 0;
+               printf("ioctl: VIDIOC_ENUMINPUT\n");
+               while (test_ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
+                       if (vin.index)
+                               printf("\n");
+                       printf("\tInput       : %d\n", vin.index);
+                       printf("\tName        : %s\n", vin.name);
+                       printf("\tType        : 0x%08X\n", vin.type);
+                       printf("\tAudioset    : 0x%08X\n", vin.audioset);
+                       printf("\tTuner       : 0x%08X\n", vin.tuner);
+                       printf("\tStandard    : 0x%016llX (%s)\n", (unsigned 
long long)vin.std,
+                               std2s(vin.std).c_str());
+                       printf("\tStatus      : 0x%08X (%s)\n", vin.status, 
status2s(vin.status).c_str());
+                       printf("\tCapabilities: 0x%08X (%s)\n", 
vin.capabilities, input_cap2s(vin.capabilities).c_str());
+                        vin.index++;
+                }
+       }
+
+       if (options[OptListOutputs]) {
+               struct v4l2_output vout;
+
+               vout.index = 0;
+               printf("ioctl: VIDIOC_ENUMOUTPUT\n");
+               while (test_ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
+                       if (vout.index)
+                               printf("\n");
+                       printf("\tOutput      : %d\n", vout.index);
+                       printf("\tName        : %s\n", vout.name);
+                       printf("\tType        : 0x%08X\n", vout.type);
+                       printf("\tAudioset    : 0x%08X\n", vout.audioset);
+                       printf("\tStandard    : 0x%016llX (%s)\n", (unsigned 
long long)vout.std,
+                                       std2s(vout.std).c_str());
+                       printf("\tCapabilities: 0x%08X (%s)\n", 
vout.capabilities, output_cap2s(vout.capabilities).c_str());
+                       vout.index++;
+               }
+       }
+
+       if (options[OptListAudioInputs]) {
+               struct v4l2_audio vaudio;       /* list audio inputs */
+               vaudio.index = 0;
+               printf("ioctl: VIDIOC_ENUMAUDIO\n");
+               while (test_ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
+                       if (vaudio.index)
+                               printf("\n");
+                       printf("\tInput   : %d\n", vaudio.index);
+                       printf("\tName    : %s\n", vaudio.name);
+                       vaudio.index++;
+               }
+       }
+
+       if (options[OptListAudioOutputs]) {
+               struct v4l2_audioout vaudio;    /* list audio outputs */
+               vaudio.index = 0;
+               printf("ioctl: VIDIOC_ENUMAUDOUT\n");
+               while (test_ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudio) >= 0) {
+                       if (vaudio.index)
+                               printf("\n");
+                       printf("\tOutput  : %d\n", vaudio.index);
+                       printf("\tName    : %s\n", vaudio.name);
+                       vaudio.index++;
+               }
+       }
+}
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index c96bd6b..c28e8f4 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -220,32 +220,6 @@ static struct option long_options[] = {
        {0, 0, 0, 0}
 };
 
-static void usage_io(void)
-{
-       printf("\nInput/Output options:\n"
-              "  -I, --get-input    query the video input [VIDIOC_G_INPUT]\n"
-              "  -i, --set-input=<num>\n"
-              "                     set the video input to <num> 
[VIDIOC_S_INPUT]\n"
-              "  -N, --list-outputs display video outputs 
[VIDIOC_ENUMOUTPUT]\n"
-              "  -n, --list-inputs  display video inputs [VIDIOC_ENUMINPUT]\n"
-              "  -O, --get-output   query the video output [VIDIOC_G_OUTPUT]\n"
-              "  -o, --set-output=<num>\n"
-              "                     set the video output to <num> 
[VIDIOC_S_OUTPUT]\n"
-              "  --set-audio-output=<num>\n"
-              "                     set the audio output to <num> 
[VIDIOC_S_AUDOUT]\n"
-              "  --get-audio-input  query the audio input [VIDIOC_G_AUDIO]\n"
-              "  --set-audio-input=<num>\n"
-              "                     set the audio input to <num> 
[VIDIOC_S_AUDIO]\n"
-              "  --get-audio-output query the audio output [VIDIOC_G_AUDOUT]\n"
-              "  --set-audio-output=<num>\n"
-              "                     set the audio output to <num> 
[VIDIOC_S_AUDOUT]\n"
-              "  --list-audio-outputs\n"
-              "                     display audio outputs 
[VIDIOC_ENUMAUDOUT]\n"
-              "  --list-audio-inputs\n"
-              "                     display audio inputs [VIDIOC_ENUMAUDIO]\n"
-              );
-}
-
 static void usage_stds(void)
 {
        printf("\nStandards/Presets/Timings options:\n"
@@ -501,7 +475,7 @@ static void usage_all(void)
 {
        common_usage();
        tuner_usage();
-       usage_io();
+       io_usage();
        usage_stds();
        usage_vidcap();
        usage_vidout();
@@ -664,53 +638,6 @@ std::string flags2s(unsigned val, const flag_def *def)
        return s;
 }
 
-static const flag_def in_status_def[] = {
-       { V4L2_IN_ST_NO_POWER,    "no power" },
-       { V4L2_IN_ST_NO_SIGNAL,   "no signal" },
-       { V4L2_IN_ST_NO_COLOR,    "no color" },
-       { V4L2_IN_ST_HFLIP,       "hflip" },
-       { V4L2_IN_ST_VFLIP,       "vflip" },
-       { V4L2_IN_ST_NO_H_LOCK,   "no hsync lock." },
-       { V4L2_IN_ST_COLOR_KILL,  "color kill" },
-       { V4L2_IN_ST_NO_SYNC,     "no sync lock" },
-       { V4L2_IN_ST_NO_EQU,      "no equalizer lock" },
-       { V4L2_IN_ST_NO_CARRIER,  "no carrier" },
-       { V4L2_IN_ST_MACROVISION, "macrovision" },
-       { V4L2_IN_ST_NO_ACCESS,   "no conditional access" },
-       { V4L2_IN_ST_VTR,         "VTR time constant" },
-       { 0, NULL }
-};
-
-static std::string status2s(__u32 status)
-{
-       return status ? flags2s(status, in_status_def) : "ok";
-}
-
-
-static const flag_def input_cap_def[] = {
-       {V4L2_IN_CAP_PRESETS, "DV presets" },
-       {V4L2_IN_CAP_CUSTOM_TIMINGS, "DV timings" },
-       {V4L2_IN_CAP_STD, "SD presets" },
-       { 0, NULL }
-};
-
-static std::string input_cap2s(__u32 capabilities)
-{
-       return capabilities ? flags2s(capabilities, input_cap_def) : "not 
defined";
-}
-
-static const flag_def output_cap_def[] = {
-       {V4L2_OUT_CAP_PRESETS, "DV presets" },
-       {V4L2_OUT_CAP_CUSTOM_TIMINGS, "DV timings" },
-       {V4L2_OUT_CAP_STD, "SD presets" },
-       { 0, NULL }
-};
-
-static std::string output_cap2s(__u32 capabilities)
-{
-       return capabilities ? flags2s(capabilities, output_cap_def) : "not 
defined";
-}
-
 static void print_sliced_vbi_cap(struct v4l2_sliced_vbi_cap &cap)
 {
        printf("\tType           : %s\n", buftype2s(cap.type).c_str());
@@ -1255,7 +1182,7 @@ static const char *std_atsc[] = {
        NULL
 };
 
-static std::string std2s(v4l2_std_id std)
+std::string std2s(v4l2_std_id std)
 {
        std::string s;
 
@@ -1791,10 +1718,6 @@ int main(int argc, char **argv)
        struct v4l2_format overlay_fmt; /* set_format/get_format video overlay 
*/
        struct v4l2_format overlay_fmt_out;     /* set_format/get_format video 
overlay output */
        struct v4l2_capability vcap;    /* list_cap */
-       struct v4l2_input vin;          /* list_inputs */
-       struct v4l2_output vout;        /* list_outputs */
-       struct v4l2_audio vaudio;       /* list audio inputs */
-       struct v4l2_audioout vaudout;   /* audio outputs */
        struct v4l2_frmsizeenum frmsize;/* list frame sizes */
        struct v4l2_frmivalenum frmival;/* list frame intervals */
        struct v4l2_rect vcrop;         /* crop rect */
@@ -1815,8 +1738,6 @@ int main(int argc, char **argv)
        struct v4l2_dv_timings_cap dv_timings_cap; /* get_dv_timings_cap */
        struct v4l2_encoder_cmd enc_cmd; /* (try_)encoder_cmd */
        struct v4l2_decoder_cmd dec_cmd; /* (try_)decoder_cmd */
-       int input;                      /* set_input/get_input */
-       int output;                     /* set_output/get_output */
        v4l2_std_id std;                /* get_std/set_std */
        double fps = 0;                 /* set framerate speed, in fps */
        double output_fps = 0;          /* set framerate speed, in fps */
@@ -1842,10 +1763,6 @@ int main(int argc, char **argv)
        memset(&overlay_fmt_out, 0, sizeof(overlay_fmt_out));
        memset(&raw_fmt_out, 0, sizeof(raw_fmt_out));
        memset(&vcap, 0, sizeof(vcap));
-       memset(&vin, 0, sizeof(vin));
-       memset(&vout, 0, sizeof(vout));
-       memset(&vaudio, 0, sizeof(vaudio));
-       memset(&vaudout, 0, sizeof(vaudout));
        memset(&frmsize, 0, sizeof(frmsize));
        memset(&frmival, 0, sizeof(frmival));
        memset(&vcrop, 0, sizeof(vcrop));
@@ -1892,7 +1809,7 @@ int main(int argc, char **argv)
                        tuner_usage();
                        return 0;
                case OptHelpIO:
-                       usage_io();
+                       io_usage();
                        return 0;
                case OptHelpStds:
                        usage_stds();
@@ -2189,18 +2106,6 @@ int main(int argc, char **argv)
                        get_sel_target = gsel.target;
                        break;
                }
-               case OptSetInput:
-                       input = strtol(optarg, 0L, 0);
-                       break;
-               case OptSetOutput:
-                       output = strtol(optarg, 0L, 0);
-                       break;
-               case OptSetAudioInput:
-                       vaudio.index = strtol(optarg, 0L, 0);
-                       break;
-               case OptSetAudioOutput:
-                       vaudout.index = strtol(optarg, 0L, 0);
-                       break;
                case OptSetStandard:
                        if (!strncmp(optarg, "pal", 3)) {
                                if (optarg[3])
@@ -2433,6 +2338,7 @@ int main(int argc, char **argv)
                default:
                        common_cmd(ch, optarg);
                        tuner_cmd(ch, optarg);
+                       io_cmd(ch, optarg);
                        break;
                }
        }
@@ -2534,6 +2440,7 @@ int main(int argc, char **argv)
 
        common_set(fd);
        tuner_set(fd);
+       io_set(fd);
 
        if (options[OptSetStandard]) {
                if (std & (1ULL << 63)) {
@@ -2604,31 +2511,6 @@ int main(int argc, char **argv)
                }
        }
 
-       if (options[OptSetInput]) {
-               if (doioctl(fd, VIDIOC_S_INPUT, &input) == 0) {
-                       printf("Video input set to %d", input);
-                       vin.index = input;
-                       if (test_ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
-                               printf(" (%s: %s)", vin.name, 
status2s(vin.status).c_str());
-                       printf("\n");
-               }
-       }
-
-       if (options[OptSetOutput]) {
-               if (doioctl(fd, VIDIOC_S_OUTPUT, &output) == 0)
-                       printf("Output set to %d\n", output);
-       }
-
-       if (options[OptSetAudioInput]) {
-               if (doioctl(fd, VIDIOC_S_AUDIO, &vaudio) == 0)
-                       printf("Audio input set to %d\n", vaudio.index);
-       }
-
-       if (options[OptSetAudioOutput]) {
-               if (doioctl(fd, VIDIOC_S_AUDOUT, &vaudout) == 0)
-                       printf("Audio output set to %d\n", vaudout.index);
-       }
-
        if (options[OptSetVideoFormat] || options[OptTryVideoFormat]) {
                struct v4l2_format in_vfmt;
 
@@ -2867,6 +2749,7 @@ int main(int argc, char **argv)
 
        common_get(fd);
        tuner_get(fd);
+       io_get(fd);
 
        if (options[OptGetVideoFormat]) {
                vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -3048,37 +2931,6 @@ int main(int argc, char **argv)
                }
        }
 
-       if (options[OptGetInput]) {
-               if (doioctl(fd, VIDIOC_G_INPUT, &input) == 0) {
-                       printf("Video input : %d", input);
-                       vin.index = input;
-                       if (test_ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
-                               printf(" (%s: %s)", vin.name, 
status2s(vin.status).c_str());
-                       printf("\n");
-               }
-       }
-
-       if (options[OptGetOutput]) {
-               if (doioctl(fd, VIDIOC_G_OUTPUT, &output) == 0) {
-                       printf("Video output: %d", output);
-                       vout.index = output;
-                       if (test_ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
-                               printf(" (%s)", vout.name);
-                       }
-                       printf("\n");
-               }
-       }
-
-       if (options[OptGetAudioInput]) {
-               if (doioctl(fd, VIDIOC_G_AUDIO, &vaudio) == 0)
-                       printf("Audio input : %d (%s)\n", vaudio.index, 
vaudio.name);
-       }
-
-       if (options[OptGetAudioOutput]) {
-               if (doioctl(fd, VIDIOC_G_AUDOUT, &vaudout) == 0)
-                       printf("Audio output: %d (%s)\n", vaudout.index, 
vaudout.name);
-       }
-
        if (options[OptGetStandard]) {
                if (doioctl(fd, VIDIOC_G_STD, &std) == 0) {
                        printf("Video Standard = 0x%08llx\n", (unsigned long 
long)std);
@@ -3195,67 +3047,8 @@ int main(int argc, char **argv)
 
        /* List options */
 
-       if (options[OptListInputs]) {
-               vin.index = 0;
-               printf("ioctl: VIDIOC_ENUMINPUT\n");
-               while (test_ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
-                       if (vin.index)
-                               printf("\n");
-                       printf("\tInput       : %d\n", vin.index);
-                       printf("\tName        : %s\n", vin.name);
-                       printf("\tType        : 0x%08X\n", vin.type);
-                       printf("\tAudioset    : 0x%08X\n", vin.audioset);
-                       printf("\tTuner       : 0x%08X\n", vin.tuner);
-                       printf("\tStandard    : 0x%016llX (%s)\n", (unsigned 
long long)vin.std,
-                               std2s(vin.std).c_str());
-                       printf("\tStatus      : 0x%08X (%s)\n", vin.status, 
status2s(vin.status).c_str());
-                       printf("\tCapabilities: 0x%08X (%s)\n", 
vin.capabilities, input_cap2s(vin.capabilities).c_str());
-                        vin.index++;
-                }
-       }
-
-       if (options[OptListOutputs]) {
-               vout.index = 0;
-               printf("ioctl: VIDIOC_ENUMOUTPUT\n");
-               while (test_ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
-                       if (vout.index)
-                               printf("\n");
-                       printf("\tOutput      : %d\n", vout.index);
-                       printf("\tName        : %s\n", vout.name);
-                       printf("\tType        : 0x%08X\n", vout.type);
-                       printf("\tAudioset    : 0x%08X\n", vout.audioset);
-                       printf("\tStandard    : 0x%016llX (%s)\n", (unsigned 
long long)vout.std,
-                                       std2s(vout.std).c_str());
-                       printf("\tCapabilities: 0x%08X (%s)\n", 
vout.capabilities, output_cap2s(vout.capabilities).c_str());
-                       vout.index++;
-               }
-       }
-
-       if (options[OptListAudioInputs]) {
-               struct v4l2_audio vaudio;       /* list audio inputs */
-               vaudio.index = 0;
-               printf("ioctl: VIDIOC_ENUMAUDIO\n");
-               while (test_ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
-                       if (vaudio.index)
-                               printf("\n");
-                       printf("\tInput   : %d\n", vaudio.index);
-                       printf("\tName    : %s\n", vaudio.name);
-                       vaudio.index++;
-               }
-       }
-
-       if (options[OptListAudioOutputs]) {
-               struct v4l2_audioout vaudio;    /* list audio outputs */
-               vaudio.index = 0;
-               printf("ioctl: VIDIOC_ENUMAUDOUT\n");
-               while (test_ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudio) >= 0) {
-                       if (vaudio.index)
-                               printf("\n");
-                       printf("\tOutput  : %d\n", vaudio.index);
-                       printf("\tName    : %s\n", vaudio.name);
-                       vaudio.index++;
-               }
-       }
+       common_list(fd);
+       io_list(fd);
 
        if (options[OptListStandards]) {
                printf("ioctl: VIDIOC_ENUMSTD\n");
@@ -3327,8 +3120,6 @@ int main(int argc, char **argv)
                print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
        }
 
-       common_list(fd);
-
        if (options[OptGetSlicedVbiCap]) {
                struct v4l2_sliced_vbi_cap cap;
 
diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
index 9d963bd..948b399 100644
--- a/utils/v4l2-ctl/v4l2-ctl.h
+++ b/utils/v4l2-ctl/v4l2-ctl.h
@@ -159,6 +159,7 @@ int doioctl_name(int fd, unsigned long int request, void 
*parm, const char *name
 int test_ioctl(int fd, int cmd, void *arg);
 std::string flags2s(unsigned val, const flag_def *def);
 int parse_subopt(char **subs, const char * const *subopts, char **value);
+std::string std2s(v4l2_std_id std);
 
 #define doioctl(n, r, p) doioctl_name(n, r, p, #r)
 
@@ -178,5 +179,12 @@ void tuner_cmd(int ch, char *optarg);
 void tuner_set(int fd);
 void tuner_get(int fd);
 
+// v4l2-ctl-io.cpp
+void io_usage(void);
+void io_cmd(int ch, char *optarg);
+void io_set(int fd);
+void io_get(int fd);
+void io_list(int fd);
+
 
 #endif

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

Reply via email to