FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/ietf_fo.c @ 441:ebe499058c63
libtwamr: implement API functions for RFC 4867 I/O
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 May 2024 07:06:31 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
440:bc736a8654af | 441:ebe499058c63 |
---|---|
1 /* | |
2 * The function implemented in this module groks the first octet of | |
3 * an RFC 4867 payload and tells the calling application how many more | |
4 * bytes need to be read, or if the frame type is invalid. | |
5 */ | |
6 | |
7 #include <stdint.h> | |
8 #include "tw_amr.h" | |
9 | |
10 static const uint8_t extra_bytes_per_ft[9] = | |
11 {12, 13, 15, 17, 19, 20, 26, 31, 5}; | |
12 | |
13 int amr_ietf_grok_first_octet(uint8_t fo) | |
14 { | |
15 uint8_t ft; | |
16 | |
17 ft = (fo & 0x78) >> 3; | |
18 if (ft == AMR_FT_NODATA) | |
19 return 0; | |
20 if (ft > MRDTX) | |
21 return -1; | |
22 return extra_bytes_per_ft[ft]; | |
23 } |