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
use crate::SdpAttribute;
use crate::SdpConnection;
use crate::SdpCodecIdentifier;

#[derive(Debug, PartialEq, Clone)]
pub struct SdpMediaFormat {
    pub codec: SdpCodecIdentifier,
    pub connection: Option<SdpConnection>,
    pub attributes: Vec<SdpAttribute>
}

impl SdpMediaFormat {

    pub fn new(codec: SdpCodecIdentifier) -> SdpMediaFormat {
        SdpMediaFormat {
            codec,
            connection: None,
            attributes: vec![]
        }
    }

    pub fn connection(mut self, conn: SdpConnection) -> SdpMediaFormat {
        self.connection = Some(conn);
        self
    }

    pub fn attribute(mut self, attr: SdpAttribute) -> SdpMediaFormat {
        self.attributes.push(attr);
        self
    }
}