pub fn parse(mime_type: &str, line: &str) -> Box<dyn Fmtp> {
    let mut parameters = HashMap::new();
    for p in line.split(';').collect::<Vec<&str>>() {
        let pp: Vec<&str> = p.trim().splitn(2, '=').collect();
        let key = pp[0].to_lowercase();
        let value = if pp.len() > 1 {
            pp[1].to_owned()
        } else {
            String::new()
        };
        parameters.insert(key, value);
    }

    if mime_type.to_uppercase() == "video/h264".to_uppercase() {
        Box::new(H264Fmtp { parameters })
    } else {
        Box::new(GenericFmtp {
            mime_type: mime_type.to_owned(),
            parameters,
        })
    }
}
/// parse parses an fmtp string based on the MimeType
parse parses an fmtp string based on the MimeType
parse parses an fmtp string based on the MimeType
pub fn parse(mime_type: &str, line: &str) -> Box<dyn Fmtp> {
    let mut parameters = HashMap::new();
    for p in line.split(';').collect::<Vec<&str>>() {
        let pp: Vec<&str> = p.trim().splitn(2, '=').collect();
        let key = pp[0].to_lowercase();
        let value = if pp.len() > 1 {
            pp[1].to_owned()
        } else {
            String::new()
        };
        parameters.insert(key, value);
    }
    if mime_type.to_uppercase() == "video/h264".to_uppercase() {
        Box::new(H264Fmtp { parameters })
    } else {
        Box::new(GenericFmtp {
            mime_type: mime_type.to_owned(),
            parameters,
        })
    }
}
pub fn parse ( mime_type : & str , line : & str ) -> Box < dyn Fmtp > { let mut parameters = HashMap :: new ( ) ; for p in line . split ( ';' ) . collect :: < Vec < & str > > ( ) { let pp : Vec < & str > = p . trim ( ) . splitn ( 2 , '=' ) . collect ( ) ; let key = pp [ 0 ] . to_lowercase ( ) ; let value = if pp . len ( ) > 1 { pp [ 1 ] . to_owned ( ) } else { String :: new ( ) } ; parameters . insert ( key , value ) ; } if mime_type . to_uppercase ( ) == " " . to_uppercase ( ) { Box :: new ( H264Fmtp { parameters } ) } else { Box :: new ( GenericFmtp { mime_type : mime_type . to_owned ( ) , parameters , } ) } }
parse parses an fmtp string based on the MimeType
parse parses an fmtp string based on the MimeType
mime_type
&str
line
&str