summaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_mgcp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-03-13 14:33:37 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-06-05 14:00:47 +0200
commit136a319e910eec81ea9ff8f8a34c324557109d03 (patch)
treeaa8cc97a2b675a0aaeec42653ae2cc201994fcaf /openbsc/src/osmo-bsc_mgcp
parent239a853f40879a68487057fbcd0a09a8d3625185 (diff)
mgcp: Add CLI tool to test audio conversion
This tool uses mgcp_transcode.c to convert audio data from stdin to stdout. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/osmo-bsc_mgcp')
-rw-r--r--openbsc/src/osmo-bsc_mgcp/mgcp_transcode.c13
-rw-r--r--openbsc/src/osmo-bsc_mgcp/mgcp_transcode.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.c b/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.c
index cadc8769e..91c0c383c 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.c
@@ -72,6 +72,19 @@ struct mgcp_process_rtp_state {
size_t dst_samples_per_frame;
};
+int mgcp_transcoding_get_frame_size(void *state_, int nsamples, int dst)
+{
+ struct mgcp_process_rtp_state *state = state_;
+ if (dst)
+ return (nsamples >= 0 ?
+ nsamples / state->dst_samples_per_frame :
+ 1) * state->dst_frame_size;
+ else
+ return (nsamples >= 0 ?
+ nsamples / state->src_samples_per_frame :
+ 1) * state->src_frame_size;
+}
+
static enum audio_format get_audio_format(const struct mgcp_rtp_end *rtp_end)
{
if (rtp_end->subtype_name) {
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.h b/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.h
index 2dfb06abf..0961634da 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.h
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_transcode.h
@@ -31,4 +31,6 @@ void mgcp_transcoding_net_downlink_format(struct mgcp_endpoint *endp,
int mgcp_transcoding_process_rtp(struct mgcp_endpoint *endp,
struct mgcp_rtp_end *dst_end,
char *data, int *len, int buf_size);
+
+int mgcp_transcoding_get_frame_size(void *state_, int nsamples, int dst);
#endif /* OPENBSC_MGCP_TRANSCODE_H */