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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#[macro_use]
extern crate serde_derive;

#[macro_use]
extern crate servo_media_derive;

extern crate servo_media_player as player;

extern crate byte_slice_cast;
extern crate euclid;
extern crate log;
extern crate num_complex;
extern crate num_traits;
extern crate petgraph;
extern crate smallvec;
extern crate speexdsp_resampler;
#[macro_use]
pub mod macros;
extern crate servo_media_streams;
extern crate servo_media_traits;

pub mod analyser_node;
pub mod biquad_filter_node;
pub mod block;
pub mod buffer_source_node;
pub mod channel_node;
pub mod constant_source_node;
pub mod context;
pub mod decoder;
pub mod destination_node;
pub mod gain_node;
pub mod graph;
pub mod iir_filter_node;
pub mod listener;
pub mod media_element_source_node;
pub mod media_stream_destination_node;
pub mod media_stream_source_node;
pub mod node;
pub mod offline_sink;
pub mod oscillator_node;
pub mod panner_node;
pub mod param;
pub mod render_thread;
pub mod sink;
pub mod stereo_panner;
pub mod wave_shaper_node;

pub trait AudioBackend {
    type Sink: sink::AudioSink + 'static;
    fn make_decoder() -> Box<dyn decoder::AudioDecoder>;
    fn make_sink() -> Result<Self::Sink, sink::AudioSinkError>;
    fn make_streamreader(
        id: servo_media_streams::MediaStreamId,
        sample_rate: f32,
    ) -> Box<dyn AudioStreamReader + Send>;
}

pub trait AudioStreamReader {
    fn pull(&self) -> block::Block;
    fn start(&self);
    fn stop(&self);
}