| 1 |
declare module 'h264-profile-level-id' |
| 2 |
{ |
| 3 |
export const ProfileConstrainedBaseline: number; |
| 4 |
export const ProfileBaseline: number; |
| 5 |
export const ProfileMain: number; |
| 6 |
export const ProfileConstrainedHigh: number; |
| 7 |
export const ProfileHigh: number; |
| 8 |
|
| 9 |
// All values are equal to ten times the level number, except level 1b which is |
| 10 |
// special. |
| 11 |
|
| 12 |
/* eslint-disable camelcase, @typescript-eslint/camelcase */ |
| 13 |
export const Level1_b: number; |
| 14 |
export const Level1: number; |
| 15 |
export const Level1_1: number; |
| 16 |
export const Level1_2: number; |
| 17 |
export const Level1_3: number; |
| 18 |
export const Level2: number; |
| 19 |
export const Level2_1: number; |
| 20 |
export const Level2_2: number; |
| 21 |
export const Level3: number; |
| 22 |
export const Level3_1: number; |
| 23 |
export const Level3_2: number; |
| 24 |
export const Level4: number; |
| 25 |
export const Level4_1: number; |
| 26 |
export const Level4_2: number; |
| 27 |
export const Level5: number; |
| 28 |
export const Level5_1: number; |
| 29 |
export const Level5_2: number; |
| 30 |
/* eslint-enable camelcase, @typescript-eslint/camelcase */ |
| 31 |
|
| 32 |
// eslint-disable-next-line @typescript-eslint/no-empty-interface |
| 33 |
export interface ProfileLevelId {} |
| 34 |
|
| 35 |
/** |
| 36 |
* Parse profile level id that is represented as a string of 3 hex bytes. |
| 37 |
* Nothing will be returned if the string is not a recognized H264 profile |
| 38 |
* level id. |
| 39 |
*/ |
| 40 |
export function parseProfileLevelId(str: string): ProfileLevelId |
| 41 |
|
| 42 |
/** |
| 43 |
* Returns canonical string representation as three hex bytes of the profile |
| 44 |
* level id, or returns nothing for invalid profile level ids. |
| 45 |
*/ |
| 46 |
// eslint-disable-next-line camelcase, @typescript-eslint/camelcase |
| 47 |
export function profileLevelIdToString(profile_level_id: ProfileLevelId): string |
| 48 |
|
| 49 |
/** |
| 50 |
* Parse profile level id that is represented as a string of 3 hex bytes |
| 51 |
* contained in an SDP key-value map. A default profile level id will be |
| 52 |
* returned if the profile-level-id key is missing. Nothing will be returned if |
| 53 |
* the key is present but the string is invalid. |
| 54 |
*/ |
| 55 |
export function parseSdpProfileLevelId(params: object): ProfileLevelId |
| 56 |
|
| 57 |
/** |
| 58 |
* Returns true if the parameters have the same H264 profile, i.e. the same |
| 59 |
* H264 profile (Baseline, High, etc). |
| 60 |
* |
| 61 |
*/ |
| 62 |
export function isSameProfile(params1: object, params2: object): boolean |
| 63 |
|
| 64 |
/** |
| 65 |
* Generate codec parameters that will be used as answer in an SDP negotiation |
| 66 |
* based on local supported parameters and remote offered parameters. Both |
| 67 |
* local_supported_params and remote_offered_params represent sendrecv media |
| 68 |
* descriptions, i.e they are a mix of both encode and decode capabilities. In |
| 69 |
* theory, when the profile in local_supported_params represent a strict superset |
| 70 |
* of the profile in remote_offered_params, we could limit the profile in the |
| 71 |
* answer to the profile in remote_offered_params. |
| 72 |
* |
| 73 |
* However, to simplify the code, each supported H264 profile should be listed |
| 74 |
* explicitly in the list of local supported codecs, even if they are redundant. |
| 75 |
* Then each local codec in the list should be tested one at a time against the |
| 76 |
* remote codec, and only when the profiles are equal should this function be |
| 77 |
* called. Therefore, this function does not need to handle profile intersection, |
| 78 |
* and the profile of local_supported_params and remote_offered_params must be |
| 79 |
* equal before calling this function. The parameters that are used when |
| 80 |
* negotiating are the level part of profile-level-id and level-asymmetry-allowed. |
| 81 |
* |
| 82 |
*/ |
| 83 |
export function generateProfileLevelIdForAnswer( |
| 84 |
// eslint-disable-next-line camelcase, @typescript-eslint/camelcase |
| 85 |
local_supported_params: object, |
| 86 |
// eslint-disable-next-line camelcase, @typescript-eslint/camelcase |
| 87 |
remote_offered_params: object |
| 88 |
): string |
| 89 |
} |