The patch number 7933 was added via Hans Verkuil <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Hans Verkuil  <[EMAIL PROTECTED]>
ivtv-ctl: add support to set mute and audio stereo/bilingual modes for playback


There was no support to set the fast/slow playback mute mode and the
stereo/bilingual playback modes. Added this to ivtv-ctl.

Signed-off-by: Hans Verkuil <[EMAIL PROTECTED]>


---

 v4l2-apps/util/ivtv-ctl.c |   58 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 3 deletions(-)

diff -r f0fe3d3acbd1 -r e54adb30b984 v4l2-apps/util/ivtv-ctl.c
--- a/v4l2-apps/util/ivtv-ctl.c Sun May 25 13:45:53 2008 +0200
+++ b/v4l2-apps/util/ivtv-ctl.c Sun May 25 15:02:53 2008 +0200
@@ -39,6 +39,7 @@
 
 #include <linux/videodev2.h>
 #include <linux/dvb/video.h>
+#include <linux/dvb/audio.h>
 
 /* copied from ivtv-driver.h */
 #define IVTV_DBGFLG_WARN    (1 << 0)
@@ -84,10 +85,15 @@ enum Option {
        OptReset = 128,
        OptSetYuvMode,
        OptGetYuvMode,
+       OptSetAudioMute,
+       OptSetStereoMode,
+       OptSetBilingualMode,
        OptLast = 256
 };
 
 static char options[OptLast];
+
+static int app_result;
 
 static struct option long_options[] = {
        /* Please keep in alphabetical order of the short option.
@@ -104,6 +110,9 @@ static struct option long_options[] = {
        {"reset", required_argument, 0, OptReset},
        {"get-yuv-mode", no_argument, 0, OptGetYuvMode},
        {"set-yuv-mode", required_argument, 0, OptSetYuvMode},
+       {"set-audio-mute", required_argument, 0, OptSetAudioMute},
+       {"set-stereo-mode", required_argument, 0, OptSetStereoMode},
+       {"set-bilingual-mode", required_argument, 0, OptSetBilingualMode},
        {0, 0, 0, 0}
 };
 
@@ -121,6 +130,21 @@ static void usage(void)
        printf("                     mode 1: interlaced (bottom transmitted 
first)\n");
        printf("                     mode 2: progressive\n");
        printf("                     mode 3: auto\n");
+       printf("  --set-audio-mute <mute>\n");
+       printf("                     0=enable audio during 1.5x and 0.5x 
playback\n");
+       printf("                     1=mute audio during 1.5x and 0.5x 
playback\n");
+       printf("  --set-stereo-mode <mode>\n");
+       printf("                     mode 0: playback stereo as stereo\n");
+       printf("                     mode 1: playback left stereo channel as 
mono\n");
+       printf("                     mode 2: playback right stereo channel as 
mono\n");
+       printf("                     mode 3: playback stereo as mono\n");
+       printf("                     mode 4: playback stereo as swapped 
stereo\n");
+       printf("  --set-bilingual-mode <mode>\n");
+       printf("                     mode 0: playback bilingual as stereo\n");
+       printf("                     mode 1: playback left bilingual channel as 
mono\n");
+       printf("                     mode 2: playback right bilingual channel 
as mono\n");
+       printf("                     mode 3: playback bilingual as mono\n");
+       printf("                     mode 4: playback bilingual as swapped 
stereo\n");
        printf("  --reset <mask>     reset the infrared receiver (1) or 
digitizer (2) [VIDIOC_INT_RESET]\n");
        printf("\n");
        printf("Expert options:\n");
@@ -285,8 +309,10 @@ static int doioctl(int fd, int request, 
 
        printf("ioctl %s ", name);
        retVal = ioctl(fd, request, parm);
-       if (retVal < 0)
+       if (retVal < 0) {
+               app_result = -1;
                printf("failed: %s\n", strerror(errno));
+       }
        else
                printf("ok\n");
 
@@ -325,6 +351,9 @@ int main(int argc, char **argv)
        unsigned short gpio_dir = 0x0;  /* GPIO direction bits */
        int gpio_set_dir = 0;
        int passthrough = 0;
+       int audio_mute = 0;
+       int stereo_mode = 0;
+       int bilingual_mode = 0;
        int debug_level = 0;
        __u32 reset = 0;
        int new_debug_level, gdebug_level;
@@ -427,6 +456,15 @@ int main(int argc, char **argv)
                case OptPassThrough:
                        passthrough = strtol(optarg, 0L, 0);
                        break;
+               case OptSetAudioMute:
+                       audio_mute = strtol(optarg, 0L, 0);
+                       break;
+               case OptSetStereoMode:
+                       stereo_mode = strtol(optarg, 0L, 0);
+                       break;
+               case OptSetBilingualMode:
+                       bilingual_mode = strtol(optarg, 0L, 0);
+                       break;
                case OptSetGPIO:
                        subs = optarg;
                        while (*subs != '\0') {
@@ -588,6 +626,20 @@ int main(int argc, char **argv)
                                "IVTV_IOC_PASSTHROUGH");
        }
 
+       if (options[OptSetAudioMute]) {
+               doioctl(fd, AUDIO_SET_MUTE, (void *)audio_mute, 
"AUDIO_SET_MUTE");
+       }
+
+       if (options[OptSetStereoMode]) {
+               doioctl(fd, AUDIO_CHANNEL_SELECT,
+                       (void *)stereo_mode, "AUDIO_CHANNEL_SELECT");
+       }
+
+       if (options[OptSetBilingualMode]) {
+               doioctl(fd, AUDIO_BILINGUAL_CHANNEL_SELECT,
+                       (void *)bilingual_mode, 
"AUDIO_BILINGUAL_CHANNEL_SELECT");
+       }
+
        if (options[OptReset])
                doioctl(fd, VIDIOC_INT_RESET, &reset, "VIDIOC_INT_RESET");
 
@@ -631,5 +683,5 @@ int main(int argc, char **argv)
        }
 
        close(fd);
-       exit(0);
-}
+       exit(app_result);
+}


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/e54adb30b98427d55ebed67ba93fe98c9ccf66a0

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

Reply via email to