}
return -1;
- }
+}
static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
file_stream *u;
pa_sink_input_new_data data;
int fd;
SF_INFO sfi;
+ pa_memchunk silence;
pa_assert(sink);
pa_assert(fname);
u->readf_function = NULL;
u->memblockq = NULL;
- if ((fd = open(fname, O_RDONLY
-#ifdef O_NOCTTY
- |O_NOCTTY
-#endif
- )) < 0) {
+ if ((fd = pa_open_cloexec(fname, O_RDONLY, 0)) < 0) {
pa_log("Failed to open file %s: %s", fname, pa_cstrerror(errno));
goto fail;
}
u->readf_function = pa_sndfile_readf_function(&ss);
pa_sink_input_new_data_init(&data);
- data.sink = sink;
+ pa_sink_input_new_data_set_sink(&data, sink, FALSE);
data.driver = __FILE__;
pa_sink_input_new_data_set_sample_spec(&data, &ss);
pa_sink_input_new_data_set_channel_map(&data, &cm);
u->sink_input->state_change = sink_input_state_change_cb;
u->sink_input->userdata = u;
- u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, NULL);
+ pa_sink_input_get_silence(u->sink_input, &silence);
+ u->memblockq = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, pa_frame_size(&ss), 1, 1, 0, &silence);
+ pa_memblock_unref(silence.memblock);
pa_sink_input_put(u->sink_input);