use crate::{ffi, unsupported, MediaPlayerError};
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct PlayableContentDataSource;
impl PlayableContentDataSource {
#[must_use]
pub fn is_supported() -> bool {
unsafe { ffi::mp_playable_content_data_source_is_supported() != 0 }
}
#[must_use]
pub fn unavailable_reason() -> String {
unsafe {
unsupported::take_string(ffi::mp_playable_content_data_source_copy_unavailable_reason())
.unwrap_or_else(|| "MPPlayableContentDataSource is unavailable on macOS".to_string())
}
}
#[must_use]
pub fn unsupported_error() -> MediaPlayerError {
unsupported::not_available("MPPlayableContentDataSource", Some(Self::unavailable_reason()))
}
pub fn new() -> Result<Self, MediaPlayerError> {
Err(Self::unsupported_error())
}
}