Crate h264_profile_level_id
source ·Expand description
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()),
);
}
Structs
- A container encapsulating both H264 profile and level as parsed from a
profile-level-id
string
Enums
Functions
- Generate codec parameters that will be used as answer in an SDP negotiation based on local supported parameters and remote offered parameters. Both
local_profile_level_id
andremote_profile_level_id
represent sendrecv media descriptions, i.e they are a mix of both encode and decode capabilities. In theory, when the profile inlocal_profile_level_id
represent a strict superset of the profile inremote_profile_level_id
, we could limit the profile in the answer to the profile inremote_profile_level_id
. - Returns
Some
with parsed profiles if stringprofile-level-id
correspond to the same H264 profile (Baseline, High, etc).