From 95e666404e1e31dfb95d7dc8b00c1b0be88659b3 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Wed, 30 Aug 2017 19:03:49 +0700 Subject: [PATCH] Introduce a shared 'libosmogapk' library The previous GAPK implementation was represented as a single executable. So, all audio transcoding operations were available only by calling the 'gapk' binary. This approach didn't allow external applications to benefit from using GAPK API directly. Since there are some projects (such as GR-GSM and OsmocomBB), which are potential users of GAPK code base, it would be better to have all transcoding functions within a shared library. So, this change separates the common code into a shared library, named 'libosmogapk', and links the 'gapk' binary against one. Currently there are no shared headers, pkg-config manifest and the export map, but they will be done latter. --- src/Makefile.am | 98 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 14 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index e0b622c..93bdfa1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,20 +1,90 @@ -AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir) -AM_CFLAGS=-Wall $(LIBOSMOCODEC_CFLAGS) $(LIBOSMOCORE_CFLAGS) \ - ${OPENCORE_AMRNB_CFLAGS} $(LIBALSA_CFLAGS) -AM_LDFLAGS=$(LIBOSMOCODEC_LIBS) $(LIBOSMOCORE_LIBS) \ - ${OPENCORE_AMRNB_LIBS} ${LIBGSM_LIBS} $(LIBALSA_LIBS) +# This is _NOT_ the library release version, it's an API version. +# Please read Chapter 6 "Library interface versions" of the libtool +# documentation before making any modification +LIBVERSION = 0:0:0 -COM_SOURCES = procqueue.c pq_file.c pq_format.c pq_codec.c pq_rtp.c pq_alsa.c \ - formats.c fmt_amr.c fmt_gsm.c fmt_hr_ref.c fmt_racal.c \ - fmt_amr_opencore.c \ - fmt_rtp_amr.c fmt_rtp_efr.c fmt_rtp_hr_etsi.c fmt_rtp_hr_ietf.c \ - fmt_rawpcm.c fmt_ti.c benchmark.c \ - codecs.c codec_pcm.c codec_hr.c codec_fr.c codec_efr.c codec_amr.c +AM_CPPFLAGS = \ + $(all_includes) \ + -I$(top_builddir) \ + -I$(top_srcdir)/include \ + $(NULL) -bin_PROGRAMS = gapk +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOCODEC_CFLAGS) \ + ${OPENCORE_AMRNB_CFLAGS} \ + $(LIBALSA_CFLAGS) \ + $(NULL) -gapk_SOURCES = main.c $(COM_SOURCES) +lib_LTLIBRARIES = libosmogapk.la + +libosmogapk_la_LDFLAGS = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOCODEC_LIBS) \ + ${OPENCORE_AMRNB_LIBS} \ + ${LIBGSM_LIBS} \ + $(LIBALSA_LIBS) \ + -version-info $(LIBVERSION) \ + -no-undefined \ + $(NULL) if ENABLE_GSMHR -gapk_LDADD = $(top_builddir)/libgsmhr/libgsmhr.la +libosmogapk_la_LIBADD = $(top_builddir)/libgsmhr/libgsmhr.la endif + +# Processing queue implementation +libosmogapk_la_SOURCES = \ + procqueue.c \ + pq_format.c \ + pq_codec.c \ + pq_file.c \ + pq_alsa.c \ + pq_rtp.c \ + $(NULL) + +# Formats implementation +libosmogapk_la_SOURCES += \ + formats.c \ + fmt_ti.c \ + fmt_amr.c \ + fmt_gsm.c \ + fmt_hr_ref.c \ + fmt_racal.c \ + fmt_rawpcm.c \ + fmt_rtp_amr.c \ + fmt_rtp_efr.c \ + fmt_rtp_hr_etsi.c \ + fmt_rtp_hr_ietf.c \ + fmt_amr_opencore.c \ + $(NULL) + +# Codecs implementation +libosmogapk_la_SOURCES += \ + codecs.c \ + codec_pcm.c \ + codec_hr.c \ + codec_fr.c \ + codec_efr.c \ + codec_amr.c \ + $(NULL) + +# Codec benchmarking +libosmogapk_la_SOURCES += \ + benchmark.c \ + $(NULL) + +# libosmogapk representative application +bin_PROGRAMS = gapk + +gapk_SOURCES = \ + main.c \ + $(NULL) + +gapk_LDFLAGS = \ + $(LIBOSMOCORE_LIBS) \ + $(NULL) + +gapk_LDADD = \ + $(top_builddir)/src/libosmogapk.la \ + $(NULL)