Name: pulseaudio
Summary: Improved Linux sound server
Version: 11.1
-Release: 52
+Release: 53
Group: Multimedia/Audio
License: LGPL-2.1
URL: http://pulseaudio.org
pa_cvolume hardware_volume;
-#ifndef __TIZEN__
- unsigned int *rates;
-#else
+ pa_sample_spec verified_sample_spec;
pa_sample_format_t *supported_formats;
unsigned int *supported_rates;
struct {
- pa_sample_spec sample_spec;
size_t fragment_size;
size_t nfrags;
size_t tsched_size;
size_t tsched_watermark;
size_t rewind_safeguard;
} initial_info;
-#endif
size_t
frame_size,
fragment_size,
hwbuf_size,
-#ifdef __TIZEN__
tsched_size,
-#endif
tsched_watermark,
tsched_watermark_ref,
hwbuf_unused,
(double) u->tsched_watermark_usec / PA_USEC_PER_MSEC);
}
-#ifdef __TIZEN__
+/* Called from IO Context on unsuspend */
static void update_size(struct userdata *u, pa_sample_spec *ss) {
pa_assert(u);
pa_assert(ss);
u->frame_size = pa_frame_size(ss);
u->frames_per_block = pa_mempool_block_size_max(u->core->mempool) / u->frame_size;
- if (u->initial_info.sample_spec.rate == ss->rate && u->initial_info.sample_spec.format == ss->format) {
- /* use initial values including module arguments */
- u->fragment_size = u->initial_info.fragment_size;
- u->hwbuf_size = u->initial_info.nfrags * u->fragment_size;
- u->tsched_size = u->initial_info.tsched_size;
- u->tsched_watermark = u->initial_info.tsched_watermark;
- u->rewind_safeguard = u->initial_info.rewind_safeguard;
- } else {
- u->fragment_size = pa_usec_to_bytes(u->core->default_fragment_size_msec * PA_USEC_PER_MSEC, ss);
- u->hwbuf_size = u->core->default_n_fragments * u->fragment_size;
- u->tsched_size = pa_usec_to_bytes(DEFAULT_TSCHED_BUFFER_USEC, ss);
- u->tsched_watermark = pa_usec_to_bytes(DEFAULT_TSCHED_WATERMARK_USEC, ss);
- u->rewind_safeguard = PA_MAX(DEFAULT_REWIND_SAFEGUARD_BYTES, pa_usec_to_bytes(DEFAULT_REWIND_SAFEGUARD_USEC, ss));
- }
+ /* use initial values including module arguments */
+ u->fragment_size = u->initial_info.fragment_size;
+ u->hwbuf_size = u->initial_info.nfrags * u->fragment_size;
+ u->tsched_size = u->initial_info.tsched_size;
+ u->tsched_watermark = u->initial_info.tsched_watermark;
+ u->rewind_safeguard = u->initial_info.rewind_safeguard;
u->tsched_watermark_ref = u->tsched_watermark;
pa_log_info("Updated frame_size %zu, frames_per_block %lu, fragment_size %zu, hwbuf_size %zu, tsched(size %zu, watermark %zu), rewind_safeguard %zu",
u->frame_size, (unsigned long) u->frames_per_block, u->fragment_size, u->hwbuf_size, u->tsched_size, u->tsched_watermark, u->rewind_safeguard);
}
-#endif
/* Called from IO context */
static int unsuspend(struct userdata *u) {
pa_sample_spec ss;
int err;
bool b, d;
-#ifndef __TIZEN__
- snd_pcm_uframes_t period_size, buffer_size;
-#else
snd_pcm_uframes_t period_frames, buffer_frames;
snd_pcm_uframes_t tsched_frames = 0;
-#endif
char *device_name = NULL;
+ bool frame_size_changed = false;
pa_assert(u);
pa_assert(!u->pcm_handle);
goto fail;
}
-#ifdef __TIZEN__
if (pa_frame_size(&u->sink->sample_spec) != u->frame_size) {
update_size(u, &u->sink->sample_spec);
tsched_frames = u->tsched_size / u->frame_size;
+ frame_size_changed = true;
}
+
+ ss = u->sink->sample_spec;
period_frames = u->fragment_size / u->frame_size;
buffer_frames = u->hwbuf_size / u->frame_size;
-#endif
- ss = u->sink->sample_spec;
-#ifndef __TIZEN__
- period_size = u->fragment_size / u->frame_size;
- buffer_size = u->hwbuf_size / u->frame_size;
-#endif
b = u->use_mmap;
d = u->use_tsched;
-#ifdef __TIZEN__
if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_frames, &buffer_frames, tsched_frames, &b, &d, true)) < 0) {
-#else
- if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, true)) < 0) {
-#endif
pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err));
goto fail;
}
goto fail;
}
-#ifdef __TIZEN__
- if (tsched_frames) {
+ if (frame_size_changed) {
u->fragment_size = (size_t)(period_frames * u->frame_size);
u->hwbuf_size = (size_t)(buffer_frames * u->frame_size);
pa_proplist_setf(u->sink->proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%zu", u->hwbuf_size);
pa_proplist_setf(u->sink->proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%zu", u->fragment_size);
+
} else if (period_frames * u->frame_size != u->fragment_size ||
buffer_frames * u->frame_size != u->hwbuf_size) {
pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %zu/%zu, New %lu/%lu)",
(unsigned long) buffer_frames * u->frame_size, (unsigned long) period_frames * u->frame_size);
goto fail;
}
-#else
- if (period_size*u->frame_size != u->fragment_size ||
- buffer_size*u->frame_size != u->hwbuf_size) {
- pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu/%lu, New %lu/%lu)",
- (unsigned long) u->hwbuf_size, (unsigned long) u->fragment_size,
- (unsigned long) (buffer_size*u->frame_size), (unsigned long) (period_size*u->frame_size));
- goto fail;
- }
-#endif
if (update_sw_params(u) < 0)
goto fail;
* framework, but this must be changed if we do. */
/* Count how many sample rates we support */
-#ifdef __TIZEN__
for (idx = 0, n = 0; u->supported_rates[idx]; idx++)
-#else
- for (idx = 0, n = 0; u->rates[idx]; idx++)
-#endif
n++;
/* First insert non-PCM formats since we prefer those. */
PA_IDXSET_FOREACH(f, formats, idx) {
if (!pa_format_info_is_pcm(f)) {
g = pa_format_info_copy(f);
-#ifdef __TIZEN__
pa_format_info_set_prop_int_array(g, PA_PROP_FORMAT_RATE, (int *) u->supported_rates, n);
-#else
- pa_format_info_set_prop_int_array(g, PA_PROP_FORMAT_RATE, (int *) u->rates, n);
-#endif
pa_idxset_put(u->formats, g, NULL);
}
}
return true;
}
-static int sink_reconfigure_cb(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
+static void sink_reconfigure_cb(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
struct userdata *u = s->userdata;
int i;
-#ifndef __TIZEN__
- bool supported = false;
-
- /* FIXME: we only update rate for now */
-
- pa_assert(u);
-
- for (i = 0; u->rates[i]; i++) {
- if (u->rates[i] == spec->rate) {
- supported = true;
- break;
- }
- }
-
- if (!supported) {
- pa_log_info("Sink does not support sample rate of %d Hz", spec->rate);
- return -1;
- }
-
- if (!PA_SINK_IS_OPENED(s->state)) {
- pa_log_info("Updating rate for device %s, new rate is %d", u->device_name, spec->rate);
- u->sink->sample_spec.rate = spec->rate;
- return 0;
- }
-
- /* Passthrough status change is handled during unsuspend */
-
- return -1;
-#else
bool format_supported = false;
bool rate_supported = false;
pa_assert(u);
- if (PA_SINK_IS_OPENED(s->state)) {
- pa_log_warn("Sink is opened, skip it");
- return -1;
- }
-
for (i = 0; u->supported_formats[i] != PA_SAMPLE_MAX; i++) {
if (u->supported_formats[i] == spec->format) {
- u->sink->sample_spec.format = spec->format;
- format_supported = true;
- pa_log_info("Sink supports sample format of %s", pa_sample_format_to_string(spec->format));
+ pa_sink_set_sample_format(u->sink, spec->format);
+ format_supported = true;
break;
}
}
+ if (!format_supported) {
+ pa_log_info("Sink does not support sample format of %s, set it to a verified value",
+ pa_sample_format_to_string(spec->format));
+ pa_sink_set_sample_format(u->sink, u->verified_sample_spec.format);
+ }
+
for (i = 0; u->supported_rates[i]; i++) {
if (u->supported_rates[i] == spec->rate) {
- u->sink->sample_spec.rate = spec->rate;
+ pa_sink_set_sample_rate(u->sink, spec->rate);
rate_supported = true;
- pa_log_info("Sink supports sample rate of %d Hz", spec->rate);
break;
}
}
- if (!format_supported && !rate_supported) {
- pa_log_warn("Sink does not support both sample format of %s and rate of %d Hz",
- pa_sample_format_to_string(spec->format), spec->rate);
- return -1;
+ if (!rate_supported) {
+ pa_log_info("Sink does not support sample rate of %u, set it to a verified value", spec->rate);
+ pa_sink_set_sample_rate(u->sink, u->verified_sample_spec.rate);
}
/* Passthrough status change is handled during unsuspend */
-
- return 0;
-#endif
}
static int process_rewind(struct userdata *u) {
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard;
snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames;
size_t frame_size;
-#ifdef __TIZEN__
bool use_mmap = true;
bool use_tsched = true;
bool ignore_dB = false;
bool b;
bool d;
bool avoid_resampling;
-#else
- bool use_mmap = true, b, use_tsched = true, d, ignore_dB = false, namereg_fail = false, deferred_volume = false, set_formats = false, fixed_latency_range = false;
-#endif
pa_sink_new_data data;
bool volume_is_set;
bool mute_is_set;
ss = m->core->default_sample_spec;
map = m->core->default_channel_map;
-#ifdef __TIZEN__
avoid_resampling = m->core->avoid_resampling;
-#endif
/* Pick sample spec overrides from the mapping, if any */
if (mapping) {
u->module = m;
u->use_mmap = use_mmap;
u->use_tsched = use_tsched;
-#ifdef __TIZEN__
u->tsched_size = tsched_size;
- u->initial_info.sample_spec = ss;
u->initial_info.nfrags = (size_t) nfrags;
u->initial_info.fragment_size = (size_t) frag_size;
u->initial_info.tsched_size = (size_t) tsched_size;
u->initial_info.tsched_watermark = (size_t) tsched_watermark;
u->initial_info.rewind_safeguard = (size_t) rewind_safeguard;
-#endif
u->deferred_volume = deferred_volume;
u->fixed_latency_range = fixed_latency_range;
u->first = true;
if ((is_iec958(u) || is_hdmi(u)) && ss.channels == 2)
set_formats = true;
-#ifdef __TIZEN__
+ u->verified_sample_spec = ss;
+
u->supported_formats = pa_alsa_get_supported_formats(u->pcm_handle, ss.format);
if (!u->supported_formats) {
pa_log_error("Failed to find any supported sample formats.");
u->supported_rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
if (!u->supported_rates) {
-#else
- u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
- if (!u->rates) {
-#endif
pa_log_error("Failed to find any supported sample rates.");
goto fail;
}
goto fail;
}
data.namereg_fail = namereg_fail;
-#ifdef __TIZEN__
+
if (pa_modargs_get_value_boolean(ma, "avoid_resampling", &avoid_resampling) < 0) {
pa_log("Failed to parse avoid_resampling argument.");
pa_sink_new_data_done(&data);
goto fail;
}
data.avoid_resampling = avoid_resampling;
-#endif
pa_sink_new_data_set_sample_spec(&data, &ss);
pa_sink_new_data_set_channel_map(&data, &map);
if (u->formats)
pa_idxset_free(u->formats, (pa_free_cb_t) pa_format_info_free);
-#ifdef __TIZEN__
if (u->supported_formats)
pa_xfree(u->supported_formats);
if (u->supported_rates)
pa_xfree(u->supported_rates);
-#else
- if (u->rates)
- pa_xfree(u->rates);
-#endif
reserve_done(u);
monitor_done(u);
pa_cvolume hardware_volume;
-#ifndef __TIZEN__
- unsigned int *rates;
-#else
+ pa_sample_spec verified_sample_spec;
pa_sample_format_t *supported_formats;
unsigned int *supported_rates;
struct {
- pa_sample_spec sample_spec;
size_t fragment_size;
size_t nfrags;
size_t tsched_size;
size_t tsched_watermark;
} initial_info;
-#endif
size_t
frame_size,
fragment_size,
hwbuf_size,
-#ifdef __TIZEN__
tsched_size,
-#endif
tsched_watermark,
tsched_watermark_ref,
hwbuf_unused,
(double) u->tsched_watermark_usec / PA_USEC_PER_MSEC);
}
-#ifdef __TIZEN__
+/* Called from IO Context on unsuspend */
static void update_size(struct userdata *u, pa_sample_spec *ss) {
pa_assert(u);
pa_assert(ss);
u->frame_size = pa_frame_size(ss);
u->frames_per_block = pa_mempool_block_size_max(u->core->mempool) / u->frame_size;
- if (u->initial_info.sample_spec.rate == ss->rate && u->initial_info.sample_spec.format == ss->format) {
- /* use initial values including module arguments */
- u->fragment_size = u->initial_info.fragment_size;
- u->hwbuf_size = u->initial_info.nfrags * u->fragment_size;
- u->tsched_size = u->initial_info.tsched_size;
- u->tsched_watermark = u->initial_info.tsched_watermark;
- } else {
- u->fragment_size = pa_usec_to_bytes(u->core->default_fragment_size_msec * PA_USEC_PER_MSEC, ss);
- u->hwbuf_size = u->core->default_n_fragments * u->fragment_size;
- u->tsched_size = pa_usec_to_bytes(DEFAULT_TSCHED_BUFFER_USEC, ss);
- u->tsched_watermark = pa_usec_to_bytes(DEFAULT_TSCHED_WATERMARK_USEC, ss);
- }
+ /* use initial values including module arguments */
+ u->fragment_size = u->initial_info.fragment_size;
+ u->hwbuf_size = u->initial_info.nfrags * u->fragment_size;
+ u->tsched_size = u->initial_info.tsched_size;
+ u->tsched_watermark = u->initial_info.tsched_watermark;
u->tsched_watermark_ref = u->tsched_watermark;
+
pa_log_info("Updated frame_size %zu, frames_per_block %lu, fragment_size %zu, hwbuf_size %zu, tsched(size %zu, watermark %zu)",
u->frame_size, (unsigned long) u->frames_per_block, u->fragment_size, u->hwbuf_size, u->tsched_size, u->tsched_watermark);
}
-#endif
/* Called from IO context */
static int unsuspend(struct userdata *u) {
pa_sample_spec ss;
int err;
bool b, d;
-#ifndef __TIZEN__
- snd_pcm_uframes_t period_size, buffer_size;
-#else
snd_pcm_uframes_t period_frames, buffer_frames;
snd_pcm_uframes_t tsched_frames = 0;
-#endif
+ bool frame_size_changed = false;
pa_assert(u);
pa_assert(!u->pcm_handle);
goto fail;
}
-#ifdef __TIZEN__
if (pa_frame_size(&u->source->sample_spec) != u->frame_size) {
update_size(u, &u->source->sample_spec);
tsched_frames = u->tsched_size / u->frame_size;
+ frame_size_changed = true;
}
+
+ ss = u->source->sample_spec;
period_frames = u->fragment_size / u->frame_size;
buffer_frames = u->hwbuf_size / u->frame_size;
-#endif
- ss = u->source->sample_spec;
-#ifndef __TIZEN__
- period_size = u->fragment_size / u->frame_size;
- buffer_size = u->hwbuf_size / u->frame_size;
-#endif
b = u->use_mmap;
d = u->use_tsched;
-#ifdef __TIZEN__
if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_frames, &buffer_frames, tsched_frames, &b, &d, true)) < 0) {
-#else
- if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, true)) < 0) {
-#endif
pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err));
goto fail;
}
goto fail;
}
-#ifdef __TIZEN__
- if (tsched_frames) {
+ if (frame_size_changed) {
u->fragment_size = (size_t)(period_frames * u->frame_size);
u->hwbuf_size = (size_t)(buffer_frames * u->frame_size);
pa_proplist_setf(u->source->proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%zu", u->hwbuf_size);
pa_proplist_setf(u->source->proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%zu", u->fragment_size);
+
} else if (period_frames * u->frame_size != u->fragment_size ||
buffer_frames * u->frame_size != u->hwbuf_size) {
pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %zu/%zu, New %lu/%lu)",
(unsigned long) buffer_frames * u->frame_size, (unsigned long) period_frames * u->frame_size);
goto fail;
}
-#else
- if (period_size*u->frame_size != u->fragment_size ||
- buffer_size*u->frame_size != u->hwbuf_size) {
- pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu/%lu, New %lu/%lu)",
- (unsigned long) u->hwbuf_size, (unsigned long) u->fragment_size,
- (unsigned long) (buffer_size*u->frame_size), (unsigned long) (period_size*u->frame_size));
- goto fail;
- }
-#endif
if (update_sw_params(u) < 0)
goto fail;
update_sw_params(u);
}
-static int source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, bool passthrough) {
+static void source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, bool passthrough) {
struct userdata *u = s->userdata;
int i;
-#ifndef __TIZEN__
- bool supported = false;
-
- /* FIXME: we only update rate for now */
-
- pa_assert(u);
-
- for (i = 0; u->rates[i]; i++) {
- if (u->rates[i] == spec->rate) {
- supported = true;
- break;
- }
- }
-
- if (!supported) {
- pa_log_info("Source does not support sample rate of %d Hz", spec->rate);
- return -1;
- }
-
- if (!PA_SOURCE_IS_OPENED(s->state)) {
- pa_log_info("Updating rate for device %s, new rate is %d", u->device_name, spec->rate);
- u->source->sample_spec.rate = spec->rate;
- return 0;
- }
-
- return -1;
-#else
bool format_supported = false;
bool rate_supported = false;
pa_assert(u);
- if (PA_SOURCE_IS_OPENED(s->state)) {
- pa_log_warn("Source is opened, skip it");
- return -1;
- }
-
for (i = 0; u->supported_formats[i] != PA_SAMPLE_MAX; i++) {
if (u->supported_formats[i] == spec->format) {
- u->source->sample_spec.format = spec->format;
+ pa_source_set_sample_format(u->source, spec->format);
format_supported = true;
- pa_log_info("Source supports sample format of %s", pa_sample_format_to_string(spec->format));
break;
}
}
+ if (!format_supported) {
+ pa_log_info("Source does not support sample format of %s, set it to a verified value",
+ pa_sample_format_to_string(spec->format));
+ pa_source_set_sample_format(u->source, u->verified_sample_spec.format);
+ }
+
for (i = 0; u->supported_rates[i]; i++) {
if (u->supported_rates[i] == spec->rate) {
- u->source->sample_spec.rate = spec->rate;
+ pa_source_set_sample_rate(u->source, spec->rate);
rate_supported = true;
- pa_log_info("Source supports sample rate of %d Hz", spec->rate);
break;
}
}
- if (!format_supported && !rate_supported) {
- pa_log_warn("Source does not support both sample format of %s and rate of %d Hz",
- pa_sample_format_to_string(spec->format), spec->rate);
- return -1;
+ if (!rate_supported) {
+ pa_log_info("Source does not support sample rate of %u, set it to a verfied value", spec->rate);
+ pa_source_set_sample_rate(u->source, u->verified_sample_spec.rate);
}
-
- return 0;
-#endif
}
static void thread_func(void *userdata) {
uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark;
snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames;
size_t frame_size;
-#ifdef __TIZEN__
bool use_mmap = true;
bool use_tsched = true;
bool ignore_dB = false;
bool b;
bool d;
bool avoid_resampling;
-#else
- bool use_mmap = true, b, use_tsched = true, d, ignore_dB = false, namereg_fail = false, deferred_volume = false, fixed_latency_range = false;
-#endif
pa_source_new_data data;
bool volume_is_set;
bool mute_is_set;
ss = m->core->default_sample_spec;
map = m->core->default_channel_map;
-#ifdef __TIZEN__
avoid_resampling = m->core->avoid_resampling;
-#endif
/* Pick sample spec overrides from the mapping, if any */
if (mapping) {
u->module = m;
u->use_mmap = use_mmap;
u->use_tsched = use_tsched;
-#ifdef __TIZEN__
u->tsched_size = tsched_size;
- u->initial_info.sample_spec = ss;
u->initial_info.nfrags = (size_t) nfrags;
- u->initial_info.fragment_size = (size_t )frag_size;
+ u->initial_info.fragment_size = (size_t) frag_size;
u->initial_info.tsched_size = (size_t) tsched_size;
u->initial_info.tsched_watermark = (size_t) tsched_watermark;
-#endif
u->deferred_volume = deferred_volume;
u->fixed_latency_range = fixed_latency_range;
u->first = true;
pa_log_info("Disabling latency range changes on overrun");
}
-#ifdef __TIZEN__
+ u->verified_sample_spec = ss;
+
u->supported_formats = pa_alsa_get_supported_formats(u->pcm_handle, ss.format);
if (!u->supported_formats) {
pa_log_error("Failed to find any supported sample formats.");
u->supported_rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
if (!u->supported_rates) {
-#else
- u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate);
- if (!u->rates) {
-#endif
pa_log_error("Failed to find any supported sample rates.");
goto fail;
}
goto fail;
}
data.namereg_fail = namereg_fail;
-#ifdef __TIZEN__
+
if (pa_modargs_get_value_boolean(ma, "avoid_resampling", &avoid_resampling) < 0) {
pa_log("Failed to parse avoid_resampling argument.");
pa_source_new_data_done(&data);
goto fail;
}
data.avoid_resampling = avoid_resampling;
-#endif
pa_source_new_data_set_sample_spec(&data, &ss);
pa_source_new_data_set_channel_map(&data, &map);
if (u->smoother)
pa_smoother_free(u->smoother);
-#ifdef __TIZEN__
if (u->supported_formats)
pa_xfree(u->supported_formats);
if (u->supported_rates)
pa_xfree(u->supported_rates);
-#else
- if (u->rates)
- pa_xfree(u->rates);
-#endif
reserve_done(u);
monitor_done(u);
if (!(data->flags & PA_SINK_INPUT_VARIABLE_RATE) &&
!pa_sample_spec_equal(&data->sample_spec, &data->sink->sample_spec)) {
-#ifdef __TIZEN__
/* try to change sink format and rate. This is done before the FIXATE hook since
module-suspend-on-idle can resume a sink */
-#else
- /* try to change sink rate. This is done before the FIXATE hook since
- module-suspend-on-idle can resume a sink */
-#endif
-#ifdef __TIZEN__
pa_log_info("Trying to change sample spec");
-#else
- pa_log_info("Trying to change sample rate");
-#endif
- if (pa_sink_reconfigure(data->sink, &data->sample_spec, pa_sink_input_new_data_is_passthrough(data)) >= 0)
- pa_log_info("Rate changed to %u Hz", data->sink->sample_spec.rate);
+ pa_sink_reconfigure(data->sink, &data->sample_spec, pa_sink_input_new_data_is_passthrough(data));
}
if (pa_sink_input_new_data_is_passthrough(data) &&
if (i->sink) {
if (i->state == PA_SINK_INPUT_CORKED && state == PA_SINK_INPUT_RUNNING && pa_sink_used_by(i->sink) == 0 &&
!pa_sample_spec_equal(&i->sample_spec, &i->sink->sample_spec)) {
-#ifdef __TIZEN__
/* We were uncorked and the sink was not playing anything -- let's try
* to update the sample format and rate to avoid resampling */
-#else
- /* We were uncorked and the sink was not playing anything -- let's try
- * to update the sample rate to avoid resampling */
-#endif
pa_sink_reconfigure(i->sink, &i->sample_spec, pa_sink_input_is_passthrough(i));
}
if (!(i->flags & PA_SINK_INPUT_VARIABLE_RATE) &&
!pa_sample_spec_equal(&i->sample_spec, &dest->sample_spec)) {
-#ifdef __TIZEN__
/* try to change dest sink format and rate if possible without glitches.
module-suspend-on-idle resumes destination sink with
SINK_INPUT_MOVE_FINISH hook */
pa_log_info("Trying to change sample spec");
- if (pa_sink_reconfigure(dest, &i->sample_spec, pa_sink_input_is_passthrough(i)) >= 0)
- pa_log_info("format, rate are updated to %s, %u Hz",
- pa_sample_format_to_string(dest->sample_spec.format), dest->sample_spec.rate);
-#else
- /* try to change dest sink rate if possible without glitches.
- module-suspend-on-idle resumes destination sink with
- SINK_INPUT_MOVE_FINISH hook */
-
- pa_log_info("Trying to change sample rate");
- if (pa_sink_reconfigure(dest, &i->sample_spec, pa_sink_input_is_passthrough(i)) >= 0)
- pa_log_info("Rate changed to %u Hz", dest->sample_spec.rate);
-#endif
+ pa_sink_reconfigure(dest, &i->sample_spec, pa_sink_input_is_passthrough(i));
}
if (i->moving)
if (pa_sink_input_get_state(i) == PA_SINK_INPUT_CORKED)
i->sink->n_corked++;
-#ifndef __TIZEN__
- pa_sink_input_update_rate(i);
-#else
pa_sink_input_update_resampler(i);
-#endif
pa_sink_update_status(dest);
}
/* Called from main context */
-#ifndef __TIZEN__
-/* Updates the sink input's resampler with whatever the current sink requires
- * -- useful when the underlying sink's rate might have changed */
-int pa_sink_input_update_rate(pa_sink_input *i) {
-#else
/* Updates the sink input's resampler with whatever the current sink requires
* -- useful when the underlying sink's sample spec might have changed */
int pa_sink_input_update_resampler(pa_sink_input *i) {
-#endif
pa_resampler *new_resampler;
char *memblockq_name;
void pa_sink_input_cork(pa_sink_input *i, bool b);
int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate);
-#ifdef __TIZEN__
int pa_sink_input_update_resampler(pa_sink_input *i);
-#else
-int pa_sink_input_update_rate(pa_sink_input *i);
-#endif
/* This returns the sink's fields converted into out sample type */
size_t pa_sink_input_get_max_rewind(pa_sink_input *i);
s->alternate_sample_rate = data->alternate_sample_rate;
else
s->alternate_sample_rate = s->core->alternate_sample_rate;
-#ifdef __TIZEN__
+
s->avoid_resampling = data->avoid_resampling;
+#ifdef __TIZEN__
s->origin_avoid_resampling = data->avoid_resampling;
s->selected_sample_format = s->sample_spec.format;
s->selected_sample_rate = s->sample_spec.rate;
}
/* Called from main thread */
-int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
- int ret = -1;
+void pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
pa_sample_spec desired_spec;
uint32_t default_rate = s->default_sample_rate;
uint32_t alternate_rate = s->alternate_sample_rate;
pa_sink_input *i;
bool default_rate_is_usable = false;
bool alternate_rate_is_usable = false;
-#ifdef __TIZEN__
bool avoid_resampling = s->avoid_resampling;
-#else
- bool avoid_resampling = s->core->avoid_resampling;
- /* We currently only try to reconfigure the sample rate */
-
-#endif
#ifndef __TIZEN__
if (pa_sample_spec_equal(spec, &s->sample_spec))
- return 0;
+ return;
#endif
if (!s->reconfigure)
- return -1;
+ return;
#ifndef __TIZEN__
if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !avoid_resampling)) {
pa_log_debug("Default and alternate sample rates are the same, so there is no point in switching.");
- return -1;
+ return;
}
#endif
if (PA_SINK_IS_RUNNING(s->state)) {
-#ifdef __TIZEN__
pa_log_info("Cannot update sample spec, SINK_IS_RUNNING, will keep using %s and %u Hz",
pa_sample_format_to_string(s->sample_spec.format), s->sample_spec.rate);
-#else
- pa_log_info("Cannot update rate, SINK_IS_RUNNING, will keep using %u Hz",
- s->sample_spec.rate);
-#endif
- return -1;
+ return;
}
if (s->monitor_source) {
if (PA_SOURCE_IS_RUNNING(s->monitor_source->state) == true) {
-#ifdef __TIZEN__
pa_log_info("Cannot update sample spec, monitor source is RUNNING");
-#else
- pa_log_info("Cannot update rate, monitor source is RUNNING");
-#endif
- return -1;
+ return;
}
}
if (PA_UNLIKELY(!pa_sample_spec_valid(spec)))
- return -1;
+ return;
desired_spec = s->sample_spec;
default_rate = alternate_rate = s->selected_sample_rate;
desired_spec.format = s->selected_sample_format;
}
+#endif
if (passthrough) {
/* We have to try to use the sink input format and rate */
desired_spec.format = spec->format;
desired_spec.rate = spec->rate;
-#else
- if (passthrough) {
- /* We have to try to use the sink input rate */
- desired_spec.rate = spec->rate;
-#endif
-#ifdef __TIZEN__
- } else if (avoid_resampling && (spec->format != s->sample_spec.format ||
- spec->rate >= default_rate || spec->rate >= alternate_rate)) {
- desired_spec.format = spec->format;
-#else
- } else if (avoid_resampling && (spec->rate >= default_rate || spec->rate >= alternate_rate)) {
-#endif
+
+ } else if (avoid_resampling) {
/* We just try to set the sink input's sample rate if it's not too low */
- desired_spec.rate = spec->rate;
+ if (spec->rate >= default_rate || spec->rate >= alternate_rate)
+ desired_spec.rate = spec->rate;
+ desired_spec.format = spec->format;
} else if (default_rate == spec->rate || alternate_rate == spec->rate) {
/* We can directly try to use this rate */
desired_spec.rate = spec->rate;
- } else {
+ }
+
+ if (desired_spec.rate != spec->rate) {
/* See if we can pick a rate that results in less resampling effort */
if (default_rate % 11025 == 0 && spec->rate % 11025 == 0)
default_rate_is_usable = true;
#ifdef __TIZEN__
{
pa_log_info("desired spec is same as sink->sample_spec");
- return 0;
+ return;
}
#else
- return -1;
+ return;
#endif
if (!passthrough && pa_sink_used_by(s) > 0)
- return -1;
+ return;
-#ifdef __TIZEN__
pa_log_debug("Suspending sink %s due to changing format, desired format = %s rate = %u",
s->name, pa_sample_format_to_string(desired_spec.format), desired_spec.rate);
-#else
- pa_log_debug("Suspending sink %s due to changing format", s->name);
-#endif
pa_sink_suspend(s, true, PA_SUSPEND_INTERNAL);
- if (s->reconfigure(s, &desired_spec, passthrough) >= 0) {
- /* update monitor source as well */
- if (s->monitor_source && !passthrough)
-#ifdef __TIZEN__
- pa_source_reconfigure(s->monitor_source, &s->sample_spec, false);
- pa_log_info("Reconfigured successfully");
-#else
- pa_source_reconfigure(s->monitor_source, &desired_spec, false);
- pa_log_info("Changed format successfully");
-#endif
+ s->reconfigure(s, &desired_spec, passthrough);
- PA_IDXSET_FOREACH(i, s->inputs, idx) {
- if (i->state == PA_SINK_INPUT_CORKED)
-#ifdef __TIZEN__
- pa_sink_input_update_resampler(i);
-#else
- pa_sink_input_update_rate(i);
-#endif
- }
+ /* update monitor source as well */
+ if (s->monitor_source && !passthrough)
+ pa_source_reconfigure(s->monitor_source, &s->sample_spec, false);
+ pa_log_info("Reconfigured successfully");
- ret = 0;
+ PA_IDXSET_FOREACH(i, s->inputs, idx) {
+ if (i->state == PA_SINK_INPUT_CORKED)
+ pa_sink_input_update_resampler(i);
}
pa_sink_suspend(s, false, PA_SUSPEND_INTERNAL);
-
- return ret;
}
/* Called from main thread */
return out_formats;
}
+/* Called from the main thread */
+void pa_sink_set_sample_format(pa_sink *s, pa_sample_format_t format) {
+ pa_sample_format_t old_format;
+
+ pa_assert(s);
+ pa_assert(pa_sample_format_valid(format));
+
+ old_format = s->sample_spec.format;
+ if (old_format == format)
+ return;
+
+ pa_log_info("%s: format: %s -> %s",
+ s->name, pa_sample_format_to_string(old_format), pa_sample_format_to_string(format));
+
+ s->sample_spec.format = format;
+
+ pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+}
+
+/* Called from the main thread */
+void pa_sink_set_sample_rate(pa_sink *s, uint32_t rate) {
+ uint32_t old_rate;
+
+ pa_assert(s);
+ pa_assert(pa_sample_rate_valid(rate));
+
+ old_rate = s->sample_spec.rate;
+ if (old_rate == rate)
+ return;
+
+ pa_log_info("%s: rate: %u -> %u", s->name, old_rate, rate);
+
+ s->sample_spec.rate = rate;
+
+ pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+}
+
/* Called from the main thread. */
void pa_sink_set_reference_volume_direct(pa_sink *s, const pa_cvolume *volume) {
pa_cvolume old_volume;
pa_channel_map channel_map;
uint32_t default_sample_rate;
uint32_t alternate_sample_rate;
-#ifdef __TIZEN__
bool avoid_resampling:1;
+#ifdef __TIZEN__
uint32_t *supported_sample_rates;
uint32_t selected_sample_rate;
pa_sample_format_t *supported_sample_formats;
/* Called whenever device parameters need to be changed. Called from
* main thread. */
- int (*reconfigure)(pa_sink *s, pa_sample_spec *spec, bool passthrough);
+ void (*reconfigure)(pa_sink *s, pa_sample_spec *spec, bool passthrough);
/* Contains copies of the above data so that the real-time worker
* thread can work without access locking */
pa_sample_spec sample_spec;
pa_channel_map channel_map;
uint32_t alternate_sample_rate;
-#ifdef __TIZEN__
bool avoid_resampling:1;
-#endif
pa_cvolume volume;
bool muted:1;
/**** May be called by everyone, from main context */
-int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough);
+void pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough);
void pa_sink_set_port_latency_offset(pa_sink *s, int64_t offset);
/* The returned value is supposed to be in the time domain of the sound card! */
bool pa_sink_check_format(pa_sink *s, pa_format_info *f);
pa_idxset* pa_sink_check_formats(pa_sink *s, pa_idxset *in_formats);
+void pa_sink_set_sample_format(pa_sink *s, pa_sample_format_t format);
+void pa_sink_set_sample_rate(pa_sink *s, uint32_t rate);
+
/*** To be called exclusively by the sink driver, from IO context */
void pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result);
if (!(data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) &&
!pa_sample_spec_equal(&data->sample_spec, &data->source->sample_spec)) {
-#ifdef __TIZEN__
/* try to change source format and rate. This is done before the FIXATE hook since
module-suspend-on-idle can resume a source */
pa_log_info("Trying to change sample spec");
- if (pa_source_reconfigure(data->source, &data->sample_spec, pa_source_output_new_data_is_passthrough(data)) >= 0)
- pa_log_info("format, rate are updated to %s, %u Hz",
- pa_sample_format_to_string(data->source->sample_spec.format), data->source->sample_spec.rate);
-#else
- /* try to change source rate. This is done before the FIXATE hook since
- module-suspend-on-idle can resume a source */
-
- pa_log_info("Trying to change sample rate");
- if (pa_source_reconfigure(data->source, &data->sample_spec, pa_source_output_new_data_is_passthrough(data)) >= 0)
- pa_log_info("Rate changed to %u Hz", data->source->sample_spec.rate);
-#endif
+ pa_source_reconfigure(data->source, &data->sample_spec, pa_source_output_new_data_is_passthrough(data));
}
if (pa_source_output_new_data_is_passthrough(data) &&
if (o->source) {
if (o->state == PA_SOURCE_OUTPUT_CORKED && state == PA_SOURCE_OUTPUT_RUNNING && pa_source_used_by(o->source) == 0 &&
!pa_sample_spec_equal(&o->sample_spec, &o->source->sample_spec)) {
-#ifdef __TIZEN__
/* We were uncorked and the source was not playing anything -- let's try
* to update the sample format and rate to avoid resampling */
-#else
- /* We were uncorked and the source was not playing anything -- let's try
- * to update the sample rate to avoid resampling */
-#endif
pa_source_reconfigure(o->source, &o->sample_spec, pa_source_output_is_passthrough(o));
}
if (!(o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) &&
!pa_sample_spec_equal(&o->sample_spec, &dest->sample_spec)) {
-#ifdef __TIZEN__
/* try to change dest source format and rate if possible without glitches.
module-suspend-on-idle resumes destination source with
SOURCE_OUTPUT_MOVE_FINISH hook */
pa_log_info("Trying to change sample spec");
- if (pa_source_reconfigure(dest, &o->sample_spec, pa_source_output_is_passthrough(o)) >= 0)
- pa_log_info("format, rate are updated to %s, %u Hz",
- pa_sample_format_to_string(dest->sample_spec.format), dest->sample_spec.rate);
-#else
- /* try to change dest sink rate if possible without glitches.
- module-suspend-on-idle resumes destination source with
- SOURCE_OUTPUT_MOVE_FINISH hook */
-
- pa_log_info("Trying to change sample rate");
- if (pa_source_reconfigure(dest, &o->sample_spec, pa_source_output_is_passthrough(o)) >= 0)
- pa_log_info("Rate changed to %u Hz", dest->sample_spec.rate);
-#endif
+ pa_source_reconfigure(dest, &o->sample_spec, pa_source_output_is_passthrough(o));
}
if (o->moving)
if (pa_source_output_get_state(o) == PA_SOURCE_OUTPUT_CORKED)
o->source->n_corked++;
-#ifndef __TIZEN__
- pa_source_output_update_rate(o);
-#else
pa_source_output_update_resampler(o);
-#endif
pa_source_update_status(dest);
}
/* Called from main context */
-#ifndef __TIZEN__
-/* Updates the source output's resampler with whatever the current source
- * requires -- useful when the underlying source's rate might have changed */
-int pa_source_output_update_rate(pa_source_output *o) {
-#else
/* Updates the source output's resampler with whatever the current source
* requires -- useful when the underlying source's sample spec might have changed */
int pa_source_output_update_resampler(pa_source_output *o) {
-#endif
pa_resampler *new_resampler;
char *memblockq_name;
void pa_source_output_cork(pa_source_output *o, bool b);
int pa_source_output_set_rate(pa_source_output *o, uint32_t rate);
-#ifdef __TIZEN__
int pa_source_output_update_resampler(pa_source_output *o);
-#else
-int pa_source_output_update_rate(pa_source_output *o);
-#endif
size_t pa_source_output_get_max_rewind(pa_source_output *o);
s->alternate_sample_rate = data->alternate_sample_rate;
else
s->alternate_sample_rate = s->core->alternate_sample_rate;
-#ifdef __TIZEN__
+
s->avoid_resampling = data->avoid_resampling;
-#endif
s->outputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
}
/* Called from main thread */
-int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough) {
- int ret;
+void pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough) {
+ uint32_t idx;
+ pa_source_output *o;
pa_sample_spec desired_spec;
uint32_t default_rate = s->default_sample_rate;
uint32_t alternate_rate = s->alternate_sample_rate;
bool default_rate_is_usable = false;
bool alternate_rate_is_usable = false;
-#ifdef __TIZEN__
bool avoid_resampling = s->avoid_resampling;
-#else
- bool avoid_resampling = s->core->avoid_resampling;
-#endif
-
-#ifndef __TIZEN__
- /* We currently only try to reconfigure the sample rate */
-#endif
if (pa_sample_spec_equal(spec, &s->sample_spec))
- return 0;
+ return;
if (!s->reconfigure && !s->monitor_of)
- return -1;
+ return;
if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !avoid_resampling)) {
pa_log_debug("Default and alternate sample rates are the same, so there is no point in switching.");
- return -1;
+ return;
}
if (PA_SOURCE_IS_RUNNING(s->state)) {
-#ifdef __TIZEN__
pa_log_info("Cannot update sample spec, SOURCE_IS_RUNNING, will keep using %s and %u Hz",
pa_sample_format_to_string(s->sample_spec.format), s->sample_spec.rate);
-#else
- pa_log_info("Cannot update rate, SOURCE_IS_RUNNING, will keep using %u Hz",
- s->sample_spec.rate);
-#endif
- return -1;
+ return;
}
if (s->monitor_of) {
if (PA_SINK_IS_RUNNING(s->monitor_of->state)) {
-#ifdef __TIZEN__
pa_log_info("Cannot update sample spec, this is a monitor source and the sink is running.");
-#else
- pa_log_info("Cannot update rate, this is a monitor source and the sink is running.");
-#endif
- return -1;
+ return;
}
}
if (PA_UNLIKELY(!pa_sample_spec_valid(spec)))
- return -1;
+ return;
desired_spec = s->sample_spec;
-#ifdef __TIZEN__
if (passthrough) {
/* We have to try to use the source output format and rate */
desired_spec.format = spec->format;
desired_spec.rate = spec->rate;
-#else
- if (passthrough) {
- /* We have to try to use the source output rate */
- desired_spec.rate = spec->rate;
-#endif
-#ifdef __TIZEN__
- } else if (avoid_resampling && (spec->format != s->sample_spec.format ||
- spec->rate >= default_rate || spec->rate >= alternate_rate)) {
- desired_spec.format = spec->format;
-#else
- } else if (avoid_resampling && (spec->rate >= default_rate || spec->rate >= alternate_rate)) {
-#endif
+
+ } else if (avoid_resampling) {
/* We just try to set the source output's sample rate if it's not too low */
- desired_spec.rate = spec->rate;
+ if (spec->rate >= default_rate || spec->rate >= alternate_rate)
+ desired_spec.rate = spec->rate;
+ desired_spec.format = spec->format;
} else if (default_rate == spec->rate || alternate_rate == spec->rate) {
/* We can directly try to use this rate */
desired_spec.rate = spec->rate;
- } else {
+ }
+
+ if (desired_spec.rate != spec->rate) {
/* See if we can pick a rate that results in less resampling effort */
if (default_rate % 11025 == 0 && spec->rate % 11025 == 0)
default_rate_is_usable = true;
}
if (pa_sample_spec_equal(&desired_spec, &s->sample_spec) && passthrough == pa_source_is_passthrough(s))
- return -1;
+ return;
if (!passthrough && pa_source_used_by(s) > 0)
- return -1;
+ return;
-#ifdef __TIZEN__
- pa_log_debug("Suspending sink %s due to changing format, desired format = %s rate = %u",
+ pa_log_debug("Suspending source %s due to changing format, desired format = %s rate = %u",
s->name, pa_sample_format_to_string(desired_spec.format), desired_spec.rate);
-#else
- pa_log_debug("Suspending source %s due to changing the sample rate", s->name);
-#endif
pa_source_suspend(s, true, PA_SUSPEND_INTERNAL);
if (s->reconfigure)
- ret = s->reconfigure(s, &desired_spec, passthrough);
+ s->reconfigure(s, &desired_spec, passthrough);
else {
/* This is a monitor source. */
* have no idea whether the behaviour with passthrough streams is
* sensible. */
if (!passthrough) {
- pa_sample_spec old_spec = s->sample_spec;
-
s->sample_spec = desired_spec;
- ret = pa_sink_reconfigure(s->monitor_of, &desired_spec, false);
-
- if (ret < 0) {
- /* Changing the sink rate failed, roll back the old rate for
- * the monitor source. Why did we set the source rate before
- * calling pa_sink_reconfigure(), you may ask. The reason is
- * that pa_sink_reconfigure() tries to update the monitor
- * source rate, but we are already in the process of updating
- * the monitor source rate, so there's a risk of entering an
- * infinite loop. Setting the source rate before calling
- * pa_sink_reconfigure() makes the rate == s->sample_spec.rate
- * check in the beginning of this function return early, so we
- * avoid looping. */
- s->sample_spec = old_spec;
- }
+ pa_sink_reconfigure(s->monitor_of, &desired_spec, false);
+ s->sample_spec = s->monitor_of->sample_spec;
} else
- ret = -1;
+ goto unsuspend;
}
- if (ret >= 0) {
- uint32_t idx;
- pa_source_output *o;
-
- PA_IDXSET_FOREACH(o, s->outputs, idx) {
- if (o->state == PA_SOURCE_OUTPUT_CORKED)
-#ifdef __TIZEN__
- pa_source_output_update_resampler(o);
-#else
- pa_source_output_update_rate(o);
-#endif
- }
-
-#ifndef __TIZEN__
- pa_log_info("Changed sampling rate successfully");
-#else
- pa_log_info("Reconfigured successfully");
-#endif
+ PA_IDXSET_FOREACH(o, s->outputs, idx) {
+ if (o->state == PA_SOURCE_OUTPUT_CORKED)
+ pa_source_output_update_resampler(o);
}
- pa_source_suspend(s, false, PA_SUSPEND_INTERNAL);
+ pa_log_info("Reconfigured successfully");
- return ret;
+unsuspend:
+ pa_source_suspend(s, false, PA_SUSPEND_INTERNAL);
}
/* Called from main thread */
return out_formats;
}
+/* Called from the main thread */
+void pa_source_set_sample_format(pa_source *s, pa_sample_format_t format) {
+ pa_sample_format_t old_format;
+
+ pa_assert(s);
+ pa_assert(pa_sample_format_valid(format));
+
+ old_format = s->sample_spec.format;
+ if (old_format == format)
+ return;
+
+ pa_log_info("%s: format: %s -> %s",
+ s->name, pa_sample_format_to_string(old_format), pa_sample_format_to_string(format));
+
+ s->sample_spec.format = format;
+
+ pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+}
+
+/* Called from the main thread */
+void pa_source_set_sample_rate(pa_source *s, uint32_t rate) {
+ uint32_t old_rate;
+
+ pa_assert(s);
+ pa_assert(pa_sample_rate_valid(rate));
+
+ old_rate = s->sample_spec.rate;
+ if (old_rate == rate)
+ return;
+
+ pa_log_info("%s: rate: %u -> %u", s->name, old_rate, rate);
+
+ s->sample_spec.rate = rate;
+
+ pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+}
+
/* Called from the main thread. */
void pa_source_set_reference_volume_direct(pa_source *s, const pa_cvolume *volume) {
pa_cvolume old_volume;
pa_channel_map channel_map;
uint32_t default_sample_rate;
uint32_t alternate_sample_rate;
-#ifdef __TIZEN__
bool avoid_resampling:1;
-#endif
pa_idxset *outputs;
unsigned n_corked;
/* Called whenever device parameters need to be changed. Called from
* main thread. */
- int (*reconfigure)(pa_source *s, pa_sample_spec *spec, bool passthrough);
+ void (*reconfigure)(pa_source *s, pa_sample_spec *spec, bool passthrough);
/* Contains copies of the above data so that the real-time worker
* thread can work without access locking */
pa_sample_spec sample_spec;
pa_channel_map channel_map;
uint32_t alternate_sample_rate;
-#ifdef __TIZEN__
bool avoid_resampling:1;
-#endif
pa_cvolume volume;
bool muted:1;
int pa_source_set_port(pa_source *s, const char *name, bool save);
void pa_source_set_mixer_dirty(pa_source *s, bool is_dirty);
-int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough);
+void pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough);
unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */
unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */
bool pa_source_check_format(pa_source *s, pa_format_info *f);
pa_idxset* pa_source_check_formats(pa_source *s, pa_idxset *in_formats);
+void pa_source_set_sample_format(pa_source *s, pa_sample_format_t format);
+void pa_source_set_sample_rate(pa_source *s, uint32_t rate);
+
/*** To be called exclusively by the source driver, from IO context */
void pa_source_post(pa_source*s, const pa_memchunk *chunk);