some fixes

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@36 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2004-06-24 23:27:06 +00:00
parent a1b59db712
commit 1ad4ff1ca4
7 changed files with 19 additions and 10 deletions

View file

@ -28,7 +28,7 @@ pkglib_LTLIBRARIES=libiochannel.la libsocket-server.la libsocket-client.la \
module-simple-protocol-unix.la module-cli-protocol-tcp.la \ module-simple-protocol-unix.la module-cli-protocol-tcp.la \
libprotocol-cli.la module-cli-protocol-unix.la libtagstruct.la \ libprotocol-cli.la module-cli-protocol-unix.la libtagstruct.la \
libpdispatch.la libprotocol-native.la libpstream-util.la \ libpdispatch.la libprotocol-native.la libpstream-util.la \
module-native-protocol-tcp.la module-native-protocol-unix.la \ module-native-protocol-tcp.la module-native-protocol-unix.la \
libpolyp.la libpolyp.la
polypaudio_SOURCES = idxset.c idxset.h \ polypaudio_SOURCES = idxset.c idxset.h \
@ -110,7 +110,7 @@ libprotocol_cli_la_LIBADD = libsocket-server.la libiochannel.la libcli.la
libprotocol_native_la_SOURCES = protocol-native.c protocol-native.h libprotocol_native_la_SOURCES = protocol-native.c protocol-native.h
libprotocol_native_la_LDFLAGS = -avoid-version libprotocol_native_la_LDFLAGS = -avoid-version
libprotocol_native_la_LIBADD = libsocket-server.la libiochannel.la libpacket.la libpstream.la libpstream-util.la libprotocol_native_la_LIBADD = libsocket-server.la libiochannel.la libpacket.la libpstream.la libpstream-util.la libpdispatch.la
libtagstruct_la_SOURCES = tagstruct.c tagstruct.h libtagstruct_la_SOURCES = tagstruct.c tagstruct.h
libtagstruct_la_LDFLAGS = -avoid-version libtagstruct_la_LDFLAGS = -avoid-version

View file

@ -39,8 +39,13 @@ int main(int argc, char *argv[]) {
assert(c); assert(c);
module_load(c, "module-oss-mmap", "/dev/dsp1"); module_load(c, "module-oss-mmap", "/dev/dsp1");
module_load(c, "module-pipe-sink", NULL); /* module_load(c, "module-pipe-sink", NULL);
module_load(c, "module-simple-protocol-tcp", NULL); module_load(c, "module-simple-protocol-tcp", NULL);
module_load(c, "module-simple-protocol-unix", NULL);*/
module_load(c, "module-cli-protocol-tcp", NULL);
/* module_load(c, "module-cli-protocol-unix", NULL);
module_load(c, "module-native-protocol-tcp", NULL);*/
module_load(c, "module-native-protocol-unix", NULL);
module_load(c, "module-cli", NULL); module_load(c, "module-cli", NULL);
fprintf(stderr, "main: mainloop entry.\n"); fprintf(stderr, "main: mainloop entry.\n");

View file

@ -8,18 +8,21 @@
#include "protocol-simple.h" #include "protocol-simple.h"
#define protocol_free protocol_simple_free #define protocol_free protocol_simple_free
#define IPV4_PORT 4711 #define IPV4_PORT 4711
#define UNIX_SOCKET "/tmp/polypaudio_simple"
#else #else
#ifdef USE_PROTOCOL_CLI #ifdef USE_PROTOCOL_CLI
#include "protocol-cli.h" #include "protocol-cli.h"
#define protocol_new protocol_cli_new #define protocol_new protocol_cli_new
#define protocol_free protocol_cli_free #define protocol_free protocol_cli_free
#define IPV4_PORT 4712 #define IPV4_PORT 4712
#define UNIX_SOCKET "/tmp/polypaudio_cli"
#else #else
#ifdef USE_PROTOCOL_NATIVE #ifdef USE_PROTOCOL_NATIVE
#include "protocol-native.h" #include "protocol-native.h"
#define protocol_new protocol_native_new #define protocol_new protocol_native_new
#define protocol_free protocol_native_free #define protocol_free protocol_native_free
#define IPV4_PORT 4713 #define IPV4_PORT 4713
#define UNIX_SOCKET "/tmp/polypaudio_native"
#else #else
#error "Broken build system" #error "Broken build system"
#endif #endif
@ -34,7 +37,7 @@ int module_init(struct core *c, struct module*m) {
if (!(s = socket_server_new_ipv4(c->mainloop, INADDR_LOOPBACK, IPV4_PORT))) if (!(s = socket_server_new_ipv4(c->mainloop, INADDR_LOOPBACK, IPV4_PORT)))
return -1; return -1;
#else #else
if (!(s = socket_server_new_unix(c->mainloop, "/tmp/polypsimple"))) if (!(s = socket_server_new_unix(c->mainloop, UNIX_SOCKET)))
return -1; return -1;
#endif #endif

View file

@ -46,6 +46,7 @@ struct pdispatch* pdispatch_new(struct pa_mainloop_api *mainloop, const struct p
pd->mainloop = mainloop; pd->mainloop = mainloop;
pd->command_table = table; pd->command_table = table;
pd->n_commands = entries; pd->n_commands = entries;
pd->replies = NULL;
return pd; return pd;
} }

View file

@ -15,7 +15,7 @@
#define DEFAULT_MAX_LENGTH 20480 #define DEFAULT_MAX_LENGTH 20480
#define DEFAULT_PREBUF 4096 #define DEFAULT_PREBUF 4096
#define DEFAULT_TIMEOUT 5 #define DEFAULT_TIMEOUT 5
#define DEFAULT_SERVER "/tmp/foo" #define DEFAULT_SERVER "/tmp/polypaudio_native"
struct pa_context { struct pa_context {
char *name; char *name;

View file

@ -101,7 +101,7 @@ static int do_connect(struct socket_client *c, const struct sockaddr *sa, sockle
assert(c->io_source); assert(c->io_source);
} else { } else {
c->fixed_source = c->mainloop->source_fixed(c->mainloop, connect_fixed_cb, c); c->fixed_source = c->mainloop->source_fixed(c->mainloop, connect_fixed_cb, c);
assert(c->io_source); assert(c->fixed_source);
} }
return 0; return 0;

View file

@ -34,7 +34,7 @@ struct tagstruct *tagstruct_new(const uint8_t* data, size_t length) {
t->data = (uint8_t*) data; t->data = (uint8_t*) data;
t->allocated = t->length = data ? length : 0; t->allocated = t->length = data ? length : 0;
t->rindex = 0; t->rindex = 0;
t->dynamic = !!data; t->dynamic = !data;
return t; return t;
} }
@ -57,7 +57,7 @@ uint8_t* tagstruct_free_data(struct tagstruct*t, size_t *l) {
static void extend(struct tagstruct*t, size_t l) { static void extend(struct tagstruct*t, size_t l) {
assert(t && t->dynamic); assert(t && t->dynamic);
if (t->allocated <= l) if (l <= t->allocated)
return; return;
t->data = realloc(t->data, t->allocated = l+100); t->data = realloc(t->data, t->allocated = l+100);
@ -75,7 +75,7 @@ void tagstruct_puts(struct tagstruct*t, const char *s) {
} }
void tagstruct_putu32(struct tagstruct*t, uint32_t i) { void tagstruct_putu32(struct tagstruct*t, uint32_t i) {
assert(t && i); assert(t);
extend(t, 5); extend(t, 5);
t->data[t->length] = TAG_U32; t->data[t->length] = TAG_U32;
*((uint32_t*) (t->data+t->length+1)) = htonl(i); *((uint32_t*) (t->data+t->length+1)) = htonl(i);
@ -83,7 +83,7 @@ void tagstruct_putu32(struct tagstruct*t, uint32_t i) {
} }
void tagstruct_putu8(struct tagstruct*t, uint8_t c) { void tagstruct_putu8(struct tagstruct*t, uint8_t c) {
assert(t && c); assert(t);
extend(t, 2); extend(t, 2);
t->data[t->length] = TAG_U8; t->data[t->length] = TAG_U8;
*(t->data+t->length+1) = c; *(t->data+t->length+1) = c;