h264-profile-level-id

Crates.ioh264-profile-level-id
lib.rsh264-profile-level-id
version0.2.0
sourcesrc
created_at2020-10-11 08:00:42.964259
updated_at2023-12-18 18:15:23.695833
descriptionUtility to process H264 profile-level-id values
homepage
repositoryhttps://github.com/nazar-pc/h264-profile-level-id
max_upload_size
id298276
size28,253
Nazar Mokrynskyi (nazar-pc)

documentation

https://docs.rs/h264-profile-level-id

README

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

Commit count: 13

cargo fmt