#[cfg(target_os = "android")]
mod android_video_surface;
mod decoder_worker;
mod latest_channel;
mod runtime_player;
use shaderloom::CompiledShader;
const VIDEO_YUV_SHADER: CompiledShader = include!(concat!(env!("OUT_DIR"), "/video_yuv.rs"));
const VIDEO_YUV_SPHERICAL_SHADER: CompiledShader =
include!(concat!(env!("OUT_DIR"), "/video_yuv_spherical.rs"));
#[cfg(target_os = "android")]
#[doc(hidden)]
pub use android_video_surface::{AndroidVideoSurfaceBridge, AndroidVideoSurfaceHost};
use waterkit_audio::{AudioDevice, AudioOutput, PlayerError};
use waterkit_video::{AnyLicenseServer, LicenseServer, ZenwaveLicenseServer};
use waterui_core::{Binding, Environment};
#[derive(Debug, Clone)]
pub struct VideoGpuOptions {
pub(crate) audio_output: AudioOutput,
pub(crate) skip_silence: Binding<bool>,
pub(crate) license_server: AnyLicenseServer,
}
impl VideoGpuOptions {
#[must_use]
pub fn new() -> Self {
Self {
audio_output: AudioOutput::system_default(),
skip_silence: Binding::bool(false),
license_server: AnyLicenseServer::new(ZenwaveLicenseServer),
}
}
#[must_use]
pub fn audio_output(mut self, output: AudioOutput) -> Self {
self.audio_output = output;
self
}
#[must_use]
pub fn skip_silence(mut self, enabled: &Binding<bool>) -> Self {
self.skip_silence = enabled.clone();
self
}
#[must_use]
pub fn license_server(mut self, server: impl LicenseServer) -> Self {
self.license_server = AnyLicenseServer::new(server);
self
}
}
impl Default for VideoGpuOptions {
fn default() -> Self {
Self::new()
}
}
#[cfg_attr(
target_os = "ios",
expect(
clippy::missing_const_for_fn,
reason = "the cross-platform API must keep identical constness where other targets enumerate devices at runtime"
)
)]
pub fn audio_output_devices() -> Result<Vec<AudioDevice>, PlayerError> {
AudioDevice::list()
}
pub fn install(env: &mut Environment) {
install_with_options(env, VideoGpuOptions::new());
}
pub fn install_with_options(env: &mut Environment, options: VideoGpuOptions) {
runtime_player::install(env, options);
}