mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
pactl: add format flag for JSON output
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/497>
This commit is contained in:
parent
1b96b49f65
commit
19adddee31
4 changed files with 1050 additions and 225 deletions
|
|
@ -53,6 +53,12 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
|||
<optdesc><p>Choose the server to connect to.</p></optdesc>
|
||||
</option>
|
||||
|
||||
<option>
|
||||
<p><opt>-f | --format</opt><arg>=FORMAT</arg></p>
|
||||
|
||||
<optdesc><p>Choose output format, available options are "text" or "json".</p></optdesc>
|
||||
</option>
|
||||
|
||||
<option>
|
||||
<p><opt>-n | --client-name</opt><arg>=NAME</arg></p>
|
||||
|
||||
|
|
@ -63,7 +69,7 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
<section name="Commands">
|
||||
<p>
|
||||
When supplied as arguments to the commands below, the special names \@DEFAULT_SINK@, \@DEFAULT_SOURCE@ and \@DEFAULT_MONITOR@
|
||||
When supplied as arguments to the commands below, the special names \@DEFAULT_SINK@, \@DEFAULT_SOURCE@ and \@DEFAULT_MONITOR@
|
||||
can be used to specify the default sink, source and monitor respectively.
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -650,6 +650,16 @@ static pa_json_context_type_t json_encoder_context_pop(pa_json_encoder *encoder)
|
|||
return type;
|
||||
}
|
||||
|
||||
bool pa_json_encoder_is_empty(pa_json_encoder *encoder) {
|
||||
pa_json_context_type_t type;
|
||||
|
||||
pa_assert(encoder);
|
||||
pa_assert(encoder->context);
|
||||
|
||||
type = encoder->context->type;
|
||||
return type == PA_JSON_CONTEXT_EMPTY;
|
||||
}
|
||||
|
||||
pa_json_encoder *pa_json_encoder_new(void) {
|
||||
pa_json_encoder *encoder;
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ void pa_json_encoder_free(pa_json_encoder *encoder);
|
|||
/** Convert pa_json_encoder to string, free pa_json_encoder structure.
|
||||
* The returned string needs to be freed with pa_xree(). \since 15.0 */
|
||||
char *pa_json_encoder_to_string_free(pa_json_encoder *encoder);
|
||||
/** Check if a pa_json_encoder is empty (nothing has been added). \since 16.0 */
|
||||
bool pa_json_encoder_is_empty(pa_json_encoder *encoder);
|
||||
|
||||
/** Start appending JSON object element by writing an opening brace. \since 15.0 */
|
||||
void pa_json_encoder_begin_element_object(pa_json_encoder *encoder);
|
||||
|
|
|
|||
1255
src/utils/pactl.c
1255
src/utils/pactl.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue