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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! How encoded audio arrives when it turns up in pieces: bytes are pushed
//! in, samples are pulled out, and an incomplete frame waits inside for the
//! rest of itself.
//!
//! The trait is declared here and implemented by every streaming reader in
//! the crate. Whole-input decoding needs no trait: a caller holding all the
//! bytes hands them to a reader directly.
use crateAudioSpec;
use crateDecodeError;
/// A stream that arrives in pieces: bytes are pushed in, samples are pulled
/// out, and an incomplete frame waits inside for the rest of itself.
///
/// This is a pull model even though every codec in this crate's first four
/// steps is stateless and would be served perfectly well by a chunk-in,
/// chunk-out function. MP3's bit reservoir lets a frame borrow bits from
/// earlier frames, which makes chunk-in-chunk-out wrong for MP3 before a line
/// of it is written. The shape costs almost nothing now and costs everything
/// above it later.