adhoc_audio/codec/adhoc/
audio_stream.rs1use serde::{Deserialize, Serialize};
2
3use super::*;
4
5#[derive(Deserialize,Serialize)]
6pub struct AudioStream {
7 info: Option<StreamInfo>,
8 stream: BitStream,
9}
10
11impl Default for AudioStream{
12 fn default() -> Self {
13 Self::new()
14 }
15}
16
17impl AudioStream {
18 pub fn new() -> Self {
19 Self {
20 info: None,
21 stream: BitStream::new(),
22 }
23 }
24 pub fn set_info(&mut self,info:Option<StreamInfo>){
25 self.info = info;
26 }
27 pub fn info(&self) -> Option<StreamInfo> {
28 self.info
29 }
30}
31
32impl Deref for AudioStream {
33 type Target = BitStream;
34 fn deref(&self) -> &Self::Target {
35 &self.stream
36 }
37}
38
39impl DerefMut for AudioStream {
40 fn deref_mut(&mut self) -> &mut Self::Target {
41 &mut self.stream
42 }
43}