cubeb_sys/
resampler.rs

1// Copyright © 2017-2018 Mozilla Foundation
2//
3// This program is made available under an ISC-style license.  See the
4// accompanying file LICENSE for details.
5
6use callbacks::cubeb_data_callback;
7use std::os::raw::{c_long, c_uint, c_void};
8use stream::{cubeb_stream, cubeb_stream_params};
9
10pub enum cubeb_resampler {}
11
12cubeb_enum! {
13    pub enum cubeb_resampler_quality {
14        CUBEB_RESAMPLER_QUALITY_VOIP,
15        CUBEB_RESAMPLER_QUALITY_DEFAULT,
16        CUBEB_RESAMPLER_QUALITY_DESKTOP,
17    }
18}
19
20cubeb_enum! {
21    pub enum cubeb_resampler_reclock {
22        CUBEB_RESAMPLER_RECLOCK_NONE,
23        CUBEB_RESAMPLER_RECLOCK_INPUT,
24    }
25}
26
27extern "C" {
28    pub fn cubeb_resampler_create(
29        stream: *mut cubeb_stream,
30        input_params: *mut cubeb_stream_params,
31        output_params: *mut cubeb_stream_params,
32        target_rate: c_uint,
33        callback: cubeb_data_callback,
34        user_ptr: *mut c_void,
35        quality: cubeb_resampler_quality,
36        reclock: cubeb_resampler_reclock,
37    ) -> *mut cubeb_resampler;
38
39    pub fn cubeb_resampler_fill(
40        resampler: *mut cubeb_resampler,
41        input_buffer: *mut c_void,
42        input_frame_count: *mut c_long,
43        output_buffer: *mut c_void,
44        output_frames_needed: c_long,
45    ) -> c_long;
46
47    pub fn cubeb_resampler_destroy(resampler: *mut cubeb_resampler);
48    pub fn cubeb_resampler_latency(resampler: *mut cubeb_resampler) -> c_long;
49}