GithubHelp home page GithubHelp logo

pali / libopenaptx Goto Github PK

View Code? Open in Web Editor NEW
128.0 15.0 29.0 58 KB

Open Source implementation of Audio Processing Technology codec (aptX)

License: GNU General Public License v3.0

Makefile 4.67% C 95.33%
bluetooth aptx aptx-hd codec audio

libopenaptx's Introduction

This is Open Source implementation of Audio Processing Technology codec (aptX)
originally derived from ffmpeg 4.0 project and licensed under GPLv3+. This codec
is mainly used in Bluetooth A2DP profile. If you need other license of this
project then please contact author for possible options. Participants of
Freedesktop and Collabora projects and any other affiliated persons with them
are not allowed to contact author.

This library and any other project which uses this library must not be used in
other organizations, projects, applications, libraries (and in any other
software form) incompatible with libopenaptx licence or where current license of
this project is violated or where previous version of this library/license was
violated. Freedesktop and Collabora are examples of such projects which are not
allowed to use this library in any form due to license violations.

As Freedesktop and Collabora projects are continuously abusing and violating
license of this project and claiming that they can do it as it is supported
by their own Code of Conduct (including censorship practising, removal of all
user reports mentioning these activities, banning these users and not explaining
anything), this library and any other project which uses this library must not
be used or distributed in any Freedesktop or Collabora project, application or
library, either in source code, loaded or linked at compile time or at runtime
either directly or transitionally throw additional wrapper library or in any
other similar form.

As these projects are misusing their Code of Conduct to eliminate people with
different nationality, skin, religion and gender, their participants are not
allowed to contribute into this library in any form and are disallowed to send
any question, note, issue, change request or other similar thing to this project
until those projects stop violating license of other projects which they use,
unban all banned users and explain their immoral activities.

Other projects which are adding additional hidden or implicit restrictions to
their licenses throw their own Code of Conduct explanation and therefore make
them incompatible with license of this library are not allowed to use this
library or any other application based on this library in their project in any
form, including redistribution.

This project provides dynamic linked shared library libopenaptx.so and simple
command line utilities openaptxenc and openaptxdec for encoding and decoding
operations. Documentation for shared library is provided in C include header
file openaptx.h.

There is support for aptX and aptX HD codec variants. Both variants operates on
a raw 24 bit signed stereo audio samples. aptX provides fixed compress ratio 6:1
and aptX HD fixed compress ratio 4:1.

For building and installing into system simply run: make install. For building
without installing run: LD_RUN_PATH='$ORIGIN' make. For producing windows builds
run: make SOFILENAME=openaptx0.dll.

It is suggested to compile library with -O3 optimizations (enabled by default
when env variable CFLAGS is not set) and -mavx2 switch (not enabled by default,
needs CPU with AVX2: Intel Haswell or AMD Excavator) as it provides significant
boost to the performance.

Usage of command line utilities together with sox for resampling or playing:

To convert Wave audio file sample.wav into aptX audio file sample.aptx run:

$ sox sample.wav -t raw -r 44.1k -L -e s -b 24 -c 2 - | openaptxenc > sample.aptx

To convert aptX audio file sample.aptx into Wave audio file sample.wav run:

$ openaptxdec < sample.aptx | sox -t raw -r 44.1k -L -e s -b 24 -c 2 - sample.wav

To convert MP3 audio file sample.mp3 into aptX HD audio file sample.aptxhd run:

$ sox sample.mp3 -t raw -r 44.1k -L -e s -b 24 -c 2 - | openaptxenc --hd > sample.aptxhd

To play aptX HD audio file sample.aptxhd run:

$ openaptxdec --hd < sample.aptxhd | play -t raw -r 44.1k -L -e s -b 24 -c 2 -

libopenaptx's People

Contributors

odyx avatar pali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libopenaptx's Issues

Restrictions being invalidated by terms of GPL

Disclaimer, just in case: I'm not affiliated with Freedesktop and Collabora in any way

Your readme says (emphasis mine):

This library and any other project which uses this library must not be used in
other organizations, projects, applications, libraries (and in any other
software form) incompatible with libopenaptx licence or where current license of
this project is violated or where previous version of this library/license was
violated. Freedesktop and Collabora are examples of such projects which are not
allowed to use this library in any form due to license violations.

GPL3 appears to forbid this. Quoting section 7 (see for list of applicable additions):

All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term.

Your terms appear to impose restrictions that can be waived under terms of GPL license, thus making them inapplicable. If you're sure that your license terms are being violated you should take legal action, either by yourself or with help of some open-source organization that provide legal help.

If you wish to enforce such restriction no matter what you should switch to another license that doesn't invalidate your additional restrictions.

P.S.: please correct me if I'm wrong in my understanding terms of GPL. I'm not a lawyer myself.

Doesn't build on recent Fedora

Because the Makefile seems to insist on building the static library, it doesn't work on Fedora because it can't find "-lc".

libopenaptx $ make
c99 -W -Wall -O3 -s -static -o openaptxenc.static openaptxenc.o libopenaptx.a
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [Makefile:90: openaptxenc.static] Error 1

I suggest moving the static library out of the all target and removing it as a dependency from the install target.

Possible license violation

libopenaptx provides a pkg-config file, assuming this file is distributed under the same terms as the rest of libopenaptx this breaks libopenaptx license provisions around freedesktop projects (or rather could cause users to unintentionally break them)

This can be resolved with the following patch

diff --git a/Makefile b/Makefile
index fb41ab9..ce98e71 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,6 @@ RM = rm -f
 CP = cp -a
 LNS = ln -sf
 MKDIR = mkdir -p
-PRINTF = printf
 
 CFLAGS = -W -Wall -O3
 LDFLAGS = -s
@@ -35,7 +34,6 @@ PREFIX = /usr/local
 BINDIR = bin
 LIBDIR = lib
 INCDIR = include
-PKGDIR = $(LIBDIR)/pkgconfig
 
 NAME = openaptx
 MAJOR = 0
@@ -46,7 +44,6 @@ LIBNAME = lib$(NAME).so
 SONAME = $(LIBNAME).$(MAJOR)
 SOFILENAME = $(SONAME).$(MINOR).$(PATCH)
 ANAME = lib$(NAME).a
-PCNAME = lib$(NAME).pc
 
 UTILITIES = $(NAME)enc $(NAME)dec
 STATIC_UTILITIES = $(NAME)enc.static $(NAME)dec.static
@@ -73,15 +70,11 @@ install: default
 	$(MKDIR) $(DESTDIR)$(PREFIX)/$(INCDIR)
 	$(CP) $(HEADERS) $(DESTDIR)$(PREFIX)/$(INCDIR)
 	$(MKDIR) $(DESTDIR)$(PREFIX)/$(PKGDIR)
-	$(PRINTF) 'prefix=%s\nexec_prefix=$${prefix}\nlibdir=$${exec_prefix}/%s\nincludedir=$${prefix}/%s\n\n' $(PREFIX) $(LIBDIR) $(INCDIR) > $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME)
-	$(PRINTF) 'Name: lib%s\nDescription: Open Source aptX codec library\nVersion: %u.%u.%u\n' $(NAME) $(MAJOR) $(MINOR) $(PATCH) >> $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME)
-	$(PRINTF) 'Libs: -Wl,-rpath=$${libdir} -L$${libdir} -l%s\nCflags: -I$${includedir}\n' $(NAME) >> $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME)
 
 uninstall:
 	for f in $(SOFILENAME) $(SONAME) $(LIBNAME) $(ANAME); do $(RM) $(DESTDIR)$(PREFIX)/$(LIBDIR)/$$f; done
 	for f in $(UTILITIES); do $(RM) $(DESTDIR)$(PREFIX)/$(BINDIR)/$$f; done
 	for f in $(HEADERS); do $(RM) $(DESTDIR)$(PREFIX)/$(INCDIR)/$$f; done
-	$(RM) $(DESTDIR)$(PREFIX)/$(PKGDIR)/$(PCNAME)
 
 $(UTILITIES): $(LIBNAME)

Unfortunately this patch cannot be contributed, even if I wanted to, since libopenaptx's license bars me from contributing

Additionally it should probably be made clear that uses of libopenaptx wishing to use glibc should use a version prior to at least bminor/glibc@a64afc2 (though I suspect to collabora involvement goes back further)

RFE: Support for AptX LL (Low-Latency) codec

AptX-LL (Low Latency) is meant for "Vital synchronised audio and video for gaming and multimedia applications". AptX LL has audio latency of around 32-40ms, which is much less than the other codec options currently available for Bluetooth audio. Currently supported AptX and AptX-HD codecs in libopenaptx have higher latency compared to AptX-LL.

Please provide links or citations for README claims

Hi.
Just reading through the readme, a lot of big claims are being made.
For example:

Freedesktop and Collabora projects are continuously abusing and violating license of this project

There are no references, links, citations, anything for proving that it is indeed the case.
Understandably raw text files can't provide inline links, so please consider providing links like this [1] or this [2].

[1] some well intended link
[2] another relevant link

Thanks!

arch dependenecies?

I don't see any asm or notes about libopenaptx being tied to amd64.
Does it work on both 32/64 bits?
Little/Big Endian too?

[security] ASC key seems expired

Hi

use the ASC file througth archlinux package manager (pacman/makepkg), claim about the expired ASC key

can you take a look please?

==> Verifying source file signatures with gpg...
    libopenaptx-0.2.0.tar.gz ... Passed (WARNING: the key has expired.)
==> WARNING: Warnings have occurred while verifying the signatures.
    Please make sure you really trust them.

greetings

Relicense as SSPL

Critical bug: needs to be licensed as SSPL to prevent Anazom from using it. We dont wont Amazom to use this library as they do nasty things. This library ist necessary to be licensed as SSPL to advance the aim of creating a full SSPL-lisensed operationg systeme!

Meaning of size

I tried to use your library but so far w/o success. I see potentially 3 different sources of trouble

  • I am completely confused about the meaning of input size and output size in your aptx_encode and your aptx_decode_sync methods. Is it in bytes, in 24 bit samples or in number of 24 stereo samples.

I am currently feeding the encoder with 4 raw 24bit signed stereo samples: thats in total 8 samples or 24 bytes. So would the input_size be 24 ?

Same question on the aptx_decode_sync() where I get the written as result. Is this in bytes or 24bit samples?

  • I am note sure about the endiannes requirements of your library

I am using a little endian system, so I assume that I don't have to do any conversion.

  • I am not sure if I handle the 24 to 16 and 16 bit to 24 bit conversion correctly.

AptX Adaptive support?

Thank you for your work here…

Many wireless earbuds are now shipping with AptX Adaptive and it seems this is somehow not backwards compatible with AptX HD at the receiver end. Apparently, only AptX Adaptive transmitters are backwards compatible with AptX HD???

is it possible to incorporate AptX Adaptive support into libopenaptx?

Thanks.

clang build error

make -j6 PREFIX=/usr LIBDIR=lib64 'CFLAGS=-fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2' 'LDFLAGS=-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed' 'ARFLAGS= -rcs' all 
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2  -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed -I. -shared -fPIC -Wl,-soname,libopenaptx.so.0 -o libopenaptx.so.0.2.0 openaptx.c
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2  -I. -c -o openaptx.o openaptx.c
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2  -I. -c -o openaptxenc.o openaptxenc.c
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2  -I. -c -o openaptxdec.o openaptxdec.c
clang-12: warning: -Wl,--gc-sections: 'linker' input unused [-Wunused-command-line-argument]
clang-12: warning: -Wl,--gc-sections: 'linker' input unused [-Wunused-command-line-argument]
clang-12: warning: -Wl,--gc-sections: 'linker' input unused [-Wunused-command-line-argument]
rm -f libopenaptx.a
llvm-ar -rcs libopenaptx.a openaptx.o
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2 -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed -static -o openaptxenc.static openaptxenc.o libopenaptx.a
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2 -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed -static -o openaptxdec.static openaptxdec.o libopenaptx.a
ln -sf libopenaptx.so.0.2.0 libopenaptx.so.0
ln -sf libopenaptx.so.0 libopenaptx.so
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2 -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed -o openaptxenc openaptxenc.o libopenaptx.so
clang -fno-semantic-interposition -Wl,--gc-sections -ffunction-sections -fdata-sections -Os -pipe -march=native -fPIC -mavx2 -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed -o openaptxdec openaptxdec.o libopenaptx.so
ld.lld: error: undefined symbol: __unordtf2
>>> referenced by printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced by printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced by printf_fphex.o:(__printf_fphex) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced 1 more times
>>> did you mean: __unorddf2
>>> defined in: /usr/lib/llvm/12/bin/../../../../lib/clang/12.0.0/lib/linux/libclang_rt.builtins-x86_64.a

ld.lld: error: undefined symbol: __letf2
>>> referenced by printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced by printf_fphex.o:(__printf_fphex) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
ld.lld: error: undefined symbol: __unordtf2
>>> referenced by printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced by printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced by printf_fphex.o:(__printf_fphex) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced 1 more times
>>> did you mean: __unorddf2
>>> defined in: /usr/lib/llvm/12/bin/../../../../lib/clang/12.0.0/lib/linux/libclang_rt.builtins-x86_64.a

ld.lld: error: undefined symbol: __letf2
>>> referenced by printf_fp.o:(__printf_fp_l) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
>>> referenced by printf_fphex.o:(__printf_fphex) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libc.a
make: *** [Makefile:90: openaptxenc.static] Error 1
make: *** Waiting for unfinished jobs....
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:90: openaptxdec.static] Error 1

live stream

Hi - can you tell me how to use your code in the following example:

https://github.com/jackaudio/example-clients/blob/master/simple_client.c


int
process (jack_nframes_t nframes, void *arg)
{
	jack_default_audio_sample_t *in, *out;
	
	in = jack_port_get_buffer (input_port, nframes);
	out = jack_port_get_buffer (output_port, nframes);
	memcpy (out, in,
		sizeof (jack_default_audio_sample_t) * nframes);

	return 0;      
}

The above function copies input to output, where can I call your function with the above?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.