btaudio patch: implement SNDCTL_DSP_GETISPACE so mp1e will work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Gerd,

Another btaudio patch - mp1e needs the SNDCTL_DSP_GETISPACE ioctl for
its audio/video sync to work properly (and for it to achieve the initial
sync that it needs to get started).

I've done an implementation of this ioctl that I think is right.  You'll
probably want to review what I did 'cos I don't claim to have a deep
understanding of the overall btaudio code.

By the way - don't forget the other msp3400 patch I sent on the 1st which
fixes that msp3400 doesn't switch the I2S output in every case.  Symptom
of that bug was no btaudio output in radio mode.

Anyway - here's this patch:


--- bttv-0.7.79/driver/btaudio.c	Fri Sep 14 14:52:29 2001
+++ bttv-0.7.79-sld/driver/btaudio.c	Wed Oct  3 11:36:03 2001
@@ -757,6 +757,25 @@
         case SNDCTL_DSP_SYNC:
 		/* NOP */
 		return 0;
+	case SNDCTL_DSP_GETISPACE:
+	{
+		audio_buf_info info;
+		if (!bta->recording) return -EINVAL;
+		info.fragsize = bta->block_bytes>>bta->sampleshift;
+		info.fragstotal = bta->block_count;
+		info.bytes = bta->read_count;
+		info.fragments = info.bytes / info.fragsize;
+#if 0
+		if (debug) {
+			printk(KERN_DEBUG "Called SNDCTL_DSP_GETISPACE on a btaudio fd!\n");
+			printk(KERN_DEBUG "Returning fragsize=%d, fragstotal=%d bytes=%d fragments=%d\n",
+					info.fragsize, info.fragstotal, info.bytes, info.fragments);
+		}
+#endif
+		if (copy_to_user((void *)arg, &info, sizeof(info)))
+			return -EFAULT;
+		return 0;
+	}
 #if 0 /* TODO */
         case SNDCTL_DSP_GETTRIGGER:
         case SNDCTL_DSP_SETTRIGGER:





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux