summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/gconf/gconf-helper.c30
-rw-r--r--src/modules/gconf/module-gconf.c62
-rw-r--r--src/modules/module-hal-detect.c10
-rw-r--r--src/modules/module-oss.c10
-rw-r--r--src/modules/rtp/module-rtp-recv.c64
-rw-r--r--src/modules/rtp/module-rtp-send.c36
-rw-r--r--src/modules/rtp/rtp.c34
-rw-r--r--src/modules/rtp/rtp.h6
-rw-r--r--src/modules/rtp/sap.c28
-rw-r--r--src/modules/rtp/sap.h6
-rw-r--r--src/modules/rtp/sdp.c30
-rw-r--r--src/modules/rtp/sdp.h6
12 files changed, 161 insertions, 161 deletions
diff --git a/src/modules/gconf/gconf-helper.c b/src/modules/gconf/gconf-helper.c
index 5f6def4d..3483b845 100644
--- a/src/modules/gconf/gconf-helper.c
+++ b/src/modules/gconf/gconf-helper.c
@@ -4,17 +4,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,30 +48,30 @@ static void handle_module(GConfClient *client, const char *name) {
snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/enabled", name);
enabled = gconf_client_get_bool(client, p, FALSE);
-
+
printf("%c%s%c", enabled ? '+' : '-', name, 0);
if (enabled) {
-
+
for (i = 0; i < 10; i++) {
gchar *n, *a;
-
+
snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/name%i", name, i);
if (!(n = gconf_client_get_string(client, p, NULL)) || !*n)
break;
-
+
snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/args%i", name, i);
a = gconf_client_get_string(client, p, NULL);
-
+
printf("%s%c%s%c", n, 0, a ? a : "", 0);
-
+
g_free(n);
g_free(a);
}
-
+
printf("%c", 0);
}
-
+
fflush(stdout);
}
@@ -83,7 +83,7 @@ static void modules_callback(
const char *n;
char buf[128];
-
+
g_assert(strncmp(entry->key, PA_GCONF_PATH_MODULES"/", sizeof(PA_GCONF_PATH_MODULES)) == 0);
n = entry->key + sizeof(PA_GCONF_PATH_MODULES);
@@ -113,17 +113,17 @@ int main(int argc, char *argv[]) {
char *e = strrchr(m->data, '/');
handle_module(client, e ? e+1 : m->data);
}
-
+
g_slist_free(modules);
/* Signal the parent that we are now initialized */
printf("!");
fflush(stdout);
-
+
g = g_main_loop_new(NULL, FALSE);
g_main_loop_run(g);
g_main_loop_unref(g);
-
+
g_object_unref(G_OBJECT(client));
return 0;
diff --git a/src/modules/gconf/module-gconf.c b/src/modules/gconf/module-gconf.c
index df7b1643..cbe17d20 100644
--- a/src/modules/gconf/module-gconf.c
+++ b/src/modules/gconf/module-gconf.c
@@ -4,17 +4,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -80,7 +80,7 @@ struct module_info {
struct userdata {
pa_core *core;
pa_module *module;
-
+
pa_hashmap *module_infos;
pid_t pid;
@@ -129,7 +129,7 @@ static char *read_string(struct userdata *u) {
for (;;) {
char *e;
-
+
if ((e = memchr(u->buf, 0, u->buf_fill))) {
char *ret = pa_xstrdup(u->buf);
u->buf_fill -= e - u->buf +1;
@@ -149,7 +149,7 @@ static void unload_one_module(struct userdata *u, struct module_info*m, unsigned
if (m->items[i].index == PA_INVALID_INDEX)
return;
-
+
pa_log_debug("Unloading module #%i", m->items[i].index);
pa_module_unload_by_index(u->core, m->items[i].index);
m->items[i].index = PA_INVALID_INDEX;
@@ -160,7 +160,7 @@ static void unload_one_module(struct userdata *u, struct module_info*m, unsigned
static void unload_all_modules(struct userdata *u, struct module_info*m) {
unsigned i;
-
+
assert(u);
assert(m);
@@ -179,7 +179,7 @@ static void load_module(
int is_new) {
pa_module *mod;
-
+
assert(u);
assert(m);
assert(name);
@@ -193,18 +193,18 @@ static void load_module(
unload_one_module(u, m, i);
}
-
+
pa_log_debug("Loading module '%s' with args '%s' due to GConf configuration.", name, args);
m->items[i].name = pa_xstrdup(name);
m->items[i].args = pa_xstrdup(args);
m->items[i].index = PA_INVALID_INDEX;
-
+
if (!(mod = pa_module_load(u->core, name, args))) {
pa_log("pa_module_load() failed");
return;
}
-
+
m->items[i].index = mod->index;
}
@@ -227,18 +227,18 @@ static int handle_event(struct userdata *u) {
do {
if ((opcode = read_byte(u)) < 0)
goto fail;
-
+
switch (opcode) {
case '!':
/* The helper tool is now initialized */
ret = 1;
break;
-
+
case '+': {
char *name;
struct module_info *m;
unsigned i, j;
-
+
if (!(name = read_string(u)))
goto fail;
@@ -282,16 +282,16 @@ static int handle_event(struct userdata *u) {
/* Unload all removed modules */
for (j = i; j < m->n_items; j++)
unload_one_module(u, m, j);
-
+
m->n_items = i;
-
+
break;
}
-
+
case '-': {
char *name;
struct module_info *m;
-
+
if (!(name = read_string(u)))
goto fail;
@@ -301,7 +301,7 @@ static int handle_event(struct userdata *u) {
}
pa_xfree(name);
-
+
break;
}
}
@@ -324,12 +324,12 @@ static void io_event_cb(
struct userdata *u = userdata;
if (handle_event(u) < 0) {
-
+
if (u->io_event) {
u->core->mainloop->io_free(u->io_event);
u->io_event = NULL;
}
-
+
pa_module_unload_request(u->module);
}
}
@@ -342,7 +342,7 @@ static int start_client(const char *n, pid_t *pid) {
pa_log("pipe() failed: %s", pa_cstrerror(errno));
goto fail;
}
-
+
if ((child = fork()) == (pid_t) -1) {
pa_log("fork() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -357,7 +357,7 @@ static int start_client(const char *n, pid_t *pid) {
return pipe_fds[0];
} else {
int max_fd, i;
-
+
/* child */
close(pipe_fds[0]);
@@ -373,7 +373,7 @@ static int start_client(const char *n, pid_t *pid) {
open("/dev/null", O_WRONLY);
max_fd = 1024;
-
+
#ifdef HAVE_SYS_RESOURCE_H
{
struct rlimit r;
@@ -381,7 +381,7 @@ static int start_client(const char *n, pid_t *pid) {
max_fd = r.rlim_max;
}
#endif
-
+
for (i = 3; i < max_fd; i++)
close(i);
@@ -402,14 +402,14 @@ static int start_client(const char *n, pid_t *pid) {
execl(n, n, NULL);
_exit(1);
}
-
+
fail:
if (pipe_fds[0] >= 0)
close(pipe_fds[0]);
if (pipe_fds[1] >= 0)
close(pipe_fds[1]);
-
+
return -1;
}
@@ -427,17 +427,17 @@ int pa__init(pa_core *c, pa_module*m) {
u->fd_type = 0;
u->io_event = NULL;
u->buf_fill = 0;
-
+
if ((u->fd = start_client(PA_GCONF_HELPER, &u->pid)) < 0)
goto fail;
-
+
u->io_event = c->mainloop->io_new(
c->mainloop,
u->fd,
PA_IO_EVENT_INPUT,
io_event_cb,
u);
-
+
do {
if ((r = handle_event(u)) < 0)
goto fail;
@@ -445,7 +445,7 @@ int pa__init(pa_core *c, pa_module*m) {
/* Read until the client signalled us that it is ready with
* initialization */
} while (r != 1);
-
+
return 0;
fail:
diff --git a/src/modules/module-hal-detect.c b/src/modules/module-hal-detect.c
index 27cd449e..1f48a452 100644
--- a/src/modules/module-hal-detect.c
+++ b/src/modules/module-hal-detect.c
@@ -87,7 +87,7 @@ struct userdata {
pa_hashmap *devices;
#if defined(HAVE_ALSA) && defined(HAVE_OSS)
int use_oss;
-#endif
+#endif
};
struct timerdata {
@@ -269,7 +269,7 @@ static dbus_bool_t hal_device_add(struct userdata *u, const char *udi,
case CAP_OSS:
#ifdef HAVE_ALSA
if (u->use_oss)
-#endif
+#endif
m = hal_device_load_oss(u, udi, error);
break;
#endif
@@ -533,9 +533,9 @@ int pa__init(pa_core *c, pa_module*m) {
#endif
#if defined(HAVE_ALSA) && defined(HAVE_OSS)
u->use_oss = 0;
-
+
if (n <= 0) {
-#endif
+#endif
#ifdef HAVE_OSS
n += hal_device_add_all(u, CAP_OSS);
#endif
@@ -546,7 +546,7 @@ int pa__init(pa_core *c, pa_module*m) {
if (n > 0)
u->use_oss = 1;
}
-#endif
+#endif
libhal_ctx_set_user_data(hal_ctx, u);
libhal_ctx_set_device_added(hal_ctx, device_added_cb);
diff --git a/src/modules/module-oss.c b/src/modules/module-oss.c
index 22b12ef7..9d4d0eac 100644
--- a/src/modules/module-oss.c
+++ b/src/modules/module-oss.c
@@ -172,11 +172,11 @@ static void do_write(struct userdata *u) {
if (errno != EAGAIN) {
pa_log("write() failed: %s", pa_cstrerror(errno));
-
+
clear_up(u);
pa_module_unload_request(u->module);
}
-
+
break;
}
@@ -228,14 +228,14 @@ static void do_read(struct userdata *u) {
assert(memchunk.memblock);
if ((r = pa_iochannel_read(u->io, memchunk.memblock->data, memchunk.memblock->length)) < 0) {
pa_memblock_unref(memchunk.memblock);
-
+
if (errno != EAGAIN) {
pa_log("read() failed: %s", pa_cstrerror(errno));
-
+
clear_up(u);
pa_module_unload_request(u->module);
}
-
+
break;
}
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index db83756a..62ef561f 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -3,17 +3,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -145,7 +145,7 @@ static void rtp_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
pa_memchunk chunk;
int64_t k, j, delta;
struct timeval tv;
-
+
assert(m);
assert(e);
assert(s);
@@ -159,7 +159,7 @@ static void rtp_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
pa_memblock_unref(chunk.memblock);
return;
}
-
+
if (!s->first_packet) {
s->first_packet = 1;
@@ -183,7 +183,7 @@ static void rtp_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
delta = k;
else
delta = j;
-
+
pa_memblockq_seek(s->memblockq, delta * s->rtp_context.frame_size, PA_SEEK_RELATIVE);
if (pa_memblockq_push(s->memblockq, &chunk) < 0) {
@@ -191,10 +191,10 @@ static void rtp_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
pa_memblockq_flush(s->memblockq);
pa_memblockq_push(s->memblockq, &chunk);
}
-
+
/* The next timestamp we expect */
s->offset = s->rtp_context.timestamp + (chunk.length / s->rtp_context.frame_size);
-
+
pa_memblock_unref(chunk.memblock);
/* Reset death timer */
@@ -205,7 +205,7 @@ static void rtp_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
static void death_event_cb(pa_mainloop_api *m, pa_time_event *t, const struct timeval *tv, void *userdata) {
struct session *s = userdata;
-
+
assert(m);
assert(t);
assert(tv);
@@ -216,7 +216,7 @@ static void death_event_cb(pa_mainloop_api *m, pa_time_event *t, const struct ti
static int mcast_socket(const struct sockaddr* sa, socklen_t salen) {
int af, fd = -1, r, one;
-
+
af = sa->sa_family;
if ((fd = socket(af, SOCK_DGRAM, 0)) < 0) {
pa_log("Failed to create socket: %s", pa_cstrerror(errno));
@@ -228,7 +228,7 @@ static int mcast_socket(const struct sockaddr* sa, socklen_t salen) {
pa_log("SO_REUSEADDR failed: %s", pa_cstrerror(errno));
goto fail;
}
-
+
if (af == AF_INET) {
struct ip_mreq mr4;
memset(&mr4, 0, sizeof(mr4));
@@ -245,14 +245,14 @@ static int mcast_socket(const struct sockaddr* sa, socklen_t salen) {
pa_log_info("Joining mcast group failed: %s", pa_cstrerror(errno));
goto fail;
}
-
+
if (bind(fd, sa, salen) < 0) {
pa_log("bind() failed: %s", pa_cstrerror(errno));
goto fail;
}
return fd;
-
+
fail:
if (fd >= 0)
close(fd);
@@ -273,7 +273,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
pa_log("session limit reached.");
goto fail;
}
-
+
if (!(sink = pa_namereg_get(u->core, u->sink_name, PA_NAMEREG_SINK, 1))) {
pa_log("sink does not exist.");
goto fail;
@@ -289,7 +289,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
c = pa_sprintf_malloc("RTP Stream%s%s%s",
sdp_info->session_name ? " (" : "",
- sdp_info->session_name ? sdp_info->session_name : "",
+ sdp_info->session_name ? sdp_info->session_name : "",
sdp_info->session_name ? ")" : "");
pa_sink_input_new_data_init(&data);
@@ -298,10 +298,10 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
data.name = c;
data.module = u->module;
pa_sink_input_new_data_set_sample_spec(&data, &sdp_info->sample_spec);
-
+
s->sink_input = pa_sink_input_new(u->core, &data, 0);
pa_xfree(c);
-
+
if (!s->sink_input) {
pa_log("failed to create sink input.");
goto fail;
@@ -318,7 +318,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
&s->sink_input->sample_spec,
(pa_bytes_per_second(&s->sink_input->sample_spec)/128/pa_frame_size(&s->sink_input->sample_spec))*
pa_frame_size(&s->sink_input->sample_spec));
-
+
s->memblockq = pa_memblockq_new(
0,
MEMBLOCKQ_MAXLENGTH,
@@ -331,7 +331,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
pa_memblock_unref(silence);
s->rtp_event = u->core->mainloop->io_new(u->core->mainloop, fd, PA_IO_EVENT_INPUT, rtp_event_cb, s);
-
+
pa_gettimeofday(&tv);
pa_timeval_add(&tv, DEATH_TIMEOUT);
s->death_event = u->core->mainloop->time_new(u->core->mainloop, &tv, death_event_cb, s);
@@ -343,14 +343,14 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
pa_log_info("Found new session '%s'", s->sdp_info.session_name);
u->n_sessions++;
-
+
return s;
fail:
if (s) {
if (fd >= 0)
close(fd);
-
+
pa_xfree(s);
}
@@ -377,7 +377,7 @@ static void session_free(struct session *s, int from_hash) {
assert(s->userdata->n_sessions >= 1);
s->userdata->n_sessions--;
-
+
pa_xfree(s);
}
@@ -386,7 +386,7 @@ static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
int goodbye;
pa_sdp_info info;
struct session *s;
-
+
assert(m);
assert(e);
assert(u);
@@ -410,14 +410,14 @@ static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
if (!(s = pa_hashmap_get(u->by_origin, info.origin))) {
if (!(s = session_new(u, &info)))
pa_sdp_info_destroy(&info);
-
+
} else {
struct timeval tv;
-
+
pa_gettimeofday(&tv);
pa_timeval_add(&tv, DEATH_TIMEOUT);
m->time_restart(s->death_event, &tv);
-
+
pa_sdp_info_destroy(&info);
}
}
@@ -432,7 +432,7 @@ int pa__init(pa_core *c, pa_module*m) {
socklen_t salen;
const char *sap_address;
int fd = -1;
-
+
assert(c);
assert(m);
@@ -442,7 +442,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
sap_address = pa_modargs_get_value(ma, "sap_address", DEFAULT_SAP_ADDRESS);
-
+
if (inet_pton(AF_INET6, sap_address, &sa6.sin6_addr) > 0) {
sa6.sin6_family = AF_INET6;
sa6.sin6_port = htons(SAP_PORT);
@@ -471,9 +471,9 @@ int pa__init(pa_core *c, pa_module*m) {
u->sap_event = c->mainloop->io_new(c->mainloop, fd, PA_IO_EVENT_INPUT, sap_event_cb, u);
u->by_origin = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-
+
pa_sap_context_init_recv(&u->sap_context, fd);
-
+
pa_modargs_free(ma);
return 0;
@@ -484,7 +484,7 @@ fail:
if (fd >= 0)
close(fd);
-
+
return -1;
}
@@ -504,7 +504,7 @@ void pa__done(pa_core *c, pa_module*m) {
pa_sap_context_destroy(&u->sap_context);
pa_hashmap_free(u->by_origin, free_func, NULL);
-
+
pa_xfree(u->sink_name);
pa_xfree(u);
}
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 18e5e055..8c9e5f23 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -4,17 +4,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -111,7 +111,7 @@ static void source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
pa_log("Failed to push chunk into memblockq.");
return;
}
-
+
pa_rtp_send(&u->rtp_context, u->mtu, u->memblockq);
}
@@ -138,7 +138,7 @@ static pa_usec_t source_output_get_latency (pa_source_output *o) {
static void sap_event_cb(pa_mainloop_api *m, pa_time_event *t, const struct timeval *tv, void *userdata) {
struct userdata *u = userdata;
struct timeval next;
-
+
assert(m);
assert(t);
assert(tv);
@@ -172,7 +172,7 @@ int pa__init(pa_core *c, pa_module*m) {
char hn[128], *n;
int loop = 0;
pa_source_output_new_data data;
-
+
assert(c);
assert(m);
@@ -210,7 +210,7 @@ int pa__init(pa_core *c, pa_module*m) {
payload = pa_rtp_payload_from_sample_spec(&ss);
mtu = (DEFAULT_MTU/pa_frame_size(&ss))*pa_frame_size(&ss);
-
+
if (pa_modargs_get_value_u32(ma, "mtu", &mtu) < 0 || mtu < 1 || mtu % pa_frame_size(&ss) != 0) {
pa_log("invalid mtu.");
goto fail;
@@ -241,7 +241,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log("invalid destination '%s'", dest);
goto fail;
}
-
+
if ((fd = socket(af, SOCK_DGRAM, 0)) < 0) {
pa_log("socket() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -275,7 +275,7 @@ int pa__init(pa_core *c, pa_module*m) {
data.source = s;
pa_source_output_new_data_set_sample_spec(&data, &ss);
pa_source_output_new_data_set_channel_map(&data, &cm);
-
+
if (!(o = pa_source_output_new(c, &data, 0))) {
pa_log("failed to create source output.");
goto fail;
@@ -284,7 +284,7 @@ int pa__init(pa_core *c, pa_module*m) {
o->push = source_output_push;
o->kill = source_output_kill;
o->get_latency = source_output_get_latency;
-
+
u = pa_xnew(struct userdata, 1);
m->userdata = u;
o->userdata = u;
@@ -292,7 +292,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->module = m;
u->core = c;
u->source_output = o;
-
+
u->memblockq = pa_memblockq_new(
0,
MEMBLOCKQ_MAXLENGTH,
@@ -303,20 +303,20 @@ int pa__init(pa_core *c, pa_module*m) {
NULL);
u->mtu = mtu;
-
+
k = sizeof(sa_dst);
r = getsockname(fd, (struct sockaddr*) &sa_dst, &k);
assert(r >= 0);
n = pa_sprintf_malloc("PulseAudio RTP Stream on %s", pa_get_fqdn(hn, sizeof(hn)));
-
+
p = pa_sdp_build(af,
af == AF_INET ? (void*) &((struct sockaddr_in*) &sa_dst)->sin_addr : (void*) &((struct sockaddr_in6*) &sa_dst)->sin6_addr,
af == AF_INET ? (void*) &sa4.sin_addr : (void*) &sa6.sin6_addr,
n, port, payload, &ss);
pa_xfree(n);
-
+
pa_rtp_context_init_send(&u->rtp_context, fd, c->cookie, payload, pa_frame_size(&ss));
pa_sap_context_init_send(&u->sap_context, sap_fd, p);
@@ -339,7 +339,7 @@ fail:
if (fd >= 0)
close(fd);
-
+
if (sap_fd >= 0)
close(sap_fd);
@@ -347,7 +347,7 @@ fail:
pa_source_output_disconnect(o);
pa_source_output_unref(o);
}
-
+
return -1;
}
@@ -360,7 +360,7 @@ void pa__done(pa_core *c, pa_module*m) {
return;
c->mainloop->time_free(u->sap_event);
-
+
if (u->source_output) {
pa_source_output_disconnect(u->source_output);
pa_source_output_unref(u->source_output);
@@ -372,6 +372,6 @@ void pa__done(pa_core *c, pa_module*m) {
pa_sap_context_destroy(&u->sap_context);
pa_memblockq_free(u->memblockq);
-
+
pa_xfree(u);
}
diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
index bc5260a8..03a01412 100644
--- a/src/modules/rtp/rtp.c
+++ b/src/modules/rtp/rtp.c
@@ -4,17 +4,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -53,7 +53,7 @@ pa_rtp_context* pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint32_t ssr
c->ssrc = ssrc ? ssrc : (uint32_t) (rand()*rand());
c->payload = payload & 127;
c->frame_size = frame_size;
-
+
return c;
}
@@ -64,14 +64,14 @@ int pa_rtp_send(pa_rtp_context *c, size_t size, pa_memblockq *q) {
pa_memblock* mb[MAX_IOVECS];
int iov_idx = 1;
size_t n = 0, skip = 0;
-
+
assert(c);
assert(size > 0);
assert(q);
if (pa_memblockq_get_length(q) < size)
return 0;
-
+
for (;;) {
int r;
pa_memchunk chunk;
@@ -105,7 +105,7 @@ int pa_rtp_send(pa_rtp_context *c, size_t size, pa_memblockq *q) {
iov[0].iov_base = (void*)header;
iov[0].iov_len = sizeof(header);
-
+
m.msg_name = NULL;
m.msg_namelen = 0;
m.msg_iov = iov;
@@ -113,7 +113,7 @@ int pa_rtp_send(pa_rtp_context *c, size_t size, pa_memblockq *q) {
m.msg_control = NULL;
m.msg_controllen = 0;
m.msg_flags = 0;
-
+
k = sendmsg(c->fd, &m, MSG_DONTWAIT);
for (i = 1; i < iov_idx; i++)
@@ -124,13 +124,13 @@ int pa_rtp_send(pa_rtp_context *c, size_t size, pa_memblockq *q) {
k = 0;
c->timestamp += skip/c->frame_size;
-
+
if (k < 0) {
if (errno != EAGAIN) /* If the queue is full, just ignore it */
pa_log("sendmsg() failed: %s", pa_cstrerror(errno));
return -1;
}
-
+
if (r < 0 || pa_memblockq_get_length(q) < size)
break;
@@ -158,7 +158,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool) {
uint32_t header;
int cc;
ssize_t r;
-
+
assert(c);
assert(chunk);
@@ -184,7 +184,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool) {
m.msg_control = NULL;
m.msg_controllen = 0;
m.msg_flags = 0;
-
+
if ((r = recvmsg(c->fd, &m, 0)) != size) {
pa_log("recvmsg() failed: %s", r < 0 ? pa_cstrerror(errno) : "size mismatch");
goto fail;
@@ -198,7 +198,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool) {
memcpy(&header, chunk->memblock->data, sizeof(uint32_t));
memcpy(&c->timestamp, (uint8_t*) chunk->memblock->data + 4, sizeof(uint32_t));
memcpy(&c->ssrc, (uint8_t*) chunk->memblock->data + 8, sizeof(uint32_t));
-
+
header = ntohl(header);
c->timestamp = ntohl(c->timestamp);
c->ssrc = ntohl(c->ssrc);
@@ -234,7 +234,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool) {
pa_log("Vad RTP packet size.");
goto fail;
}
-
+
return 0;
fail:
@@ -255,7 +255,7 @@ uint8_t pa_rtp_payload_from_sample_spec(const pa_sample_spec *ss) {
return 10;
if (ss->format == PA_SAMPLE_S16BE && ss->rate == 44100 && ss->channels == 1)
return 11;
-
+
return 127;
}
@@ -280,7 +280,7 @@ pa_sample_spec *pa_rtp_sample_spec_from_payload(uint8_t payload, pa_sample_spec
ss->format = PA_SAMPLE_S16BE;
ss->rate = 44100;
break;
-
+
case 11:
ss->channels = 1;
ss->format = PA_SAMPLE_S16BE;
@@ -340,7 +340,7 @@ const char* pa_rtp_format_to_string(pa_sample_format_t f) {
pa_sample_format_t pa_rtp_string_to_format(const char *s) {
assert(s);
-
+
if (!(strcmp(s, "L16")))
return PA_SAMPLE_S16BE;
else if (!strcmp(s, "L8"))
diff --git a/src/modules/rtp/rtp.h b/src/modules/rtp/rtp.h
index db7acd98..ad7175ca 100644
--- a/src/modules/rtp/rtp.h
+++ b/src/modules/rtp/rtp.h
@@ -7,17 +7,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/modules/rtp/sap.c b/src/modules/rtp/sap.c
index a6e92187..82421807 100644
--- a/src/modules/rtp/sap.c
+++ b/src/modules/rtp/sap.c
@@ -4,17 +4,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -60,8 +60,8 @@ pa_sap_context* pa_sap_context_init_send(pa_sap_context *c, int fd, char *sdp_da
c->fd = fd;
c->sdp_data = sdp_data;
c->msg_id_hash = (uint16_t) (rand()*rand());
-
- return c;
+
+ return c;
}
void pa_sap_context_destroy(pa_sap_context *c) {
@@ -86,7 +86,7 @@ int pa_sap_send(pa_sap_context *c, int goodbye) {
}
assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6);
-
+
header = htonl(((uint32_t) 1 << 29) |
(sa->sa_family == AF_INET6 ? (uint32_t) 1 << 28 : 0) |
(goodbye ? (uint32_t) 1 << 26 : 0) |
@@ -103,7 +103,7 @@ int pa_sap_send(pa_sap_context *c, int goodbye) {
iov[3].iov_base = c->sdp_data;
iov[3].iov_len = strlen(c->sdp_data);
-
+
m.msg_name = NULL;
m.msg_namelen = 0;
m.msg_iov = iov;
@@ -111,7 +111,7 @@ int pa_sap_send(pa_sap_context *c, int goodbye) {
m.msg_control = NULL;
m.msg_controllen = 0;
m.msg_flags = 0;
-
+
if ((k = sendmsg(c->fd, &m, MSG_DONTWAIT)) < 0)
pa_log("sendmsg() failed: %s\n", pa_cstrerror(errno));
@@ -135,7 +135,7 @@ int pa_sap_recv(pa_sap_context *c, int *goodbye) {
uint32_t header;
int six, ac;
ssize_t r;
-
+
assert(c);
assert(goodbye);
@@ -146,7 +146,7 @@ int pa_sap_recv(pa_sap_context *c, int *goodbye) {
buf = pa_xnew(char, size+1);
buf[size] = 0;
-
+
iov.iov_base = buf;
iov.iov_len = size;
@@ -157,7 +157,7 @@ int pa_sap_recv(pa_sap_context *c, int *goodbye) {
m.msg_control = NULL;
m.msg_controllen = 0;
m.msg_flags = 0;
-
+
if ((r = recvmsg(c->fd, &m, 0)) != size) {
pa_log("recvmsg() failed: %s", r < 0 ? pa_cstrerror(errno) : "size mismatch");
goto fail;
@@ -208,12 +208,12 @@ int pa_sap_recv(pa_sap_context *c, int *goodbye) {
if (c->sdp_data)
pa_xfree(c->sdp_data);
-
+
c->sdp_data = pa_xstrndup(e, size);
pa_xfree(buf);
-
+
*goodbye = !!((header >> 26) & 1);
-
+
return 0;
fail:
diff --git a/src/modules/rtp/sap.h b/src/modules/rtp/sap.h
index cac697e6..f906a32b 100644
--- a/src/modules/rtp/sap.h
+++ b/src/modules/rtp/sap.h
@@ -7,17 +7,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/src/modules/rtp/sdp.c b/src/modules/rtp/sdp.c
index 7f0e7027..8b0bd535 100644
--- a/src/modules/rtp/sdp.c
+++ b/src/modules/rtp/sdp.c
@@ -4,17 +4,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -54,18 +54,18 @@ char *pa_sdp_build(int af, const void *src, const void *dst, const char *name, u
f = pa_rtp_format_to_string(ss->format);
assert(f);
-
+
if (!(u = getenv("USER")))
if (!(u = getenv("USERNAME")))
u = "-";
-
+
ntp = time(NULL) + 2208988800U;
a = inet_ntop(af, src, buf_src, sizeof(buf_src));
assert(a);
a = inet_ntop(af, dst, buf_dst, sizeof(buf_dst));
assert(a);
-
+
return pa_sprintf_malloc(
PA_SDP_HEADER
"o=%s %lu 0 IN %s %s\n"
@@ -125,11 +125,11 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) {
assert(t);
assert(i);
-
+
i->origin = i->session_name = NULL;
i->salen = 0;
i->payload = 255;
-
+
if (!pa_startswith(t, PA_SDP_HEADER)) {
pa_log("Failed to parse SDP data: invalid header.");
goto fail;
@@ -156,7 +156,7 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) {
size_t k;
k = l-8 > sizeof(a) ? sizeof(a) : l-8;
-
+
pa_strlcpy(a, t+9, k);
a[strcspn(a, "/")] = 0;
@@ -173,7 +173,7 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) {
size_t k;
k = l-8 > sizeof(a) ? sizeof(a) : l-8;
-
+
pa_strlcpy(a, t+9, k);
a[strcspn(a, "/")] = 0;
@@ -189,7 +189,7 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) {
if (i->payload > 127) {
int _port, _payload;
-
+
if (sscanf(t+8, "%i RTP/AVP %i", &_port, &_payload) == 2) {
if (_port <= 0 || _port > 0xFFFF) {
@@ -224,16 +224,16 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) {
if (_payload == i->payload) {
c[strcspn(c, "\n")] = 0;
-
+
if (parse_sdp_sample_spec(&i->sample_spec, c))
ss_valid = 1;
}
}
}
}
-
+
t += l;
-
+
if (*t == '\n')
t++;
}
@@ -247,7 +247,7 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) {
((struct sockaddr_in*) &i->sa)->sin_port = htons(port);
else
((struct sockaddr_in6*) &i->sa)->sin6_port = htons(port);
-
+
return i;
fail:
diff --git a/src/modules/rtp/sdp.h b/src/modules/rtp/sdp.h
index 4c68ac5a..7c91fca6 100644
--- a/src/modules/rtp/sdp.h
+++ b/src/modules/rtp/sdp.h
@@ -7,17 +7,17 @@
This file is part of PulseAudio.
Copyright 2006 Lennart Poettering
-
+
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
-
+
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307