Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SattlerF committed Jun 26, 2019
0 parents commit ed52133
Show file tree
Hide file tree
Showing 176 changed files with 52,553 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.iml
.gradle
/.idea
/build
local.properties
750 changes: 750 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DabMpg123DecoderPlugin

This is a Plugin-App to decode MPEG-1 Layer 2 DAB Audio.

## Why

Most Android devices do not provide a decoder for MPEG-1 Layer-2 Audio. Even the MP3 decoders do not decode Layer-2 audio.
The plugin will spawn a service with the defined interface in the "dabaudiodecoderplugininterface".

The used decoder is MPG123 and therefore this plugin uses the same license. See https://www.mpg123.de/

## How

To compile the project to an Android Application (.apk) just import it into Android Studio or issue the 'gradlew' command on Linux/Mac or use the 'gradlew.bat' on Windows.
You need to have the NDK installed.
The compiled APK will be located in the build output folder.


20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}

allprojects {
repositories {
jcenter()
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
2 changes: 2 additions & 0 deletions dabaudiodecoderplugininterface/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.iml
/build
22 changes: 22 additions & 0 deletions dabaudiodecoderplugininterface/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
17 changes: 17 additions & 0 deletions dabaudiodecoderplugininterface/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/sattler/android/android-sdk-linux/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
3 changes: 3 additions & 0 deletions dabaudiodecoderplugininterface/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.irt.dabaudiodecoderplugininterface">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package de.irt.dabaudiodecoderplugininterface;

interface IDabPluginCallback {

void decodedPcmData(in byte[] pcmData);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.irt.dabaudiodecoderplugininterface;

import de.irt.dabaudiodecoderplugininterface.IDabPluginCallback;

interface IDabPluginInterface {

void setCallback(in IDabPluginCallback callback);

void configure(in int codec, in int samplingRate, in int channelCount, in boolean sbr);

void enqueueEncodedData(in byte[] audioData);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">DabPluginInterface</string>
</resources>
4 changes: 4 additions & 0 deletions dabmpg123plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/build
/obj
*.iml
/libs
51 changes: 51 additions & 0 deletions dabmpg123plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "de.irt.dabmpg123decoderplugin"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
}
}

sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}

task ndkBuild(type: Exec) {
def ndkDir = project.android.ndkDirectory.absolutePath
String osName = org.gradle.internal.os.OperatingSystem.current().getName()
if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
commandLine "$ndkDir/ndk-build", '-C', file("$projectDir").absolutePath
} else if (org.gradle.internal.os.OperatingSystem.current().isUnix()) {
//TODO consider UNIX build
} else if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
commandLine "$ndkDir/ndk-build.cmd", '-C', file("$projectDir").absolutePath
} else if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
//TODO consider OSX build
} else {
//unknown OS...Ooops...
}
}

tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':dabaudiodecoderplugininterface')
}
184 changes: 184 additions & 0 deletions dabmpg123plugin/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libmpg123
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS += -O3 -Wall -DHAVE_CONFIG_H \
-fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/src

LOCAL_CFLAGS += \
-DACCURATE_ROUNDING \
-DNO_REAL \
-DNO_32BIT

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS += -mfloat-abi=softfp -mfpu=neon -DOPT_NEON -DREAL_IS_FLOAT
LOCAL_SRC_FILES := \
src/check_neon.S \
src/compat.c \
src/dct64.c \
src/dither.c \
src/equalizer.c \
src/feature.c \
src/format.c \
src/frame.c \
src/icy.c \
src/icy2utf8.c \
src/id3.c \
src/index.c \
src/layer1.c \
src/layer2.c \
src/layer3.c \
src/libmpg123.c \
src/ntom.c \
src/optimize.c \
src/parse.c \
src/readers.c \
src/stringbuf.c \
src/synth.c \
src/synth_8bit.c \
src/tabinit.c \
src/synth_neon.S \
src/synth_neon_accurate.S \
src/synth_stereo_neon.S \
src/synth_stereo_neon_accurate.S \
src/dct64_neon.S \
src/dct64_neon_float.S \
src/dct36_neon.S \
src/synth_arm_accurate.S
endif

ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_CFLAGS += -mfloat-abi=softfp -mfpu=neon -DOPT_NEON64 -DREAL_IS_FLOAT
LOCAL_SRC_FILES := \
src/check_neon.S \
src/compat.c \
src/dct64.c \
src/dither.c \
src/equalizer.c \
src/feature.c \
src/format.c \
src/frame.c \
src/icy.c \
src/icy2utf8.c \
src/id3.c \
src/index.c \
src/layer1.c \
src/layer2.c \
src/layer3.c \
src/libmpg123.c \
src/ntom.c \
src/optimize.c \
src/parse.c \
src/readers.c \
src/stringbuf.c \
src/synth.c \
src/synth_8bit.c \
src/tabinit.c \
src/synth_neon64.S \
src/synth_neon64_accurate.S \
src/synth_stereo_neon64.S \
src/synth_stereo_neon64_accurate.S \
src/dct64_neon64.S \
src/dct64_neon64_float.S \
src/dct36_neon64.S
endif

ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_CFLAGS := -DACCURATE_ROUNDING -DHAVE_STRERROR -DOPT_SSE -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -ffast-math
LOCAL_SRC_FILES := \
src/compat.c \
src/dct64.c \
src/dither.c \
src/equalizer.c \
src/feature.c \
src/format.c \
src/frame.c \
src/icy.c \
src/icy2utf8.c \
src/id3.c \
src/index.c \
src/layer1.c \
src/layer2.c \
src/layer3.c \
src/libmpg123.c \
src/ntom.c \
src/optimize.c \
src/parse.c \
src/readers.c \
src/stringbuf.c \
src/synth.c \
src/synth_8bit.c \
src/tabinit.c \
src/synth_real.c \
src/synth_s32.c \
src/synth_sse.S \
src/synth_sse_accurate.S \
src/synth_sse_float.S \
src/synth_sse_s32.S \
src/synth_stereo_sse_accurate.S \
src/synth_stereo_sse_float.S \
src/synth_stereo_sse_s32.S \
src/dct64_i386.c \
src/dct36_sse.S \
src/dct64_sse.S \
src/dct64_sse_float.S \
src/tabinit_mmx.S
LOCAL_LDLIBS += -Wl,--no-warn-shared-textrel
endif

ifeq ($(TARGET_ARCH_ABI),x86_64)
LOCAL_CFLAGS := -DACCURATE_ROUNDING -DHAVE_STRERROR -DOPT_X86_64 -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -ffast-math
LOCAL_SRC_FILES := \
src/compat.c \
src/dct64.c \
src/dither.c \
src/equalizer.c \
src/feature.c \
src/format.c \
src/frame.c \
src/icy.c \
src/icy2utf8.c \
src/id3.c \
src/index.c \
src/layer1.c \
src/layer2.c \
src/layer3.c \
src/libmpg123.c \
src/ntom.c \
src/optimize.c \
src/parse.c \
src/readers.c \
src/stringbuf.c \
src/synth.c \
src/synth_8bit.c \
src/tabinit.c \
src/synth_real.c \
src/synth_s32.c \
src/getcpuflags_x86_64.S \
src/synth_x86_64.S \
src/synth_x86_64_s32.S \
src/synth_x86_64_accurate.S \
src/synth_x86_64_float.S \
src/synth_stereo_x86_64_float.S \
src/synth_stereo_x86_64.S \
src/synth_stereo_x86_64_s32.S \
src/synth_stereo_x86_64_accurate.S \
src/dct36_x86_64.S \
src/dct64_x86_64.S \
src/dct64_x86_64_float.S
endif

include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := mpg123plug
LOCAL_SRC_FILES := mpg123-jni.cpp
LOCAL_SHARED_LIBRARIES := libmpg123
LOCAL_CFLAGS += -O3
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
4 changes: 4 additions & 0 deletions dabmpg123plugin/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
APP_STL := c++_shared
#Old APP_PLATFORM needed for compatibility
APP_PLATFORM := android-9
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
Loading

0 comments on commit ed52133

Please sign in to comment.