From dc6c272625c7801af68126bb1983207ad88400a5 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Tue, 17 May 2011 19:50:32 +0100 Subject: alsa-sink: Some trivial tidyups Mostly typo fixes but also a change to make a function relating to sink inputs use more generic variable names. --- src/modules/alsa/alsa-sink.c | 5 ++--- src/pulsecore/sink-input.c | 4 ++-- src/pulsecore/sink-input.h | 2 +- src/pulsecore/sink.c | 26 +++++++++++++++----------- 4 files changed, 20 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index b98340b7..96812c7f 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -256,6 +256,7 @@ static int reserve_monitor_init(struct userdata *u, const char *dname) { if (!(rname = pa_alsa_get_reserve_name(dname))) return 0; + /* We are resuming, try to lock the device */ u->monitor = pa_reserve_monitor_wrapper_get(u->core, rname); pa_xfree(rname); @@ -1590,7 +1591,7 @@ static void thread_func(void *userdata) { pa_usec_t volume_sleep; pa_sink_volume_change_apply(u->sink, &volume_sleep); if (volume_sleep > 0) - rtpoll_sleep = MIN(volume_sleep, rtpoll_sleep); + rtpoll_sleep = PA_MIN(volume_sleep, rtpoll_sleep); } if (rtpoll_sleep > 0) @@ -1954,7 +1955,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca SND_PCM_STREAM_PLAYBACK, &period_frames, &buffer_frames, tsched_frames, &b, &d, mapping))) - goto fail; } else if ((dev_id = pa_modargs_get_value(ma, "device_id", NULL))) { @@ -1969,7 +1969,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca SND_PCM_STREAM_PLAYBACK, &period_frames, &buffer_frames, tsched_frames, &b, &d, profile_set, &mapping))) - goto fail; } else { diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 553e3d97..9a43e044 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -1616,7 +1616,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { !pa_sample_spec_equal(&i->sample_spec, &dest->sample_spec) || !pa_channel_map_equal(&i->channel_map, &dest->channel_map)) { - /* Okey, we need a new resampler for the new sink */ + /* Okay, we need a new resampler for the new sink */ if (!(new_resampler = pa_resampler_new( i->core->mempool, @@ -1664,6 +1664,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { &i->sink->silence); i->actual_resample_method = new_resampler ? pa_resampler_get_method(new_resampler) : PA_RESAMPLER_INVALID; } + pa_sink_update_status(dest); update_volume_due_to_moving(i, dest); @@ -1678,7 +1679,6 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { /* Notify everyone */ pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], i); - pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index); return 0; diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index 0ebb74a9..38bad356 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -110,7 +110,7 @@ struct pa_sink_input { pa_bool_t muted:1; - /* if TRUE then the source we are connected to and/or the volume + /* if TRUE then the sink we are connected to and/or the volume * set is worth remembering, i.e. was explicitly chosen by the * user and not automatically. module-stream-restore looks for * this.*/ diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index bc4ddd21..ed38013d 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -1728,8 +1728,10 @@ void pa_sink_set_volume( /* Called from the io thread if sync volume is used, otherwise from the main thread. * Only to be called by sink implementor */ void pa_sink_set_soft_volume(pa_sink *s, const pa_cvolume *volume) { + pa_sink_assert_ref(s); pa_assert(!(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)); + if (s->flags & PA_SINK_SYNC_VOLUME) pa_sink_assert_io_context(s); else @@ -3295,25 +3297,27 @@ pa_idxset* pa_sink_get_formats(pa_sink *s) { /* Checks if the sink can accept this format */ pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f) { - pa_idxset *sink_formats = NULL; - pa_format_info *f_sink; - uint32_t i; + pa_idxset *formats = NULL; pa_bool_t ret = FALSE; pa_assert(s); pa_assert(f); - sink_formats = pa_sink_get_formats(s); + formats = pa_sink_get_formats(s); - PA_IDXSET_FOREACH(f_sink, sink_formats, i) { - if (pa_format_info_is_compatible(f_sink, f)) { - ret = TRUE; - break; + if (formats) { + pa_format_info *finfo_device; + uint32_t i; + + PA_IDXSET_FOREACH(finfo_device, formats, i) { + if (pa_format_info_is_compatible(finfo_device, f)) { + ret = TRUE; + break; + } } - } - if (sink_formats) - pa_idxset_free(sink_formats, (pa_free2_cb_t) pa_format_info_free2, NULL); + pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL); + } return ret; } -- cgit