Skip to content

Commit

Permalink
Initial version 0.0.0 of libopenaptx library based on ffmpeg 4.0
Browse files Browse the repository at this point in the history
Besides dynamic shared library there are also two utilities openaptxenc
and openaptxdec for encoding and decoding aptX and aptX HD streams.
  • Loading branch information
pali committed Jul 6, 2018
0 parents commit 5eb6ce6
Show file tree
Hide file tree
Showing 7 changed files with 2,033 additions and 0 deletions.
502 changes: 502 additions & 0 deletions COPYING

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
MAJOR := 0
MINOR := 0
PATCH := 0

PREFIX := /usr/local
BINDIR := bin
LIBDIR := lib
INCDIR := include

LIBNAME := libopenaptx.so
SONAME := $(LIBNAME).$(MAJOR)
FILENAME := $(SONAME).$(MINOR).$(PATCH)

UTILITIES := openaptxenc openaptxdec

HEADERS := openaptx.h

BUILD := $(FILENAME) $(SONAME) $(LIBNAME) $(UTILITIES)

all: $(BUILD)

install: $(BUILD)
mkdir -p $(DESTDIR)/$(PREFIX)/$(LIBDIR)
cp -a $(FILENAME) $(SONAME) $(LIBNAME) $(DESTDIR)/$(PREFIX)/$(LIBDIR)
mkdir -p $(DESTDIR)/$(PREFIX)/$(BINDIR)
cp -a $(UTILITIES) $(DESTDIR)/$(PREFIX)/$(BINDIR)
mkdir -p $(DESTDIR)/$(PREFIX)/$(INCDIR)
cp -a $(HEADERS) $(DESTDIR)/$(PREFIX)/$(INCDIR)

$(FILENAME): openaptx.c $(HEADERS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I. -shared -fPIC -Wl,-soname,$(SONAME) -o $@ $<

$(SONAME): $(FILENAME)
ln -sf $< $@

$(LIBNAME): $(SONAME)
ln -sf $< $@

%: %.c $(LIBNAME) $(HEADERS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I. -o $@ $< $(LIBNAME)

clean:
$(RM) $(BUILD)
30 changes: 30 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
This is Open Source implementation of Audio Processing Technology codec (aptX)
derived from ffmpeg 4.0 project and licensed under LGPLv2.1+. This codec is
mainly used in Bluetooth A2DP profile.

It provides dynamic linked shared library libopenaptx.so and simple command line
utilities openaptxenc and openaptxdec for encoding and decoding operations.
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

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 -s -3 -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 -s -3 -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 -s -3 -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 -s -3 -c 2 -
Loading

0 comments on commit 5eb6ce6

Please sign in to comment.