1#![allow(non_camel_case_types)]
7
8use ffi;
9use std::os::raw::{c_char, c_float, c_int, c_uint, c_void};
10
11#[repr(C)]
12pub struct Ops {
13 pub init: Option<
14 unsafe extern "C" fn(context: *mut *mut ffi::cubeb, context_name: *const c_char) -> c_int,
15 >,
16 pub get_backend_id: Option<unsafe extern "C" fn(context: *mut ffi::cubeb) -> *const c_char>,
17 pub get_max_channel_count:
18 Option<unsafe extern "C" fn(context: *mut ffi::cubeb, max_channels: *mut c_uint) -> c_int>,
19 pub get_min_latency: Option<
20 unsafe extern "C" fn(
21 context: *mut ffi::cubeb,
22 params: ffi::cubeb_stream_params,
23 latency_ms: *mut c_uint,
24 ) -> c_int,
25 >,
26 pub get_preferred_sample_rate:
27 Option<unsafe extern "C" fn(context: *mut ffi::cubeb, rate: *mut u32) -> c_int>,
28 pub get_supported_input_processing_params: Option<
29 unsafe extern "C" fn(
30 c: *mut ffi::cubeb,
31 params: *mut ffi::cubeb_input_processing_params,
32 ) -> c_int,
33 >,
34 pub enumerate_devices: Option<
35 unsafe extern "C" fn(
36 context: *mut ffi::cubeb,
37 devtype: ffi::cubeb_device_type,
38 collection: *mut ffi::cubeb_device_collection,
39 ) -> c_int,
40 >,
41 pub device_collection_destroy: Option<
42 unsafe extern "C" fn(
43 context: *mut ffi::cubeb,
44 collection: *mut ffi::cubeb_device_collection,
45 ) -> c_int,
46 >,
47 pub destroy: Option<unsafe extern "C" fn(context: *mut ffi::cubeb)>,
48 #[allow(clippy::type_complexity)]
49 pub stream_init: Option<
50 unsafe extern "C" fn(
51 context: *mut ffi::cubeb,
52 stream: *mut *mut ffi::cubeb_stream,
53 stream_name: *const c_char,
54 input_device: ffi::cubeb_devid,
55 input_stream_params: *mut ffi::cubeb_stream_params,
56 output_device: ffi::cubeb_devid,
57 output_stream_params: *mut ffi::cubeb_stream_params,
58 latency: c_uint,
59 data_callback: ffi::cubeb_data_callback,
60 state_callback: ffi::cubeb_state_callback,
61 user_ptr: *mut c_void,
62 ) -> c_int,
63 >,
64 pub stream_destroy: Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream)>,
65 pub stream_start: Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream) -> c_int>,
66 pub stream_stop: Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream) -> c_int>,
67 pub stream_get_position:
68 Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, position: *mut u64) -> c_int>,
69 pub stream_get_latency:
70 Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, latency: *mut u32) -> c_int>,
71 pub stream_get_input_latency:
72 Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, latency: *mut u32) -> c_int>,
73 pub stream_set_volume:
74 Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, volumes: c_float) -> c_int>,
75 pub stream_set_name:
76 Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, name: *const c_char) -> c_int>,
77 pub stream_get_current_device: Option<
78 unsafe extern "C" fn(
79 stream: *mut ffi::cubeb_stream,
80 device: *mut *mut ffi::cubeb_device,
81 ) -> c_int,
82 >,
83 pub stream_set_input_mute:
84 Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, mute: c_int) -> c_int>,
85 pub stream_set_input_processing_params: Option<
86 unsafe extern "C" fn(
87 stream: *mut ffi::cubeb_stream,
88 params: ffi::cubeb_input_processing_params,
89 ) -> c_int,
90 >,
91 pub stream_device_destroy: Option<
92 unsafe extern "C" fn(
93 stream: *mut ffi::cubeb_stream,
94 device: *mut ffi::cubeb_device,
95 ) -> c_int,
96 >,
97 pub stream_register_device_changed_callback: Option<
98 unsafe extern "C" fn(
99 stream: *mut ffi::cubeb_stream,
100 device_changed_callback: ffi::cubeb_device_changed_callback,
101 ) -> c_int,
102 >,
103 pub register_device_collection_changed: Option<
104 unsafe extern "C" fn(
105 context: *mut ffi::cubeb,
106 devtype: ffi::cubeb_device_type,
107 callback: ffi::cubeb_device_collection_changed_callback,
108 user_ptr: *mut c_void,
109 ) -> c_int,
110 >,
111}