Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

转AS结构,FIX jni init方法没有返回值 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .classpath

This file was deleted.

11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
/app/build
Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions .project

This file was deleted.

4 changes: 0 additions & 4 deletions .settings/org.eclipse.jdt.core.prefs

This file was deleted.

32 changes: 32 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "26.0.1"

defaultConfig {
applicationId "com.phuket.tour.ffmpeg_decoder"
minSdkVersion 14
targetSdkVersion 19

ndk {
moduleName "libsongstudio"
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
externalNativeBuild{
ndkBuild{
path file("src/main/jni/Android.mk")
}
}
}

dependencies {
compile 'com.android.support:support-v4:23.+'
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions jni/Application.mk → app/src/main/jni/Application.mk
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_ABI := armeabi-v7a
APP_STL := gnustl_static
APP_CPPFLAGS := -std=gnu++11 -fexceptions -D__STDC_LIMIT_MACROS
NDK_TOOLCHAIN_VERSION = 4.8
APP_PLATFORM := android-9
NDK_TOOLCHAIN_VERSION = 4.9
APP_PLATFORM := android-14
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion jni/decoder/jni/Mp3Decoder.cpp → app/src/main/jni/decoder/jni/Mp3Decoder.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ JNIEXPORT jint JNICALL Java_com_phuket_tour_decoder_Mp3Decoder_init
const char* pcmPath = env->GetStringUTFChars(pcmPathParam, NULL);
const char* mp3Path = env->GetStringUTFChars(mp3PathParam, NULL);
decoderController = new AccompanyDecoderController();
decoderController->Init(mp3Path, pcmPath);
int ret= decoderController->Init(mp3Path, pcmPath);
env->ReleaseStringUTFChars(mp3PathParam, mp3Path);
env->ReleaseStringUTFChars(pcmPathParam, pcmPath);
return ret;
}

JNIEXPORT void JNICALL Java_com_phuket_tour_decoder_Mp3Decoder_decode
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ int AccompanyDecoder::getMusicMeta(const char* fileString, int * metaData) {
return 0;
}

void AccompanyDecoder::init(const char* fileString, int packetBufferSizeParam){
init(fileString);
int AccompanyDecoder::init(const char* fileString, int packetBufferSizeParam){
int ret= init(fileString);
packetBufferSize = packetBufferSizeParam;
return ret;
}

int AccompanyDecoder::init(const char* audioFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AccompanyDecoder {
//获取采样率以及比特率
virtual int getMusicMeta(const char* fileString, int * metaData);
//初始化这个decoder,即打开指定的mp3文件
virtual void init(const char* fileString, int packetBufferSizeParam);
virtual int init(const char* fileString, int packetBufferSizeParam);
virtual AudioPacket* decodePacket();
//销毁这个decoder
virtual void destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ AccompanyDecoderController::AccompanyDecoderController() {
AccompanyDecoderController::~AccompanyDecoderController() {
}

void AccompanyDecoderController::Init(const char* accompanyPath, const char* pcmFilePath) {
int AccompanyDecoderController::Init(const char* accompanyPath, const char* pcmFilePath) {
//初始化两个decoder
AccompanyDecoder* tempDecoder = new AccompanyDecoder();
int accompanyMetaData[2];
Expand All @@ -21,8 +21,9 @@ void AccompanyDecoderController::Init(const char* accompanyPath, const char* pcm
int accompanyByteCountPerSec = accompanySampleRate * CHANNEL_PER_FRAME * BITS_PER_CHANNEL / BITS_PER_BYTE;
accompanyPacketBufferSize = (int) ((accompanyByteCountPerSec / 2) * 0.2);
accompanyDecoder = new AccompanyDecoder();
accompanyDecoder->init(accompanyPath, accompanyPacketBufferSize);
int ret= accompanyDecoder->init(accompanyPath, accompanyPacketBufferSize);
pcmFile = fopen(pcmFilePath, "wb+");
return pcmFile!=NULL&&ret==1?1:-1;
}

void AccompanyDecoderController::Decode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AccompanyDecoderController {
~AccompanyDecoderController();

/** 初始两个decoder,并且根据上一步算出的采样率,计算出伴奏和原唱的bufferSize **/
void Init(const char* accompanyPath, const char* pcmFilePath);
int Init(const char* accompanyPath, const char* pcmFilePath);
/** 解码操作 **/
void Decode();
/** 销毁这个controller **/
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 0 additions & 29 deletions bin/AndroidManifest.xml

This file was deleted.

Binary file removed bin/FFmpegDecoder.apk
Binary file not shown.
Binary file removed bin/classes.dex
Binary file not shown.
Binary file removed bin/classes/com/phuket/tour/decoder/Mp3Decoder.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed bin/classes/com/phuket/tour/ffmpeg_decoder/R$attr.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed bin/classes/com/phuket/tour/ffmpeg_decoder/R$id.class
Binary file not shown.
Binary file not shown.
Binary file removed bin/classes/com/phuket/tour/ffmpeg_decoder/R$menu.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed bin/classes/com/phuket/tour/ffmpeg_decoder/R.class
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions bin/jarlist.cache

This file was deleted.

Binary file removed bin/res/crunch/drawable-hdpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/res/crunch/drawable-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/res/crunch/drawable-xhdpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/res/crunch/drawable-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/resources.ap_
Binary file not shown.
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

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

task clean(type: Delete) {
delete rootProject.buildDir
}
6 changes: 0 additions & 6 deletions gen/com/phuket/tour/ffmpeg_decoder/BuildConfig.java

This file was deleted.

Loading