mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-24 08:56:42 -05:00
add owner field to all entities add client file to source outputs and sink inputs git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@59 fefdeb5f-60dc-0310-8127-8f9354f1896f
43 lines
925 B
C
43 lines
925 B
C
#include <stdio.h>
|
|
#include <assert.h>
|
|
#include <unistd.h>
|
|
|
|
#include "module.h"
|
|
#include "iochannel.h"
|
|
#include "cli.h"
|
|
#include "sioman.h"
|
|
|
|
static void eof_cb(struct pa_cli*c, void *userdata) {
|
|
struct pa_module *m = userdata;
|
|
assert(c && m);
|
|
|
|
pa_module_unload_request(m->core, m);
|
|
}
|
|
|
|
int pa_module_init(struct pa_core *c, struct pa_module*m) {
|
|
struct pa_iochannel *io;
|
|
assert(c && m);
|
|
|
|
if (pa_stdio_acquire() < 0) {
|
|
fprintf(stderr, "STDIN/STDUSE already used\n");
|
|
return -1;
|
|
}
|
|
|
|
io = pa_iochannel_new(c->mainloop, STDIN_FILENO, STDOUT_FILENO);
|
|
assert(io);
|
|
pa_iochannel_set_noclose(io, 1);
|
|
|
|
m->userdata = pa_cli_new(c, io, m);
|
|
assert(m->userdata);
|
|
|
|
pa_cli_set_eof_callback(m->userdata, eof_cb, m);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void pa_module_done(struct pa_core *c, struct pa_module*m) {
|
|
assert(c && m);
|
|
|
|
pa_cli_free(m->userdata);
|
|
pa_stdio_release();
|
|
}
|