mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
introspect: Expose card profile available flag
Available flag can be used by clients to disable the selection of profiles unavailable. Update protocol to 29
This commit is contained in:
parent
b76b9c32d9
commit
b98a2e158f
5 changed files with 37 additions and 16 deletions
9
PROTOCOL
9
PROTOCOL
|
|
@ -342,6 +342,15 @@ SUBCOMMAND_SAVE_FORMATS, in reply from SUBCOMMAND_READ_FORMATS[_ALL]
|
||||||
|
|
||||||
(uint8_t ) PA_ENCODING_MPEG2_AAC_IEC61937 := 6
|
(uint8_t ) PA_ENCODING_MPEG2_AAC_IEC61937 := 6
|
||||||
|
|
||||||
|
## v29, implemented by >= 5.0
|
||||||
|
#
|
||||||
|
New field in all commands that send/receive profile introspection data
|
||||||
|
(PA_COMMAND_GET_CARD_INFO)
|
||||||
|
|
||||||
|
uint32 available
|
||||||
|
|
||||||
|
The field is added once for every profile.
|
||||||
|
|
||||||
#### If you just changed the protocol, read this
|
#### If you just changed the protocol, read this
|
||||||
## module-tunnel depends on the sink/source/sink-input/source-input protocol
|
## module-tunnel depends on the sink/source/sink-input/source-input protocol
|
||||||
## internals, so if you changed these, you might have broken module-tunnel.
|
## internals, so if you changed these, you might have broken module-tunnel.
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ AC_SUBST(PA_MINOR, pa_minor)
|
||||||
AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)
|
AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)
|
||||||
|
|
||||||
AC_SUBST(PA_API_VERSION, 12)
|
AC_SUBST(PA_API_VERSION, 12)
|
||||||
AC_SUBST(PA_PROTOCOL_VERSION, 28)
|
AC_SUBST(PA_PROTOCOL_VERSION, 29)
|
||||||
|
|
||||||
# The stable ABI for client applications, for the version info x:y:z
|
# The stable ABI for client applications, for the version info x:y:z
|
||||||
# always will hold y=z
|
# always will hold y=z
|
||||||
|
|
|
||||||
|
|
@ -886,12 +886,8 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
|
||||||
pa_tagstruct_gets(t, &i.name) < 0 ||
|
pa_tagstruct_gets(t, &i.name) < 0 ||
|
||||||
pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
|
pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
|
||||||
pa_tagstruct_gets(t, &i.driver) < 0 ||
|
pa_tagstruct_gets(t, &i.driver) < 0 ||
|
||||||
pa_tagstruct_getu32(t, &i.n_profiles) < 0) {
|
pa_tagstruct_getu32(t, &i.n_profiles) < 0)
|
||||||
|
goto fail;
|
||||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
|
||||||
card_info_free(&i);
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i.n_profiles > 0) {
|
if (i.n_profiles > 0) {
|
||||||
i.profiles = pa_xnew0(pa_card_profile_info, i.n_profiles+1);
|
i.profiles = pa_xnew0(pa_card_profile_info, i.n_profiles+1);
|
||||||
|
|
@ -902,11 +898,15 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
|
||||||
pa_tagstruct_gets(t, &i.profiles[j].description) < 0 ||
|
pa_tagstruct_gets(t, &i.profiles[j].description) < 0 ||
|
||||||
pa_tagstruct_getu32(t, &i.profiles[j].n_sinks) < 0 ||
|
pa_tagstruct_getu32(t, &i.profiles[j].n_sinks) < 0 ||
|
||||||
pa_tagstruct_getu32(t, &i.profiles[j].n_sources) < 0 ||
|
pa_tagstruct_getu32(t, &i.profiles[j].n_sources) < 0 ||
|
||||||
pa_tagstruct_getu32(t, &i.profiles[j].priority) < 0) {
|
pa_tagstruct_getu32(t, &i.profiles[j].priority) < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
i.profiles[j].available = 1;
|
||||||
card_info_free(&i);
|
if (o->context->version >= 29) {
|
||||||
goto finish;
|
uint32_t av;
|
||||||
|
if (pa_tagstruct_getu32(t, &av) < 0)
|
||||||
|
goto fail;
|
||||||
|
i.profiles[j].available = av;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -934,11 +934,8 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o->context->version >= 26) {
|
if (o->context->version >= 26) {
|
||||||
if (fill_card_port_info(o->context, t, &i) < 0) {
|
if (fill_card_port_info(o->context, t, &i) < 0)
|
||||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
goto fail;
|
||||||
card_info_free(&i);
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o->callback) {
|
if (o->callback) {
|
||||||
|
|
@ -958,6 +955,12 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
|
||||||
finish:
|
finish:
|
||||||
pa_operation_done(o);
|
pa_operation_done(o);
|
||||||
pa_operation_unref(o);
|
pa_operation_unref(o);
|
||||||
|
return;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||||
|
card_info_free(&i);
|
||||||
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_operation* pa_context_get_card_info_by_index(pa_context *c, uint32_t idx, pa_card_info_cb_t cb, void *userdata) {
|
pa_operation* pa_context_get_card_info_by_index(pa_context *c, uint32_t idx, pa_card_info_cb_t cb, void *userdata) {
|
||||||
|
|
|
||||||
|
|
@ -452,6 +452,12 @@ typedef struct pa_card_profile_info {
|
||||||
uint32_t n_sinks; /**< Number of sinks this profile would create */
|
uint32_t n_sinks; /**< Number of sinks this profile would create */
|
||||||
uint32_t n_sources; /**< Number of sources this profile would create */
|
uint32_t n_sources; /**< Number of sources this profile would create */
|
||||||
uint32_t priority; /**< The higher this value is, the more useful this profile is as a default. */
|
uint32_t priority; /**< The higher this value is, the more useful this profile is as a default. */
|
||||||
|
int available;
|
||||||
|
/**< Is this profile available? If this is zero, meaning "unavailable",
|
||||||
|
* then it makes no sense to try to activate this profile. If this is
|
||||||
|
* non-zero, it's still not a guarantee that activating the profile will
|
||||||
|
* result in anything useful, it just means that the server isn't aware of
|
||||||
|
* any reason why the profile would definitely be useless. \since 5.0 */
|
||||||
} pa_card_profile_info;
|
} pa_card_profile_info;
|
||||||
|
|
||||||
/** Stores information about a specific port of a card. Please
|
/** Stores information about a specific port of a card. Please
|
||||||
|
|
|
||||||
|
|
@ -3287,6 +3287,9 @@ static void card_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_car
|
||||||
pa_tagstruct_putu32(t, p->n_sinks);
|
pa_tagstruct_putu32(t, p->n_sinks);
|
||||||
pa_tagstruct_putu32(t, p->n_sources);
|
pa_tagstruct_putu32(t, p->n_sources);
|
||||||
pa_tagstruct_putu32(t, p->priority);
|
pa_tagstruct_putu32(t, p->priority);
|
||||||
|
|
||||||
|
if (c->version >= 29)
|
||||||
|
pa_tagstruct_putu32(t, (p->available != PA_AVAILABLE_NO));
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_tagstruct_puts(t, card->active_profile->name);
|
pa_tagstruct_puts(t, card->active_profile->name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue