mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-14 06:59:53 -05:00
For better readability, "pactl list message-handlers" is introduced which prints a formatted output of "pactl send-message /core list-handlers". The patch also adds the functions pa_message_params_read_raw() and pa_message_params_read_string() for easy parsing of the message response string. Because the functions need to modify the parameter string, the message handler and the pa_context_string_callback function now receive a char* instead of a const char* as parameter argument. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/51>
50 lines
1.7 KiB
C
50 lines
1.7 KiB
C
#ifndef foocoremessageshfoo
|
|
#define foocoremessageshfoo
|
|
|
|
/***
|
|
This file is part of PulseAudio.
|
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser General Public License as published
|
|
by the Free Software Foundation; either version 2.1 of the License,
|
|
or (at your option) any later version.
|
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
|
***/
|
|
|
|
#include <pulsecore/core.h>
|
|
|
|
/* Message handler types and functions */
|
|
|
|
/* Prototype for message callback */
|
|
typedef int (*pa_message_handler_cb_t)(
|
|
const char *object_path,
|
|
const char *message,
|
|
char *message_parameters,
|
|
char **response,
|
|
void *userdata);
|
|
|
|
/* Message handler object */
|
|
struct pa_message_handler {
|
|
char *object_path;
|
|
char *description;
|
|
pa_message_handler_cb_t callback;
|
|
void *userdata;
|
|
};
|
|
|
|
/* Handler registration */
|
|
void pa_message_handler_register(pa_core *c, const char *object_path, const char *description, pa_message_handler_cb_t cb, void *userdata);
|
|
void pa_message_handler_unregister(pa_core *c, const char *object_path);
|
|
|
|
/* Send message to the specified object path */
|
|
int pa_message_handler_send_message(pa_core *c, const char *object_path, const char *message, const char *message_parameters, char **response);
|
|
|
|
/* Set handler description */
|
|
int pa_message_handler_set_description(pa_core *c, const char *object_path, const char *description);
|
|
#endif
|