summaryrefslogtreecommitdiffstats
path: root/third_party/rust/cubeb-pulse/src/backend/mod.rs
blob: 9255be83af08d60b0c1174edbd68e7ed7f5bc90c (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
// Copyright © 2017-2018 Mozilla Foundation
//
// This program is made available under an ISC-style license.  See the
// accompanying file LICENSE for details.

mod context;
mod cork_state;
mod intern;
mod stream;

pub use self::context::PulseContext;
use self::intern::Intern;
pub use self::stream::Device;
pub use self::stream::PulseStream;
use std::ffi::CStr;
use std::os::raw::c_char;

// helper to convert *const c_char to Option<CStr>
fn try_cstr_from<'str>(s: *const c_char) -> Option<&'str CStr> {
    if s.is_null() {
        None
    } else {
        Some(unsafe { CStr::from_ptr(s) })
    }
}