#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

#149 in Video

Download history 150/week @ 2024-06-19 193/week @ 2024-06-26 188/week @ 2024-07-03 204/week @ 2024-07-10 631/week @ 2024-07-17 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 120/week @ 2024-10-02

701 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

~280–780KB
~18K SLoC