parent
							
								
									fbfe1cea33
								
							
						
					
					
						commit
						b553ef1bba
					
				| @ -0,0 +1 @@ | ||||
| /build | ||||
| @ -0,0 +1,43 @@ | ||||
| # For more information about using CMake with Android Studio, read the | ||||
| # documentation: https://d.android.com/studio/projects/add-native-code.html | ||||
| 
 | ||||
| # Sets the minimum version of CMake required to build the native library. | ||||
| 
 | ||||
| cmake_minimum_required(VERSION 3.4.1) | ||||
| 
 | ||||
| # Creates and names a library, sets it as either STATIC | ||||
| # or SHARED, and provides the relative paths to its source code. | ||||
| # You can define multiple libraries, and CMake builds them for you. | ||||
| # Gradle automatically packages shared libraries with your APK. | ||||
| 
 | ||||
| add_library( # Sets the name of the library. | ||||
|              mp3-lite | ||||
| 
 | ||||
|              # Sets the library as a shared library. | ||||
|              SHARED | ||||
| 
 | ||||
|              # Provides a relative path to your source file(s). | ||||
|              src/main/cpp/audio_lame.c | ||||
|         ) | ||||
| 
 | ||||
| add_library( mp3lame | ||||
|              SHARED | ||||
|              IMPORTED ) | ||||
| set_target_properties( mp3lame | ||||
|             PROPERTIES IMPORTED_LOCATION | ||||
|             ../../../../libs/${CMAKE_ANDROID_ARCH_ABI}/libmp3lame.so ) | ||||
| 
 | ||||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") | ||||
| 
 | ||||
| include_directories(src/main/cpp) | ||||
| 
 | ||||
| find_library( # Sets the name of the path variable. | ||||
|               log-lib | ||||
|               log ) | ||||
| 
 | ||||
| target_link_libraries( # Specifies the target library. | ||||
|                        mp3-lite | ||||
|                        mp3lame | ||||
|                        # Links the target library to the log library | ||||
|                        # included in the NDK. | ||||
|                        ${log-lib} ) | ||||
| @ -0,0 +1,52 @@ | ||||
| apply plugin: 'com.android.library' | ||||
| apply plugin: 'kotlin-android' | ||||
| apply plugin: 'kotlin-android-extensions' | ||||
| android { | ||||
|     compileSdkVersion rootProject.ext.compileSdkVersion | ||||
|     buildToolsVersion rootProject.ext.buildToolsVersion | ||||
| 
 | ||||
| 
 | ||||
|     defaultConfig { | ||||
|         minSdkVersion rootProject.ext.minSdkVersion | ||||
|         targetSdkVersion rootProject.ext.targetSdkVersion | ||||
|         versionCode rootProject.ext.versionCode | ||||
|         versionName rootProject.ext.versionName | ||||
| 
 | ||||
|         externalNativeBuild { | ||||
|             cmake { | ||||
|                 cppFlags "" | ||||
|             } | ||||
|         } | ||||
|         ndk { | ||||
|             abiFilters "armeabi-v7a", "arm64-v8a" | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     buildTypes { | ||||
|         release { | ||||
|             minifyEnabled false | ||||
|             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     externalNativeBuild { | ||||
|         cmake { | ||||
|             path "CMakeLists.txt" | ||||
|         } | ||||
|     } | ||||
|     sourceSets { | ||||
|         main { | ||||
|             jniLibs.srcDirs = ['libs'] | ||||
|             jni.srcDirs = [] | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| dependencies { | ||||
|     implementation fileTree(dir: 'libs', include: ['*.jar']) | ||||
|     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||||
|     implementation "androidx.appcompat:appcompat:$rootProject.appcompatVersion" | ||||
|     implementation "androidx.core:core-ktx:$rootProject.core_ktx" | ||||
|     implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.lifecycle_ktx" | ||||
|     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||||
| } | ||||
| @ -0,0 +1,21 @@ | ||||
| # Add project specific ProGuard rules here. | ||||
| # You can control the set of applied configuration files using the | ||||
| # proguardFiles setting in build.gradle. | ||||
| # | ||||
| # For more details, see | ||||
| #   http://developer.android.com/guide/developing/tools/proguard.html | ||||
| 
 | ||||
| # 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 *; | ||||
| #} | ||||
| 
 | ||||
| # Uncomment this to preserve the line number information for | ||||
| # debugging stack traces. | ||||
| #-keepattributes SourceFile,LineNumberTable | ||||
| 
 | ||||
| # If you keep the line number information, uncomment this to | ||||
| # hide the original source file name. | ||||
| #-renamesourcefileattribute SourceFile | ||||
| @ -0,0 +1,2 @@ | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     package="com.frank.mp3" /> | ||||
									
										
											File diff suppressed because it is too large
											Load Diff
										
									
								
							
						| @ -1,4 +1,4 @@ | ||||
| package com.frank.ffmpeg.mp3 | ||||
| package com.frank.mp3 | ||||
| 
 | ||||
| class Mp3LameBuilder internal constructor() { | ||||
| 
 | ||||
| @ -0,0 +1,31 @@ | ||||
| package com.frank.mp3; | ||||
| 
 | ||||
| /** | ||||
|  * Mp3Lite: use AudioTrack and OpenSL ES to play audio | ||||
|  * Created by frank on 2018/2/1. | ||||
|  */ | ||||
| 
 | ||||
| public class Mp3Lite { | ||||
|     static { | ||||
|         System.loadLibrary("mp3-lite"); | ||||
|     } | ||||
| 
 | ||||
|     public native static void lameInitDefault(); | ||||
| 
 | ||||
|     public native static void lameInit(int inSamplerate, int outChannel, | ||||
|                                        int outSamplerate, int outBitrate, float scaleInput, int mode, int vbrMode, | ||||
|                                        int quality, int vbrQuality, int abrMeanBitrate, int lowpassFreq, int highpassFreq, String id3tagTitle, | ||||
|                                        String id3tagArtist, String id3tagAlbum, String id3tagYear, | ||||
|                                        String id3tagComment); | ||||
| 
 | ||||
|     public native static int lameEncode(short[] buffer_l, short[] buffer_r, | ||||
|                                         int samples, byte[] mp3buf); | ||||
| 
 | ||||
|     public native static int encodeBufferInterleaved(short[] pcm, int samples, | ||||
|                                                      byte[] mp3buf); | ||||
| 
 | ||||
|     public native static int lameFlush(byte[] mp3buf); | ||||
| 
 | ||||
|     public native static void lameClose(); | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,3 @@ | ||||
| <resources> | ||||
|     <string name="app_name">LibMp3</string> | ||||
| </resources> | ||||
| @ -1 +1 @@ | ||||
| include ':app', ':Live', ':OnLive' | ||||
| include ':app', ':Live', ':OnLive', ':libmp3' | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue