pcm_jack.c (alsa-plugins-1.2.6.tar.bz2) | : | pcm_jack.c (alsa-plugins-1.2.7.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | * GNU Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
* | * | |||
*/ | */ | |||
#define _GNU_SOURCE | ||||
#include <stdbool.h> | #include <stdbool.h> | |||
#include <errno.h> | ||||
#include <byteswap.h> | #include <byteswap.h> | |||
#include <sys/shm.h> | #include <sys/shm.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/socket.h> | #include <sys/socket.h> | |||
#include <jack/jack.h> | #include <jack/jack.h> | |||
#include <alsa/asoundlib.h> | #include <alsa/asoundlib.h> | |||
#include <alsa/pcm_external.h> | #include <alsa/pcm_external.h> | |||
#include <pthread.h> | #include <pthread.h> | |||
#define MAX_PERIODS_MULTIPLE 64 | #define MAX_PERIODS_MULTIPLE 64 | |||
skipping to change at line 433 | skipping to change at line 435 | |||
for (i = 0; i < io->channels; i++) { | for (i = 0; i < io->channels; i++) { | |||
if (jack->ports[i]) { | if (jack->ports[i]) { | |||
jack_port_unregister(jack->client, jack->ports[i]); | jack_port_unregister(jack->client, jack->ports[i]); | |||
jack->ports[i] = NULL; | jack->ports[i] = NULL; | |||
} | } | |||
} | } | |||
#endif | #endif | |||
return 0; | return 0; | |||
} | } | |||
static int snd_pcm_jack_sw_params(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *par | ||||
ams) | ||||
{ | ||||
snd_pcm_jack_t *jack = io->private_data; | ||||
snd_pcm_sw_params_get_avail_min(params, &jack->min_avail); | ||||
return 0; | ||||
} | ||||
static snd_pcm_ioplug_callback_t jack_pcm_callback = { | static snd_pcm_ioplug_callback_t jack_pcm_callback = { | |||
.close = snd_pcm_jack_close, | .close = snd_pcm_jack_close, | |||
.start = snd_pcm_jack_start, | .start = snd_pcm_jack_start, | |||
.stop = snd_pcm_jack_stop, | .stop = snd_pcm_jack_stop, | |||
.pointer = snd_pcm_jack_pointer, | .pointer = snd_pcm_jack_pointer, | |||
.hw_free = snd_pcm_jack_hw_free, | .hw_free = snd_pcm_jack_hw_free, | |||
.prepare = snd_pcm_jack_prepare, | .prepare = snd_pcm_jack_prepare, | |||
.poll_revents = snd_pcm_jack_poll_revents, | .poll_revents = snd_pcm_jack_poll_revents, | |||
.sw_params = snd_pcm_jack_sw_params, | ||||
}; | }; | |||
#define ARRAY_SIZE(ary) (sizeof(ary)/sizeof(ary[0])) | #define ARRAY_SIZE(ary) (sizeof(ary)/sizeof(ary[0])) | |||
static int jack_set_hw_constraint(snd_pcm_jack_t *jack) | static int jack_set_hw_constraint(snd_pcm_jack_t *jack) | |||
{ | { | |||
unsigned int access_list[] = { | unsigned int access_list[] = { | |||
SND_PCM_ACCESS_MMAP_INTERLEAVED, | SND_PCM_ACCESS_MMAP_INTERLEAVED, | |||
SND_PCM_ACCESS_MMAP_NONINTERLEAVED, | SND_PCM_ACCESS_MMAP_NONINTERLEAVED, | |||
SND_PCM_ACCESS_RW_INTERLEAVED, | SND_PCM_ACCESS_RW_INTERLEAVED, | |||
skipping to change at line 595 | skipping to change at line 605 | |||
return err; | return err; | |||
} | } | |||
if (jack->num_ports == 0) { | if (jack->num_ports == 0) { | |||
SNDERR("define the %s_ports section", | SNDERR("define the %s_ports section", | |||
stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture" ); | stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture" ); | |||
snd_pcm_jack_free(jack); | snd_pcm_jack_free(jack); | |||
return -EINVAL; | return -EINVAL; | |||
} | } | |||
if (client_name == NULL) | if (client_name == NULL) { | |||
const char *pname = program_invocation_short_name; | ||||
if (!pname[0]) { | ||||
pname = "alsa-jack"; | ||||
} | ||||
err = snprintf(jack_client_name, sizeof(jack_client_name), | err = snprintf(jack_client_name, sizeof(jack_client_name), | |||
"alsa-jack.%s%s.%d.%d", name, | "%s.%s.%d.%d", pname, | |||
stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", | stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", | |||
getpid(), num++); | getpid(), num++); | |||
else | } else | |||
err = snprintf(jack_client_name, sizeof(jack_client_name), | err = snprintf(jack_client_name, sizeof(jack_client_name), | |||
"%s", client_name); | "%s", client_name); | |||
if (err >= (int)sizeof(jack_client_name)) { | if (err >= (int)sizeof(jack_client_name)) { | |||
fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n", | fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n", | |||
__func__, jack_client_name, (int)strlen(jack_client_name) ); | __func__, jack_client_name, (int)strlen(jack_client_name) ); | |||
} | } | |||
jack->client = jack_client_open(jack_client_name, JackNoStartServer, NULL ); | jack->client = jack_client_open(jack_client_name, JackNoStartServer, NULL ); | |||
End of changes. 7 change blocks. | ||||
3 lines changed or deleted | 18 lines changed or added |