Skip to content

Commit 791d2a7

Browse files
Merge branch 'release/v0.2.1'
2 parents b92c41b + cb1b5a6 commit 791d2a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+360
-148
lines changed

FFmpegAndroid/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ android {
55
buildToolsVersion "20.0.0"
66

77
defaultConfig {
8-
applicationId "github.hiteshsondhi88.libffmpeg"
8+
applicationId "com.github.hiteshsondhi88.libffmpeg"
99
minSdkVersion 16
1010
targetSdkVersion 16
11-
versionCode 1
12-
versionName "1.0"
11+
versionCode 21
12+
versionName "0.2.1"
1313
}
1414

1515
sourceSets.main {

FFmpegAndroid/gradle.properties

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POM_NAME=FFmpegAndroid Library
2+
POM_ARTIFACT_ID=FFmpegAndroid
3+
POM_PACKAGING=aar

FFmpegAndroid/jni/armArch.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <cpu-features.h>
55

66
jstring
7-
Java_github_hiteshsondhi88_libffmpeg_ArmArchHelper_cpuArchFromJNI(JNIEnv* env, jobject obj)
7+
Java_com_github_hiteshsondhi88_libffmpeg_ArmArchHelper_cpuArchFromJNI(JNIEnv* env, jobject obj)
88
{
99
// Maximum we need to store here is ARM v7-neon
1010
// Which is 11 char long, so initializing a character array of length 11
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 Bytes
Binary file not shown.
Binary file not shown.

FFmpegAndroid/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="github.hiteshsondhi88.libffmpeg">
2+
package="com.github.hiteshsondhi88.libffmpeg">
33

44
<application
55
android:label="@string/app_name">

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/ArmArchHelper.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/ArmArchHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
class ArmArchHelper {
44
static {

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/CommandResult.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CommandResult.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
class CommandResult {
44
final String output;

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/CpuArch.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
enum CpuArch {
44
x86, ARMv7, ARMv7_NEON, NONE

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/CpuArchHelper.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import android.os.Build;
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.github.hiteshsondhi88.libffmpeg;
2+
3+
public class ExecuteBinaryResponseHandler implements FFmpegExecuteResponseHandler {
4+
5+
@Override
6+
public void onSuccess(String message) {
7+
8+
}
9+
10+
@Override
11+
public void onProgress(String message) {
12+
13+
}
14+
15+
@Override
16+
public void onFailure(String message) {
17+
18+
}
19+
20+
@Override
21+
public void onStart() {
22+
23+
}
24+
25+
@Override
26+
public void onFinish() {
27+
28+
}
29+
}

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/FFmpeg.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpeg.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import android.content.Context;
44
import android.text.TextUtils;
55

66
import java.util.Map;
77

8-
import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
9-
import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
8+
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
9+
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
1010

1111
@SuppressWarnings("unused")
1212
public class FFmpeg implements FFmpegInterface {

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/FFmpegExecuteAsyncTask.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegExecuteAsyncTask.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import android.os.AsyncTask;
44

@@ -15,6 +15,7 @@ class FFmpegExecuteAsyncTask extends AsyncTask<Void, String, CommandResult> {
1515
private final long timeout;
1616
private long startTime;
1717
private Process process;
18+
private String output = "";
1819

1920
FFmpegExecuteAsyncTask(String cmd, long timeout, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) {
2021
this.cmd = cmd;
@@ -62,10 +63,11 @@ protected void onProgressUpdate(String... values) {
6263
@Override
6364
protected void onPostExecute(CommandResult commandResult) {
6465
if (ffmpegExecuteResponseHandler != null) {
66+
output += commandResult.output;
6567
if (commandResult.success) {
66-
ffmpegExecuteResponseHandler.onSuccess(commandResult.output);
68+
ffmpegExecuteResponseHandler.onSuccess(output);
6769
} else {
68-
ffmpegExecuteResponseHandler.onFailure(commandResult.output);
70+
ffmpegExecuteResponseHandler.onFailure(output);
6971
}
7072
ffmpegExecuteResponseHandler.onFinish();
7173
}
@@ -87,6 +89,7 @@ private void checkAndUpdateProcess() throws TimeoutException, InterruptedExcepti
8789
String line;
8890
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
8991
while ((line = reader.readLine()) != null) {
92+
output += line+"\n";
9093
publishProgress(line);
9194
}
9295
} catch (IOException e) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.hiteshsondhi88.libffmpeg;
2+
3+
public interface FFmpegExecuteResponseHandler extends ResponseHandler {
4+
5+
/**
6+
* on Success
7+
* @param message complete output of the FFmpeg command
8+
*/
9+
public void onSuccess(String message);
10+
11+
/**
12+
* on Progress
13+
* @param message current output of FFmpeg command
14+
*/
15+
public void onProgress(String message);
16+
17+
/**
18+
* on Failure
19+
* @param message complete output of the FFmpeg command
20+
*/
21+
public void onFailure(String message);
22+
23+
}

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/FFmpegInterface.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegInterface.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import java.util.Map;
44

5-
import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
6-
import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
5+
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
6+
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
77

88
@SuppressWarnings("unused")
99
interface FFmpegInterface {
1010

1111
/**
1212
* Load binary to the device according to archituecture. This also updates FFmpeg binary if the binary on device have old version.
13-
* @param ffmpegLoadBinaryResponseHandler {@link github.hiteshsondhi88.libffmpeg.FFmpegLoadBinaryResponseHandler}
13+
* @param ffmpegLoadBinaryResponseHandler {@link FFmpegLoadBinaryResponseHandler}
1414
* @throws FFmpegNotSupportedException
1515
*/
1616
public void loadBinary(FFmpegLoadBinaryResponseHandler ffmpegLoadBinaryResponseHandler) throws FFmpegNotSupportedException;
@@ -19,15 +19,15 @@ interface FFmpegInterface {
1919
* Executes a command
2020
* @param environvenmentVars Environment variables
2121
* @param cmd command to execute
22-
* @param ffmpegExecuteResponseHandler {@link github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler}
22+
* @param ffmpegExecuteResponseHandler {@link FFmpegExecuteResponseHandler}
2323
* @throws FFmpegCommandAlreadyRunningException
2424
*/
2525
public void execute(Map<String, String> environvenmentVars, String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException;
2626

2727
/**
2828
* Executes a command
2929
* @param cmd command to execute
30-
* @param ffmpegExecuteResponseHandler {@link github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler}
30+
* @param ffmpegExecuteResponseHandler {@link FFmpegExecuteResponseHandler}
3131
* @throws FFmpegCommandAlreadyRunningException
3232
*/
3333
public void execute(String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException;
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
public interface FFmpegLoadBinaryResponseHandler extends ResponseHandler {
44

5+
/**
6+
* on Fail
7+
*/
58
public void onFailure();
9+
10+
/**
11+
* on Success
12+
*/
613
public void onSuccess();
714

815
}

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/FFmpegLoadLibraryAsyncTask.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegLoadLibraryAsyncTask.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import android.content.Context;
44
import android.os.AsyncTask;
55
import android.text.TextUtils;
66

77
import java.io.File;
88

9-
import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
9+
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
1010

1111
class FFmpegLoadLibraryAsyncTask extends AsyncTask<Void, Void, Boolean> {
1212

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/FileUtils.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FileUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import android.content.Context;
44
import android.util.Log;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.github.hiteshsondhi88.libffmpeg;
2+
3+
public class LoadBinaryResponseHandler implements FFmpegLoadBinaryResponseHandler {
4+
5+
@Override
6+
public void onFailure() {
7+
8+
}
9+
10+
@Override
11+
public void onSuccess() {
12+
13+
}
14+
15+
@Override
16+
public void onStart() {
17+
18+
}
19+
20+
@Override
21+
public void onFinish() {
22+
23+
}
24+
}

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/Log.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/Log.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
@SuppressWarnings("unused")
44
class Log {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.github.hiteshsondhi88.libffmpeg;
2+
3+
abstract interface ResponseHandler {
4+
5+
/**
6+
* on Start
7+
*/
8+
public void onStart();
9+
10+
/**
11+
* on Finish
12+
*/
13+
public void onFinish();
14+
15+
}

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/ShellCommand.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/ShellCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import java.io.IOException;
44

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/Util.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/Util.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg;
1+
package com.github.hiteshsondhi88.libffmpeg;
22

33
import android.content.Context;
44
import android.content.pm.ApplicationInfo;

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/exceptions/FFmpegCommandAlreadyRunningException.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/exceptions/FFmpegCommandAlreadyRunningException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg.exceptions;
1+
package com.github.hiteshsondhi88.libffmpeg.exceptions;
22

33
public class FFmpegCommandAlreadyRunningException extends Exception {
44

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/exceptions/FFmpegNotSupportedException.java FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/exceptions/FFmpegNotSupportedException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package github.hiteshsondhi88.libffmpeg.exceptions;
1+
package com.github.hiteshsondhi88.libffmpeg.exceptions;
22

33
public class FFmpegNotSupportedException extends Exception {
44

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/FFmpegExecuteResponseHandler.java

-9
This file was deleted.

FFmpegAndroid/src/main/java/github/hiteshsondhi88/libffmpeg/ResponseHandler.java

-8
This file was deleted.

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ For examples and usage instructions head over to:
1717
* armv7-neon
1818
* x86
1919

20+
## Sample
21+
![http://i.imgur.com/cP4WhLn.gif](http://i.imgur.com/cP4WhLn.gif)
22+
[Download APK](https://github.com/hiteshsondhi88/ffmpeg-android-java/releases/download/v0.2.1/app-debug.apk)
23+
2024
## JavaDoc
2125
* [Javadoc](http://hiteshsondhi88.github.io/ffmpeg-android-java/docs/)
2226

app/app.iml

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
<orderEntry type="library" exported="" scope="TEST" name="assertj-core-1.6.1" level="project" />
8686
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-20.0.0" level="project" />
8787
<orderEntry type="library" exported="" name="dagger-compiler-1.2.2" level="project" />
88+
<orderEntry type="library" exported="" name="butterknife-5.1.2" level="project" />
8889
<orderEntry type="library" exported="" name="javawriter-2.5.0" level="project" />
8990
<orderEntry type="module" module-name="FFmpegAndroid" exported="" />
9091
</component>

app/build.gradle

+9-7
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ android {
55
buildToolsVersion "20.0.0"
66

77
defaultConfig {
8-
applicationId "github.hiteshsondhi88.sampleffmpeg"
8+
applicationId "com.github.hiteshsondhi88.sampleffmpeg"
99
minSdkVersion 16
1010
targetSdkVersion 20
11-
versionCode 1
12-
versionName "1.0"
11+
versionCode 21
12+
versionName "0.2.1"
1313
}
1414

1515
sourceSets.main {
@@ -18,6 +18,10 @@ android {
1818
jni.srcDirs = [] //disable automatic ndk-build
1919
}
2020

21+
packagingOptions {
22+
exclude 'META-INF/services/javax.annotation.processing.Processor'
23+
}
24+
2125
buildTypes {
2226
release {
2327
runProguard false
@@ -29,10 +33,8 @@ android {
2933
dependencies {
3034
compile 'com.squareup.dagger:dagger-compiler:1.2.2'
3135
compile 'com.squareup.dagger:dagger:1.2.2'
32-
36+
compile 'com.jakewharton:butterknife:5.1.2'
3337
compile fileTree(dir: 'libs', include: ['*.jar'])
34-
35-
compile project(':FFmpegAndroid')
36-
3738
androidTestCompile 'com.squareup.assertj:assertj-android:1.0.0'
39+
compile project(':FFmpegAndroid')
3840
}

0 commit comments

Comments
 (0)