mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
add frame alignment APIs; don't require memory to be writable when silencing it (required of the mmap modes drivers where the hw data needs to be silenced, although it is not writable to others)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1826 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
298d2392f9
commit
0469c84366
1 changed files with 21 additions and 2 deletions
|
|
@ -38,7 +38,7 @@
|
|||
#include "sample-util.h"
|
||||
#include "endianmacros.h"
|
||||
|
||||
#define PA_SILENCE_MAX (1024*1024*1)
|
||||
#define PA_SILENCE_MAX (PA_PAGE_SIZE*16)
|
||||
|
||||
pa_memblock *pa_silence_memblock_new(pa_mempool *pool, const pa_sample_spec *spec, size_t length) {
|
||||
size_t fs;
|
||||
|
|
@ -82,7 +82,6 @@ void pa_silence_memchunk(pa_memchunk *c, const pa_sample_spec *spec) {
|
|||
pa_assert(c->memblock);
|
||||
pa_assert(spec);
|
||||
|
||||
pa_memchunk_make_writable(c, 0);
|
||||
data = pa_memblock_acquire(c->memblock);
|
||||
pa_silence_memory((uint8_t*) data+c->index, c->length, spec);
|
||||
pa_memblock_release(c->memblock);
|
||||
|
|
@ -474,3 +473,23 @@ void pa_volume_memchunk(
|
|||
pa_memblock_release(c->memblock);
|
||||
}
|
||||
|
||||
size_t pa_frame_align(size_t l, const pa_sample_spec *ss) {
|
||||
size_t fs;
|
||||
|
||||
pa_assert(ss);
|
||||
|
||||
fs = pa_frame_size(ss);
|
||||
|
||||
return (l/fs) * fs;
|
||||
}
|
||||
|
||||
int pa_frame_aligned(size_t l, const pa_sample_spec *ss) {
|
||||
size_t fs;
|
||||
|
||||
pa_assert(ss);
|
||||
|
||||
fs = pa_frame_size(ss);
|
||||
|
||||
return l % fs == 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue