summaryrefslogtreecommitdiffstats
path: root/third_party/rust/cubeb-backend/src/ops.rs
blob: c819ce6b3bff151026a67ac54986256f82b00f61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Copyright © 2017 Mozilla Foundation
//
// This program is made available under an ISC-style license.  See the
// accompanying file LICENSE for details.

#![allow(non_camel_case_types)]

use ffi;
use std::os::raw::{c_char, c_float, c_int, c_uint, c_void};

#[repr(C)]
pub struct Ops {
    pub init: Option<
        unsafe extern "C" fn(context: *mut *mut ffi::cubeb, context_name: *const c_char) -> c_int,
    >,
    pub get_backend_id: Option<unsafe extern "C" fn(context: *mut ffi::cubeb) -> *const c_char>,
    pub get_max_channel_count:
        Option<unsafe extern "C" fn(context: *mut ffi::cubeb, max_channels: *mut c_uint) -> c_int>,
    pub get_min_latency: Option<
        unsafe extern "C" fn(
            context: *mut ffi::cubeb,
            params: ffi::cubeb_stream_params,
            latency_ms: *mut c_uint,
        ) -> c_int,
    >,
    pub get_preferred_sample_rate:
        Option<unsafe extern "C" fn(context: *mut ffi::cubeb, rate: *mut u32) -> c_int>,
    pub get_supported_input_processing_params: Option<
        unsafe extern "C" fn(
            c: *mut ffi::cubeb,
            params: *mut ffi::cubeb_input_processing_params,
        ) -> c_int,
    >,
    pub enumerate_devices: Option<
        unsafe extern "C" fn(
            context: *mut ffi::cubeb,
            devtype: ffi::cubeb_device_type,
            collection: *mut ffi::cubeb_device_collection,
        ) -> c_int,
    >,
    pub device_collection_destroy: Option<
        unsafe extern "C" fn(
            context: *mut ffi::cubeb,
            collection: *mut ffi::cubeb_device_collection,
        ) -> c_int,
    >,
    pub destroy: Option<unsafe extern "C" fn(context: *mut ffi::cubeb)>,
    #[allow(clippy::type_complexity)]
    pub stream_init: Option<
        unsafe extern "C" fn(
            context: *mut ffi::cubeb,
            stream: *mut *mut ffi::cubeb_stream,
            stream_name: *const c_char,
            input_device: ffi::cubeb_devid,
            input_stream_params: *mut ffi::cubeb_stream_params,
            output_device: ffi::cubeb_devid,
            output_stream_params: *mut ffi::cubeb_stream_params,
            latency: c_uint,
            data_callback: ffi::cubeb_data_callback,
            state_callback: ffi::cubeb_state_callback,
            user_ptr: *mut c_void,
        ) -> c_int,
    >,
    pub stream_destroy: Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream)>,
    pub stream_start: Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream) -> c_int>,
    pub stream_stop: Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream) -> c_int>,
    pub stream_get_position:
        Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, position: *mut u64) -> c_int>,
    pub stream_get_latency:
        Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, latency: *mut u32) -> c_int>,
    pub stream_get_input_latency:
        Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, latency: *mut u32) -> c_int>,
    pub stream_set_volume:
        Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, volumes: c_float) -> c_int>,
    pub stream_set_name:
        Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, name: *const c_char) -> c_int>,
    pub stream_get_current_device: Option<
        unsafe extern "C" fn(
            stream: *mut ffi::cubeb_stream,
            device: *mut *mut ffi::cubeb_device,
        ) -> c_int,
    >,
    pub stream_set_input_mute:
        Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, mute: c_int) -> c_int>,
    pub stream_set_input_processing_params: Option<
        unsafe extern "C" fn(
            stream: *mut ffi::cubeb_stream,
            params: ffi::cubeb_input_processing_params,
        ) -> c_int,
    >,
    pub stream_device_destroy: Option<
        unsafe extern "C" fn(
            stream: *mut ffi::cubeb_stream,
            device: *mut ffi::cubeb_device,
        ) -> c_int,
    >,
    pub stream_register_device_changed_callback: Option<
        unsafe extern "C" fn(
            stream: *mut ffi::cubeb_stream,
            device_changed_callback: ffi::cubeb_device_changed_callback,
        ) -> c_int,
    >,
    pub register_device_collection_changed: Option<
        unsafe extern "C" fn(
            context: *mut ffi::cubeb,
            devtype: ffi::cubeb_device_type,
            callback: ffi::cubeb_device_collection_changed_callback,
            user_ptr: *mut c_void,
        ) -> c_int,
    >,
}