-/* $Id$ */
-
/***
This file is part of PulseAudio.
#include <sndfile.h>
#include <pulse/xmalloc.h>
+#include <pulse/util.h>
#include <pulsecore/core-error.h>
#include <pulsecore/sink-input.h>
* we are heard right-away. */
if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT)
- pa_sink_input_request_rewind(i, 0, FALSE, TRUE);
+ pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE);
}
/* Called from IO thread context */
if (!u->memblockq)
return -1;
- pa_log_debug("pop: %lu", (unsigned long) length);
-
for (;;) {
pa_memchunk tchunk;
size_t fs;
sf_count_t n;
if (pa_memblockq_peek(u->memblockq, chunk) >= 0) {
+ chunk->length = PA_MIN(chunk->length, length);
pa_memblockq_drop(u->memblockq, chunk->length);
return 0;
}
if (u->readf_function) {
fs = pa_frame_size(&i->sample_spec);
- n = u->readf_function(u->sndfile, p, length/fs);
+ n = u->readf_function(u->sndfile, p, (sf_count_t) (length/fs));
} else {
fs = 1;
- n = sf_read_raw(u->sndfile, p, length);
+ n = sf_read_raw(u->sndfile, p, (sf_count_t) length);
}
pa_memblock_release(tchunk.memblock);
break;
}
- tchunk.length = n * fs;
+ tchunk.length = (size_t) n * fs;
pa_memblockq_push(u->memblockq, &tchunk);
pa_memblock_unref(tchunk.memblock);
}
- pa_log_debug("peek fail");
-
if (pa_sink_input_safe_to_remove(i)) {
- pa_log_debug("completed to play");
-
pa_memblockq_free(u->memblockq);
u->memblockq = NULL;
file_stream *u;
pa_sink_input_assert_ref(i);
- pa_assert(nbytes > 0);
u = FILE_STREAM(i->userdata);
file_stream_assert_ref(u);
break;
}
- ss.rate = sfinfo.samplerate;
- ss.channels = sfinfo.channels;
+ ss.rate = (uint32_t) sfinfo.samplerate;
+ ss.channels = (uint8_t) sfinfo.channels;
if (!pa_sample_spec_valid(&ss)) {
pa_log("Unsupported sample format in file %s", fname);
data.sink = sink;
data.driver = __FILE__;
pa_sink_input_new_data_set_sample_spec(&data, &ss);
- pa_sink_input_new_data_set_volume(&data, volume);
- pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, fname);
+ pa_sink_input_new_data_set_virtual_volume(&data, volume);
+ pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, pa_path_get_filename(fname));
pa_proplist_sets(data.proplist, PA_PROP_MEDIA_FILENAME, fname);
u->sink_input = pa_sink_input_new(sink->core, &data, 0);