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: Add support for setting the band to S_TUNER / S_MODULATOR Author: Hans de Goede <[email protected]> Date: Sun May 27 11:45:13 2012 +0200 Signed-off-by: Hans de Goede <[email protected]> (cherry picked from commit ac23fa07d11daf1d1f95ea9f73a6dc589e984742) Signed-off-by: Gregor Jasny <[email protected]> utils/v4l2-ctl/v4l2-ctl.cpp | 137 ++++++++++++++++++++++++++++-------------- 1 files changed, 91 insertions(+), 46 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=25dfa9809343696cb00535d1f36d3b72abea794b diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 42a8dd5..3190093 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -350,6 +350,8 @@ static struct option long_options[] = { {0, 0, 0, 0} }; +static std::string tcap2bands(unsigned cap); + static void usage_hint(void) { fprintf(stderr, "Try 'v4l2-ctl --help' for more information.\n"); @@ -390,14 +392,15 @@ static void usage_tuner(void) " -f, --set-freq=<freq>\n" " set the frequency to <freq> MHz [VIDIOC_S_FREQUENCY]\n" " -T, --get-tuner query the tuner settings [VIDIOC_G_TUNER]\n" - " -t, --set-tuner=<mode>\n" - " set the audio mode of the tuner [VIDIOC_S_TUNER]\n" - " Possible values: mono, stereo, lang2, lang1, bilingual\n" + " -t, --set-tuner=band=<band>,mode=<mode>\n" + " set the band / audio mode of the tuner [VIDIOC_S_TUNER]\n" + " <band>: %s\n" + " <mode>: mono stereo lang2 lang1 bilingual\n" " --tuner-index=<idx> Use idx as tuner idx for tuner/modulator commands\n" " --get-modulator query the modulator settings [VIDIOC_G_MODULATOR]\n" - " --set-modulator=<txsubchans>\n" - " set the sub-carrier modulation [VIDIOC_S_MODULATOR]\n" - " <txsubchans> is one of:\n" + " --set-modulator=band=<band>,txsubchans=<txsubchans>\n" + " set the band / sub-carrier modulation [VIDIOC_S_MODULATOR]\n" + " <band> see --set-tuner, <txsubchans> is one of:\n" " mono: Modulate as mono\n" " mono-rds: Modulate as mono with RDS (radio only)\n" " stereo: Modulate as stereo\n" @@ -409,8 +412,8 @@ static void usage_tuner(void) " perform a hardware frequency seek [VIDIOC_S_HW_FREQ_SEEK]\n" " dir is 0 (seek downward) or 1 (seek upward)\n" " wrap is 0 (do not wrap around) or 1 (wrap around)\n" - " spacing is 0 (use default seek resolution) or sets the seek resolution\n" - ); + " spacing is 0 (use default seek resolution) or sets the seek resolution\n", + tcap2bands(-1).c_str()); } static void usage_io(void) @@ -2357,7 +2360,8 @@ int main(int argc, char **argv) unsigned int set_overlay_fmt = 0; unsigned int set_overlay_fmt_out = 0; - int mode = V4L2_TUNER_MODE_STEREO; /* set audio mode */ + int mode = -1; /* set audio mode */ + int band = -1; /* set tuner/modulator band */ /* command args */ int ch; @@ -2397,7 +2401,7 @@ int main(int argc, char **argv) struct v4l2_decoder_cmd dec_cmd; /* (try_)decoder_cmd */ int input; /* set_input/get_input */ int output; /* set_output/get_output */ - int txsubchans = 0; /* set_modulator */ + int txsubchans = -1; /* set_modulator */ v4l2_std_id std; /* get_std/set_std */ double freq = 0; /* get/set frequency */ double fps = 0; /* set framerate speed, in fps */ @@ -2801,43 +2805,78 @@ int main(int argc, char **argv) } break; case OptSetTuner: - if (!strcmp(optarg, "stereo")) - mode = V4L2_TUNER_MODE_STEREO; - else if (!strcmp(optarg, "lang1")) - mode = V4L2_TUNER_MODE_LANG1; - else if (!strcmp(optarg, "lang2")) - mode = V4L2_TUNER_MODE_LANG2; - else if (!strcmp(optarg, "bilingual")) - mode = V4L2_TUNER_MODE_LANG1_LANG2; - else if (!strcmp(optarg, "mono")) - mode = V4L2_TUNER_MODE_MONO; - else { - fprintf(stderr, "Unknown audio mode\n"); - usage_tuner(); - return 1; + subs = optarg; + while (*subs != '\0') { + static const char *const subopts[] = + { "band", "mode", NULL }; + + switch (parse_subopt(&subs, subopts, &value)) { + case 0: + band = s2band(value); + if (band == -1) { + fprintf(stderr, "Unknown band: '%s'\n", value); + usage_tuner(); + return 1; + } + break; + case 1: + if (!strcmp(value, "stereo")) + mode = V4L2_TUNER_MODE_STEREO; + else if (!strcmp(value, "lang1")) + mode = V4L2_TUNER_MODE_LANG1; + else if (!strcmp(value, "lang2")) + mode = V4L2_TUNER_MODE_LANG2; + else if (!strcmp(value, "bilingual")) + mode = V4L2_TUNER_MODE_LANG1_LANG2; + else if (!strcmp(value, "mono")) + mode = V4L2_TUNER_MODE_MONO; + else { + fprintf(stderr, "Unknown audio mode: '%s'\n", value); + usage_tuner(); + return 1; + } + break; + } } break; case OptSetModulator: - txsubchans = strtol(optarg, 0L, 0); - if (!strcmp(optarg, "stereo")) - txsubchans = V4L2_TUNER_SUB_STEREO; - else if (!strcmp(optarg, "stereo-sap")) - txsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_SAP; - else if (!strcmp(optarg, "bilingual")) - txsubchans = V4L2_TUNER_SUB_LANG1; - else if (!strcmp(optarg, "mono")) - txsubchans = V4L2_TUNER_SUB_MONO; - else if (!strcmp(optarg, "mono-sap")) - txsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_SAP; - else if (!strcmp(optarg, "stereo-rds")) - txsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_RDS; - else if (!strcmp(optarg, "mono-rds")) - txsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_RDS; - else { - fprintf(stderr, "Unknown txsubchans value\n"); - usage_tuner(); - return 1; - } + subs = optarg; + while (*subs != '\0') { + static const char *const subopts[] = + { "band", "txsubchans", NULL }; + + switch (parse_subopt(&subs, subopts, &value)) { + case 0: + band = s2band(value); + if (band == -1) { + fprintf(stderr, "Unknown band: '%s'\n", value); + usage_tuner(); + return 1; + } + break; + case 1: + if (!strcmp(value, "stereo")) + txsubchans = V4L2_TUNER_SUB_STEREO; + else if (!strcmp(value, "stereo-sap")) + txsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_SAP; + else if (!strcmp(value, "bilingual")) + txsubchans = V4L2_TUNER_SUB_LANG1; + else if (!strcmp(value, "mono")) + txsubchans = V4L2_TUNER_SUB_MONO; + else if (!strcmp(value, "mono-sap")) + txsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_SAP; + else if (!strcmp(value, "stereo-rds")) + txsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_RDS; + else if (!strcmp(value, "mono-rds")) + txsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_RDS; + else { + fprintf(stderr, "Unknown txsubchans value: '%s'\n", value); + usage_tuner(); + return 1; + } + break; + } + } break; case OptSetSlicedVbiFormat: case OptSetSlicedVbiOutFormat: @@ -3288,7 +3327,10 @@ int main(int argc, char **argv) memset(&vt, 0, sizeof(struct v4l2_tuner)); vt.index = tuner_index; if (doioctl(fd, VIDIOC_G_TUNER, &vt) == 0) { - vt.audmode = mode; + if (mode != -1) + vt.audmode = mode; + if (band != -1) + vt.band = band; doioctl(fd, VIDIOC_S_TUNER, &vt); } } @@ -3299,7 +3341,10 @@ int main(int argc, char **argv) memset(&mt, 0, sizeof(struct v4l2_modulator)); mt.index = tuner_index; if (doioctl(fd, VIDIOC_G_MODULATOR, &mt) == 0) { - mt.txsubchans = txsubchans; + if (txsubchans != -1) + mt.txsubchans = txsubchans; + if (band != -1) + mt.band = band; doioctl(fd, VIDIOC_S_MODULATOR, &mt); } } _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
