1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
APP := lib$(PROJECT)_$(MARCH).$(EXT)
THIRDPARTIES_INC := ../thirdparties/android/include
THIRDPARTIES_INC_COMMON := ../thirdparties/common/include
THIRDPARTIES_LIB := ../thirdparties/android/lib
THIRDPARTIES_MARCH_LIB := ../thirdparties/android/lib/$(MARCH)
##########
# Before starting to set parmeters we will override those provided by the user
#
ifeq ($(LICENSE),lgpl)
H264 := no
endif
##########
# Set LD and CFLAGS according to the user parameters
#
# FFMPEG (Default: enabled)
ifeq ($(FFMPEG), no)
FFMPEG_CFLAGS := -DHAVE_FFMPEG=0
FFMPEG_LDFLAGS :=
else
FFMPEG_CFLAGS := -DHAVE_FFMPEG=1
FFMPEG_LDFLAGS := -lavutil-$(LICENSE) -lswscale-$(LICENSE) -lavcore-$(LICENSE) -lavcodec-$(LICENSE)
endif
# LibYUV (Default: enabled)
ifeq ($(LIBYUV), no)
LIBYUV_CFLAGS := -DHAVE_LIBYUV=0
LIBYUV_LDFLAGS :=
else
LIBYUV_CFLAGS := -DHAVE_LIBYUV=1 -I$(THIRDPARTIES_INC_COMMON)/libyuv
LIBYUV_LDFLAGS := -lyuv_$(MARCH)
endif
# H264 (Default: enabled)
ifeq ($(H264),no) # TODO: should depend on FFMPEG
FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_H264=0
else
FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_H264=1
FFMPEG_LDFLAGS := $(FFMPEG_LDFLAGS) -lx264
endif
# THEORA (Default: enabled)
ifeq ($(THEORA),no) # TODO: should depend on FFMPEG
FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_THEORA=0
else
FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_THEORA=1
FFMPEG_LDFLAGS := $(FFMPEG_LDFLAGS) -ltheora -logg
endif
# VP8 (Default: disabled because of NEON)
ifeq ($(VPX),yes)
VPX_CFLAGS := -DHAVE_LIBVPX=1
VPX_LDFLAGS := -lvpx_$(MARCH)
else
VPX_CFLAGS := -DHAVE_LIBVPX=0
endif
# OPUS (Default: enabled)
ifeq ($(OPUS), no)
OPUS_CFLAGS := -DHAVE_LIBOPUS=0
else
OPUS_CFLAGS := -DHAVE_LIBOPUS=1
OPUS_LDFLAGS := -lopus
endif
# AMR (Default: enabled)
ifeq ($(OPENCORE_AMR), no)
OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=0
else
OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=1
OPENCORE_AMR_LDFLAGS := -lopencore-amrnb
endif
# SPEEX_DSP (Default: disabled)
ifeq ($(SPEEX_DSP), yes)
SPEEX_DSP_CFLAGS := -DHAVE_SPEEX_DSP=1
SPEEX_DSP_LDFLAGS := -lspeexdsp
# Speex audio resampler (Default: enabled)
ifneq ($(SPEEX_RESAMPLER), no)
SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_RESAMPLER=1
else
SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_RESAMPLER=0
endif
# Speex audio/video jitterbuffer (Default: enabled)
ifneq ($(SPEEX_JB), no)
SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_JB=1
else
SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_JB=0
endif
# Speex audio denoiser (Default: disabled)
ifeq ($(SPEEX_DENOISE), yes)
SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_DENOISE=1
else
SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_DENOISE=0
endif
else
SPEEX_DSP_CFLAGS := -DHAVE_SPEEX_DSP=0
endif
# SPEEX (Default: disabled)
ifeq ($(SPEEX), yes)
SPEEX_CFLAGS := -DHAVE_LIB_SPEEX=1
SPEEX_LDFLAGS := -lspeex
else
SPEEX_CFLAGS := -DHAVE_LIB_SPEEX=0
endif
# Google WebRTC (Default: enabled)
ifeq ($(WEBRTC), yes)
WEBRTC_CFLAGS := -DHAVE_WEBRTC=1
WEBRTC_LDFLAGS := -lwebrtc_aec_$(MARCH) -lwebrtc_spl_$(MARCH) -lwebrtc_apm_utility_$(MARCH) -lwebrtc_nsx_$(MARCH) -lwebrtc_system_wrappers_$(MARCH)
else
WEBRTC_CFLAGS := -DHAVE_WEBRTC=0
endif
ifeq ($(WEBRTC_DENOISE), yes)
WEBRTC_CFLAGS += -DHAVE_WEBRTC_DENOISE=1
endif
# ILBC (Default: disabled)
ifeq ($(ILBC), yes)
ILBC_CFLAGS := -DHAVE_ILBC=1
ILBC_LDFLAGS := -liLBC
else
ILBC_CFLAGS := -DHAVE_ILBC=0
endif
# GSM (Default: enabled)
ifeq ($(LIBGSM),no)
LIBGSM_CFLAGS := -DHAVE_LIBGSM=0
else
LIBGSM_CFLAGS := -DHAVE_LIBGSM=1
LIBGSM_LDFLAGS := -lgsm
endif
# BV16 (Always disabled)
#BV16_CFLAGS := -DHAVE_BV16=0 -I$(THIRDPARTIES_INC)/BroadVoice16/bv16 -I$(THIRDPARTIES_INC)/BroadVoice16/bvcommon
#BV16_LDFLAGS := -lbv16
# G.729 (Default: Disabled)
ifeq ($(G729), yes)
G729_CFLAGS := -DHAVE_G729=1 -DG729_ENABLE_VAD=0 -D__unix__
G729_LDFLAGS := -lg729b_$(MARCH)
# Reset all other ITU CODECS
OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=0
OPENCORE_AMR_LDFLAGS :=
BV16_CFLAGS := -DHAVE_BV16=0
BV16_LDFLAGS :=
else
G729_CFLAGS := -DHAVE_G729=0
G729_LDFLAGS :=
endif
# SRTP (Default: enabled)
ifeq ($(SRTP),no)
LIBSRTP_CFLAGS := -DHAVE_SRTP=0
else
LIBSRTP_CFLAGS := -DHAVE_SRTP=1
LIBSRTP_LDFLAGS := -lsrtp
endif
################################
CFLAGS := $(CFLAGS_LIB) -I$(THIRDPARTIES_INC) -I$(THIRDPARTIES_INC_COMMON) $(ILBC_CFLAGS) $(LIBGSM_CFLAGS) \
$(FFMPEG_CFLAGS) $(LIBYUV_CFLAGS) $(VPX_CFLAGS) $(SPEEX_CFLAGS) $(SPEEX_DSP_CFLAGS) $(WEBRTC_CFLAGS) $(OPUS_CFLAGS) $(OPENCORE_AMR_CFLAGS) $(BV16_CFLAGS) $(G729_CFLAGS) \
$(LIBSRTP_CFLAGS) \
-I../tinySAK/src -I../tinyNET/src -I../tinyIPSec/src -I../tinySDP/include -I../tinyRTP/include -I../tinyMEDIA/include -I../tinyMSRP/include -I./include \
-DJB_HISTORY_SIZE=500
LDFLAGS := $(LDFLAGS_LIB) -L$(THIRDPARTIES_LIB) -L$(THIRDPARTIES_MARCH_LIB) \
$(FFMPEG_LDFLAGS) $(LIBYUV_LDFLAGS) $(VPX_LDFLAGS) $(SPEEX_LDFLAGS) $(SPEEX_DSP_LDFLAGS) $(WEBRTC_LDFLAGS) $(OPUS_LDFLAGS) $(OPENCORE_AMR_LDFLAGS) $(ILBC_LDFLAGS) $(LIBGSM_LDFLAGS) $(BV16_LDFLAGS) $(G729_LDFLAGS) \
$(LIBSRTP_LDFLAGS) \
-ltinySAK_$(MARCH) -ltinyNET_$(MARCH) -ltinyIPSec_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -lm -lgcc
all: $(APP)
OBJS = \
src/tdav.o \
src/tdav_session_av.o
### audio
OBJS += src/audio/tdav_consumer_audio.o \
src/audio/tdav_speakup_jitterbuffer.o \
src/audio/tdav_jitterbuffer.o \
src/audio/tdav_producer_audio.o \
src/audio/tdav_session_audio.o \
src/audio/tdav_speex_denoise.o \
src/audio/tdav_speex_jitterbuffer.o \
src/audio/tdav_speex_resampler.o \
src/audio/tdav_webrtc_denoise.o
### video
OBJS += src/video/tdav_consumer_video.o \
src/video/tdav_converter_video.o \
src/video/tdav_runnable_video.o \
src/video/tdav_session_video.o \
src/video/jb/tdav_video_frame.o \
src/video/jb/tdav_video_jb.o
### T.140
OBJS += src/t140/tdav_consumer_t140.o \
src/t140/tdav_producer_t140.o \
src/t140/tdav_session_t140.o
### msrp
OBJS += src/msrp/tdav_consumer_msrp.o \
src/msrp/tdav_producer_msrp.o \
src/msrp/tdav_session_msrp.o
### codecs (OPUS)
OBJS += src/codecs/opus/tdav_codec_opus.o
### codecs (AMR)
OBJS += src/codecs/amr/tdav_codec_amr.o
### codecs (G.711)
OBJS += src/codecs/g711/g711.o \
src/codecs/g711/tdav_codec_g711.o
### codecs (G.722)
OBJS += src/codecs/g722/g722_decode.o \
src/codecs/g722/g722_encode.o \
src/codecs/g722/tdav_codec_g722.o
### codecs (G.729)
OBJS += src/codecs/g729/tdav_codec_g729.o
### codecs (GSM)
OBJS += src/codecs/gsm/tdav_codec_gsm.o
### codecs (BV16)
OBJS += src/codecs/bv/tdav_codec_bv16.o \
src/codecs/bv/tdav_codec_bv32.o
### codecs (iLBC)
OBJS += src/codecs/ilbc/tdav_codec_ilbc.o
### codecs (Speex)
OBJS += src/codecs/speex/tdav_codec_speex.o
### codecs (DTMF)
OBJS += src/codecs/dtmf/tdav_codec_dtmf.o
### codecs (FEC)
OBJS += src/codecs/fec/tdav_codec_red.o \
src/codecs/fec/tdav_codec_ulpfec.o
### codecs (H.261)
OBJS += src/codecs/h261/tdav_codec_h261.o
### codecs (H.263)
OBJS += src/codecs/h263/tdav_codec_h263.o
### codecs (H.264)
OBJS += src/codecs/h264/tdav_codec_h264.o \
src/codecs/h264/tdav_codec_h264_rtp.o
### codecs (Theora)
OBJS += src/codecs/theora/tdav_codec_theora.o
### codecs (VPX)
OBJS += src/codecs/vpx/tdav_codec_vp8.o
### codecs (MP4V-ES)
OBJS += src/codecs/mp4ves/tdav_codec_mp4ves.o
### codecs (MSRP)
OBJS += src/codecs/msrp/tdav_codec_msrp.o
### T.140
OBJS += src/codecs/t140/tdav_codec_t140.o
$(APP): $(OBJS)
ifeq ($(EXT), a)
$(AR) rcs $@ $^
else
$(CC) $(LDFLAGS) -o $@ $^
endif
%.o: %.c
$(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@
%.o: %.cxx
$(CPP) -c $(INCLUDE) $(CFLAGS) $< -o $@
install: $(APP)
$(ANDROID_SDK_ROOT)/tools/adb remount
$(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(LIB_DIR)/$(APP)
$(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(LIB_DIR)/$(APP)
clean:
@rm -f $(OBJS) $(APP)
|