From: Jaroslav Kysela Date: Sat, 8 Mar 2003 16:32:38 +0000 (+0000) Subject: More cleanups X-Git-Tag: v1.0.3~210 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=c8fab38b67d4473693facc5329872cb3f000a465;p=alsa-lib.git More cleanups --- diff --git a/src/pcm/ext/pcm_jack.c b/src/pcm/ext/pcm_jack.c index f55b1d5a..abe67cbf 100644 --- a/src/pcm/ext/pcm_jack.c +++ b/src/pcm/ext/pcm_jack.c @@ -204,7 +204,7 @@ snd_pcm_jack_process_cb (jack_nframes_t nframes, snd_pcm_t *pcm) unsigned int channel; #ifdef PCM_JACK_DEBUG - printf("PROCESS %d!\n",jack->state); + printf("PROCESS %d! (%u)\n",jack->state, (unsigned)nframes); #endif for (channel = 0; channel < jack->channels; channel++) { @@ -342,7 +342,7 @@ static int snd_pcm_jack_start(snd_pcm_t *pcm) jack_port_name (jack->ports[i]), jack->playback_ports[i])) { - fprintf(stderr, "cannot connect %s to %s", + fprintf(stderr, "cannot connect %s to %s\n", jack_port_name(jack->ports[i]), jack->playback_ports[i]); return -EIO; @@ -363,7 +363,7 @@ static int snd_pcm_jack_start(snd_pcm_t *pcm) jack->capture_ports[i], jack_port_name (jack->ports[i]))) { - fprintf(stderr, "cannot connect %s to %s", + fprintf(stderr, "cannot connect %s to %s\n", jack->capture_ports[i], jack_port_name(jack->ports[i])); return -EIO; @@ -401,12 +401,15 @@ static int snd_pcm_jack_drop(snd_pcm_t *pcm) printf("deactivate done\n"); jack->activated = 0; } + { + unsigned i; for (i = 0; i < pcm->channels; i++) { if (jack->ports[i]) { jack_port_unregister(jack->client, jack->ports[i]); jack->ports[i] = NULL; } } + } #endif jack->state = SND_PCM_STATE_SETUP; return 0; @@ -510,7 +513,7 @@ static int snd_pcm_jack_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) (1<capture_ports = NULL; jack->capture_ports_n = 0; - err = parse_ports(playback_conf, - &jack->playback_ports,&jack->playback_ports_n); + err = parse_ports(playback_conf, &jack->playback_ports,&jack->playback_ports_n); if (err) goto _free; - err = parse_ports(capture_conf, - &jack->capture_ports,&jack->capture_ports_n); + err = parse_ports(capture_conf, &jack->capture_ports,&jack->capture_ports_n); if (err) goto _free; @@ -729,6 +730,10 @@ int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, jack->client = jack_client_new("alsaC"); } + if (jack->channels == 0) { + SNDERR("define the %s_ports section\n", stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture"); + goto _free; + } if (jack->client==0) { err = -ENOENT; @@ -765,6 +770,8 @@ int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, _free: if (jack) { + if (jack->client) + jack_client_close(jack->client); if (jack->playback_ports) { unsigned int k;