Crates.io | h264-profile-level-id |
lib.rs | h264-profile-level-id |
version | 0.2.0 |
source | src |
created_at | 2020-10-11 08:00:42.964259 |
updated_at | 2023-12-18 18:15:23.695833 |
description | Utility to process H264 profile-level-id values |
homepage | |
repository | https://github.com/nazar-pc/h264-profile-level-id |
max_upload_size | |
id | 298276 |
size | 28,253 |
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.
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()),
);
}
Feel free to create issues and send pull requests, they are highly appreciated!
ISC