mediaplayer 0.4.3

Safe Rust bindings for MediaPlayer.framework on macOS — now playing, remote commands, artwork, and explicit iOS-only stubs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use core::ffi::c_char;
use crate::{ffi, MediaPlayerError};

pub unsafe fn take_string(ptr: *mut c_char) -> Option<String> {
    doom_fish_utils::ffi_string::take_owned_cstring_c(ptr, |p| ffi::mp_string_free(p))
}

pub fn not_available(area: &str, reason: Option<String>) -> MediaPlayerError {
    MediaPlayerError::NotAvailable(
        reason.unwrap_or_else(|| format!("{area} is unavailable on macOS")),
    )
}