├── library ├── src │ └── main │ │ ├── jniLibs │ │ ├── res │ │ └── values │ │ │ ├── styles.xml │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── appunite │ │ └── ffmpeg │ │ ├── FFmpegDisplay.java │ │ ├── NativeTester.java │ │ ├── FFmpegError.java │ │ ├── FFmpegListener.java │ │ ├── NotPlayingException.java │ │ ├── FpsCounter.java │ │ ├── JniReader.java │ │ ├── FFmpegSurfaceView.java │ │ ├── FFmpegStreamInfo.java │ │ ├── ViewCompat.java │ │ ├── SeekerView.java │ │ └── FFmpegPlayer.java ├── lint.xml └── build.gradle ├── settings.gradle ├── example ├── src │ └── main │ │ ├── res │ │ ├── menu │ │ │ └── main_activity.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── constans.xml │ │ │ └── strings.xml │ │ └── layout │ │ │ ├── main_list_item.xml │ │ │ ├── main_activity.xml │ │ │ └── video_surfaceview.xml │ │ ├── java │ │ └── com │ │ │ └── ffmpegtest │ │ │ ├── AppConstants.java │ │ │ ├── UserPreferences.java │ │ │ ├── adapter │ │ │ ├── VideoItem.java │ │ │ └── ItemsAdapter.java │ │ │ ├── MainActivity.java │ │ │ └── VideoActivity.java │ │ └── AndroidManifest.xml └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── library-jni └── jni │ ├── android-ndk-profiler-3.1 │ ├── armeabi │ │ └── libandprof.a │ ├── armeabi-v7a │ │ └── libandprof.a │ ├── prof.h │ └── android-ndk-profiler.mk │ ├── fetch.sh │ ├── Android-tropicssl.mk │ ├── aes-protocol.h │ ├── jni-protocol.h │ ├── Application.mk │ ├── sync.h │ ├── blend.h │ ├── nativetester.h │ ├── helpers.h │ ├── helpers.c │ ├── nativetester.c │ ├── convert.h │ ├── nativetester-jni.c │ ├── ffmpeg-jni.c │ ├── convert.cpp │ ├── queue.h │ ├── blend.c │ ├── Android.mk │ ├── player.h │ ├── jni-protocol.c │ ├── queue.c │ ├── aes-protocol.c │ └── build_android.sh ├── .gitignore ├── .gitmodules ├── .travis.yml ├── README.md ├── gradlew └── LICENSE /library/src/main/jniLibs: -------------------------------------------------------------------------------- 1 | ../../../library-jni/libs/ -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':library' 2 | include ':example' 3 | -------------------------------------------------------------------------------- /library/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /example/src/main/res/menu/main_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/example/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/example/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/example/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/example/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library-jni/jni/android-ndk-profiler-3.1/armeabi/libandprof.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/library-jni/jni/android-ndk-profiler-3.1/armeabi/libandprof.a -------------------------------------------------------------------------------- /library-jni/jni/android-ndk-profiler-3.1/armeabi-v7a/libandprof.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appunite/AndroidFFmpeg/HEAD/library-jni/jni/android-ndk-profiler-3.1/armeabi-v7a/libandprof.a -------------------------------------------------------------------------------- /library/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-jni/jni/fetch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | (cd freetype2 && ./autogen.sh) 3 | (cd fribidi && autoreconf -ivf) 4 | (cd libass && autoreconf -ivf) 5 | (cd vo-aacenc && autoreconf -ivf) 6 | (cd vo-amrwbenc && autoreconf -ivf) 7 | -------------------------------------------------------------------------------- /example/src/main/res/values/constans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | .3gp 5 | .mp4 6 | .avi 7 | .mov 8 | 9 | -------------------------------------------------------------------------------- /library-jni/jni/android-ndk-profiler-3.1/prof.h: -------------------------------------------------------------------------------- 1 | #ifndef prof_h_seen 2 | #define prof_h_seen 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | void monstartup(const char *libname); 8 | void moncleanup(void); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /example/src/main/java/com/ffmpegtest/AppConstants.java: -------------------------------------------------------------------------------- 1 | package com.ffmpegtest; 2 | 3 | public class AppConstants { 4 | public static final String VIDEO_PLAY_ACTION = "com.ffmpegtest.VIDEO_PLAY_ACTION"; 5 | public static final String VIDEO_PLAY_ACTION_EXTRA_URL = "url"; 6 | public static final String VIDEO_PLAY_ACTION_EXTRA_ENCRYPTION_KEY = "encryption_key"; 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Specific 2 | library-jni/libs/ 3 | library-jni/obj/ 4 | library-jni/jni/ffmpeg-build/ 5 | 6 | #IntelliJ IDEA 7 | .idea 8 | *.iml 9 | *.ipr 10 | *.iws 11 | classes 12 | gen-external-apklibs 13 | 14 | #Gradle 15 | .gradle 16 | build 17 | local.properties 18 | 19 | #Other 20 | .DS_Store 21 | tmp 22 | *.swp 23 | *.tmp 24 | *.bak 25 | *.swp 26 | *.launch 27 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 15 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 9 9 | targetSdkVersion 17 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /example/src/main/res/layout/main_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | dependencies { 4 | compile 'com.android.support:support-v4:22.1.1' 5 | compile "javax.annotation:javax.annotation-api:1.2" 6 | compile "com.google.code.findbugs:jsr305:2.0.1" 7 | 8 | compile(project(":library")) 9 | } 10 | 11 | android { 12 | compileSdkVersion 15 13 | buildToolsVersion "22.0.1" 14 | 15 | defaultConfig { 16 | minSdkVersion 9 17 | targetSdkVersion 17 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /library-jni/jni/android-ndk-profiler-3.1/android-ndk-profiler.mk: -------------------------------------------------------------------------------- 1 | TARGET_thumb_release_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_thumb_release_CFLAGS)) 2 | TARGET_thumb_release_CFLAGS := $(filter-out -fomit-frame-pointer,$(TARGET_thumb_release_CFLAGS)) 3 | TARGET_arm_release_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_arm_release_CFLAGS)) 4 | TARGET_arm_release_CFLAGS := $(filter-out -fomit-frame-pointer,$(TARGET_arm_release_CFLAGS)) 5 | TARGET_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_CFLAGS)) 6 | 7 | # include libandprof.a in the build 8 | include $(CLEAR_VARS) 9 | LOCAL_MODULE := andprof 10 | LOCAL_SRC_FILES := android-ndk-profiler-3.1/$(TARGET_ARCH_ABI)/libandprof.a 11 | include $(PREBUILT_STATIC_LIBRARY) 12 | -------------------------------------------------------------------------------- /library-jni/jni/Android-tropicssl.mk: -------------------------------------------------------------------------------- 1 | #the tropicssl library 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_CFLAGS := -std=gnu99 5 | 6 | SRC_FILES := \ 7 | aes.c arc4.c base64.c \ 8 | bignum.c certs.c debug.c \ 9 | des.c dhm.c havege.c \ 10 | md2.c md4.c md5.c \ 11 | net.c padlock.c rsa.c \ 12 | sha1.c sha2.c sha4.c \ 13 | ssl_cli.c ssl_srv.c ssl_tls.c \ 14 | timing.c x509parse.c xtea.c \ 15 | camellia.c 16 | SRC_DIR=tropicssl/library 17 | 18 | #disable thumb 19 | LOCAL_ARM_MODE := arm 20 | LOCAL_CFLAGS := -O3 21 | 22 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/tropicssl/include/ 23 | LOCAL_ALLOW_UNDEFINED_SYMBOLS=false 24 | LOCAL_MODULE := tropicssl 25 | LOCAL_SRC_FILES := $(addprefix $(SRC_DIR)/,$(SRC_FILES)) 26 | 27 | LOCAL_LDLIBS := -ldl -llog 28 | 29 | include $(BUILD_STATIC_LIBRARY) 30 | -------------------------------------------------------------------------------- /library-jni/jni/aes-protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * aes-protocol.h 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef AES_PROTOCOL_H 20 | #define AES_PROTOCOL_H 21 | 22 | void register_aes_protocol(); 23 | 24 | #endif /* H_AES_PROTOCOL */ 25 | 26 | -------------------------------------------------------------------------------- /library-jni/jni/jni-protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jni-protocol.h 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef JNI_PROTOCOL_H 20 | #define JNI_PROTOCOL_H 21 | 22 | void register_jni_protocol(JavaVM *jvm); 23 | 24 | #endif /* H_JNI_PROTOCOL */ 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/appunite/ffmpeg/FFmpegDisplay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FFmpegDisplay.java 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.appunite.ffmpeg; 20 | 21 | public interface FFmpegDisplay { 22 | 23 | void setMpegPlayer(FFmpegPlayer fFmpegPlayer); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /library-jni/jni/Application.mk: -------------------------------------------------------------------------------- 1 | # Application.mk 2 | # Copyright (c) 2012 Jacek Marchwicki 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # The ARMv7 is significanly faster due to the use of the hardware FPU 17 | #APP_ABI := all 18 | APP_ABI := armeabi-v7a armeabi x86 mips 19 | APP_PLATFORM := android-10 20 | #APP_OPTIM := debug 21 | 22 | APP_STL := gnustl_static 23 | -------------------------------------------------------------------------------- /example/src/main/java/com/ffmpegtest/UserPreferences.java: -------------------------------------------------------------------------------- 1 | package com.ffmpegtest; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.support.annotation.Nullable; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | public class UserPreferences { 10 | 11 | public static final String USER_PREFERENCES = "USER_PREFERENCES"; 12 | private static final String KEY_URL = "url"; 13 | private final SharedPreferences preferences; 14 | 15 | public UserPreferences(@Nonnull Context context) { 16 | preferences = context.getSharedPreferences(USER_PREFERENCES, 0); 17 | } 18 | 19 | public void setUrl(@Nullable String url) { 20 | preferences.edit().putString(KEY_URL, url).apply(); 21 | } 22 | 23 | @Nullable 24 | public String getUrl() { 25 | return preferences.getString(KEY_URL, "rtsp://ip.appunite-local.net:554"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /library/src/main/java/com/appunite/ffmpeg/NativeTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * NativeTester.java 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.appunite.ffmpeg; 20 | 21 | class NativeTester { 22 | static { 23 | System.loadLibrary("nativetester-jni"); 24 | } 25 | 26 | native boolean isNeon(); 27 | } 28 | -------------------------------------------------------------------------------- /library-jni/jni/sync.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sync.h 3 | * Copyright (c) 2013 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef SYNC_H_ 20 | #define SYNC_H_ 21 | 22 | enum WaitFuncRet { 23 | WAIT_FUNC_RET_OK = 0, 24 | WAIT_FUNC_RET_SKIP = 1, 25 | }; 26 | 27 | typedef enum WaitFuncRet (WaitFunc) (void *data , int64_t time, int stream_no); 28 | 29 | 30 | #endif /* SYNC_H_ */ 31 | -------------------------------------------------------------------------------- /library/src/main/java/com/appunite/ffmpeg/FFmpegError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FFmpegError.java 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.appunite.ffmpeg; 20 | 21 | public class FFmpegError extends Throwable { 22 | 23 | public FFmpegError(int err) { 24 | super(String.format("FFmpegPlayer error %d", err)); 25 | } 26 | 27 | /** 28 | * 29 | */ 30 | private static final long serialVersionUID = 1L; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /example/src/main/java/com/ffmpegtest/adapter/VideoItem.java: -------------------------------------------------------------------------------- 1 | package com.ffmpegtest.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | public class VideoItem { 8 | private final long id; 9 | @Nullable 10 | private final String text; 11 | @Nonnull 12 | private String video; 13 | @Nullable 14 | private String key; 15 | 16 | public VideoItem(long id, 17 | @Nullable String text, 18 | @Nonnull String video, 19 | @Nullable String key) { 20 | this.id = id; 21 | this.text = text; 22 | this.video = video; 23 | this.key = key; 24 | } 25 | 26 | public long id() { 27 | return id; 28 | } 29 | 30 | @Nullable 31 | public String text() { 32 | return text; 33 | } 34 | 35 | @Nonnull 36 | public String video() { 37 | return video; 38 | } 39 | 40 | @Nullable 41 | public String key() { 42 | return key; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /library-jni/jni/blend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * blend.h 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef BLEND_H_ 20 | #define BLEND_H_ 21 | 22 | #include 23 | #include 24 | 25 | void blend_ass_image(AVPicture *dest, const ASS_Image *image, int imgw, 26 | int imgh, enum PixelFormat pixel_format); 27 | void blend_subrect_rgba(AVPicture *dest, const AVSubtitleRect *rect, int imgw, 28 | int imgh, enum PixelFormat pixel_format); 29 | 30 | #endif /* BLEND_H_ */ 31 | -------------------------------------------------------------------------------- /library-jni/jni/nativetester.h: -------------------------------------------------------------------------------- 1 | /* 2 | * nativetester.h 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef NATIVETESTER_H_ 20 | #define NATIVETESTER_H_ 21 | 22 | static const char *nativetester_class_path_name = "com/appunite/ffmpeg/NativeTester"; 23 | 24 | jboolean jni_nativetester_is_neon(JNIEnv *env, jobject thiz); 25 | 26 | 27 | static JNINativeMethod nativetester_methods[] = { 28 | {"isNeon", "()Z", (void*) jni_nativetester_is_neon}, 29 | }; 30 | 31 | #endif /* NATIVETESTER_H_ */ 32 | -------------------------------------------------------------------------------- /library-jni/jni/helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * helpers.h 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef HELPERS_H_ 20 | #define HELPERS_H_ 21 | 22 | typedef struct { 23 | const char* name; 24 | const char* signature; 25 | } JavaMethod; 26 | 27 | typedef struct { 28 | char* name; 29 | char* signature; 30 | } JavaField; 31 | 32 | jfieldID java_get_field(JNIEnv *env, char * class_name, JavaField field); 33 | jmethodID java_get_method(JNIEnv *env, jclass class, JavaMethod method); 34 | 35 | 36 | #endif /* HELPERS_H_ */ 37 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "library-jni/jni/ffmpeg"] 2 | path = library-jni/jni/ffmpeg 3 | url = git://source.ffmpeg.org/ffmpeg.git 4 | [submodule "library-jni/jni/vo-aacenc"] 5 | path = library-jni/jni/vo-aacenc 6 | url = git://git.code.sf.net/p/opencore-amr/vo-aacenc 7 | [submodule "library-jni/jni/vo-amrwbenc"] 8 | path = library-jni/jni/vo-amrwbenc 9 | url = git://git.code.sf.net/p/opencore-amr/vo-amrwbenc 10 | [submodule "library-jni/jni/x264"] 11 | path = library-jni/jni/x264 12 | url = git://git.videolan.org/x264.git 13 | [submodule "library-jni/jni/tropicssl"] 14 | path = library-jni/jni/tropicssl 15 | url = https://github.com/appunite/tropicssl.git 16 | [submodule "library-jni/jni/libass"] 17 | path = library-jni/jni/libass 18 | url = https://github.com/libass/libass.git 19 | [submodule "library-jni/jni/fribidi"] 20 | path = library-jni/jni/fribidi 21 | url = https://github.com/appunite/fribidi.git 22 | [submodule "library-jni/jni/freetype2"] 23 | path = library-jni/jni/freetype2 24 | url = git://git.sv.gnu.org/freetype/freetype2.git 25 | [submodule "library-jni/jni/libyuv"] 26 | path = library-jni/jni/libyuv 27 | url = https://chromium.googlesource.com/external/libyuv 28 | -------------------------------------------------------------------------------- /library/src/main/java/com/appunite/ffmpeg/FFmpegListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FFmpegListener.java 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.appunite.ffmpeg; 20 | 21 | public interface FFmpegListener { 22 | void onFFDataSourceLoaded(FFmpegError err, FFmpegStreamInfo[] streams); 23 | 24 | void onFFResume(NotPlayingException result); 25 | 26 | void onFFPause(NotPlayingException err); 27 | 28 | void onFFStop(); 29 | 30 | void onFFUpdateTime(long mCurrentTimeUs, long mVideoDurationUs, boolean isFinished); 31 | 32 | void onFFSeeked(NotPlayingException result); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /library-jni/jni/helpers.c: -------------------------------------------------------------------------------- 1 | /* 2 | * helpers.c 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | #include "helpers.h" 22 | 23 | jfieldID java_get_field(JNIEnv *env, char * class_name, JavaField field) { 24 | jclass clazz = (*env)->FindClass(env, class_name); 25 | jfieldID jField = (*env)->GetFieldID(env, clazz, field.name, field.signature); 26 | (*env)->DeleteLocalRef(env, clazz); 27 | return jField; 28 | } 29 | 30 | jmethodID java_get_method(JNIEnv *env, jclass class, JavaMethod method) { 31 | return (*env)->GetMethodID(env, class, method.name, method.signature); 32 | } 33 | -------------------------------------------------------------------------------- /library/src/main/java/com/appunite/ffmpeg/NotPlayingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * NotPlayingException.java 3 | * Copyright (c) 2012 Jacek Marchwicki 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.appunite.ffmpeg; 20 | 21 | public class NotPlayingException extends Exception { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public NotPlayingException(String detailMessage, Throwable throwable) { 25 | super(detailMessage, throwable); 26 | } 27 | 28 | public NotPlayingException(String detailMessage) { 29 | super(detailMessage); 30 | } 31 | 32 | public NotPlayingException() { 33 | super(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /example/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World, FFmpegExampleActivity! 5 | FFmpegExample 6 | No videos 7 | Could not read videos directory 8 | Error! 9 | Select video file 10 | Convert Video 11 | Could not convert video 12 | Language: %s 13 | Subtitle: %s 14 | Unknown 15 | End of video 16 | End of video occure 17 | Could not open stream 18 | Hello world! 19 | Settings 20 | AndroidFFmpeg 21 | Video url 22 | Play 23 | 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: oraclejdk7 3 | sudo: false 4 | 5 | env: 6 | global: 7 | - NDK_VERSION=r10e 8 | 9 | addons: 10 | apt: 11 | packages: 12 | - libgd2-xpm 13 | - ia32-libs 14 | - ia32-libs-multiarch 15 | - yasm 16 | - pkg-config 17 | - make 18 | - autoconf 19 | - libtool 20 | - make 21 | - autoconf-archive 22 | - automake 23 | 24 | cache: 25 | directories: 26 | - $HOME/.gradle/caches 27 | 28 | android: 29 | components: 30 | - build-tools-22.0.1 31 | - android-15 32 | - extra-android-m2repository 33 | licenses: 34 | - 'android-sdk-preview-license-52d11cd2' 35 | - 'android-sdk-license-.+' 36 | - 'google-gdk-license-.+' 37 | 38 | before_install: 39 | # Android NDK 40 | - if [ `uname -m` = x86_64 ]; then wget http://dl.google.com/android/ndk/android-ndk-$NDK_VERSION-linux-x86_64.bin -O ndk.bin; else wget http://dl.google.com/android/ndk/android-ndk-$NDK_VERSION-linux-x86.bin -O ndk.bin; fi 41 | - chmod a+x ndk.bin 42 | - ./ndk.bin | egrep -v ^Extracting 43 | - rm ndk.bin 44 | - export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION 45 | - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_NDK_HOME} 46 | install: 47 | - sh -c 'cd library-jni/jni/ && ./fetch.sh' 48 | - sh -c 'cd library-jni/jni && ./build_android.sh' 49 | - sh -c 'cd library-jni/jni && ndk-build' 50 | - rm -rf $ANDROID_NDK_HOME 51 | - rm -rf library-jni/jni 52 | - TERM=dumb ./gradlew build 53 | 54 | -------------------------------------------------------------------------------- /example/src/main/res/layout/main_activity.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 20 | 28 |