mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
glib mainloop fix
implement server status command support for sink_list/source_list in polyplib git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@110 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
e9bed206d2
commit
37d930ac4a
13 changed files with 319 additions and 29 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include "namereg.h"
|
||||
#include "scache.h"
|
||||
#include "xmalloc.h"
|
||||
#include "util.h"
|
||||
|
||||
struct connection;
|
||||
struct pa_protocol_native;
|
||||
|
|
@ -129,6 +130,7 @@ static void command_play_sample(struct pa_pdispatch *pd, uint32_t command, uint3
|
|||
static void command_remove_sample(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata);
|
||||
static void command_get_info(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata);
|
||||
static void command_get_info_list(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata);
|
||||
static void command_get_server_info(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata);
|
||||
|
||||
static const struct pa_pdispatch_command command_table[PA_COMMAND_MAX] = {
|
||||
[PA_COMMAND_ERROR] = { NULL },
|
||||
|
|
@ -156,6 +158,7 @@ static const struct pa_pdispatch_command command_table[PA_COMMAND_MAX] = {
|
|||
[PA_COMMAND_GET_SOURCE_INFO] = { command_get_info },
|
||||
[PA_COMMAND_GET_SINK_INFO_LIST] = { command_get_info_list },
|
||||
[PA_COMMAND_GET_SOURCE_INFO_LIST] = { command_get_info_list },
|
||||
[PA_COMMAND_GET_SERVER_INFO] = { command_get_server_info },
|
||||
};
|
||||
|
||||
/* structure management */
|
||||
|
|
@ -933,7 +936,7 @@ static void sink_fill_tagstruct(struct pa_tagstruct *t, struct pa_sink *sink) {
|
|||
assert(t && sink);
|
||||
pa_tagstruct_putu32(t, sink->index);
|
||||
pa_tagstruct_puts(t, sink->name);
|
||||
pa_tagstruct_puts(t, sink->description);
|
||||
pa_tagstruct_puts(t, sink->description ? sink->description : "");
|
||||
pa_tagstruct_put_sample_spec(t, &sink->sample_spec);
|
||||
pa_tagstruct_putu32(t, sink->owner ? sink->owner->index : (uint32_t) -1);
|
||||
pa_tagstruct_putu32(t, sink->volume);
|
||||
|
|
@ -946,7 +949,7 @@ static void source_fill_tagstruct(struct pa_tagstruct *t, struct pa_source *sour
|
|||
assert(t && source);
|
||||
pa_tagstruct_putu32(t, source->index);
|
||||
pa_tagstruct_puts(t, source->name);
|
||||
pa_tagstruct_puts(t, source->description);
|
||||
pa_tagstruct_puts(t, source->description ? source->description : "");
|
||||
pa_tagstruct_put_sample_spec(t, &source->sample_spec);
|
||||
pa_tagstruct_putu32(t, source->owner ? source->owner->index : (uint32_t) -1);
|
||||
pa_tagstruct_putu32(t, source->monitor_of ? source->monitor_of->index : (uint32_t) -1);
|
||||
|
|
@ -1045,6 +1048,34 @@ static void command_get_info_list(struct pa_pdispatch *pd, uint32_t command, uin
|
|||
pa_pstream_send_tagstruct(c->pstream, reply);
|
||||
}
|
||||
|
||||
static void command_get_server_info(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
|
||||
struct connection *c = userdata;
|
||||
struct pa_tagstruct *reply;
|
||||
char txt[256];
|
||||
assert(c && t);
|
||||
|
||||
if (!pa_tagstruct_eof(t)) {
|
||||
protocol_error(c);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!c->authorized) {
|
||||
pa_pstream_send_error(c->pstream, tag, PA_ERROR_ACCESS);
|
||||
return;
|
||||
}
|
||||
|
||||
reply = pa_tagstruct_new(NULL, 0);
|
||||
assert(reply);
|
||||
pa_tagstruct_putu32(reply, PA_COMMAND_REPLY);
|
||||
pa_tagstruct_putu32(reply, tag);
|
||||
pa_tagstruct_puts(reply, PACKAGE_NAME);
|
||||
pa_tagstruct_puts(reply, PACKAGE_VERSION);
|
||||
pa_tagstruct_puts(reply, pa_get_user_name(txt, sizeof(txt)));
|
||||
pa_tagstruct_puts(reply, pa_get_host_name(txt, sizeof(txt)));
|
||||
pa_tagstruct_put_sample_spec(reply, &c->protocol->core->default_sample_spec);
|
||||
pa_pstream_send_tagstruct(c->pstream, reply);
|
||||
}
|
||||
|
||||
/*** pstream callbacks ***/
|
||||
|
||||
static void pstream_packet_callback(struct pa_pstream *p, struct pa_packet *packet, void *userdata) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue