mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
basic cli interface
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@22 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
eb946dbdbe
commit
993d1bce74
21 changed files with 505 additions and 49 deletions
34
src/module-cli.c
Normal file
34
src/module-cli.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "module.h"
|
||||
#include "iochannel.h"
|
||||
#include "cli.h"
|
||||
|
||||
int module_init(struct core *c, struct module*m) {
|
||||
struct iochannel *io;
|
||||
assert(c && m);
|
||||
|
||||
if (stdin_inuse || stdout_inuse) {
|
||||
fprintf(stderr, "STDIN/STDUSE already used\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
stdin_inuse = stdout_inuse = 1;
|
||||
io = iochannel_new(c->mainloop, STDIN_FILENO, STDOUT_FILENO);
|
||||
assert(io);
|
||||
|
||||
m->userdata = cli_new(c, io);
|
||||
assert(m->userdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void module_done(struct core *c, struct module*m) {
|
||||
assert(c && m);
|
||||
|
||||
cli_free(m->userdata);
|
||||
assert(stdin_inuse && stdout_inuse);
|
||||
stdin_inuse = stdout_inuse = 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue