"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "jack/pcm_jack.c" between
alsa-plugins-1.2.2.tar.bz2 and alsa-plugins-1.2.5.tar.bz2

About: ALSA (Advanced Linux Sound Architecture) - Additional plugins for various audio libraries and sound servers.

pcm_jack.c  (alsa-plugins-1.2.2.tar.bz2):pcm_jack.c  (alsa-plugins-1.2.5.tar.bz2)
skipping to change at line 54 skipping to change at line 54
int fd; int fd;
int activated; /* jack is activated? */ int activated; /* jack is activated? */
snd_pcm_jack_port_list_t **port_names; snd_pcm_jack_port_list_t **port_names;
unsigned int num_ports; unsigned int num_ports;
snd_pcm_uframes_t boundary; snd_pcm_uframes_t boundary;
snd_pcm_uframes_t hw_ptr; snd_pcm_uframes_t hw_ptr;
unsigned int sample_bits; unsigned int sample_bits;
snd_pcm_uframes_t min_avail; snd_pcm_uframes_t min_avail;
int use_period_alignment;
snd_pcm_channel_area_t *areas; snd_pcm_channel_area_t *areas;
jack_port_t **ports; jack_port_t **ports;
jack_client_t *client; jack_client_t *client;
/* JACK thread -> ALSA thread */ /* JACK thread -> ALSA thread */
bool xrun_detected; bool xrun_detected;
} snd_pcm_jack_t; } snd_pcm_jack_t;
skipping to change at line 453 skipping to change at line 454
jack->sample_bits = snd_pcm_format_physical_width(format); jack->sample_bits = snd_pcm_format_physical_width(format);
if ((err = snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_IOPLUG_HW_ACC ESS, if ((err = snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_IOPLUG_HW_ACC ESS,
ARRAY_SIZE(access_list), access_ list)) < 0 || ARRAY_SIZE(access_list), access_ list)) < 0 ||
(err = snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_IOPLUG_HW_FOR MAT, (err = snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_IOPLUG_HW_FOR MAT,
1, &format)) < 0 || 1, &format)) < 0 ||
(err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_C HANNELS, (err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_C HANNELS,
jack->num_ports, jack->num_por ts)) < 0 || jack->num_ports, jack->num_por ts)) < 0 ||
(err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_R ATE, (err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_R ATE,
rate, rate)) < 0 || rate, rate)) < 0 ||
(err = snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_IOPLUG_HW_PER (err = jack->use_period_alignment ?
IOD_BYTES, snd_pcm_ioplug_set_param_list(&jack->io, SND_PCM_
ARRAY_SIZE(psize_list), psize_li IOPLUG_HW_PERIOD_BYTES, ARRAY_SIZE(psize_list), psize_list) :
st)) < 0 || snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PC
M_IOPLUG_HW_PERIOD_BYTES, 128, 64*1024) ) < 0 ||
(err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_P ERIODS, (err = snd_pcm_ioplug_set_param_minmax(&jack->io, SND_PCM_IOPLUG_HW_P ERIODS,
2, 64)) < 0) 2, 64)) < 0)
return err; return err;
return 0; return 0;
} }
static int parse_ports(snd_pcm_jack_t *jack, snd_config_t *conf) static int parse_ports(snd_pcm_jack_t *jack, snd_config_t *conf)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
skipping to change at line 535 skipping to change at line 537
if (fl & O_NONBLOCK) if (fl & O_NONBLOCK)
return 0; return 0;
return fcntl(fd, F_SETFL, fl | O_NONBLOCK); return fcntl(fd, F_SETFL, fl | O_NONBLOCK);
} }
static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
const char *client_name, const char *client_name,
snd_config_t *playback_conf, snd_config_t *playback_conf,
snd_config_t *capture_conf, snd_config_t *capture_conf,
int use_period_alignment,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_pcm_jack_t *jack; snd_pcm_jack_t *jack;
int err; int err;
int fd[2]; int fd[2];
static unsigned int num = 0; static unsigned int num = 0;
char jack_client_name[32]; char jack_client_name[32];
assert(pcmp); assert(pcmp);
jack = calloc(1, sizeof(*jack)); jack = calloc(1, sizeof(*jack));
if (!jack) if (!jack)
return -ENOMEM; return -ENOMEM;
jack->fd = -1; jack->fd = -1;
jack->io.poll_fd = -1; jack->io.poll_fd = -1;
jack->use_period_alignment = use_period_alignment;
err = parse_ports(jack, stream == SND_PCM_STREAM_PLAYBACK ? err = parse_ports(jack, stream == SND_PCM_STREAM_PLAYBACK ?
playback_conf : capture_conf); playback_conf : capture_conf);
if (err) { if (err) {
snd_pcm_jack_free(jack); snd_pcm_jack_free(jack);
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",
skipping to change at line 637 skipping to change at line 641
return 0; return 0;
} }
SND_PCM_PLUGIN_DEFINE_FUNC(jack) SND_PCM_PLUGIN_DEFINE_FUNC(jack)
{ {
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
snd_config_t *playback_conf = NULL; snd_config_t *playback_conf = NULL;
snd_config_t *capture_conf = NULL; snd_config_t *capture_conf = NULL;
const char *client_name = NULL; const char *client_name = NULL;
int err; int err;
int align_jack_period = 1; /*by default we allow only JACK aligned period size*/
snd_config_for_each(i, next, conf) { snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i); snd_config_t *n = snd_config_iterator_entry(i);
const char *id; const char *id;
if (snd_config_get_id(n, &id) < 0) if (snd_config_get_id(n, &id) < 0)
continue; continue;
if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strc mp(id, "hint") == 0) if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strc mp(id, "hint") == 0)
continue; continue;
if (strcmp(id, "name") == 0) { if (strcmp(id, "name") == 0) {
snd_config_get_string(n, &client_name); snd_config_get_string(n, &client_name);
skipping to change at line 665 skipping to change at line 670
continue; continue;
} }
if (strcmp(id, "capture_ports") == 0) { if (strcmp(id, "capture_ports") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id); SNDERR("Invalid type for %s", id);
return -EINVAL; return -EINVAL;
} }
capture_conf = n; capture_conf = n;
continue; continue;
} }
if (strcmp(id, "align_psize") == 0) {
err = snd_config_get_bool(n);
if (err < 0)
return err;
align_jack_period = err ? 1 : 0;
continue;
}
SNDERR("Unknown field %s", id); SNDERR("Unknown field %s", id);
return -EINVAL; return -EINVAL;
} }
err = snd_pcm_jack_open(pcmp, name, client_name, playback_conf, capture_c onf, stream, mode); err = snd_pcm_jack_open(pcmp, name, client_name, playback_conf, capture_c onf, align_jack_period, stream, mode);
return err; return err;
} }
SND_PCM_PLUGIN_SYMBOL(jack); SND_PCM_PLUGIN_SYMBOL(jack);
 End of changes. 7 change blocks. 
5 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)