mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
introspect: Get format of sink input
This gets the negotiated format of sink inputs in pa_context_get_sink_input*(). Also prints the format in 'pactl list'.
This commit is contained in:
parent
322980e2e3
commit
7aa84e8208
5 changed files with 16 additions and 2 deletions
5
PROTOCOL
5
PROTOCOL
|
|
@ -236,3 +236,8 @@ PA_COMMAND_GET_SINK_INFO_LIST)
|
||||||
format_info format1
|
format_info format1
|
||||||
...
|
...
|
||||||
format_info formatn
|
format_info formatn
|
||||||
|
|
||||||
|
One new field in reply from PA_COMMAND_GET_SINK_INPUT_INFO (and thus
|
||||||
|
PA_COMMAND_GET_SINK_INPUT_INFO_LIST)
|
||||||
|
|
||||||
|
format_info format
|
||||||
|
|
|
||||||
|
|
@ -1033,6 +1033,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
|
||||||
|
|
||||||
pa_zero(i);
|
pa_zero(i);
|
||||||
i.proplist = pa_proplist_new();
|
i.proplist = pa_proplist_new();
|
||||||
|
i.format = pa_format_info_new();
|
||||||
|
|
||||||
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
|
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
|
||||||
pa_tagstruct_gets(t, &i.name) < 0 ||
|
pa_tagstruct_gets(t, &i.name) < 0 ||
|
||||||
|
|
@ -1050,10 +1051,12 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
|
||||||
(o->context->version >= 13 && pa_tagstruct_get_proplist(t, i.proplist) < 0) ||
|
(o->context->version >= 13 && pa_tagstruct_get_proplist(t, i.proplist) < 0) ||
|
||||||
(o->context->version >= 19 && pa_tagstruct_get_boolean(t, &corked) < 0) ||
|
(o->context->version >= 19 && pa_tagstruct_get_boolean(t, &corked) < 0) ||
|
||||||
(o->context->version >= 20 && (pa_tagstruct_get_boolean(t, &has_volume) < 0 ||
|
(o->context->version >= 20 && (pa_tagstruct_get_boolean(t, &has_volume) < 0 ||
|
||||||
pa_tagstruct_get_boolean(t, &volume_writable) < 0))) {
|
pa_tagstruct_get_boolean(t, &volume_writable) < 0)) ||
|
||||||
|
(o->context->version >= 21 && pa_tagstruct_get_format_info(t, i.format) < 0)) {
|
||||||
|
|
||||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||||
pa_proplist_free(i.proplist);
|
pa_proplist_free(i.proplist);
|
||||||
|
pa_format_info_free(i.format);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1068,6 +1071,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_proplist_free(i.proplist);
|
pa_proplist_free(i.proplist);
|
||||||
|
pa_format_info_free(i.format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -508,6 +508,7 @@ typedef struct pa_sink_input_info {
|
||||||
int corked; /**< Stream corked \since 1.0 */
|
int corked; /**< Stream corked \since 1.0 */
|
||||||
int has_volume; /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
|
int has_volume; /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
|
||||||
int volume_writable; /**< The volume can be set. If not set, the volume can still change even though clients can't control the volume. \since 1.0 */
|
int volume_writable; /**< The volume can be set. If not set, the volume can still change even though clients can't control the volume. \since 1.0 */
|
||||||
|
pa_format_info *format; /**< Stream format information. \since 1.0 */
|
||||||
} pa_sink_input_info;
|
} pa_sink_input_info;
|
||||||
|
|
||||||
/** Callback prototype for pa_context_get_sink_input_info() and friends*/
|
/** Callback prototype for pa_context_get_sink_input_info() and friends*/
|
||||||
|
|
|
||||||
|
|
@ -3153,6 +3153,8 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t,
|
||||||
pa_tagstruct_put_boolean(t, has_volume);
|
pa_tagstruct_put_boolean(t, has_volume);
|
||||||
pa_tagstruct_put_boolean(t, s->volume_writable);
|
pa_tagstruct_put_boolean(t, s->volume_writable);
|
||||||
}
|
}
|
||||||
|
if (c->version >= 21)
|
||||||
|
pa_tagstruct_put_format_info(t, s->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void source_output_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_source_output *s) {
|
static void source_output_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_source_output *s) {
|
||||||
|
|
|
||||||
|
|
@ -560,7 +560,7 @@ static void get_card_info_callback(pa_context *c, const pa_card_info *i, int is_
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, int is_last, void *userdata) {
|
static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, int is_last, void *userdata) {
|
||||||
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], f[PA_FORMAT_INFO_SNPRINT_MAX];
|
||||||
char *pl;
|
char *pl;
|
||||||
|
|
||||||
if (is_last < 0) {
|
if (is_last < 0) {
|
||||||
|
|
@ -600,6 +600,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
||||||
"\tSink: %u\n"
|
"\tSink: %u\n"
|
||||||
"\tSample Specification: %s\n"
|
"\tSample Specification: %s\n"
|
||||||
"\tChannel Map: %s\n"
|
"\tChannel Map: %s\n"
|
||||||
|
"\tFormat: %s\n"
|
||||||
"\tMute: %s\n"
|
"\tMute: %s\n"
|
||||||
"\tVolume: %s\n"
|
"\tVolume: %s\n"
|
||||||
"\t %s\n"
|
"\t %s\n"
|
||||||
|
|
@ -615,6 +616,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
||||||
i->sink,
|
i->sink,
|
||||||
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),
|
pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec),
|
||||||
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
||||||
|
pa_format_info_snprint(f, sizeof(f), i->format),
|
||||||
pa_yes_no(i->mute),
|
pa_yes_no(i->mute),
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
||||||
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &i->volume),
|
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &i->volume),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue