summaryrefslogtreecommitdiffstats
path: root/src/sink-pipe.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-06-14 22:47:12 +0000
committerLennart Poettering <lennart@poettering.net>2004-06-14 22:47:12 +0000
commitf78e9b68cbc45015af05db497d1547c0e02d2751 (patch)
tree6ea929ab2faa67b6c36605533fc609a1fbf4ade2 /src/sink-pipe.c
parent0575fc66e9b175fef129a250697f07d7053e9108 (diff)
commit some work and rename
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@13 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/sink-pipe.c')
-rw-r--r--src/sink-pipe.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/sink-pipe.c b/src/sink-pipe.c
index 78ea7bf2..e63a7a86 100644
--- a/src/sink-pipe.c
+++ b/src/sink-pipe.c
@@ -13,6 +13,8 @@
#include "module.h"
struct userdata {
+ char *filename;
+
struct sink *sink;
struct iochannel *io;
struct core *core;
@@ -73,7 +75,6 @@ static void io_callback(struct iochannel *io, void*userdata) {
int module_init(struct core *c, struct module*m) {
struct userdata *u = NULL;
struct stat st;
- struct sink *sink;
char *p;
int fd = -1;
const static struct sample_spec ss = {
@@ -100,17 +101,16 @@ int module_init(struct core *c, struct module*m) {
goto fail;
}
- if (!(sink = sink_new(c, "fifo", &ss))) {
- fprintf(stderr, "Failed to allocate new sink!\n");
- goto fail;
- }
u = malloc(sizeof(struct userdata));
assert(u);
+ u->filename = strdup(p);
+ assert(u->filename);
u->core = c;
- u->sink = sink;
- sink_set_notify_callback(sink, notify_callback, u);
+ u->sink = sink_new(c, "fifo", &ss);
+ assert(u->sink);
+ sink_set_notify_callback(u->sink, notify_callback, u);
u->io = iochannel_new(c->mainloop, -1, fd);
assert(u->io);
@@ -119,22 +119,18 @@ int module_init(struct core *c, struct module*m) {
u->memchunk.memblock = NULL;
u->memchunk.length = 0;
- u->mainloop_source = mainloop_source_new_prepare(c->mainloop, prepare_callback, u);
+ u->mainloop_source = mainloop_source_new_fixed(c->mainloop, prepare_callback, u);
assert(u->mainloop_source);
mainloop_source_enable(u->mainloop_source, 0);
m->userdata = u;
-
return 0;
fail:
if (fd >= 0)
close(fd);
- if (u)
- free(u);
-
return -1;
}
@@ -151,5 +147,10 @@ void module_done(struct core *c, struct module*m) {
sink_free(u->sink);
iochannel_free(u->io);
mainloop_source_free(u->mainloop_source);
+
+ assert(u->filename);
+ unlink(u->filename);
+ free(u->filename);
+
free(u);
}