pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/29277 )
Change subject: library/AMR: Add RTP AMR helper structs and functions ......................................................................
library/AMR: Add RTP AMR helper structs and functions
Change-Id: I40cd999badeeefa38a393af9008d8ce047e3c778 --- M library/AMR_Types.ttcn 1 file changed, 26 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/library/AMR_Types.ttcn b/library/AMR_Types.ttcn index 3ef2fbc..b4f044d 100644 --- a/library/AMR_Types.ttcn +++ b/library/AMR_Types.ttcn @@ -11,6 +11,7 @@ module AMR_Types {
import from General_Types all; +import from Osmocom_Types all;
/* AMR voice frame type identifiers * See also 3GPP TS 26.101, Table 1a: Interpretation of Frame Type, Mode @@ -35,4 +36,29 @@ return c_AMRFT_len[amr_ft]; }
+type record RTP_AMR_Hdr { + uint4_t cmr, + BIT4 padding1, + BIT1 f, + uint4_t ft, + BIT1 q, + BIT2 padding2 +} with { variant "FIELDORDER(msb)" }; + +template (value) RTP_AMR_Hdr ts_RTP_AMR_Hdr(template (value) uint4_t cmr, + template (value) uint4_t ft, + template (value) BIT1 q := '1'B, + template (value) BIT1 f := '0'B) := { + cmr := cmr, + padding1 := '0000'B, + f := f, + ft := ft, + q := q, + padding2 := '00'B +} +external function enc_RTP_AMR_Hdr(in RTP_AMR_Hdr amr_hdr) return octetstring + with { extension "prototype(convert) encode(RAW)" }; +external function dec_RTP_AMR_Hdr(in octetstring stream) return RTP_AMR_Hdr + with { extension "prototype(convert) decode(RAW)" }; + } with { encode "RAW"}