diff --git a/audioutils/lame/.gitignore b/audioutils/lame/.gitignore new file mode 100644 index 000000000..746d2f0dd --- /dev/null +++ b/audioutils/lame/.gitignore @@ -0,0 +1 @@ +lame diff --git a/audioutils/lame/CMakeLists.txt b/audioutils/lame/CMakeLists.txt new file mode 100644 index 000000000..d0abfd65c --- /dev/null +++ b/audioutils/lame/CMakeLists.txt @@ -0,0 +1,26 @@ +# ############################################################################## +# apps/audioutils/lame/CMakeLists.txt +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +if(CONFIG_AUDIOUTILS_LAME) + + # call origin build system to generate libmp3lame + nuttx_call_apps_makefile(TARGET lame TARGET_BIN libmp3lame.a) + +endif() diff --git a/audioutils/lame/Kconfig b/audioutils/lame/Kconfig new file mode 100644 index 000000000..47adb3219 --- /dev/null +++ b/audioutils/lame/Kconfig @@ -0,0 +1,8 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config AUDIOUTILS_LAME + bool "Enable LAME MP3 Encoder" + default n diff --git a/audioutils/lame/Make.defs b/audioutils/lame/Make.defs new file mode 100644 index 000000000..632d2a95e --- /dev/null +++ b/audioutils/lame/Make.defs @@ -0,0 +1,23 @@ +############################################################################ +# apps/audioutils/lame/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +ifneq ($(CONFIG_AUDIOUTILS_LAME),) +CONFIGURED_APPS += $(APPDIR)/audioutils/lame +endif diff --git a/audioutils/lame/Makefile b/audioutils/lame/Makefile new file mode 100644 index 000000000..e941b8bd8 --- /dev/null +++ b/audioutils/lame/Makefile @@ -0,0 +1,105 @@ +############################################################################ +# apps/audioutils/lame/Makefile +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +# Download lame if no lame/configure found +lame-svn: + $(Q) echo "svn checkout lame ..." + $(Q) svn checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame + +ifeq ($(wildcard lame/configure),) +context:: lame-svn +distclean:: + $(call DELDIR, lame) +endif + +ifeq ($(DST_PATH),) + include $(APPDIR)/Make.defs + # configure in place + DST_PATH := lame +else + # configure out of tree + DST_PATH := $(realpath $(DST_PATH)) + include $(DST_PATH)/Make.defs + BIN := $(DST_PATH)/libmp3lame.a + # enable Application.mk PREFIX + PREFIX := $(DST_PATH)$(DELIM) +endif + +ifneq ($(CONFIG_ARCH),sim) + CFG_CMDS += --host=$(CONFIG_ARCH) + CFG_CMDS += --cross-prefix=$(CROSSDEV) +endif + +SRC_PATH := lame + +CFLAGS += -DHAVE_CONFIG_H -D'fast_log2=lame_fast_log2' +CFLAGS += $(INCDIR_PREFIX)$(DST_PATH) \ + $(INCDIR_PREFIX)$(SRC_PATH)/include \ + $(INCDIR_PREFIX)$(SRC_PATH)/libmp3lame +CFLAGS += -Wno-address -Wno-array-parameter \ + -Wno-builtin-declaration-mismatch \ + -Wno-incompatible-pointer-types \ + -Wno-implicit-function-declaration -Wno-shadow \ + -Wno-stringop-overflow -Wno-unused-variable \ + -Wno-unused-but-set-variable \ + -msse + +CSRCS += $(SRC_PATH)/libmp3lame/bitstream.c \ + $(SRC_PATH)/libmp3lame/encoder.c \ + $(SRC_PATH)/libmp3lame/fft.c \ + $(SRC_PATH)/libmp3lame/gain_analysis.c \ + $(SRC_PATH)/libmp3lame/id3tag.c \ + $(SRC_PATH)/libmp3lame/lame.c \ + $(SRC_PATH)/libmp3lame/newmdct.c \ + $(SRC_PATH)/libmp3lame/psymodel.c \ + $(SRC_PATH)/libmp3lame/quantize.c \ + $(SRC_PATH)/libmp3lame/vector/xmm_quantize_sub.c \ + $(SRC_PATH)/libmp3lame/quantize_pvt.c \ + $(SRC_PATH)/libmp3lame/set_get.c \ + $(SRC_PATH)/libmp3lame/vbrquantize.c \ + $(SRC_PATH)/libmp3lame/reservoir.c \ + $(SRC_PATH)/libmp3lame/tables.c \ + $(SRC_PATH)/libmp3lame/takehiro.c \ + $(SRC_PATH)/libmp3lame/util.c \ + $(SRC_PATH)/libmp3lame/VbrTag.c \ + $(SRC_PATH)/libmp3lame/version.c \ + $(SRC_PATH)/libmp3lame/presets.c + +LAME_CONFIG_SCRIPT := $(CURDIR)$(DELIM)lame$(DELIM)configure + +$(DST_PATH)/config.h: + $(Q)echo "lame configure... $(CONFIG_ARCH)" + $(Q)cd $(DST_PATH) && $(LAME_CONFIG_SCRIPT) \ + --disable-cpml --disable-decoder --disable-efence \ + --disable-frontend --disable-mp3x --disable-gtktest \ + --disable-ipv6 --disable-rpath --enable-static \ + $(CFG_CMDS) + +context:: $(DST_PATH)/config.h + +ifneq ($(PREFIX),) + @$(eval ALL_SRCS = $(CSRCS)) + @$(foreach src,$(ALL_SRCS),$(shell mkdir -p $(PREFIX)$(dir $(src)))) +endif + +distclean:: + $(Q)cd $(DST_PATH) && make distclean + +include $(APPDIR)/Application.mk