mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
add new function pa_usec_to_bytes() as inverse of pa_bytes_to_usec()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@942 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
bc87137a8f
commit
651e575575
2 changed files with 9 additions and 0 deletions
|
|
@ -66,6 +66,12 @@ pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) {
|
|||
return (pa_usec_t) (((double) length/pa_frame_size(spec)*1000000)/spec->rate);
|
||||
}
|
||||
|
||||
size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) {
|
||||
assert(spec);
|
||||
|
||||
return ((double) t * spec->rate / 1000000)*pa_frame_size(spec);
|
||||
}
|
||||
|
||||
int pa_sample_spec_valid(const pa_sample_spec *spec) {
|
||||
assert(spec);
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,9 @@ size_t pa_sample_size(const pa_sample_spec *spec);
|
|||
/** Calculate the time the specified bytes take to play with the specified sample type */
|
||||
pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec);
|
||||
|
||||
/** Calculates the number of bytes that are required for the specified time. \since 0.9 */
|
||||
size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec);
|
||||
|
||||
/** Return non-zero when the sample type specification is valid */
|
||||
int pa_sample_spec_valid(const pa_sample_spec *spec);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue