aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 13:05:31 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 13:12:19 +0200
commitdd1f81512d32dec075e896356cf65fbebe11f303 (patch)
tree3aac6364b17bf0b9beec5095302fa50df89d8753
parent4fb7e64da2e13db1d739cb9fe8e553282843fba5 (diff)
mgcp: Make the internal state of the transcoder accessible
For the unit tests we need to look at the internal state.
-rw-r--r--openbsc/include/openbsc/mgcp_transcode.h53
-rw-r--r--openbsc/src/libmgcp/mgcp_transcode.c51
2 files changed, 54 insertions, 50 deletions
diff --git a/openbsc/include/openbsc/mgcp_transcode.h b/openbsc/include/openbsc/mgcp_transcode.h
index 0961634da..cb11cb217 100644
--- a/openbsc/include/openbsc/mgcp_transcode.h
+++ b/openbsc/include/openbsc/mgcp_transcode.h
@@ -19,6 +19,59 @@
#ifndef OPENBSC_MGCP_TRANSCODE_H
#define OPENBSC_MGCP_TRANSCODE_H
+#include "bscconfig.h"
+
+#include <gsm.h>
+#ifdef HAVE_BCG729
+#include <bcg729/decoder.h>
+#include <bcg729/encoder.h>
+#endif
+
+enum audio_format {
+ AF_INVALID,
+ AF_S16,
+ AF_L16,
+ AF_GSM,
+ AF_G729,
+ AF_PCMA
+};
+
+
+struct mgcp_process_rtp_state {
+ /* decoding */
+ enum audio_format src_fmt;
+ union {
+ gsm gsm_handle;
+#ifdef HAVE_BCG729
+ bcg729DecoderChannelContextStruct *g729_dec;
+#endif
+ } src;
+ size_t src_frame_size;
+ size_t src_samples_per_frame;
+
+ /* processing */
+
+ /* encoding */
+ enum audio_format dst_fmt;
+ union {
+ gsm gsm_handle;
+#ifdef HAVE_BCG729
+ bcg729EncoderChannelContextStruct *g729_enc;
+#endif
+ } dst;
+ size_t dst_frame_size;
+ size_t dst_samples_per_frame;
+ int dst_packet_duration;
+
+ int is_running;
+ uint16_t next_seq;
+ uint32_t next_time;
+ int16_t samples[10*160];
+ size_t sample_cnt;
+ size_t sample_offs;
+};
+
+
int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
struct mgcp_rtp_end *dst_end,
struct mgcp_rtp_end *src_end);
diff --git a/openbsc/src/libmgcp/mgcp_transcode.c b/openbsc/src/libmgcp/mgcp_transcode.c
index a5f71faf6..ed5f50be3 100644
--- a/openbsc/src/libmgcp/mgcp_transcode.c
+++ b/openbsc/src/libmgcp/mgcp_transcode.c
@@ -22,64 +22,15 @@
#include <errno.h>
-#include "../../bscconfig.h"
-
#include "g711common.h"
-#include <gsm.h>
-#ifdef HAVE_BCG729
-#include <bcg729/decoder.h>
-#include <bcg729/encoder.h>
-#endif
#include <openbsc/debug.h>
#include <openbsc/mgcp.h>
#include <openbsc/mgcp_internal.h>
+#include <openbsc/mgcp_transcode.h>
#include <osmocom/core/talloc.h>
-enum audio_format {
- AF_INVALID,
- AF_S16,
- AF_L16,
- AF_GSM,
- AF_G729,
- AF_PCMA
-};
-
-struct mgcp_process_rtp_state {
- /* decoding */
- enum audio_format src_fmt;
- union {
- gsm gsm_handle;
-#ifdef HAVE_BCG729
- bcg729DecoderChannelContextStruct *g729_dec;
-#endif
- } src;
- size_t src_frame_size;
- size_t src_samples_per_frame;
-
- /* processing */
-
- /* encoding */
- enum audio_format dst_fmt;
- union {
- gsm gsm_handle;
-#ifdef HAVE_BCG729
- bcg729EncoderChannelContextStruct *g729_enc;
-#endif
- } dst;
- size_t dst_frame_size;
- size_t dst_samples_per_frame;
- int dst_packet_duration;
-
- int is_running;
- uint16_t next_seq;
- uint32_t next_time;
- int16_t samples[10*160];
- size_t sample_cnt;
- size_t sample_offs;
-};
-
int mgcp_transcoding_get_frame_size(void *state_, int nsamples, int dst)
{
struct mgcp_process_rtp_state *state = state_;