Skip to main content

kithara/
lib.rs

1#![forbid(unsafe_code)]
2
3//! # Kithara
4//!
5//! Facade crate providing a unified API for audio streaming and decoding.
6//!
7//! ## Quick start
8//!
9//! ```ignore
10//! use kithara::prelude::*;
11//!
12//! // Auto-detect from URL
13//! let config = ResourceConfig::new("https://example.com/song.mp3")?;
14//! let mut resource = Resource::new(config).await?;
15//!
16//! // Read interleaved PCM
17//! let mut buf = [0.0f32; 1024];
18//! resource.read(&mut buf);
19//! ```
20
21pub mod audio {
22    pub use kithara_audio::*;
23}
24
25pub mod bufpool {
26    pub use kithara_bufpool::*;
27}
28
29pub mod decode {
30    pub use kithara_decode::*;
31}
32
33pub mod events {
34    pub use kithara_events::*;
35}
36
37pub mod platform {
38    pub use kithara_platform::*;
39}
40
41pub mod play {
42    pub use kithara_play::*;
43}
44
45pub mod stream {
46    pub use kithara_stream::*;
47}
48
49#[cfg(feature = "file")]
50pub mod file {
51    pub use kithara_file::*;
52}
53
54#[cfg(feature = "hls")]
55pub mod abr {
56    pub use kithara_abr::*;
57}
58
59#[cfg(feature = "hls")]
60pub mod drm {
61    pub use kithara_drm::*;
62}
63
64#[cfg(feature = "hls")]
65pub mod hls {
66    pub use kithara_hls::*;
67}
68
69#[cfg(any(feature = "file", feature = "hls", feature = "assets"))]
70pub mod assets {
71    pub use kithara_assets::*;
72}
73
74#[cfg(any(feature = "file", feature = "hls", feature = "net"))]
75pub mod net {
76    pub use kithara_net::*;
77}
78
79#[cfg(feature = "assets")]
80pub mod storage {
81    pub use kithara_storage::*;
82}
83
84pub use kithara_test_macros::mock;
85#[cfg(feature = "probe")]
86pub use kithara_test_macros::{fixture, flash, test};
87
88#[cfg(feature = "mock")]
89pub mod mock {
90    pub use kithara_audio::mock::*;
91    pub use kithara_decode::mock::*;
92    pub use kithara_play::mock::*;
93    pub use kithara_stream::mock::*;
94}
95
96/// Prelude — flat imports for common types.
97pub mod prelude {
98    #[cfg(feature = "hls")]
99    pub use kithara_abr::AbrMode;
100    #[cfg(all(
101        not(target_arch = "wasm32"),
102        any(feature = "stretch-signalsmith", feature = "stretch-bungee")
103    ))]
104    pub use kithara_audio::StretchBackendKind;
105    pub use kithara_audio::{
106        Audio, AudioConfig, EngineLoadSnapshot, PcmReader, ResamplerQuality, StretchControls,
107    };
108    pub use kithara_decode::{
109        DecodeError, DecodeResult, DecoderTrackInfo, PcmMeta, PcmSpec, TrackMetadata,
110    };
111    #[cfg(feature = "hls")]
112    pub use kithara_events::HlsEvent;
113    pub use kithara_events::{AudioEvent, BusScope, Event, EventBus, EventReceiver, FileEvent};
114    #[cfg(feature = "file")]
115    pub use kithara_file::{File, FileConfig};
116    #[cfg(feature = "hls")]
117    pub use kithara_hls::{Hls, HlsConfig};
118    pub use kithara_play::{
119        AudioWorkerHandle, EngineConfig, EngineImpl, PlayerConfig, PlayerImpl, Resource,
120        ResourceConfig, ResourceSrc, ServiceClass, SourceType,
121    };
122    pub use kithara_stream::{AudioCodec, ContainerFormat, MediaInfo, Stream, StreamType};
123}