#h264 #web-rtc #sdp

h264-profile-level-id

Utility to process H264 profile-level-id values

3 releases (breaking)

0.2.0 Dec 18, 2023
0.1.1 Nov 29, 2020
0.1.0 Nov 29, 2020
0.0.0 Oct 11, 2020

#167 in Video

Download history 175/week @ 2024-07-24 206/week @ 2024-07-31 316/week @ 2024-08-07 79/week @ 2024-08-14 127/week @ 2024-08-21 138/week @ 2024-08-28 243/week @ 2024-09-04 155/week @ 2024-09-11 106/week @ 2024-09-18 279/week @ 2024-09-25 219/week @ 2024-10-02 455/week @ 2024-10-09 513/week @ 2024-10-16 127/week @ 2024-10-23 221/week @ 2024-10-30 227/week @ 2024-11-06

1,113 downloads per month
Used in 2 crates (via mediasoup)

ISC license

28KB
563 lines

h264-profile-level-id

Build Status Crates.io Docs License

Idiomatic Rust port of https://github.com/ibc/h264-profile-level-id by Iñaki Baz Castillo.

Rust utility to process H264 profile-level-id values based on Google's libwebrtc C++ code.

Basic usage example:

use h264_profile_level_id::{Profile, Level, ProfileLevelId};

fn main () {
    let profile_level_id: ProfileLevelId = "42e01f".parse().unwrap();
    
    assert_eq!(profile_level_id.profile(), Profile::ConstrainedBaseline);
    assert_eq!(profile_level_id.level(), Level::Level31);
    
    let s = profile_level_id.to_string();
    
    assert_eq!(s.as_str(), "42e01f");

    let local_profile_level_id = "42e01f".parse::<ProfileLevelId>().ok();
    let local_level_asymmetry_allowed = true;

    let remote_profile_level_id = "42e015".parse::<ProfileLevelId>().ok();
    let remote_level_asymmetry_allowed = true;

    assert_eq!(
        h264_profile_level_id::generate_profile_level_id_for_answer(
            local_profile_level_id,
            local_level_asymmetry_allowed,
            remote_profile_level_id,
            remote_level_asymmetry_allowed
        ),
        Ok("42e01f".parse::<ProfileLevelId>().unwrap()),
    );
}

Contribution

Feel free to create issues and send pull requests, they are highly appreciated!

License

ISC

Dependencies

~0.3–0.8MB
~19K SLoC