profileLevelIdToString static method
Returns canonical string representation as three hex bytes of the profile level id, or returns nothing for invalid profile level ids. @param {ProfileLevelId} profile_level_id @returns {String}
Implementation
static String? profileLevelIdToString(ProfileLevelId profile_level_id) {
// Handle special case level == 1b.
if (profile_level_id.level == Level1_b) {
switch (profile_level_id.profile) {
case ProfileConstrainedBaseline: return '42f00b';
case ProfileBaseline: return '42100b';
case ProfileMain: return '4d100b';
// level 1_b is not allowed for other profiles.
default: {
print('profileLevelidToString() | Level 1_b not is allowed for profile:${profile_level_id.profile}');
return null;
}
}
}
String profile_idc_iop_string;
switch(profile_level_id.profile) {
case ProfileConstrainedBaseline: {
profile_idc_iop_string = '42e0';
break;
}
case ProfileBaseline: {
profile_idc_iop_string = '4200';
break;
}
case ProfileMain: {
profile_idc_iop_string = '4d00';
break;
}
case ProfileConstrainedHigh: {
profile_idc_iop_string = '640c';
break;
}
case ProfileHigh: {
profile_idc_iop_string = '6400';
break;
}
default: {
print('profileLevelIdToString() | unrecognized profile:${profile_level_id.profile}');
return null;
}
}
String levelStr = profile_level_id.level.toRadixString(16);
if (levelStr.length == 1) {
levelStr = '0$levelStr';
}
return '$profile_idc_iop_string$levelStr';
}