Name: pulseaudio
Summary: Improved Linux sound server
Version: 5.0
-Release: 64
+Release: 65
Group: Multimedia/Audio
License: LGPL-2.1+
URL: http://pulseaudio.org
pa_context_set_card_profile_by_index;
pa_context_set_card_profile_by_name;
pa_context_set_default_sink;
-pa_context_set_cork_all;
-pa_context_set_default_sink_by_api_bus;
-pa_context_set_default_sink_for_usb;
pa_context_set_default_source;
pa_context_set_event_callback;
pa_context_set_name;
pa_signal_set_destroy;
pa_simple_drain;
pa_simple_flush;
-pa_simple_mute;
pa_simple_free;
pa_simple_get_latency;
-pa_simple_get_final_latency;
pa_simple_new;
pa_simple_new_proplist;
pa_simple_read;
pa_simple_write;
-pa_simple_set_volume;
pa_simple_get_stream_index;
-pa_simple_cork;
-pa_simple_is_corked;
pa_stream_begin_write;
pa_stream_cancel_write;
pa_stream_connect_playback;
return o;
}
-#ifdef __TIZEN__
-pa_operation* pa_context_set_cork_all(pa_context *c, int b, pa_context_success_cb_t cb, void *userdata) {
- pa_tagstruct *t;
- pa_operation *o;
- uint32_t tag;
-
- pa_assert(c);
- pa_assert(PA_REFCNT_VALUE(c) >= 1);
-
- PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
- PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
-
- o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
- t = pa_tagstruct_command(c, PA_COMMAND_CORK_PLAYBACK_STREAM_ALL, &tag);
- pa_tagstruct_put_boolean(t, !!b);
- pa_pstream_send_tagstruct(c->pstream, t);
- pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
-
- return o;
-}
-
-pa_operation* pa_context_set_default_sink_by_api_bus(pa_context *c, const char *api, const char *bus, pa_context_success_cb_t cb, void *userdata) {
- pa_tagstruct *t;
- pa_operation *o;
- uint32_t tag;
-
- pa_assert(c);
- pa_assert(PA_REFCNT_VALUE(c) >= 1);
-
- PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
- PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
-
- o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
- t = pa_tagstruct_command(c, PA_COMMAND_SET_DEFAULT_SINK_BY_API_BUS, &tag);
- pa_tagstruct_puts(t, api);
- pa_tagstruct_puts(t, bus);
- pa_pstream_send_tagstruct(c->pstream, t);
- pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
-
- return o;
-}
-
-pa_operation* pa_context_set_default_sink_for_usb(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
- pa_tagstruct *t;
- pa_operation *o;
- uint32_t tag;
-
- pa_assert(c);
- pa_assert(PA_REFCNT_VALUE(c) >= 1);
-
- PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
- PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
-
- o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
- t = pa_tagstruct_command(c, PA_COMMAND_SET_DEFAULT_SINK_FOR_USB, &tag);
- pa_tagstruct_puts(t, name);
- pa_pstream_send_tagstruct(c->pstream, t);
- pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
-
- return o;
-}
-#endif /* __TIZEN__ */
-
pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
pa_tagstruct *t;
pa_operation *o;
/** Set the name of the default sink. */
pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
-#ifdef __TIZEN__
-/** Set the api&bus of the default sink. */
-pa_operation* pa_context_set_default_sink_by_api_bus(pa_context *c, const char *api, const char *bus, pa_context_success_cb_t cb, void *userdata);
-
-/** Set the name of the default sink for USB */
-pa_operation* pa_context_set_default_sink_for_usb(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
-
-/** Cork all playback stream and suspend sink manually for device switching */
-pa_operation* pa_context_set_cork_all(pa_context *c, int b, pa_context_success_cb_t cb, void *userdata);
-
-#endif /* __TIZEN__ */
-
/** Set the name of the default source. */
pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata);
return -1;
}
-int pa_simple_mute(pa_simple *p, int mute, int *rerror) {
- pa_operation *o = NULL;
- uint32_t idx;
-
- pa_assert(p);
-
- CHECK_VALIDITY_RETURN_ANY(rerror, p->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE, -1);
-
- pa_threaded_mainloop_lock(p->mainloop);
- CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
-
- CHECK_SUCCESS_GOTO(p, rerror, ((idx = pa_stream_get_index (p->stream)) != PA_INVALID_INDEX), unlock_and_fail);
-
-
- o = pa_context_set_sink_input_mute (p->context, idx, mute, success_context_cb, p);
- CHECK_SUCCESS_GOTO(p, rerror, o, unlock_and_fail);
-
- p->operation_success = 0;
- while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) {
- pa_threaded_mainloop_wait(p->mainloop);
- CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
- }
- CHECK_SUCCESS_GOTO(p, rerror, p->operation_success, unlock_and_fail);
-
- pa_operation_unref(o);
- pa_threaded_mainloop_unlock(p->mainloop);
-
- return 0;
-
-unlock_and_fail:
-
- if (o) {
- pa_operation_cancel(o);
- pa_operation_unref(o);
- }
-
- pa_threaded_mainloop_unlock(p->mainloop);
- return -1;
-}
-
int pa_simple_get_stream_index(pa_simple *p, unsigned int *idx, int *rerror) {
pa_assert(p);
CHECK_VALIDITY_RETURN_ANY(rerror, idx != NULL, PA_ERR_INVALID, -1);
return -1;
}
-int pa_simple_set_volume(pa_simple *p, int volume, int *rerror) {
- pa_operation *o = NULL;
- pa_stream *s = NULL;
- uint32_t idx;
- pa_cvolume cv;
-
-
- pa_assert(p);
-
- CHECK_VALIDITY_RETURN_ANY(rerror, p->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE, -1);
- CHECK_VALIDITY_RETURN_ANY(rerror, volume >= 0, PA_ERR_INVALID, -1);
- CHECK_VALIDITY_RETURN_ANY(rerror, volume <= 65535, PA_ERR_INVALID, -1);
-
- pa_threaded_mainloop_lock(p->mainloop);
- CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
-
- CHECK_SUCCESS_GOTO(p, rerror, ((idx = pa_stream_get_index (p->stream)) != PA_INVALID_INDEX), unlock_and_fail);
-
- s = p->stream;
- pa_assert(s);
- pa_cvolume_set(&cv, s->sample_spec.channels, volume);
-
- o = pa_context_set_sink_input_volume (p->context, idx, &cv, success_context_cb, p);
- CHECK_SUCCESS_GOTO(p, rerror, o, unlock_and_fail);
-
- p->operation_success = 0;
- while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) {
- pa_threaded_mainloop_wait(p->mainloop);
- CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
- }
- CHECK_SUCCESS_GOTO(p, rerror, p->operation_success, unlock_and_fail);
-
- pa_operation_unref(o);
- pa_threaded_mainloop_unlock(p->mainloop);
-
- return 0;
-
-unlock_and_fail:
-
- if (o) {
- pa_operation_cancel(o);
- pa_operation_unref(o);
- }
-
- pa_threaded_mainloop_unlock(p->mainloop);
- return -1;
-}
pa_usec_t pa_simple_get_latency(pa_simple *p, int *rerror) {
pa_usec_t t;
int negative;
pa_threaded_mainloop_unlock(p->mainloop);
return (pa_usec_t) -1;
}
-
-#ifdef __TIZEN__
-pa_usec_t pa_simple_get_final_latency(pa_simple *p, int *rerror) {
- pa_usec_t t;
-
- pa_assert(p);
-
- CHECK_DEAD_GOTO(p, rerror, fail);
-
- if (p->context->version >= 13) {
- if (p->direction == PA_STREAM_PLAYBACK) {
- t = (pa_bytes_to_usec(p->stream->buffer_attr.tlength, &p->stream->sample_spec) + p->stream->timing_info.configured_sink_usec);
- } else if (p->direction == PA_STREAM_RECORD) {
- t = (pa_bytes_to_usec(p->stream->buffer_attr.fragsize, &p->stream->sample_spec) + p->stream->timing_info.configured_source_usec);
- } else {
- t = (pa_usec_t) -1;
- }
- } else {
- t = (pa_usec_t) -1;
- }
-
- return t;
-
-fail:
- return (pa_usec_t) -1;
-}
-#endif
-
-int pa_simple_cork(pa_simple *p, int cork, int *rerror) {
- pa_operation *o = NULL;
-
- pa_assert(p);
-
- pa_threaded_mainloop_lock(p->mainloop);
- CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
-
- o = pa_stream_cork(p->stream, cork, stream_success_context_cb, p);
- CHECK_SUCCESS_GOTO(p, rerror, o, unlock_and_fail);
-
- p->operation_success = 0;
- while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) {
- pa_threaded_mainloop_wait(p->mainloop);
- CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
- }
- CHECK_SUCCESS_GOTO(p, rerror, p->operation_success, unlock_and_fail);
-
- pa_operation_unref(o);
- pa_threaded_mainloop_unlock(p->mainloop);
-
- return 0;
-
-unlock_and_fail:
-
- if (o) {
- pa_operation_cancel(o);
- pa_operation_unref(o);
- }
-
- pa_threaded_mainloop_unlock(p->mainloop);
- return -1;
-}
-
-int pa_simple_is_corked(pa_simple *p) {
- int is_cork;
- pa_assert(p);
-
- pa_threaded_mainloop_lock(p->mainloop);
-
- is_cork = pa_stream_is_corked(p->stream);
-
- pa_threaded_mainloop_unlock(p->mainloop);
-
- return is_cork;
-}
/** Flush the playback or record buffer. This discards any audio in the buffer. */
int pa_simple_flush(pa_simple *s, int *error);
-/** Mute the playback stream */
-int pa_simple_mute(pa_simple *p, int mute, int *rerror);
-
-#ifdef __TIZEN__
-/** Return the final latency. */
-pa_usec_t pa_simple_get_final_latency(pa_simple *s, int *error);
-#endif
-
-/** Volume control the playback stream */
-int pa_simple_set_volume(pa_simple *p, int volume, int *rerror);
/** Get stream index */
int pa_simple_get_stream_index(pa_simple *p, unsigned int *idx, int *rerror);
-/** Cork on=1/off=0 stream */
-int pa_simple_cork(pa_simple *p, int cork, int *rerror);
-
-/** Check whether stream is corked or not */
-int pa_simple_is_corked(pa_simple *p);
-
PA_C_DECL_END
#endif
static void command_set_volume(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
static void command_set_mute(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
static void command_cork_playback_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
-#ifdef __TIZEN__
-static void command_cork_playback_stream_all(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
-#endif
static void command_trigger_or_flush_or_prebuf_playback_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
static void command_set_default_sink_or_source(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
-#ifdef __TIZEN__
-static void command_set_default_sink_by_api_bus(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
-static void command_set_default_sink_for_usb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
-#endif
static void command_set_stream_name(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
static void command_kill(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
static void command_load_module(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
[PA_COMMAND_SUSPEND_SOURCE] = command_suspend,
[PA_COMMAND_CORK_PLAYBACK_STREAM] = command_cork_playback_stream,
-#ifdef __TIZEN__
- [PA_COMMAND_CORK_PLAYBACK_STREAM_ALL] = command_cork_playback_stream_all,
-#endif
[PA_COMMAND_FLUSH_PLAYBACK_STREAM] = command_trigger_or_flush_or_prebuf_playback_stream,
[PA_COMMAND_TRIGGER_PLAYBACK_STREAM] = command_trigger_or_flush_or_prebuf_playback_stream,
[PA_COMMAND_PREBUF_PLAYBACK_STREAM] = command_trigger_or_flush_or_prebuf_playback_stream,
[PA_COMMAND_FLUSH_RECORD_STREAM] = command_flush_record_stream,
[PA_COMMAND_SET_DEFAULT_SINK] = command_set_default_sink_or_source,
-#ifdef __TIZEN__
- [PA_COMMAND_SET_DEFAULT_SINK_BY_API_BUS] = command_set_default_sink_by_api_bus,
- [PA_COMMAND_SET_DEFAULT_SINK_FOR_USB] = command_set_default_sink_for_usb,
-#endif
[PA_COMMAND_SET_DEFAULT_SOURCE] = command_set_default_sink_or_source,
[PA_COMMAND_SET_PLAYBACK_STREAM_NAME] = command_set_stream_name,
[PA_COMMAND_SET_RECORD_STREAM_NAME] = command_set_stream_name,
pa_pstream_send_simple_ack(c->pstream, tag);
}
-#ifdef __TIZEN__
-#define SINK_ALSA_NORMAL "alsa_output.0.analog-stereo"
-#define SINK_ALSA_HDMI "alsa_output.1.analog-stereo"
-#define SINK_ALSA_VOIP "alsa_output.3.analog-stereo"
-#define SINK_ALSA_LPA "alsa_output.4.analog-stereo"
-
-#define PROP_MANUAL_CORK "manual_cork_by_device_switch"
-
-static void command_cork_playback_stream_all(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
- pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
- uint32_t idx;
- uint32_t sink_idx;
- bool b;
- pa_sink_input* si;
- pa_sink* sink;
- const char *role = NULL;
- int ret;
- const char *is_manual_corked_str = NULL;
- uint32_t is_manual_corked;
- pa_sink_input_state_t si_state;
-
- pa_native_connection_assert_ref(c);
- pa_assert(t);
-
- if (pa_tagstruct_get_boolean(t, &b) < 0 ||
- !pa_tagstruct_eof(t)) {
- protocol_error(c);
- return;
- }
-
- CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
-
- pa_log_debug("========================= %s start =========================", b > 0 ? "cork" : "uncork");
-
- PA_IDXSET_FOREACH(si, c->protocol->core->sink_inputs, idx) {
- /* Skip this if it is already in the process of being moved
- * anyway */
- if (!si->sink)
- continue;
-
- /* It might happen that a stream and a sink are set up at the
- same time, in which case we want to make sure we don't
- interfere with that */
- if (!PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(si)))
- continue;
-
- if ((role = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_ROLE))) {
- if (pa_streq(role, "filter")) {
- pa_log_debug("This sink-input [%d] linked to [%s] is FILTER...skip", si->index, (si->sink)? si->sink->name : NULL);
- continue;
- }
- }
-
- if (pa_streq (si->sink->name, SINK_ALSA_VOIP)) {
- pa_log_info("Skip sink-input for VOIP sink");
- continue;
- }
-
- if (b) {
- si_state = pa_sink_input_get_state(si);
- /* Cork only if sink-input was Running / Drained */
- if (si_state == PA_SINK_INPUT_RUNNING || si_state == PA_SINK_INPUT_DRAINED) {
- pa_proplist_sets(si->proplist, PROP_MANUAL_CORK, "1");
- pa_sink_input_cork(si, TRUE);
- pa_log_info(" <Cork %d> for sink-input[%d]:sink[%s]", b, si->index, si->sink->name);
- }
- } else {
- /* UnCork if corked by manually */
- if ((is_manual_corked_str = pa_proplist_gets(si->proplist, PROP_MANUAL_CORK))) {
- pa_atou(is_manual_corked_str, &is_manual_corked);
- if (is_manual_corked) {
- pa_proplist_sets(si->proplist, PROP_MANUAL_CORK, "0");
- pa_sink_input_cork(si, FALSE);
- pa_log_info(" <UnCork %d> for sink-input[%d]:sink[%s]", b, si->index, si->sink->name);
- }
- }
- }
- }
-
- /* If CORK case, Do manual suspend for ALSA devices */
- if (b) {
- PA_IDXSET_FOREACH(sink, c->protocol->core->sinks, sink_idx) {
- if (pa_streq (sink->name, SINK_ALSA_NORMAL) ||
- pa_streq (sink->name, SINK_ALSA_LPA) ||
- pa_streq (sink->name, SINK_ALSA_HDMI)) {
- pa_log_info("sink[%d][%s] state=[%d], used_by[%d], check_suspend[%d], suspend-cause[0x%x]",
- sink->index, sink->name, pa_sink_get_state(sink), pa_sink_used_by(sink), pa_sink_check_suspend(sink), sink->suspend_cause);
-
- /* If sink is Not Suspended and can be suspended, do suspend */
- if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED && pa_sink_check_suspend(sink) == 0) {
- ret = pa_sink_suspend (sink, TRUE, PA_SUSPEND_INTERNAL);
- pa_log_info("suspend result [%d], after suspend-cause[0x%x]", ret, sink->suspend_cause);
- }
- }
- }
- }
- pa_log_debug("========================= %s end =========================", b > 0 ? "cork" : "uncork");
- pa_pstream_send_simple_ack(c->pstream, tag);
-}
-#endif /* __TIZEN__ */
-
static void command_trigger_or_flush_or_prebuf_playback_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
uint32_t idx;