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

FFmpeg 2.8.7, remove OpenSSL, add JNI Bridge to project #58

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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ gradle.properties
/.idea/
.DS_Store

sdk/src/main/obj
.notes
8 changes: 8 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ To play a Kickflip broadcast within your app:

You can obtain a Kickflip [`Stream`](https://github.com/Kickflip/kickflip-android-sdk/blob/preview/sdk/src/main/java/io/kickflip/sdk/api/json/Stream.java) raw media url with `stream.getStreamUrl()`. For an HLS broadcast this is a url of form https://xxx.xxx/xxx.m3u8

### Updating FFmpeg

The JNI bridge is currently written for FFmpeg 2.X, and are required for FFmpeg 3.X.
To update FFmpeg:

1. Download the [FFmpeg source](http://www.ffmpeg.org/download.html#releases) and build shared libraries using directions [here](https://github.com/OnlyInAmerica/FFmpeg-Android).
2. Place the FFmpeg shared libraries produced in `./src/main/jni/ffmpeg/ARCH/`
3. Update the JNI bridge at `./src/main/jni/FFmpegWrapper.c` as necessary by any changes to the libav* library APIs.
4. Run `ndk-build` from the `./src/main/jni` dir.

### Activities and Fragments

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// classpath 'com.android.tools.build:gradle:2.1.2'
// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
// classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}

Expand Down
1 change: 1 addition & 0 deletions sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
sdk/src/main/jni
5 changes: 5 additions & 0 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

sourceSets.main {
jni.srcDirs = [] // disable automatic ndk-build call. Invoke `ndk-build` manually in ./jni when native code changes are made
jniLibs.srcDir 'src/main/libs'
}

defaultConfig {
minSdkVersion 18
targetSdkVersion 22
Expand Down
64 changes: 64 additions & 0 deletions sdk/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

# TODO: Observe $(TARGET_ARCH) and adjust appropriately. For now, we only have armeabi libraries

# Prebuilt FFmpeg

LOCAL_MODULE:= libavcodec
LOCAL_SRC_FILES:= ./ffmpeg/$(TARGET_ARCH)/libavcodec-56.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE:= libavfilter
LOCAL_SRC_FILES:= ./ffmpeg/$(TARGET_ARCH)/libavfilter-5.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE:= libavformat
LOCAL_SRC_FILES:= ./ffmpeg/$(TARGET_ARCH)/libavformat-56.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE:= libavutil
LOCAL_SRC_FILES:= ./ffmpeg/$(TARGET_ARCH)/libavutil-54.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE:= libswresample
LOCAL_SRC_FILES:= ./ffmpeg/$(TARGET_ARCH)/libswresample-1.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE:= libswscale
LOCAL_SRC_FILES:= ./ffmpeg/$(TARGET_ARCH)/libswscale-3.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

# Our Wrapper

include $(CLEAR_VARS)

LOCAL_LDLIBS += -llog -lz
LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_SRC_FILES := FFmpegWrapper.c
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS := $(COMMON_FLAGS_LIST)
else
LOCAL_CFLAGS := -march=armv7-a -mfpu=vfp -mfloat-abi=softfp $(COMMON_FLAGS_LIST)
endif
LOCAL_MODULE := FFmpegWrapper

include $(BUILD_SHARED_LIBRARY)
1 change: 1 addition & 0 deletions sdk/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_ABI := armeabi # x86
Loading