Update of /cvsroot/alsa/alsa-kernel/usb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11056/usb
Modified Files: usbaudio.c Log Message: - assign PCM unique (sub)streams for each USB format type. this will avoid the mix up of format I and format III on M-audio transit. Index: usbaudio.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/usb/usbaudio.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- usbaudio.c 4 Feb 2004 13:35:51 -0000 1.78 +++ usbaudio.c 9 Feb 2004 16:25:38 -0000 1.79 @@ -116,7 +116,7 @@ struct list_head list; snd_pcm_format_t format; /* format type */ unsigned int channels; /* # channels */ - unsigned int nonaudio: 1; /* non-audio (type II) */ + unsigned int fmt_type; /* USB audio format type (1-3) */ unsigned int frame_size; /* samples per frame for non-audio */ int iface; /* interface number */ unsigned char altsetting; /* corresponding alternate setting */ @@ -170,7 +170,7 @@ unsigned int curpacksize; /* current packet size in bytes (for capture) */ unsigned int curframesize; /* current packet size in frames (for capture) */ unsigned int fill_max: 1; /* fill max packet size always */ - unsigned int nonaudio: 1; /* Type II format (MPEG, AC3) */ + unsigned int fmt_type; /* USB audio format type (1-3) */ unsigned int running: 1; /* running status */ @@ -200,6 +200,7 @@ snd_usb_audio_t *chip; snd_pcm_t *pcm; int pcm_index; + unsigned int fmt_type; /* USB audio format type (1-3) */ snd_usb_substream_t substream[2]; struct list_head list; }; @@ -476,7 +477,7 @@ subs->transfer_sched += counts; if (subs->transfer_sched >= runtime->period_size) { subs->transfer_sched -= runtime->period_size; - if (subs->nonaudio) { + if (subs->fmt_type == USB_FORMAT_TYPE_II) { if (subs->transfer_sched > 0) { /* FIXME: fill-max mode is not supported yet */ offs -= subs->transfer_sched; @@ -893,7 +894,7 @@ u->subs = subs; u->transfer = 0; u->packets = npacks[i]; - if (subs->nonaudio) + if (subs->fmt_type == USB_FORMAT_TYPE_II) u->packets++; /* for transfer delimiter */ if (! is_playback) { /* allocate a capture buffer per urb */ @@ -1587,7 +1588,7 @@ runtime->hw.channels_min = fp->channels; if (runtime->hw.channels_max < fp->channels) runtime->hw.channels_max = fp->channels; - if (fp->nonaudio && fp->frame_size > 0) { + if (fp->fmt_type == USB_FORMAT_TYPE_II && fp->frame_size > 0) { /* FIXME: there might be more than one audio formats... */ runtime->hw.period_bytes_min = runtime->hw.period_bytes_max = fp->frame_size; @@ -1894,7 +1895,7 @@ subs->formats |= 1ULL << fp->format; subs->endpoint = fp->endpoint; subs->num_formats++; - subs->nonaudio = fp->nonaudio; + subs->fmt_type = fp->fmt_type; } @@ -1953,17 +1954,12 @@ list_for_each(p, &chip->pcm_list) { as = list_entry(p, snd_usb_stream_t, list); + if (as->fmt_type != fp->fmt_type) + continue; subs = &as->substream[stream]; if (! subs->endpoint) - break; + continue; if (subs->endpoint == fp->endpoint) { - if (fp->nonaudio) { - if (!subs->nonaudio || subs->formats != (1ULL << fp->format)) - continue; /* non-linear formats are handled exclusively */ - } else { - if (subs->nonaudio) - continue; - } list_add_tail(&fp->list, &subs->fmt_list); subs->num_formats++; subs->formats |= 1ULL << fp->format; @@ -1973,6 +1969,8 @@ /* look for an empty stream */ list_for_each(p, &chip->pcm_list) { as = list_entry(p, snd_usb_stream_t, list); + if (as->fmt_type != fp->fmt_type) + continue; subs = &as->substream[stream]; if (subs->endpoint) continue; @@ -1990,6 +1988,7 @@ memset(as, 0, sizeof(*as)); as->pcm_index = chip->pcm_devs; as->chip = chip; + as->fmt_type = fp->fmt_type; err = snd_pcm_new(chip->card, "USB Audio", chip->pcm_devs, stream == SNDRV_PCM_STREAM_PLAYBACK ? 1 : 0, stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1, @@ -2215,7 +2214,6 @@ break; } fp->channels = 1; - fp->nonaudio = 1; brate = combine_word(&fmt[4]); /* fmt[4,5] : wMaxBitRate (in kbps) */ framesize = combine_word(&fmt[6]); /* fmt[6,7]: wSamplesPerFrame */ snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); @@ -2241,6 +2239,7 @@ dev->devnum, fp->iface, fp->altsetting, fmt[3]); return -1; } + fp->fmt_type = fmt[3]; if (err < 0) return err; #if 1 ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog