Skip to content

Commit

Permalink
Merge branch 'release/v0.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
hiteshsondhi88 committed Sep 14, 2014
2 parents b92c41b + cb1b5a6 commit 791d2a7
Show file tree
Hide file tree
Showing 45 changed files with 360 additions and 148 deletions.
6 changes: 3 additions & 3 deletions FFmpegAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ android {
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "github.hiteshsondhi88.libffmpeg"
applicationId "com.github.hiteshsondhi88.libffmpeg"
minSdkVersion 16
targetSdkVersion 16
versionCode 1
versionName "1.0"
versionCode 21
versionName "0.2.1"
}

sourceSets.main {
Expand Down
3 changes: 3 additions & 0 deletions FFmpegAndroid/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=FFmpegAndroid Library
POM_ARTIFACT_ID=FFmpegAndroid
POM_PACKAGING=aar
2 changes: 1 addition & 1 deletion FFmpegAndroid/jni/armArch.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cpu-features.h>

jstring
Java_github_hiteshsondhi88_libffmpeg_ArmArchHelper_cpuArchFromJNI(JNIEnv* env, jobject obj)
Java_com_github_hiteshsondhi88_libffmpeg_ArmArchHelper_cpuArchFromJNI(JNIEnv* env, jobject obj)
{
// Maximum we need to store here is ARM v7-neon
// Which is 11 char long, so initializing a character array of length 11
Expand Down
Binary file modified FFmpegAndroid/libs/armeabi-v7a/libARM_ARCH.so
Binary file not shown.
Binary file modified FFmpegAndroid/libs/armeabi/libARM_ARCH.so
Binary file not shown.
Binary file modified FFmpegAndroid/obj/local/armeabi-v7a/libARM_ARCH.so
Binary file not shown.
Binary file modified FFmpegAndroid/obj/local/armeabi-v7a/objs/ARM_ARCH/armArch.o
Binary file not shown.
Binary file modified FFmpegAndroid/obj/local/armeabi/libARM_ARCH.so
Binary file not shown.
Binary file modified FFmpegAndroid/obj/local/armeabi/objs/ARM_ARCH/armArch.o
Binary file not shown.
2 changes: 1 addition & 1 deletion FFmpegAndroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="github.hiteshsondhi88.libffmpeg">
package="com.github.hiteshsondhi88.libffmpeg">

<application
android:label="@string/app_name">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

class ArmArchHelper {
static {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

class CommandResult {
final String output;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

enum CpuArch {
x86, ARMv7, ARMv7_NEON, NONE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import android.os.Build;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.hiteshsondhi88.libffmpeg;

public class ExecuteBinaryResponseHandler implements FFmpegExecuteResponseHandler {

@Override
public void onSuccess(String message) {

}

@Override
public void onProgress(String message) {

}

@Override
public void onFailure(String message) {

}

@Override
public void onStart() {

}

@Override
public void onFinish() {

}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import android.content.Context;
import android.text.TextUtils;

import java.util.Map;

import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;

@SuppressWarnings("unused")
public class FFmpeg implements FFmpegInterface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import android.os.AsyncTask;

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

FFmpegExecuteAsyncTask(String cmd, long timeout, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) {
this.cmd = cmd;
Expand Down Expand Up @@ -62,10 +63,11 @@ protected void onProgressUpdate(String... values) {
@Override
protected void onPostExecute(CommandResult commandResult) {
if (ffmpegExecuteResponseHandler != null) {
output += commandResult.output;
if (commandResult.success) {
ffmpegExecuteResponseHandler.onSuccess(commandResult.output);
ffmpegExecuteResponseHandler.onSuccess(output);
} else {
ffmpegExecuteResponseHandler.onFailure(commandResult.output);
ffmpegExecuteResponseHandler.onFailure(output);
}
ffmpegExecuteResponseHandler.onFinish();
}
Expand All @@ -87,6 +89,7 @@ private void checkAndUpdateProcess() throws TimeoutException, InterruptedExcepti
String line;
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
while ((line = reader.readLine()) != null) {
output += line+"\n";
publishProgress(line);
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.hiteshsondhi88.libffmpeg;

public interface FFmpegExecuteResponseHandler extends ResponseHandler {

/**
* on Success
* @param message complete output of the FFmpeg command
*/
public void onSuccess(String message);

/**
* on Progress
* @param message current output of FFmpeg command
*/
public void onProgress(String message);

/**
* on Failure
* @param message complete output of the FFmpeg command
*/
public void onFailure(String message);

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import java.util.Map;

import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;

@SuppressWarnings("unused")
interface FFmpegInterface {

/**
* Load binary to the device according to archituecture. This also updates FFmpeg binary if the binary on device have old version.
* @param ffmpegLoadBinaryResponseHandler {@link github.hiteshsondhi88.libffmpeg.FFmpegLoadBinaryResponseHandler}
* @param ffmpegLoadBinaryResponseHandler {@link FFmpegLoadBinaryResponseHandler}
* @throws FFmpegNotSupportedException
*/
public void loadBinary(FFmpegLoadBinaryResponseHandler ffmpegLoadBinaryResponseHandler) throws FFmpegNotSupportedException;
Expand All @@ -19,15 +19,15 @@ interface FFmpegInterface {
* Executes a command
* @param environvenmentVars Environment variables
* @param cmd command to execute
* @param ffmpegExecuteResponseHandler {@link github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler}
* @param ffmpegExecuteResponseHandler {@link FFmpegExecuteResponseHandler}
* @throws FFmpegCommandAlreadyRunningException
*/
public void execute(Map<String, String> environvenmentVars, String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException;

/**
* Executes a command
* @param cmd command to execute
* @param ffmpegExecuteResponseHandler {@link github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler}
* @param ffmpegExecuteResponseHandler {@link FFmpegExecuteResponseHandler}
* @throws FFmpegCommandAlreadyRunningException
*/
public void execute(String cmd, FFmpegExecuteResponseHandler ffmpegExecuteResponseHandler) throws FFmpegCommandAlreadyRunningException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

public interface FFmpegLoadBinaryResponseHandler extends ResponseHandler {

/**
* on Fail
*/
public void onFailure();

/**
* on Success
*/
public void onSuccess();

}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import android.content.Context;
import android.os.AsyncTask;
import android.text.TextUtils;

import java.io.File;

import github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import android.content.Context;
import android.util.Log;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.hiteshsondhi88.libffmpeg;

public class LoadBinaryResponseHandler implements FFmpegLoadBinaryResponseHandler {

@Override
public void onFailure() {

}

@Override
public void onSuccess() {

}

@Override
public void onStart() {

}

@Override
public void onFinish() {

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

@SuppressWarnings("unused")
class Log {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.github.hiteshsondhi88.libffmpeg;

abstract interface ResponseHandler {

/**
* on Start
*/
public void onStart();

/**
* on Finish
*/
public void onFinish();

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg;
package com.github.hiteshsondhi88.libffmpeg;

import android.content.Context;
import android.content.pm.ApplicationInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg.exceptions;
package com.github.hiteshsondhi88.libffmpeg.exceptions;

public class FFmpegCommandAlreadyRunningException extends Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package github.hiteshsondhi88.libffmpeg.exceptions;
package com.github.hiteshsondhi88.libffmpeg.exceptions;

public class FFmpegNotSupportedException extends Exception {

Expand Down

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ For examples and usage instructions head over to:
* armv7-neon
* x86

## Sample
![http://i.imgur.com/cP4WhLn.gif](http://i.imgur.com/cP4WhLn.gif)
[Download APK](https://github.com/hiteshsondhi88/ffmpeg-android-java/releases/download/v0.2.1/app-debug.apk)

## JavaDoc
* [Javadoc](http://hiteshsondhi88.github.io/ffmpeg-android-java/docs/)

Expand Down
1 change: 1 addition & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<orderEntry type="library" exported="" scope="TEST" name="assertj-core-1.6.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-20.0.0" level="project" />
<orderEntry type="library" exported="" name="dagger-compiler-1.2.2" level="project" />
<orderEntry type="library" exported="" name="butterknife-5.1.2" level="project" />
<orderEntry type="library" exported="" name="javawriter-2.5.0" level="project" />
<orderEntry type="module" module-name="FFmpegAndroid" exported="" />
</component>
Expand Down
16 changes: 9 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ android {
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "github.hiteshsondhi88.sampleffmpeg"
applicationId "com.github.hiteshsondhi88.sampleffmpeg"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
versionCode 21
versionName "0.2.1"
}

sourceSets.main {
Expand All @@ -18,6 +18,10 @@ android {
jni.srcDirs = [] //disable automatic ndk-build
}

packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}

buildTypes {
release {
runProguard false
Expand All @@ -29,10 +33,8 @@ android {
dependencies {
compile 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.dagger:dagger:1.2.2'

compile 'com.jakewharton:butterknife:5.1.2'
compile fileTree(dir: 'libs', include: ['*.jar'])

compile project(':FFmpegAndroid')

androidTestCompile 'com.squareup.assertj:assertj-android:1.0.0'
compile project(':FFmpegAndroid')
}
Loading

0 comments on commit 791d2a7

Please sign in to comment.