mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
kill autoload stuff as planned
This commit is contained in:
parent
43762ed620
commit
29c7a28817
45 changed files with 166 additions and 944 deletions
|
|
@ -356,6 +356,7 @@ enum {
|
|||
PA_ERR_NOTSUPPORTED, /**< Operation not supported \since 0.9.5 */
|
||||
PA_ERR_UNKNOWN, /**< The error code was unknown to the client */
|
||||
PA_ERR_NOEXTENSION, /**< Extension does not exist. \since 0.9.12 */
|
||||
PA_ERR_OBSOLETE, /**< Obsolete functionality. \since 0.9.15 */
|
||||
PA_ERR_MAX /**< Not really an error but the first invalid error code */
|
||||
};
|
||||
|
||||
|
|
@ -388,13 +389,15 @@ typedef enum pa_subscription_mask {
|
|||
PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
|
||||
/**< Other global server changes. */
|
||||
|
||||
/** \cond fulldocs */
|
||||
PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
|
||||
/**< Autoload table events. */
|
||||
/**< \deprecated Autoload table events. */
|
||||
/** \endcond */
|
||||
|
||||
PA_SUBSCRIPTION_MASK_CARD = 0x0200U,
|
||||
/**< Card events. \since 0.9.15 */
|
||||
|
||||
PA_SUBSCRIPTION_MASK_ALL = 0x03ffU
|
||||
PA_SUBSCRIPTION_MASK_ALL = 0x02ffU
|
||||
/**< Catch all events */
|
||||
} pa_subscription_mask_t;
|
||||
|
||||
|
|
@ -424,8 +427,10 @@ typedef enum pa_subscription_event_type {
|
|||
PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
|
||||
/**< Event type: Global server change, only occuring with PA_SUBSCRIPTION_EVENT_CHANGE. */
|
||||
|
||||
/** \cond fulldocs */
|
||||
PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
|
||||
/**< Event type: Autoload table changes. */
|
||||
/**< \deprecated Event type: Autoload table changes. */
|
||||
/** \endcond */
|
||||
|
||||
PA_SUBSCRIPTION_EVENT_CARD = 0x0009U,
|
||||
/**< Event type: Card \since 0.9.15 */
|
||||
|
|
|
|||
|
|
@ -225,20 +225,37 @@ void pa_stream_set_state(pa_stream *s, pa_stream_state_t st);
|
|||
|
||||
pa_tagstruct *pa_tagstruct_command(pa_context *c, uint32_t command, uint32_t *tag);
|
||||
|
||||
#define PA_CHECK_VALIDITY(context, expression, error) do { \
|
||||
if (!(expression)) \
|
||||
#define PA_CHECK_VALIDITY(context, expression, error) \
|
||||
do { \
|
||||
if (!(expression)) \
|
||||
return -pa_context_set_error((context), (error)); \
|
||||
} while(0)
|
||||
} while(FALSE)
|
||||
|
||||
|
||||
#define PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, value) do { \
|
||||
if (!(expression)) { \
|
||||
pa_context_set_error((context), (error)); \
|
||||
return value; \
|
||||
} \
|
||||
} while(0)
|
||||
#define PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, value) \
|
||||
do { \
|
||||
if (!(expression)) { \
|
||||
pa_context_set_error((context), (error)); \
|
||||
return value; \
|
||||
} \
|
||||
} while(FALSE)
|
||||
|
||||
#define PA_CHECK_VALIDITY_RETURN_NULL(context, expression, error) PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, NULL)
|
||||
#define PA_CHECK_VALIDITY_RETURN_NULL(context, expression, error) \
|
||||
PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, NULL)
|
||||
|
||||
#define PA_FAIL(context, error) \
|
||||
do { \
|
||||
return -pa_context_set_error((context), (error)); \
|
||||
} while(FALSE)
|
||||
|
||||
#define PA_FAIL_RETURN_ANY(context, error, value) \
|
||||
do { \
|
||||
pa_context_set_error((context), (error)); \
|
||||
return value; \
|
||||
} while(FALSE)
|
||||
|
||||
#define PA_FAIL_RETURN_NULL(context, error) \
|
||||
PA_FAIL_RETURN_ANY(context, error, NULL)
|
||||
|
||||
void pa_ext_stream_restore_command(pa_context *c, uint32_t tag, pa_tagstruct *t);
|
||||
|
||||
|
|
|
|||
|
|
@ -1167,186 +1167,59 @@ pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_s
|
|||
|
||||
/*** Autoload stuff ***/
|
||||
|
||||
static void context_get_autoload_info_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
|
||||
pa_operation *o = userdata;
|
||||
int eol = 1;
|
||||
|
||||
pa_assert(pd);
|
||||
pa_assert(o);
|
||||
pa_assert(PA_REFCNT_VALUE(o) >= 1);
|
||||
|
||||
if (!o->context)
|
||||
goto finish;
|
||||
|
||||
if (command != PA_COMMAND_REPLY) {
|
||||
if (pa_context_handle_error(o->context, command, t, FALSE) < 0)
|
||||
goto finish;
|
||||
|
||||
eol = -1;
|
||||
} else {
|
||||
|
||||
while (!pa_tagstruct_eof(t)) {
|
||||
pa_autoload_info i;
|
||||
|
||||
memset(&i, 0, sizeof(i));
|
||||
|
||||
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.name) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.type) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.module) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.argument) < 0) {
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (o->callback) {
|
||||
pa_autoload_info_cb_t cb = (pa_autoload_info_cb_t) o->callback;
|
||||
cb(o->context, &i, 0, o->userdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (o->callback) {
|
||||
pa_autoload_info_cb_t cb = (pa_autoload_info_cb_t) o->callback;
|
||||
cb(o->context, NULL, eol, o->userdata);
|
||||
}
|
||||
|
||||
finish:
|
||||
pa_operation_done(o);
|
||||
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_WARN_REFERENCE(pa_context_get_autoload_info_by_name, "Module auto-loading no longer supported.");
|
||||
|
||||
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;
|
||||
uint32_t tag;
|
||||
|
||||
pa_assert(c);
|
||||
pa_assert(PA_REFCNT_VALUE(c) >= 1);
|
||||
pa_assert(cb);
|
||||
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID);
|
||||
|
||||
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
|
||||
|
||||
t = pa_tagstruct_command(c, PA_COMMAND_GET_AUTOLOAD_INFO, &tag);
|
||||
pa_tagstruct_puts(t, name);
|
||||
pa_tagstruct_putu32(t, type);
|
||||
pa_pstream_send_tagstruct(c->pstream, t);
|
||||
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
|
||||
|
||||
return o;
|
||||
PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE);
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_get_autoload_info_by_index, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
PA_WARN_REFERENCE(pa_context_get_autoload_info_by_index, "Module auto-loading no longer supported.");
|
||||
|
||||
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;
|
||||
uint32_t tag;
|
||||
|
||||
pa_assert(c);
|
||||
pa_assert(PA_REFCNT_VALUE(c) >= 1);
|
||||
pa_assert(cb);
|
||||
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
|
||||
|
||||
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
|
||||
|
||||
t = pa_tagstruct_command(c, PA_COMMAND_GET_AUTOLOAD_INFO, &tag);
|
||||
pa_tagstruct_putu32(t, idx);
|
||||
pa_pstream_send_tagstruct(c->pstream, t);
|
||||
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
|
||||
|
||||
return o;
|
||||
PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE);
|
||||
}
|
||||
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_get_autoload_info_list, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
PA_WARN_REFERENCE(pa_context_get_autoload_info_list, "Module auto-loading no longer supported.");
|
||||
|
||||
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_assert(c);
|
||||
pa_assert(PA_REFCNT_VALUE(c) >= 1);
|
||||
|
||||
PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE);
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_add_autoload, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
PA_WARN_REFERENCE(pa_context_add_autoload, "Module auto-loading no longer supported.");
|
||||
|
||||
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;
|
||||
uint32_t tag;
|
||||
|
||||
pa_assert(c);
|
||||
pa_assert(PA_REFCNT_VALUE(c) >= 1);
|
||||
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, module && *module, PA_ERR_INVALID);
|
||||
|
||||
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
|
||||
|
||||
t = pa_tagstruct_command(c, PA_COMMAND_ADD_AUTOLOAD, &tag);
|
||||
pa_tagstruct_puts(t, name);
|
||||
pa_tagstruct_putu32(t, type);
|
||||
pa_tagstruct_puts(t, module);
|
||||
pa_tagstruct_puts(t, argument);
|
||||
pa_pstream_send_tagstruct(c->pstream, t);
|
||||
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_index_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
|
||||
|
||||
return o;
|
||||
PA_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE);
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_remove_autoload_by_name, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
PA_WARN_REFERENCE(pa_context_remove_autoload_by_name, "Module auto-loading no longer supported.");
|
||||
|
||||
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;
|
||||
uint32_t tag;
|
||||
|
||||
pa_assert(c);
|
||||
pa_assert(PA_REFCNT_VALUE(c) >= 1);
|
||||
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, type == PA_AUTOLOAD_SINK || type == PA_AUTOLOAD_SOURCE, PA_ERR_INVALID);
|
||||
|
||||
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
|
||||
|
||||
t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_AUTOLOAD, &tag);
|
||||
pa_tagstruct_puts(t, name);
|
||||
pa_tagstruct_putu32(t, type);
|
||||
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_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE);
|
||||
}
|
||||
|
||||
PA_WARN_REFERENCE(pa_context_remove_autoload_by_index, "Autoload will no longer be implemented by future versions of the PulseAudio server.");
|
||||
PA_WARN_REFERENCE(pa_context_remove_autoload_by_index, "Module auto-loading no longer supported.");
|
||||
|
||||
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;
|
||||
uint32_t tag;
|
||||
|
||||
pa_assert(c);
|
||||
pa_assert(PA_REFCNT_VALUE(c) >= 1);
|
||||
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(c, idx != PA_INVALID_INDEX, PA_ERR_INVALID);
|
||||
|
||||
o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
|
||||
|
||||
t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_AUTOLOAD, &tag);
|
||||
pa_tagstruct_putu32(t, idx);
|
||||
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_FAIL_RETURN_NULL(c, PA_ERR_OBSOLETE);
|
||||
}
|
||||
|
||||
pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, const char *sink_name, pa_context_success_cb_t cb, void* userdata) {
|
||||
|
|
|
|||
|
|
@ -128,18 +128,6 @@
|
|||
* pa_context_get_module_info() or pa_context_get_module_info_list(). The
|
||||
* information structure is called pa_module_info.
|
||||
*
|
||||
* \subsection autoload_subsec Autoload Entries
|
||||
*
|
||||
* Modules can be autoloaded as a result of a client requesting a
|
||||
* certain sink or source. Please note that autoloading is deprecated
|
||||
* in 0.9.11. and is likely to be removed from the API in a later
|
||||
* version. This mapping between sink/source names and modules can be
|
||||
* queried from the server:
|
||||
*
|
||||
* \li By index - pa_context_get_autoload_info_by_index()
|
||||
* \li By sink/source name - pa_context_get_autoload_info_by_name()
|
||||
* \li All - pa_context_get_autoload_info_list()
|
||||
*
|
||||
* \subsection client_subsec Clients
|
||||
*
|
||||
* PulseAudio clients are also identified by index and are retrieved using
|
||||
|
|
@ -189,14 +177,6 @@
|
|||
* Server modules can be remotely loaded and unloaded using
|
||||
* pa_context_load_module() and pa_context_unload_module().
|
||||
*
|
||||
* \subsection autoload_subsec Autoload Entries
|
||||
*
|
||||
* New module autoloading rules can be added, and existing can be removed
|
||||
* using pa_context_add_autoload() and pa_context_remove_autoload_by_index()
|
||||
* / pa_context_remove_autoload_by_name(). Please note that autoloading is deprecated
|
||||
* in 0.9.11. and is likely to be removed from the API in a later
|
||||
* version.
|
||||
*
|
||||
* \subsection client_subsec Clients
|
||||
*
|
||||
* The only operation supported on clients, is the possibility of kicking
|
||||
|
|
@ -350,7 +330,9 @@ typedef struct pa_module_info {
|
|||
const char*name, /**< Name of the module */
|
||||
*argument; /**< Argument string of the module */
|
||||
uint32_t n_used; /**< Usage counter or PA_INVALID_INDEX */
|
||||
int auto_unload; /**< Non-zero if this is an autoloaded module */
|
||||
/** \cond fulldocs */
|
||||
int auto_unload; /**< \deprecated Non-zero if this is an autoloaded module */
|
||||
/** \endcond */
|
||||
} pa_module_info;
|
||||
|
||||
/** Callback prototype for pa_context_get_module_info() and firends*/
|
||||
|
|
@ -551,13 +533,13 @@ pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t
|
|||
|
||||
/** @{ \name Autoload Entries */
|
||||
|
||||
/** Type of an autoload entry. */
|
||||
/** \deprecated Type of an autoload entry. */
|
||||
typedef enum pa_autoload_type {
|
||||
PA_AUTOLOAD_SINK = 0,
|
||||
PA_AUTOLOAD_SOURCE = 1
|
||||
} pa_autoload_type_t;
|
||||
|
||||
/** Stores information about autoload entries. Please note that this structure
|
||||
/** \deprecated 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. */
|
||||
typedef struct pa_autoload_info {
|
||||
|
|
@ -568,25 +550,25 @@ typedef struct pa_autoload_info {
|
|||
const char *argument; /**< Argument string for module */
|
||||
} pa_autoload_info;
|
||||
|
||||
/** Callback prototype for pa_context_get_autoload_info_by_name() and firends */
|
||||
/** \deprecated Callback prototype for pa_context_get_autoload_info_by_name() and firends */
|
||||
typedef void (*pa_autoload_info_cb_t)(pa_context *c, const pa_autoload_info *i, int eol, void *userdata);
|
||||
|
||||
/** Get info about a specific autoload entry. */
|
||||
/** \deprecated Get info about a specific autoload entry. */
|
||||
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_GCC_DEPRECATED;
|
||||
|
||||
/** Get info about a specific autoload entry. */
|
||||
/** \deprecated Get info about a specific autoload entry. */
|
||||
pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED;
|
||||
|
||||
/** Get the complete list of autoload entries. */
|
||||
/** \deprecated Get the complete list of autoload entries. */
|
||||
pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED;
|
||||
|
||||
/** Add a new autoload entry. */
|
||||
/** \deprecated Add a new autoload entry. */
|
||||
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, void* userdata) PA_GCC_DEPRECATED;
|
||||
|
||||
/** Remove an autoload entry. */
|
||||
/** \deprecated Remove an autoload entry. */
|
||||
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_GCC_DEPRECATED;
|
||||
|
||||
/** Remove an autoload entry. */
|
||||
/** \deprecated Remove an autoload entry. */
|
||||
pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata) PA_GCC_DEPRECATED;
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue