diff options
author | Mike Thomas <rmthomas@sciolus.org> | 2010-07-11 10:54:51 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-22 11:08:55 -0700 |
commit | 7ebc8760b38bb00c35fcf43dad438c2adcd7c328 (patch) | |
tree | 7e7d85b359ef7a87d2f94ca09048348ed043f305 /drivers/staging/easycap/easycap_ioctl.c | |
parent | Staging: easycap: Replace some global variables (diff) | |
download | linux-dev-7ebc8760b38bb00c35fcf43dad438c2adcd7c328.tar.xz linux-dev-7ebc8760b38bb00c35fcf43dad438c2adcd7c328.zip |
Staging: easycap: Upsample microphone audio
Upsampling from 8000 Hz mono to 32000 Hz stereo improves audio/video
synchronization when userspace programs adopt default buffering. This
is an experimental feature.
Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/easycap/easycap_ioctl.c')
-rw-r--r-- | drivers/staging/easycap/easycap_ioctl.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/staging/easycap/easycap_ioctl.c b/drivers/staging/easycap/easycap_ioctl.c index 5853bba4dfca..7227d735f5e2 100644 --- a/drivers/staging/easycap/easycap_ioctl.c +++ b/drivers/staging/easycap/easycap_ioctl.c @@ -1985,10 +1985,17 @@ case SNDCTL_DSP_GETCAPS: { int caps; JOT(8, "SNDCTL_DSP_GETCAPS\n"); +#if defined(UPSAMPLE) + if (true == peasycap->microphone) + caps = 0x04400000; + else + caps = 0x04400000; +#else if (true == peasycap->microphone) caps = 0x02400000; else caps = 0x04400000; +#endif /*UPSAMPLE*/ if (0 != copy_to_user((void __user *)arg, &caps, sizeof(int))) return -EFAULT; @@ -1998,10 +2005,17 @@ case SNDCTL_DSP_GETFMTS: { int incoming; JOT(8, "SNDCTL_DSP_GETFMTS\n"); +#if defined(UPSAMPLE) + if (true == peasycap->microphone) + incoming = AFMT_S16_LE; + else + incoming = AFMT_S16_LE; +#else if (true == peasycap->microphone) incoming = AFMT_S16_LE; else incoming = AFMT_S16_LE; +#endif /*UPSAMPLE*/ if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) return -EFAULT; @@ -2014,10 +2028,17 @@ case SNDCTL_DSP_SETFMT: { return -EFAULT; JOT(8, "........... %i=incoming\n", incoming); +#if defined(UPSAMPLE) if (true == peasycap->microphone) outgoing = AFMT_S16_LE; else outgoing = AFMT_S16_LE; +#else + if (true == peasycap->microphone) + outgoing = AFMT_S16_LE; + else + outgoing = AFMT_S16_LE; +#endif /*UPSAMPLE*/ if (incoming != outgoing) { JOT(8, "........... %i=outgoing\n", outgoing); @@ -2037,10 +2058,17 @@ case SNDCTL_DSP_STEREO: { return -EFAULT; JOT(8, "........... %i=incoming\n", incoming); +#if defined(UPSAMPLE) + if (true == peasycap->microphone) + incoming = 1; + else + incoming = 1; +#else if (true == peasycap->microphone) incoming = 0; else incoming = 1; +#endif /*UPSAMPLE*/ if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) return -EFAULT; @@ -2053,10 +2081,17 @@ case SNDCTL_DSP_SPEED: { return -EFAULT; JOT(8, "........... %i=incoming\n", incoming); +#if defined(UPSAMPLE) + if (true == peasycap->microphone) + incoming = 32000; + else + incoming = 48000; +#else if (true == peasycap->microphone) incoming = 8000; else incoming = 48000; +#endif /*UPSAMPLE*/ if (0 != copy_to_user((void __user *)arg, &incoming, sizeof(int))) return -EFAULT; |