mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-16 06:59:55 -05:00
- deprecate autoload stuff
- allow setting of the requested latency of a sink input/source output before _put() is called - allow sinks/sources to have a "minimal" latency which applies to all requested latencies by sink inputs/source outputs - add new client library flags PA_STREAM_ADJUST_LATENCY, PA_STREAM_START_MUTED - allow client library to fill in 0 to buffer_attr fields - update module-alsa-source following module-alsa-sink - other cleanups and fixes git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2215 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
ecf6439661
commit
cdfcf6654c
26 changed files with 708 additions and 260 deletions
|
|
@ -210,16 +210,68 @@ typedef enum pa_stream_flags {
|
|||
* on older servers. \since
|
||||
* 0.9.8 */
|
||||
PA_STREAM_PEAK_DETECT = 2048, /**< Find peaks instead of
|
||||
* resampling. \since 0.9.9 */
|
||||
* resampling. \since 0.9.11 */
|
||||
|
||||
PA_STREAM_START_MUTED = 4096, /**< Create in muted state. \since 0.9.11 */
|
||||
|
||||
|
||||
PA_STREAM_ADJUST_LATENCY = 8192, /**< Try to adjust the latency of
|
||||
* the sink/source based on the
|
||||
* requested buffer metrics and
|
||||
* adjust buffer metrics
|
||||
* accordingly. \since 0.9.11 */
|
||||
} pa_stream_flags_t;
|
||||
|
||||
/** Playback and record buffer metrics */
|
||||
typedef struct pa_buffer_attr {
|
||||
uint32_t maxlength; /**< Maximum length of the buffer */
|
||||
uint32_t tlength; /**< Playback only: target length of the buffer. The server tries to assure that at least tlength bytes are always available in the buffer */
|
||||
uint32_t prebuf; /**< Playback only: pre-buffering. The server does not start with playback before at least prebug bytes are available in the buffer */
|
||||
uint32_t minreq; /**< Playback only: minimum request. The server does not request less than minreq bytes from the client, instead waints until the buffer is free enough to request more bytes at once */
|
||||
uint32_t fragsize; /**< Recording only: fragment size. The server sends data in blocks of fragsize bytes size. Large values deminish interactivity with other operations on the connection context but decrease control overhead. */
|
||||
uint32_t maxlength; /**< Maximum length of the
|
||||
* buffer. Setting this to 0 will
|
||||
* initialize this to the maximum value
|
||||
* supported by server, which is
|
||||
* recommended. */
|
||||
uint32_t tlength; /**< Playback only: target length of the
|
||||
* buffer. The server tries to assure
|
||||
* that at least tlength bytes are always
|
||||
* available in the buffer. It is
|
||||
* recommended to set this to 0, which
|
||||
* will initialize this to a value that
|
||||
* is deemed sensible by the
|
||||
* server. However, this value will
|
||||
* default to something like 2s, i.e. for
|
||||
* applications that have specific
|
||||
* latency requirements this value should
|
||||
* be set to the maximum latency that the
|
||||
* application can deal with. */
|
||||
uint32_t prebuf; /**< Playback only: pre-buffering. The
|
||||
* server does not start with playback
|
||||
* before at least prebug bytes are
|
||||
* available in the buffer. It is
|
||||
* recommended to set this to 0, which
|
||||
* will initialize this to the same value
|
||||
* as tlength, whatever that may be. */
|
||||
uint32_t minreq; /**< Playback only: minimum request. The
|
||||
* server does not request less than
|
||||
* minreq bytes from the client, instead
|
||||
* waits until the buffer is free enough
|
||||
* to request more bytes at once. It is
|
||||
* recommended to set this to 0, which
|
||||
* will initialize this to a value that
|
||||
* is deemed sensible by the server. */
|
||||
uint32_t fragsize; /**< Recording only: fragment size. The
|
||||
* server sends data in blocks of
|
||||
* fragsize bytes size. Large values
|
||||
* deminish interactivity with other
|
||||
* operations on the connection context
|
||||
* but decrease control overhead. It is
|
||||
* recommended to set this to 0, which
|
||||
* will initialize this to a value that
|
||||
* is deemed sensible by the
|
||||
* server. However, this value will
|
||||
* default to something like 2s, i.e. for
|
||||
* applications that have specific
|
||||
* latency requirements this value should
|
||||
* be set to the maximum latency that the
|
||||
* application can deal with. */
|
||||
} pa_buffer_attr;
|
||||
|
||||
/** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */
|
||||
|
|
@ -299,7 +351,9 @@ typedef enum pa_subscription_event_type {
|
|||
* source_usec+buffer_usec+transport_usec-sink_usec. (Take care of
|
||||
* sign issues!) When connected to a monitor source sink_usec contains
|
||||
* the latency of the owning sink. The two latency estimations
|
||||
* described here are implemented in pa_stream_get_latency().*/
|
||||
* described here are implemented in pa_stream_get_latency(). Please
|
||||
* note that this structure can be extended as part of evolutionary
|
||||
* API updates at any time in any new release.*/
|
||||
typedef struct pa_timing_info {
|
||||
struct timeval timestamp; /**< The time when this timing info structure was current */
|
||||
int synchronized_clocks; /**< Non-zero if the local and the
|
||||
|
|
@ -346,6 +400,11 @@ typedef struct pa_timing_info {
|
|||
* want to use it. Consider using
|
||||
* PA_SEEK_RELATIVE_ON_READ
|
||||
* instead. \since 0.8 */
|
||||
|
||||
pa_usec_t max_sink_usec; /**< The static configure latency for
|
||||
* the sink. \since 0.9.10 */
|
||||
pa_usec_t max_source_usec; /**< The static configure latency for
|
||||
* the source. \since 0.9.10 */
|
||||
} pa_timing_info;
|
||||
|
||||
/** A structure for the spawn api. This may be used to integrate auto
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P
|
|||
|
||||
while (!pa_tagstruct_eof(t)) {
|
||||
pa_sink_info i;
|
||||
pa_bool_t mute = FALSE;
|
||||
|
||||
memset(&i, 0, sizeof(i));
|
||||
i.proplist = pa_proplist_new();
|
||||
|
|
@ -160,7 +161,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P
|
|||
pa_tagstruct_get_channel_map(t, &i.channel_map) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
|
||||
pa_tagstruct_get_cvolume(t, &i.volume) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &i.mute) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &mute) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.monitor_source) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.monitor_source_name) < 0 ||
|
||||
pa_tagstruct_get_usec(t, &i.latency) < 0 ||
|
||||
|
|
@ -173,6 +174,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, P
|
|||
goto finish;
|
||||
}
|
||||
|
||||
i.mute = (int) mute;
|
||||
i.flags = (pa_sink_flags_t) flags;
|
||||
|
||||
if (o->callback) {
|
||||
|
|
@ -266,6 +268,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
while (!pa_tagstruct_eof(t)) {
|
||||
pa_source_info i;
|
||||
uint32_t flags;
|
||||
pa_bool_t mute = FALSE;
|
||||
|
||||
memset(&i, 0, sizeof(i));
|
||||
i.proplist = pa_proplist_new();
|
||||
|
|
@ -277,7 +280,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
pa_tagstruct_get_channel_map(t, &i.channel_map) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
|
||||
pa_tagstruct_get_cvolume(t, &i.volume) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &i.mute) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &mute) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.monitor_of_sink) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.monitor_of_sink_name) < 0 ||
|
||||
pa_tagstruct_get_usec(t, &i.latency) < 0 ||
|
||||
|
|
@ -290,6 +293,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
goto finish;
|
||||
}
|
||||
|
||||
i.mute = (int) mute;
|
||||
i.flags = (pa_source_flags_t) flags;
|
||||
|
||||
if (o->callback) {
|
||||
|
|
@ -464,17 +468,20 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
|
||||
while (!pa_tagstruct_eof(t)) {
|
||||
pa_module_info i;
|
||||
pa_bool_t auto_unload = FALSE;
|
||||
memset(&i, 0, sizeof(i));
|
||||
|
||||
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.name) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.argument) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.n_used) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &i.auto_unload) < 0) {
|
||||
pa_tagstruct_get_boolean(t, &auto_unload) < 0) {
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
i.auto_unload = (int) auto_unload;
|
||||
|
||||
if (o->callback) {
|
||||
pa_module_info_cb_t cb = (pa_module_info_cb_t) o->callback;
|
||||
cb(o->context, &i, 0, o->userdata);
|
||||
|
|
@ -540,6 +547,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
|
|||
|
||||
while (!pa_tagstruct_eof(t)) {
|
||||
pa_sink_input_info i;
|
||||
pa_bool_t mute = FALSE;
|
||||
|
||||
memset(&i, 0, sizeof(i));
|
||||
i.proplist = pa_proplist_new();
|
||||
|
|
@ -556,7 +564,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
|
|||
pa_tagstruct_get_usec(t, &i.sink_usec) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.resample_method) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.driver) < 0 ||
|
||||
(o->context->version >= 11 && pa_tagstruct_get_boolean(t, &i.mute) < 0) ||
|
||||
(o->context->version >= 11 && pa_tagstruct_get_boolean(t, &mute) < 0) ||
|
||||
(o->context->version >= 13 && pa_tagstruct_get_proplist(t, i.proplist) < 0)) {
|
||||
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
|
|
@ -564,6 +572,8 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
|
|||
goto finish;
|
||||
}
|
||||
|
||||
i.mute = (int) mute;
|
||||
|
||||
if (o->callback) {
|
||||
pa_sink_input_info_cb_t cb = (pa_sink_input_info_cb_t) o->callback;
|
||||
cb(o->context, &i, 0, o->userdata);
|
||||
|
|
@ -961,6 +971,7 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
|
||||
while (!pa_tagstruct_eof(t)) {
|
||||
pa_sample_info i;
|
||||
pa_bool_t lazy = FALSE;
|
||||
|
||||
memset(&i, 0, sizeof(i));
|
||||
i.proplist = pa_proplist_new();
|
||||
|
|
@ -972,7 +983,7 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
pa_tagstruct_get_sample_spec(t, &i.sample_spec) < 0 ||
|
||||
pa_tagstruct_get_channel_map(t, &i.channel_map) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.bytes) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &i.lazy) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &lazy) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.filename) < 0 ||
|
||||
(o->context->version >= 13 && pa_tagstruct_get_proplist(t, i.proplist) < 0)) {
|
||||
|
||||
|
|
@ -980,6 +991,8 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
goto finish;
|
||||
}
|
||||
|
||||
i.lazy = (int) lazy;
|
||||
|
||||
if (o->callback) {
|
||||
pa_sample_info_cb_t cb = (pa_sample_info_cb_t) o->callback;
|
||||
cb(o->context, &i, 0, o->userdata);
|
||||
|
|
@ -1192,6 +1205,8 @@ finish:
|
|||
pa_operation_unref(o);
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_get_autoload_info_by_name, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
|
||||
pa_operation* pa_context_get_autoload_info_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_autoload_info_cb_t cb, void *userdata) {
|
||||
pa_tagstruct *t;
|
||||
pa_operation *o;
|
||||
|
|
@ -1216,6 +1231,8 @@ pa_operation* pa_context_get_autoload_info_by_name(pa_context *c, const char *na
|
|||
return o;
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_get_autoload_info_by_index, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
|
||||
pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata) {
|
||||
pa_tagstruct *t;
|
||||
pa_operation *o;
|
||||
|
|
@ -1238,10 +1255,15 @@ pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx,
|
|||
return o;
|
||||
}
|
||||
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_get_autoload_info_list, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
|
||||
pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata) {
|
||||
return pa_context_send_simple_command(c, PA_COMMAND_GET_AUTOLOAD_INFO_LIST, context_get_autoload_info_callback, (pa_operation_cb_t) cb, userdata);
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_add_autoload, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
|
||||
pa_operation* pa_context_add_autoload(pa_context *c, const char *name, pa_autoload_type_t type, const char *module, const char*argument, pa_context_index_cb_t cb, void* userdata) {
|
||||
pa_operation *o;
|
||||
pa_tagstruct *t;
|
||||
|
|
@ -1268,6 +1290,8 @@ pa_operation* pa_context_add_autoload(pa_context *c, const char *name, pa_autolo
|
|||
return o;
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_remove_autoload_by_name, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
|
||||
pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name, pa_autoload_type_t type, pa_context_success_cb_t cb, void* userdata) {
|
||||
pa_operation *o;
|
||||
pa_tagstruct *t;
|
||||
|
|
@ -1291,6 +1315,8 @@ pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name
|
|||
return o;
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_remove_autoload_by_index, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
|
||||
pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata) {
|
||||
pa_operation *o;
|
||||
pa_tagstruct *t;
|
||||
|
|
|
|||
|
|
@ -212,7 +212,11 @@ PA_C_DECL_BEGIN
|
|||
#define PA_PORT_ANALOG_5_1 "analog-5-1"
|
||||
#define PA_PORT_ANALOG_4_0 "analog-4-0"
|
||||
|
||||
/** Stores information about sinks */
|
||||
/** @{ \name Sinks */
|
||||
|
||||
/** Stores information about sinks. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_sink_info {
|
||||
const char *name; /**< Name of the sink */
|
||||
uint32_t index; /**< Index of the sink */
|
||||
|
|
@ -224,10 +228,11 @@ typedef struct pa_sink_info {
|
|||
int mute; /**< Mute switch of the sink \since 0.8 */
|
||||
uint32_t monitor_source; /**< Index of the monitor source connected to this sink */
|
||||
const char *monitor_source_name; /**< The name of the monitor source */
|
||||
pa_usec_t latency; /**< Length of filled playback buffer of this sink */
|
||||
pa_usec_t latency; /**< Length of queued audio in the output buffer. */
|
||||
const char *driver; /**< Driver name. \since 0.8 */
|
||||
pa_sink_flags_t flags; /**< Flags \since 0.8 */
|
||||
pa_proplist *proplist; /**< Property list \since 0.9.10 */
|
||||
pa_proplist *proplist; /**< Property list \since 0.9.11 */
|
||||
pa_usec_t max_latency; /**< The static latency this device has been configured to. \since 0.9.11 */
|
||||
} pa_sink_info;
|
||||
|
||||
/** Callback prototype for pa_context_get_sink_info_by_name() and friends */
|
||||
|
|
@ -242,7 +247,31 @@ pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t id, pa_s
|
|||
/** Get the complete sink list */
|
||||
pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Stores information about sources */
|
||||
/** Set the volume of a sink device specified by its index */
|
||||
pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the volume of a sink device specified by its name */
|
||||
pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a sink device specified by its index \since 0.8 */
|
||||
pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a sink device specified by its name \since 0.8 */
|
||||
pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Suspend/Resume a sink. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_sink_by_name(pa_context *c, char *sink_name, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Suspend/Resume a sink. If idx is PA_INVALID_INDEX all sinks will be suspended. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_sink_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Sources */
|
||||
|
||||
/** Stores information about sources. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_source_info {
|
||||
const char *name; /**< Name of the source */
|
||||
uint32_t index; /**< Index of the source */
|
||||
|
|
@ -258,6 +287,7 @@ typedef struct pa_source_info {
|
|||
const char *driver; /**< Driver name \since 0.8 */
|
||||
pa_source_flags_t flags; /**< Flags \since 0.8 */
|
||||
pa_proplist *proplist; /**< Property list \since 0.9.10 */
|
||||
pa_usec_t max_latency; /**< The static latency this device has been configured to. \since 0.9.11 */
|
||||
} pa_source_info;
|
||||
|
||||
/** Callback prototype for pa_context_get_source_info_by_name() and friends */
|
||||
|
|
@ -272,7 +302,25 @@ pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t id, pa
|
|||
/** Get the complete source list */
|
||||
pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Server information */
|
||||
/** Set the volume of a source device specified by its index \since 0.8 */
|
||||
pa_operation* pa_context_set_source_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the volume of a source device specified by its name \since 0.8 */
|
||||
pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a source device specified by its index \since 0.8 */
|
||||
pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a source device specified by its name \since 0.8 */
|
||||
pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Server */
|
||||
|
||||
/** Server information. Please note that this structure can be
|
||||
* extended as part of evolutionary API updates at any time in any new
|
||||
* release. */
|
||||
typedef struct pa_server_info {
|
||||
const char *user_name; /**< User name of the daemon process */
|
||||
const char *host_name; /**< Host name the daemon is running on */
|
||||
|
|
@ -290,7 +338,13 @@ typedef void (*pa_server_info_cb_t) (pa_context *c, const pa_server_info*i, void
|
|||
/** Get some information about the server */
|
||||
pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Stores information about modules */
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Modules */
|
||||
|
||||
/** Stores information about modules. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_module_info {
|
||||
uint32_t index; /**< Index of the module */
|
||||
const char*name, /**< Name of the module */
|
||||
|
|
@ -308,7 +362,22 @@ pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_
|
|||
/** Get the complete list of currently loaded modules */
|
||||
pa_operation* pa_context_get_module_info_list(pa_context *c, pa_module_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Stores information about clients */
|
||||
/** Callback prototype for pa_context_load_module() */
|
||||
typedef void (*pa_context_index_cb_t)(pa_context *c, uint32_t idx, void *userdata);
|
||||
|
||||
/** Load a module. \since 0.5 */
|
||||
pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, pa_context_index_cb_t cb, void *userdata);
|
||||
|
||||
/** Unload a module. \since 0.5 */
|
||||
pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Clients */
|
||||
|
||||
/** Stores information about clients. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_client_info {
|
||||
uint32_t index; /**< Index of this client */
|
||||
const char *name; /**< Name of this client */
|
||||
|
|
@ -326,7 +395,16 @@ pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_
|
|||
/** Get the complete client list */
|
||||
pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Stores information about sink inputs */
|
||||
/** Kill a client. \since 0.5 */
|
||||
pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Sink Inputs */
|
||||
|
||||
/** Stores information about sink inputs. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_sink_input_info {
|
||||
uint32_t index; /**< Index of the sink input */
|
||||
const char *name; /**< Name of the sink input */
|
||||
|
|
@ -353,7 +431,28 @@ pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sin
|
|||
/** Get the complete sink input list */
|
||||
pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Stores information about source outputs */
|
||||
/** Move the specified sink input to a different sink. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, char *sink_name, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Move the specified sink input to a different sink. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_sink_input_by_index(pa_context *c, uint32_t idx, uint32_t sink_idx, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Set the volume of a sink input stream */
|
||||
pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a sink input stream \since 0.9.7 */
|
||||
pa_operation* pa_context_set_sink_input_mute(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Kill a sink input. \since 0.5 */
|
||||
pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Source Outputs */
|
||||
|
||||
/** Stores information about source outputs. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_source_output_info {
|
||||
uint32_t index; /**< Index of the sink input */
|
||||
const char *name; /**< Name of the sink input */
|
||||
|
|
@ -378,37 +477,28 @@ pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_
|
|||
/** Get the complete list of source outputs */
|
||||
pa_operation* pa_context_get_source_output_info_list(pa_context *c, pa_source_output_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the volume of a sink device specified by its index */
|
||||
pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
/** Move the specified source output to a different source. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx, char *source_name, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Set the volume of a sink device specified by its name */
|
||||
pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
/** Move the specified source output to a different source. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_source_output_by_index(pa_context *c, uint32_t idx, uint32_t source_idx, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Set the mute switch of a sink device specified by its index \since 0.8 */
|
||||
pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
/** Suspend/Resume a source. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_source_by_name(pa_context *c, char *source_name, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Set the mute switch of a sink device specified by its name \since 0.8 */
|
||||
pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
/** Suspend/Resume a source. If idx is PA_INVALID_INDEX all sources will be suspended. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Set the volume of a sink input stream */
|
||||
pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
/** Kill a source output. \since 0.5 */
|
||||
pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a sink input stream \since 0.9.7 */
|
||||
pa_operation* pa_context_set_sink_input_mute(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
/** @} */
|
||||
|
||||
/** Set the volume of a source device specified by its index \since 0.8 */
|
||||
pa_operation* pa_context_set_source_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
/** @{ \name Statistics */
|
||||
|
||||
/** Set the volume of a source device specified by its name \since 0.8 */
|
||||
pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a source device specified by its index \since 0.8 */
|
||||
pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Set the mute switch of a source device specified by its name \since 0.8 */
|
||||
pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Memory block statistics */
|
||||
/** Memory block statistics. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_stat_info {
|
||||
uint32_t memblock_total; /**< Currently allocated memory blocks */
|
||||
uint32_t memblock_total_size; /**< Currentl total size of allocated memory blocks */
|
||||
|
|
@ -423,7 +513,13 @@ typedef void (*pa_stat_info_cb_t) (pa_context *c, const pa_stat_info *i, void *u
|
|||
/** Get daemon memory block statistics */
|
||||
pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Stores information about sample cache entries */
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Cached Samples */
|
||||
|
||||
/** Stores information about sample cache entries. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. */
|
||||
typedef struct pa_sample_info {
|
||||
uint32_t index; /**< Index of this entry */
|
||||
const char *name; /**< Name of this entry */
|
||||
|
|
@ -449,23 +545,11 @@ pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, p
|
|||
/** Get the complete list of samples stored in the daemon. */
|
||||
pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t cb, void *userdata);
|
||||
|
||||
/** Kill a client. \since 0.5 */
|
||||
pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
/** @} */
|
||||
|
||||
/** Kill a sink input. \since 0.5 */
|
||||
pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
/** \cond fulldocs */
|
||||
|
||||
/** Kill a source output. \since 0.5 */
|
||||
pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
|
||||
/** Callback prototype for pa_context_load_module() and pa_context_add_autoload() */
|
||||
typedef void (*pa_context_index_cb_t)(pa_context *c, uint32_t idx, void *userdata);
|
||||
|
||||
/** Load a module. \since 0.5 */
|
||||
pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, pa_context_index_cb_t cb, void *userdata);
|
||||
|
||||
/** Unload a module. \since 0.5 */
|
||||
pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
|
||||
/** @{ \name Autoload Entries */
|
||||
|
||||
/** Type of an autoload entry. \since 0.5 */
|
||||
typedef enum pa_autoload_type {
|
||||
|
|
@ -473,7 +557,9 @@ typedef enum pa_autoload_type {
|
|||
PA_AUTOLOAD_SOURCE = 1
|
||||
} pa_autoload_type_t;
|
||||
|
||||
/** Stores information about autoload entries. \since 0.5 */
|
||||
/** Stores information about autoload entries. Please note that this structure
|
||||
* can be extended as part of evolutionary API updates at any time in
|
||||
* any new release. \since 0.5 */
|
||||
typedef struct pa_autoload_info {
|
||||
uint32_t index; /**< Index of this autoload entry */
|
||||
const char *name; /**< Name of the sink or source */
|
||||
|
|
@ -503,29 +589,9 @@ pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name
|
|||
/** Remove an autoload entry. \since 0.6 */
|
||||
pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Move the specified sink input to a different sink. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, char *sink_name, pa_context_success_cb_t cb, void* userdata);
|
||||
/** @} */
|
||||
|
||||
/** Move the specified sink input to a different sink. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_sink_input_by_index(pa_context *c, uint32_t idx, uint32_t sink_idx, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Move the specified source output to a different source. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx, char *source_name, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Move the specified source output to a different source. \since 0.9.5 */
|
||||
pa_operation* pa_context_move_source_output_by_index(pa_context *c, uint32_t idx, uint32_t source_idx, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Suspend/Resume a sink. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_sink_by_name(pa_context *c, char *sink_name, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Suspend/Resume a sink. If idx is PA_INVALID_INDEX all sinks will be suspended. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_sink_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Suspend/Resume a source. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_source_by_name(pa_context *c, char *source_name, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
|
||||
/** Suspend/Resume a source. If idx is PA_INVALID_INDEX all sources will be suspended. \since 0.9.7 */
|
||||
pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
|
||||
/** \endcond */
|
||||
|
||||
PA_C_DECL_END
|
||||
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED u
|
|||
pa_stream *s;
|
||||
uint32_t channel;
|
||||
const char *dn;
|
||||
int suspended;
|
||||
pa_bool_t suspended;
|
||||
uint32_t di;
|
||||
|
||||
pa_assert(pd);
|
||||
|
|
@ -342,7 +342,7 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUS
|
|||
pa_context *c = userdata;
|
||||
pa_stream *s;
|
||||
uint32_t channel;
|
||||
int suspended;
|
||||
pa_bool_t suspended;
|
||||
|
||||
pa_assert(pd);
|
||||
pa_assert(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED || command == PA_COMMAND_RECORD_STREAM_SUSPENDED);
|
||||
|
|
@ -543,15 +543,31 @@ static void create_stream_complete(pa_stream *s) {
|
|||
}
|
||||
}
|
||||
|
||||
static void automatic_buffer_attr(pa_buffer_attr *attr, pa_sample_spec *ss) {
|
||||
static void automatic_buffer_attr(pa_stream *s, pa_buffer_attr *attr, const pa_sample_spec *ss) {
|
||||
pa_assert(s);
|
||||
pa_assert(attr);
|
||||
pa_assert(ss);
|
||||
|
||||
attr->tlength = pa_bytes_per_second(ss)/2;
|
||||
attr->maxlength = (attr->tlength*3)/2;
|
||||
attr->minreq = attr->tlength/50;
|
||||
attr->prebuf = attr->tlength - attr->minreq;
|
||||
attr->fragsize = attr->tlength/50;
|
||||
if (s->context->version >= 13)
|
||||
return;
|
||||
|
||||
/* Version older than 0.9.10 didn't do server side buffer_attr
|
||||
* selection, hence we have to fake it on the client side */
|
||||
|
||||
if (!attr->maxlength <= 0)
|
||||
attr->maxlength = 4*1024*1024; /* 4MB is the maximum queue length PulseAudio <= 0.9.9 supported. */
|
||||
|
||||
if (!attr->tlength <= 0)
|
||||
attr->tlength = pa_bytes_per_second(ss)*2; /* 2s of buffering */
|
||||
|
||||
if (!attr->minreq <= 0)
|
||||
attr->minreq = (9*attr->tlength)/10; /* Ask for more data when there are only 200ms left in the playback buffer */
|
||||
|
||||
if (!attr->prebuf)
|
||||
attr->prebuf = attr->tlength; /* Start to play only when the playback is fully filled up once */
|
||||
|
||||
if (!attr->fragsize)
|
||||
attr->fragsize = attr->tlength; /* Pass data to the app only when the buffer is filled up once */
|
||||
}
|
||||
|
||||
void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
|
||||
|
|
@ -601,7 +617,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED
|
|||
pa_sample_spec ss;
|
||||
pa_channel_map cm;
|
||||
const char *dn = NULL;
|
||||
int suspended;
|
||||
pa_bool_t suspended;
|
||||
|
||||
if (pa_tagstruct_get_sample_spec(t, &ss) < 0 ||
|
||||
pa_tagstruct_get_channel_map(t, &cm) < 0 ||
|
||||
|
|
@ -631,7 +647,8 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED
|
|||
pa_buffer_attr attr;
|
||||
pa_operation *o;
|
||||
|
||||
automatic_buffer_attr(&attr, &ss);
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
automatic_buffer_attr(s, &attr, &ss);
|
||||
|
||||
/* If we need to update the buffer metrics, we wait for
|
||||
* the the OK for that call before we go to
|
||||
|
|
@ -718,7 +735,9 @@ static int create_stream(
|
|||
PA_STREAM_FIX_CHANNELS|
|
||||
PA_STREAM_DONT_MOVE|
|
||||
PA_STREAM_VARIABLE_RATE|
|
||||
PA_STREAM_PEAK_DETECT)), PA_ERR_INVALID);
|
||||
PA_STREAM_PEAK_DETECT|
|
||||
PA_STREAM_START_MUTED|
|
||||
PA_STREAM_ADJUST_LATENCY)), PA_ERR_INVALID);
|
||||
|
||||
PA_CHECK_VALIDITY(s->context, s->context->version >= 12 || !(flags & PA_STREAM_VARIABLE_RATE), PA_ERR_NOTSUPPORTED);
|
||||
PA_CHECK_VALIDITY(s->context, s->context->version >= 13 || !(flags & PA_STREAM_PEAK_DETECT), PA_ERR_NOTSUPPORTED);
|
||||
|
|
@ -727,6 +746,8 @@ static int create_stream(
|
|||
* when they are passed but actually not supported. This makes
|
||||
* client development easier */
|
||||
|
||||
PA_CHECK_VALIDITY(s->context, direction != PA_STREAM_PLAYBACK || !(flags & (PA_STREAM_START_MUTED)), PA_ERR_INVALID);
|
||||
PA_CHECK_VALIDITY(s->context, direction != PA_STREAM_RECORD || !(flags & (PA_STREAM_PEAK_DETECT)), PA_ERR_INVALID);
|
||||
PA_CHECK_VALIDITY(s->context, !volume || volume->channels == s->sample_spec.channels, PA_ERR_INVALID);
|
||||
PA_CHECK_VALIDITY(s->context, !sync_stream || (direction == PA_STREAM_PLAYBACK && sync_stream->direction == PA_STREAM_PLAYBACK), PA_ERR_INVALID);
|
||||
|
||||
|
|
@ -742,15 +763,12 @@ static int create_stream(
|
|||
s->buffer_attr = *attr;
|
||||
s->manual_buffer_attr = TRUE;
|
||||
} else {
|
||||
/* half a second, with minimum request of 10 ms */
|
||||
s->buffer_attr.tlength = pa_bytes_per_second(&s->sample_spec)/2;
|
||||
s->buffer_attr.maxlength = (s->buffer_attr.tlength*3)/2;
|
||||
s->buffer_attr.minreq = s->buffer_attr.tlength/50;
|
||||
s->buffer_attr.prebuf = s->buffer_attr.tlength - s->buffer_attr.minreq;
|
||||
s->buffer_attr.fragsize = s->buffer_attr.tlength/50;
|
||||
memset(&s->buffer_attr, 0, sizeof(s->buffer_attr));
|
||||
s->manual_buffer_attr = FALSE;
|
||||
}
|
||||
|
||||
automatic_buffer_attr(s, &s->buffer_attr, &s->sample_spec);
|
||||
|
||||
if (!dev)
|
||||
dev = s->direction == PA_STREAM_PLAYBACK ? s->context->conf->default_sink : s->context->conf->default_source;
|
||||
|
||||
|
|
@ -805,11 +823,16 @@ static int create_stream(
|
|||
|
||||
if (s->context->version >= 13) {
|
||||
|
||||
if (s->direction == PA_STREAM_PLAYBACK)
|
||||
pa_tagstruct_put_boolean(t, flags & PA_STREAM_START_MUTED);
|
||||
else
|
||||
pa_tagstruct_put_boolean(t, flags & PA_STREAM_PEAK_DETECT);
|
||||
|
||||
pa_init_proplist(s->proplist);
|
||||
|
||||
pa_tagstruct_put(
|
||||
t,
|
||||
PA_TAG_BOOLEAN, flags & PA_STREAM_PEAK_DETECT,
|
||||
PA_TAG_BOOLEAN, flags & PA_STREAM_ADJUST_LATENCY,
|
||||
PA_TAG_PROPLIST, s->proplist,
|
||||
PA_TAG_INVALID);
|
||||
}
|
||||
|
|
@ -1023,6 +1046,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
pa_operation *o = userdata;
|
||||
struct timeval local, remote, now;
|
||||
pa_timing_info *i;
|
||||
pa_bool_t playing = FALSE;
|
||||
|
||||
pa_assert(pd);
|
||||
pa_assert(o);
|
||||
|
|
@ -1047,7 +1071,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
|
||||
} else if (pa_tagstruct_get_usec(t, &i->sink_usec) < 0 ||
|
||||
pa_tagstruct_get_usec(t, &i->source_usec) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &i->playing) < 0 ||
|
||||
pa_tagstruct_get_boolean(t, &playing) < 0 ||
|
||||
pa_tagstruct_get_timeval(t, &local) < 0 ||
|
||||
pa_tagstruct_get_timeval(t, &remote) < 0 ||
|
||||
pa_tagstruct_gets64(t, &i->write_index) < 0 ||
|
||||
|
|
@ -1058,6 +1082,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
|
||||
} else {
|
||||
o->stream->timing_info_valid = 1;
|
||||
i->playing = (int) playing;
|
||||
|
||||
pa_gettimeofday(&now);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue