summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sound-file-stream.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-08-13 16:19:56 +0000
committerLennart Poettering <lennart@poettering.net>2006-08-13 16:19:56 +0000
commita621d9028548723d13df64df06a4f4538504e7a3 (patch)
treeb488b3488a11516b3c594cc2c805d693a5d6c938 /src/pulsecore/sound-file-stream.c
parentb5cbea940ea70b8ed92fa3be6b742e8a14897337 (diff)
allow hooking into the process of creating playback streams. To implement this I modified the pa_sink_input_new() signature to take a pa_sink_input_new_data structure instead of direct arguments.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1237 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/sound-file-stream.c')
-rw-r--r--src/pulsecore/sound-file-stream.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c
index 386f5bd0..6063b93e 100644
--- a/src/pulsecore/sound-file-stream.c
+++ b/src/pulsecore/sound-file-stream.c
@@ -120,13 +120,20 @@ static void sink_input_drop(pa_sink_input *i, const pa_memchunk*chunk, size_t le
}
}
-int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume) {
+int pa_play_file(
+ pa_sink *sink,
+ const char *fname,
+ const pa_cvolume *volume) {
+
struct userdata *u = NULL;
SF_INFO sfinfo;
pa_sample_spec ss;
- assert(sink && fname);
+ pa_sink_input_new_data data;
+
+ assert(sink);
+ assert(fname);
- u = pa_xmalloc(sizeof(struct userdata));
+ u = pa_xnew(struct userdata, 1);
u->sink_input = NULL;
u->memchunk.memblock = NULL;
u->memchunk.index = u->memchunk.length = 0;
@@ -171,8 +178,15 @@ int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume) {
pa_log(__FILE__": Unsupported sample format in file %s", fname);
goto fail;
}
+
+ pa_sink_input_new_data_init(&data);
+ data.sink = sink;
+ data.driver = __FILE__;
+ data.name = fname;
+ pa_sink_input_new_data_set_sample_spec(&data, &ss);
+ pa_sink_input_new_data_set_volume(&data, volume);
- if (!(u->sink_input = pa_sink_input_new(sink, __FILE__, fname, &ss, NULL, volume, 0, -1)))
+ if (!(u->sink_input = pa_sink_input_new(sink->core, &data, 0)))
goto fail;
u->sink_input->peek = sink_input_peek;
@@ -180,7 +194,7 @@ int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume) {
u->sink_input->kill = sink_input_kill;
u->sink_input->userdata = u;
- pa_sink_notify(sink);
+ pa_sink_notify(u->sink_input->sink);
return 0;