mirror of https://github.com/sipwise/rtpengine.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
4.2 KiB
137 lines
4.2 KiB
diff --git a/Makefile b/Makefile
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -3,6 +3,7 @@
|
|
# Paths
|
|
SRC_ENC = lib_enc lib_com
|
|
SRC_DEC = lib_dec lib_com
|
|
+SRC_LIB = lib_dec lib_enc lib_com
|
|
BUILD = build
|
|
|
|
SRC_DIRS = $(sort -u $(SRC_ENC) $(SRC_DEC))
|
|
@@ -10,6 +11,7 @@ SRC_DIRS = $(sort -u $(SRC_ENC) $(SRC_DEC))
|
|
# Name of CLI binaries
|
|
CLI_ENC = EVS_cod
|
|
CLI_DEC = EVS_dec
|
|
+LIB_SO = lib3gpp-evs.so
|
|
|
|
# Default tool settings
|
|
CC = gcc
|
|
@@ -62,13 +64,17 @@ CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR))
|
|
# Source file search paths
|
|
VPATH = $(SRC_DIRS)
|
|
|
|
+CFLAGS += -fPIC
|
|
+
|
|
###############################################################################
|
|
|
|
SRCS_ENC = $(foreach DIR,$(SRC_ENC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
|
|
SRCS_DEC = $(foreach DIR,$(SRC_DEC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
|
|
+SRCS_LIB = $(filter-out encoder.c decoder.c voip_client.c,$(foreach DIR,$(SRC_LIB),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c))))
|
|
|
|
OBJS_ENC = $(addprefix $(BUILD)/,$(SRCS_ENC:.c=.o))
|
|
OBJS_DEC = $(addprefix $(BUILD)/,$(SRCS_DEC:.c=.o))
|
|
+OBJS_LIB = $(addprefix $(BUILD)/,$(SRCS_LIB:.c=.o))
|
|
|
|
DEPS = $(addprefix $(BUILD)/,$(SRCS_ENC:.c=.P) $(SRCS_DEC:.c=.P))
|
|
|
|
@@ -76,7 +82,7 @@ DEPS = $(addprefix $(BUILD)/,$(SRCS_ENC:.c=.P) $(SRCS_DEC:.c=.P))
|
|
|
|
.PHONY: all clean clean_all
|
|
|
|
-all: $(CLI_ENC) $(CLI_DEC)
|
|
+all: $(CLI_ENC) $(CLI_DEC) $(LIB_SO)
|
|
|
|
$(BUILD):
|
|
$(QUIET)mkdir -p $(BUILD)
|
|
@@ -87,6 +93,9 @@ $(CLI_ENC): $(OBJS_ENC)
|
|
$(CLI_DEC): $(OBJS_DEC)
|
|
$(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_DEC) -lm -o $(CLI_DEC)
|
|
|
|
+$(LIB_SO): $(OBJS_LIB)
|
|
+ $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_LIB) -lm -shared -o $(LIB_SO)
|
|
+
|
|
clean:
|
|
$(QUIET)$(RM) $(OBJS_ENC) $(OBJS_DEC) $(DEPS)
|
|
$(QUIET)$(RM) $(DEPS:.P=.d)
|
|
diff --git a/lib_com/prot.h b/lib_com/prot.h
|
|
--- a/lib_com/prot.h
|
|
+++ b/lib_com/prot.h
|
|
@@ -624,6 +624,11 @@ short lsp_convert_poly(
|
|
const short L_frame, /* i : flag for up or down conversion */
|
|
const short Opt_AMRWB /* i : flag for the AMR-WB IO mode */
|
|
);
|
|
+unsigned long encoder_size(void);
|
|
+unsigned long encoder_ind_list_size(void);
|
|
+void encoder_set_opts(Encoder_State *st, unsigned long Fs, void *ind_list);
|
|
+void encoder_set_brate(Encoder_State *st, unsigned long brate, unsigned int bwidth,
|
|
+ unsigned int mode, unsigned int amr);
|
|
|
|
short findpulse( /* o : pulse position */
|
|
const short L_frame, /* i : length of the frame */
|
|
@@ -651,6 +656,9 @@ void preemph(
|
|
const short L, /* i : vector size */
|
|
float *mem /* i/o: memory (x[-1]) */
|
|
);
|
|
+unsigned long decoder_size(void);
|
|
+void decoder_set_Fs(Decoder_State *st, unsigned long Fs);
|
|
+void decoder_inc_ini_frame(Decoder_State *st);
|
|
|
|
void cb_shape(
|
|
const short preemphFlag, /* i : flag for pre-emphasis */
|
|
diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c
|
|
--- a/lib_dec/init_dec.c
|
|
+++ b/lib_dec/init_dec.c
|
|
@@ -653,3 +653,16 @@ void destroy_decoder(
|
|
|
|
return;
|
|
}
|
|
+
|
|
+
|
|
+
|
|
+unsigned long decoder_size(void) {
|
|
+ return sizeof(Decoder_State);
|
|
+}
|
|
+void decoder_set_Fs(Decoder_State *st, unsigned long Fs) {
|
|
+ st->output_Fs = Fs;
|
|
+}
|
|
+void decoder_inc_ini_frame(Decoder_State *st) {
|
|
+ if (st->ini_frame < MAX_FRAME_COUNTER)
|
|
+ st->ini_frame++;
|
|
+}
|
|
diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c
|
|
--- a/lib_enc/init_enc.c
|
|
+++ b/lib_enc/init_enc.c
|
|
@@ -729,3 +729,31 @@ void destroy_encoder(
|
|
|
|
return;
|
|
}
|
|
+
|
|
+
|
|
+
|
|
+unsigned long encoder_size(void) {
|
|
+ return sizeof(Encoder_State);
|
|
+}
|
|
+void encoder_set_opts(Encoder_State *st, unsigned long Fs, void *ind_list) {
|
|
+ st->input_Fs = Fs;
|
|
+ st->ind_list = ind_list;
|
|
+ st->rf_fec_indicator = 1;
|
|
+ st->last_codec_mode = st->codec_mode;
|
|
+}
|
|
+void encoder_set_brate(Encoder_State *st, unsigned long brate, unsigned int bwidth,
|
|
+ unsigned int mode, unsigned int amr) {
|
|
+ if (brate == 5900) {
|
|
+ st->Opt_SC_VBR = 1;
|
|
+ brate = 7200;
|
|
+ }
|
|
+ else
|
|
+ st->Opt_SC_VBR = 0;
|
|
+ st->total_brate = brate;
|
|
+ st->codec_mode = mode;
|
|
+ st->Opt_AMR_WB = amr;
|
|
+ st->max_bwidth = bwidth;
|
|
+}
|
|
+unsigned long encoder_ind_list_size(void) {
|
|
+ return sizeof(Indice) * MAX_NUM_INDICES;
|
|
+}
|