]>
code.delx.au - pulseaudio/blob - src/module-protocol-stub.c
5 #include "socket-server.h"
7 #ifdef USE_PROTOCOL_SIMPLE
8 #include "protocol-simple.h"
9 #define protocol_free protocol_simple_free
10 #define IPV4_PORT 4711
11 #define UNIX_SOCKET "/tmp/polypaudio_simple"
13 #ifdef USE_PROTOCOL_CLI
14 #include "protocol-cli.h"
15 #define protocol_new protocol_cli_new
16 #define protocol_free protocol_cli_free
17 #define IPV4_PORT 4712
18 #define UNIX_SOCKET "/tmp/polypaudio_cli"
20 #ifdef USE_PROTOCOL_NATIVE
21 #include "protocol-native.h"
22 #define protocol_new protocol_native_new
23 #define protocol_free protocol_native_free
24 #define IPV4_PORT 4713
25 #define UNIX_SOCKET "/tmp/polypaudio_native"
27 #error "Broken build system"
32 int module_init(struct core
*c
, struct module
*m
) {
33 struct socket_server
*s
;
36 #ifdef USE_TCP_SOCKETS
37 if (!(s
= socket_server_new_ipv4(c
->mainloop
, INADDR_LOOPBACK
, IPV4_PORT
)))
40 if (!(s
= socket_server_new_unix(c
->mainloop
, UNIX_SOCKET
)))
44 #ifdef USE_PROTOCOL_SIMPLE
45 m
->userdata
= protocol_simple_new(c
, s
, PROTOCOL_SIMPLE_PLAYBACK
);
47 m
->userdata
= protocol_new(c
, s
);
54 void module_done(struct core
*c
, struct module
*m
) {
57 protocol_free(m
->userdata
);