summaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-09-27 13:51:51 +0200
committerHarald Welte <laforge@gnumonks.org>2016-09-28 10:34:02 +0000
commit74a8f0831dbcbe40694d19dcf173185593f91be2 (patch)
treeb4c30e9cdac653e65147ead9715485def7c0f124 /include/osmocom
parent8a3409c4b7fefe4333b619498f2cad0c7c3ae81c (diff)
AMR: add function to check speech frames
Add convenience function osmo_amr_is_speech() to check if given AMR frame is speech frame: non-speech frames often require special processing. Change-Id: Ifaab02a2f581acc302b367d34fd2fc28a4d1e2e3
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/codec/codec.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/osmocom/codec/codec.h b/include/osmocom/codec/codec.h
index f7a8ad96..74eca461 100644
--- a/include/osmocom/codec/codec.h
+++ b/include/osmocom/codec/codec.h
@@ -42,6 +42,27 @@ enum osmo_amr_quality {
AMR_GOOD = 1
};
+/*! \brief Check if given AMR Frame Type is a speech frame
+ * \param[in] ft AMR Frame Type
+ * \returns true if AMR with given Frame Type contains voice, false otherwise
+ */
+inline bool osmo_amr_is_speech(enum osmo_amr_type ft)
+{
+ switch (ft) {
+ case AMR_4_75:
+ case AMR_5_15:
+ case AMR_5_90:
+ case AMR_6_70:
+ case AMR_7_40:
+ case AMR_7_95:
+ case AMR_10_2:
+ case AMR_12_2:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool osmo_fr_check_sid(uint8_t *rtp_payload, size_t payload_len);
bool osmo_hr_check_sid(uint8_t *rtp_payload, size_t payload_len);
int osmo_amr_rtp_enc(uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft,