mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
add new API function pa_memchunk_memcpy()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2271 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
144b237d86
commit
4b1d684d26
2 changed files with 23 additions and 0 deletions
|
|
@ -90,3 +90,23 @@ pa_memchunk *pa_memchunk_will_need(const pa_memchunk *c) {
|
|||
|
||||
return (pa_memchunk*) c;
|
||||
}
|
||||
|
||||
pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src) {
|
||||
void *p, *q;
|
||||
|
||||
pa_assert(dst);
|
||||
pa_assert(src);
|
||||
pa_assert(dst->length == src->length);
|
||||
|
||||
p = pa_memblock_acquire(dst->memblock);
|
||||
q = pa_memblock_acquire(src->memblock);
|
||||
|
||||
memmove((uint8_t*) p + dst->index,
|
||||
(uint8_t*) q + src->index,
|
||||
dst->length);
|
||||
|
||||
pa_memblock_release(dst->memblock);
|
||||
pa_memblock_release(src->memblock);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,4 +49,7 @@ pa_memchunk* pa_memchunk_reset(pa_memchunk *c);
|
|||
/* Map a memory chunk back into memory if it was swapped out */
|
||||
pa_memchunk *pa_memchunk_will_need(const pa_memchunk *c);
|
||||
|
||||
/* Copy the data in the src memchunk to the dst memchunk */
|
||||
pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue