Skip to content

Instantly share code, notes, and snippets.

@RichardWithnell
Last active September 21, 2015 16:04
Show Gist options
  • Save RichardWithnell/123dd99fc6b3004c42f6 to your computer and use it in GitHub Desktop.
Save RichardWithnell/123dd99fc6b3004c42f6 to your computer and use it in GitHub Desktop.
Android Studio GStreamer
# http://stackoverflow.com/questions/27530263/unable-to-build-gstreamer-tutorials-using-android-studio
# Fails with android-ndk-r10d, r9d only supports up to Android-19
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.gst_sdk_tutorials.tutorial_1"
minSdkVersion 9
targetSdkVersion 19
ndk {
moduleName "tutorial-1"
}
}
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
java.srcDirs += 'src/main/jni/src'
}
tasks.withType(Exec) {
def localProperties = new Properties()
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
def gstDir = localProperties.getProperty('gst.dir')
environment = [:]
environment['PATH'] = System.getenv("PATH")+ ":/usr/local/bin"
environment['GSTREAMER_SDK_ROOT'] = gstDir
}
task buildNative(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = project.plugins.findPlugin('com.android.application').getNdkFolder()
commandLine "$ndkDir/ndk-build",
'-C', file('src/main/jni').absolutePath,
'-j', Runtime.runtime.availableProcessors(),
'all',
'NDK_DEBUG=1',
'V=1',
'APP_PLATFORM=android-19'
}
task cleanNative(type: Exec, description: 'Clean JNI object files') {
def ndkDir = project.plugins.findPlugin('com.android.application').getNdkFolder()
commandLine "$ndkDir/ndk-build",
'-C', file('src/main/jni').absolutePath,
'clean'
}
clean.dependsOn 'cleanNative'
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
#supports android-ndk-r10d
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
java.srcDirs += 'src/main/jni/src'
}
tasks.withType(Exec) {
def localProperties = new Properties()
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
def gstDir = localProperties.getProperty('gst.dir')
environment = [:]
environment['PATH'] = System.getenv("PATH")+ ":/usr/local/bin"
environment['GSTREAMER_SDK_ROOT'] = gstDir
environment['GSTREAMER_ROOT'] = gstDir
}
task buildNative(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = project.plugins.findPlugin('com.android.application').getNdkFolder()
commandLine "$ndkDir/ndk-build",
'-C', file('src/main/jni').absolutePath,
'-j', Runtime.runtime.availableProcessors(),
'all',
'NDK_DEBUG=1',
'V=1',
'APP_PLATFORM=android-21'
}
task cleanNative(type: Exec, description: 'Clean JNI object files') {
def ndkDir = project.plugins.findPlugin('com.android.application').getNdkFolder()
commandLine "$ndkDir/ndk-build",
'-C', file('src/main/jni').absolutePath,
'clean'
}
clean.dependsOn 'cleanNative'
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative
}
GSTREAMER_PLUGINS_CORE := coreelements adder app audioconvert audiorate audioresample audiotestsrc gio pango typefindfunctions videoconvert videorate videoscale videotestsrc volume autodetect videofilter
GSTREAMER_PLUGINS_CAPTURE := camerabin
GSTREAMER_PLUGINS_CODECS_RESTRICTED := asfmux dtsdec faad mpegpsdemux mpegpsmux mpegtsdemux mpegtsmux voaacenc a52dec amrnb amrwbdec asf dvdsub dvdlpcmdec mad mpeg2dec xingmux realmedia x264 libav
GSTREAMER_PLUGINS_ENCODING := encoding
GSTREAMER_PLUGINS_CODECS_GPL := assrender
GSTREAMER_PLUGINS_NET_RESTRICTED := mms rtmp
GSTREAMER_PLUGINS_SYS := opensles opengl
GSTREAMER_PLUGINS_VIS := libvisual goom goom2k1 audiovisualizers
GSTREAMER_PLUGINS_PLAYBACK := playback
GSTREAMER_PLUGINS_EFFECTS := alpha alphacolor audiofx cairo cutter debug deinterlace dtmf effectv equalizer gdkpixbuf imagefreeze interleave level multifile replaygain shapewipe smpte spectrum videobox videocrop videomixer accurip aiff audiofxbad autoconvert bayer coloreffects debugutilsbad fieldanalysis freeverb frei0r gaudieffects geometrictransform interlace ivtc liveadder rawparse removesilence segmentclip smooth speed videofiltersbad audiomixer compositor
GSTREAMER_PLUGINS_CODECS := subparse ogg theora vorbis ivorbisdec alaw apetag audioparsers auparse avi dv flac flv flxdec icydemux id3demux isomp4 jpeg matroska mulaw multipart png speex taglib vpx wavenc wavpack wavparse y4menc adpcmdec adpcmenc dashdemux dvbsuboverlay dvdspu fragmented id3tag kate midi mxf opus pcapparse pnm rfbsrc schro gstsiren smoothstreaming subenc videoparsersbad y4mdec jpegformat gdp rsvg androidmedia
GSTREAMER_PLUGINS_NET := tcp rtsp rtp rtpmanager soup udp dataurisrc sdp
GSTREAMER_PLUGINS_EDITING := gnonlin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment