diff --git a/playback/player/android/AndroidManifest.xml b/playback/player/android/AndroidManifest.xml new file mode 100644 index 0000000000..8b156d49d0 --- /dev/null +++ b/playback/player/android/AndroidManifest.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/playback/player/android/Makefile.am b/playback/player/android/Makefile.am index e9e4c74615..2664abbab9 100644 --- a/playback/player/android/Makefile.am +++ b/playback/player/android/Makefile.am @@ -1,24 +1,10 @@ EXTRA_DIST = \ - build.gradle \ - gradlew \ - gradlew.bat \ - README.md \ - settings.gradle \ - app/build.gradle \ - app/src/main/AndroidManifest.xml \ - app/src/main/java/org/freedesktop/gstreamer/Player.java \ - app/src/main/java/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java \ - app/src/main/java/org/freedesktop/gstreamer/player/Play.java \ - app/src/main/java/org/freedesktop/gstreamer/player/VideoSelector.java \ - app/src/main/jni/Android.mk \ - app/src/main/jni/Application.mk \ - app/src/main/jni/player.c \ - app/src/main/res/layout/activity_player.xml \ - app/src/main/res/layout/activity_video_selector.xml \ - app/src/main/res/menu/menu_video_selector.xml \ - app/src/main/res/values/dimens.xml \ - app/src/main/res/values/strings.xml \ - app/src/main/res/values/styles.xml \ - app/src/main/res/values-w820dp/styles.xml \ - gradle/wrapper/gradle-wrapper.jar \ - gradle/wrapper/gradle-wrapper.properties \ No newline at end of file + AndroidManifest.xml \ + jni/Android.mk \ + jni/player.c \ + res/layout/main.xml \ + res/values/strings.xml \ + src/org/freedesktop/gstreamer/Player.java \ + src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java \ + src/org/freedesktop/gstreamer/player/Play.java + diff --git a/playback/player/android/README.md b/playback/player/android/README.md deleted file mode 100644 index cf331f7b97..0000000000 --- a/playback/player/android/README.md +++ /dev/null @@ -1,50 +0,0 @@ -GST Player Android port -======================= - -Prerequisites -------------- - -1. Install Android SDK from https://developer.android.com/sdk/ & set `sdk.dir` in **local.properties** to the installation path -2. Install Android NDK from https://developer.android.com/tools/sdk/ndk/index.html & set `ndk.dir` in **local.properties** to the installation path -3. If you have a different special directory for pkg-config or other tools (e.g. on OSX when using Homebrew), then also set this path using the `ndk.extraPath` variable in **local.properties** -4. Download the GStreamer android ports http://gstreamer.freedesktop.org/data/pkg/android/ and set `gstreamer.$ABI.dir` properties in **local.properties**: - - gstreamer.arm.dir=/path/to/gstreamer-1.0-android-arm-release-1.4.5/ - gstreamer.armv7.dir=/path/to/gstreamer-1.0-android-armv7-release-1.4.5/ - gstreamer.x86.dir=/path/to/gstreamer-1.0-android-x86-release-1.4.5/ - -Compiling the sample --------------------- - -Use - - ./gradlew installDebug - -to compile and install a debug version onto all connected devices. - -Please note this component is using the new Android build system based on Gradle. More information about this is available on http://tools.android.com/tech-docs/new-build-system. - -Android Studio --------------- - -Android Studio builds will work out of the box. Simply open `build.gradle` in this folder to import the project. - -Manual NDK build ----------------- - -It is still possible to build just the NDK portion. This will speed up the process a bit as you don't need to start gradle first and compile the complete App. -First, make sure to set `NDK_PROJECT_PATH` to this projects main source path. Additionally the SDK & NDK tools are available in `$PATH`. - - export NDK_PROJECT_PATH=$PWD/app/src/main - -Second, set the following environment variables to the GStreamer installation folders: - - export GSTREAMER_ROOT_ARM=/path/to/gstreamer-1.0-android-arm-release-1.4.5/ - export GSTREAMER_ROOT_ARMV7=/path/to/tmp/gstreamer-1.0-android-armv7-release-1.4.5/ - export GSTREAMER_ROOT_X86=/path/to/gstreamer-1.0-android-x86-release-1.4.5/ - -If you don't want to build all architectures, please modify the file `app/src/main/jni/Application.mk` - -Finally, within the `app/src/main/` directory, invoke: - - ndk-build \ No newline at end of file diff --git a/playback/player/android/app/app.iml b/playback/player/android/app/app.iml deleted file mode 100644 index 86e3b56426..0000000000 --- a/playback/player/android/app/app.iml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/playback/player/android/app/build.gradle b/playback/player/android/app/build.gradle deleted file mode 100644 index 6039b5bd7c..0000000000 --- a/playback/player/android/app/build.gradle +++ /dev/null @@ -1,68 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" - - defaultConfig { - applicationId "org.freedesktop.gstreamer.play" - minSdkVersion 9 - targetSdkVersion 22 - - ndk { - moduleName "gstplayer" - } - } - - sourceSets { - main { - // GStreamer will generate these files. - java { - srcDir 'src/main/jni/src' - } - assets { - srcDir 'src/main/jni/assets' - } - - //Tell Gradle where to put the compiled shared library - jniLibs.srcDir 'src/main/libs' - - //disable automatic ndk-build call - jni.srcDirs = []; - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } - - // Thank you http://stackoverflow.com/q/28878689/375209 - tasks.withType(JavaCompile) { - compileTask -> compileTask.dependsOn ndkBuild - } - - task ndkBuild(type: Exec) { - Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) - def ndkDir = properties.getProperty('ndk.dir') - environment GSTREAMER_ROOT_ARM: properties.getProperty('gstreamer.arm.dir') - environment GSTREAMER_ROOT_ARMV7: properties.getProperty('gstreamer.armv7.dir') - environment GSTREAMER_ROOT_X86: properties.getProperty('gstreamer.x86.dir') - - def ndkExtraPath = properties.getProperty('ndk.extraPath') - if (! "".equalsIgnoreCase(ndkExtraPath)) { - environment PATH: "${System.getenv("PATH")}${File.pathSeparator}${ndkExtraPath}" - } - - commandLine "${ndkDir}/ndk-build", '-C', file('src/main/jni').absolutePath //, 'V=1' // Enable V=1 for debugging messages. - } -} - -dependencies { - compile 'com.android.support:appcompat-v7:22.1.1' - compile "com.android.support:recyclerview-v7:22.1.1" - compile "com.android.support:support-annotations:22.1.1" -} diff --git a/playback/player/android/app/src/main/AndroidManifest.xml b/playback/player/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 6de668cec0..0000000000 --- a/playback/player/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/VideoSelector.java b/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/VideoSelector.java deleted file mode 100644 index 38739f7d12..0000000000 --- a/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/VideoSelector.java +++ /dev/null @@ -1,151 +0,0 @@ -/* GStreamer - * - * Copyright (C) 2015 Sebastian Roth - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -package org.freedesktop.gstreamer.play; - -import android.content.Context; -import android.content.Intent; -import android.database.Cursor; -import android.net.Uri; -import android.os.Bundle; -import android.provider.MediaStore; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.CursorLoader; -import android.support.v4.content.Loader; -import android.support.v4.widget.SimpleCursorAdapter; -import android.support.v7.app.AppCompatActivity; -import android.text.TextUtils; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.AdapterView; -import android.widget.ListView; - - -public class VideoSelector extends AppCompatActivity implements LoaderManager.LoaderCallbacks { - - VideoAdapter adapter; - boolean sortByName = false; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_video_selector); - - ListView videoList = (ListView) findViewById(R.id.videoList); - adapter = new VideoAdapter(this); - videoList.setAdapter(adapter); - videoList.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, final int position, final long id) { - final String videoPath = adapter.getVideoPath(position); - if (!TextUtils.isEmpty(videoPath)) { - Intent intent = new Intent(VideoSelector.this, Play.class); - intent.setData(Uri.parse("file://" + videoPath)); - startActivity(intent); - } - } - }); - - getSupportLoaderManager().initLoader(1, null, this); - - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.menu_video_selector, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. - int id = item.getItemId(); - - //noinspection SimplifiableIfStatement - if (id == R.id.action_about) { - return true; - } - - //noinspection SimplifiableIfStatement - if (id == R.id.action_sort) { - sortByName = !sortByName; - getSupportLoaderManager().restartLoader(1, null, this); - return true; - } - - - return super.onOptionsItemSelected(item); - } - - @Override - public Loader onCreateLoader(int id, Bundle args) { - if (sortByName) { - return new CursorLoader(this, MediaStore.Video.Media.getContentUri("external"), null, null, null, - "UPPER(" + MediaStore.Video.Media.DATA + ")"); - } else { - return new CursorLoader(this, MediaStore.Video.Media.getContentUri("external"), null, null, null, - "UPPER(" + MediaStore.Video.Media.DISPLAY_NAME + ")"); - } - } - - @Override - public void onLoadFinished(Loader loader, Cursor data) { - adapter.swapCursor(data); - } - - @Override - public void onLoaderReset(Loader loader) { - - } - - - class VideoAdapter extends SimpleCursorAdapter { - public VideoAdapter(Context context) { - super(context, android.R.layout.simple_list_item_2, null, - new String[]{MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.DATA}, - new int[]{android.R.id.text1, android.R.id.text2}, 0); - } - - @Override - public long getItemId(int position) { - final Cursor cursor = getCursor(); - if (cursor.getCount() == 0 || position >= cursor.getCount()) { - return 0; - } - cursor.moveToPosition(position); - - return cursor.getLong(0); - } - - public String getVideoPath(int position) { - final Cursor cursor = getCursor(); - if (cursor.getCount() == 0) { - return ""; - } - cursor.moveToPosition(position); - - return cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DATA)); - } - } -} diff --git a/playback/player/android/app/src/main/jni/Application.mk b/playback/player/android/app/src/main/jni/Application.mk deleted file mode 100644 index f665244472..0000000000 --- a/playback/player/android/app/src/main/jni/Application.mk +++ /dev/null @@ -1,2 +0,0 @@ -APP_ABI := armeabi armeabi-v7a x86 -APP_PLATFORM := android-9 \ No newline at end of file diff --git a/playback/player/android/app/src/main/res/layout/activity_player.xml b/playback/player/android/app/src/main/res/layout/activity_player.xml deleted file mode 100644 index cd4a933791..0000000000 --- a/playback/player/android/app/src/main/res/layout/activity_player.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/playback/player/android/app/src/main/res/layout/activity_video_selector.xml b/playback/player/android/app/src/main/res/layout/activity_video_selector.xml deleted file mode 100644 index 229ae17845..0000000000 --- a/playback/player/android/app/src/main/res/layout/activity_video_selector.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/playback/player/android/app/src/main/res/menu/menu_video_selector.xml b/playback/player/android/app/src/main/res/menu/menu_video_selector.xml deleted file mode 100644 index 93f44374d6..0000000000 --- a/playback/player/android/app/src/main/res/menu/menu_video_selector.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - diff --git a/playback/player/android/app/src/main/res/values-w820dp/dimens.xml b/playback/player/android/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc816444..0000000000 --- a/playback/player/android/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/playback/player/android/app/src/main/res/values/dimens.xml b/playback/player/android/app/src/main/res/values/dimens.xml deleted file mode 100644 index 47c8224673..0000000000 --- a/playback/player/android/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 16dp - 16dp - diff --git a/playback/player/android/app/src/main/res/values/styles.xml b/playback/player/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 540f2fe87c..0000000000 --- a/playback/player/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/playback/player/android/build.gradle b/playback/player/android/build.gradle deleted file mode 100644 index 01de6eff51..0000000000 --- a/playback/player/android/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' - } -} - -allprojects { - repositories { - jcenter() - } -} diff --git a/playback/player/android/build.xml b/playback/player/android/build.xml new file mode 100644 index 0000000000..4ef18c8f98 --- /dev/null +++ b/playback/player/android/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/playback/player/android/gradle/wrapper/gradle-wrapper.jar b/playback/player/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 8c0fb64a86..0000000000 Binary files a/playback/player/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/playback/player/android/gradle/wrapper/gradle-wrapper.properties b/playback/player/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 0c71e760dc..0000000000 --- a/playback/player/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/playback/player/android/gradlew b/playback/player/android/gradlew deleted file mode 100755 index 91a7e269e1..0000000000 --- a/playback/player/android/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/playback/player/android/gradlew.bat b/playback/player/android/gradlew.bat deleted file mode 100644 index 8a0b282aa6..0000000000 --- a/playback/player/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/playback/player/android/app/src/main/jni/Android.mk b/playback/player/android/jni/Android.mk similarity index 60% rename from playback/player/android/app/src/main/jni/Android.mk rename to playback/player/android/jni/Android.mk index 7afe06251e..fe4d50aaa8 100644 --- a/playback/player/android/app/src/main/jni/Android.mk +++ b/playback/player/android/jni/Android.mk @@ -2,25 +2,18 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -GST_PATH := $(LOCAL_PATH)/../../../../../ - LOCAL_MODULE := gstplayer -LOCAL_SRC_FILES := player.c \ - $(GST_PATH)/lib/gst/player/gstplayer.c \ - $(GST_PATH)/lib/gst/player/gstplayer-media-info.c -LOCAL_C_INCLUDES := $(GST_PATH)/lib +LOCAL_SRC_FILES := player.c ../../lib/gst/player/gstplayer.c ../../lib/gst/player/gstplayer-media-info.c +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../lib LOCAL_SHARED_LIBRARIES := gstreamer_android LOCAL_LDLIBS := -llog -landroid include $(BUILD_SHARED_LIBRARY) -ifeq ($(TARGET_ARCH_ABI),armeabi) - GSTREAMER_ROOT := $(GSTREAMER_ROOT_ARM) -else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) - GSTREAMER_ROOT := $(GSTREAMER_ROOT_ARMV7) -else ifeq ($(TARGET_ARCH_ABI),x86) - GSTREAMER_ROOT := $(GSTREAMER_ROOT_X86) -else - $(error Target arch ABI $(TARGET_ARCH_ABI) not supported) +ifndef GSTREAMER_ROOT +ifndef GSTREAMER_ROOT_ANDROID +$(error GSTREAMER_ROOT_ANDROID is not defined!) +endif +GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID) endif GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/ diff --git a/playback/player/android/app/src/main/jni/player.c b/playback/player/android/jni/player.c similarity index 99% rename from playback/player/android/app/src/main/jni/player.c rename to playback/player/android/jni/player.c index 133d97090f..fc552476af 100644 --- a/playback/player/android/app/src/main/jni/player.c +++ b/playback/player/android/jni/player.c @@ -25,7 +25,7 @@ #include #include -#include "gst/player/player.h" +#include "gst/player/gstplayer.h" GST_DEBUG_CATEGORY_STATIC (debug_category); #define GST_CAT_DEFAULT debug_category diff --git a/playback/player/android/res/layout/main.xml b/playback/player/android/res/layout/main.xml new file mode 100644 index 0000000000..b745d8069e --- /dev/null +++ b/playback/player/android/res/layout/main.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/playback/player/android/app/src/main/res/values/strings.xml b/playback/player/android/res/values/strings.xml similarity index 70% rename from playback/player/android/app/src/main/res/values/strings.xml rename to playback/player/android/res/values/strings.xml index d3af9a3e35..9587e3c40c 100644 --- a/playback/player/android/app/src/main/res/values/strings.xml +++ b/playback/player/android/res/values/strings.xml @@ -3,7 +3,4 @@ GStreamer Play Play Pause - - About - Sort diff --git a/playback/player/android/settings.gradle b/playback/player/android/settings.gradle deleted file mode 100644 index e7b4def49c..0000000000 --- a/playback/player/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/Player.java b/playback/player/android/src/org/freedesktop/gstreamer/Player.java similarity index 100% rename from playback/player/android/app/src/main/java/org/freedesktop/gstreamer/Player.java rename to playback/player/android/src/org/freedesktop/gstreamer/Player.java diff --git a/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/GStreamerSurfaceView.java b/playback/player/android/src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java similarity index 100% rename from playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/GStreamerSurfaceView.java rename to playback/player/android/src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java diff --git a/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/Play.java b/playback/player/android/src/org/freedesktop/gstreamer/player/Play.java similarity index 81% rename from playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/Play.java rename to playback/player/android/src/org/freedesktop/gstreamer/player/Play.java index 9be9d78b2a..2874f05de5 100644 --- a/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/Play.java +++ b/playback/player/android/src/org/freedesktop/gstreamer/player/Play.java @@ -20,13 +20,18 @@ package org.freedesktop.gstreamer.play; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.PowerManager; -import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.SurfaceHolder; +import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; @@ -37,16 +42,13 @@ import android.widget.Toast; import org.freedesktop.gstreamer.Player; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -public class Play extends AppCompatActivity implements SurfaceHolder.Callback, OnSeekBarChangeListener { +public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarChangeListener { private PowerManager.WakeLock wake_lock; private Player player; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) + { super.onCreate(savedInstanceState); try { @@ -57,7 +59,7 @@ public class Play extends AppCompatActivity implements SurfaceHolder.Callback, O return; } - setContentView(R.layout.activity_player); + setContentView(R.layout.main); player = new Player(); @@ -86,7 +88,7 @@ public class Play extends AppCompatActivity implements SurfaceHolder.Callback, O player.setPositionUpdatedListener(new Player.PositionUpdatedListener() { public void positionUpdated(Player player, final long position) { - runOnUiThread(new Runnable() { + runOnUiThread (new Runnable() { public void run() { sb.setProgress((int) (position / 1000000)); updateTimeWidget(); @@ -97,7 +99,7 @@ public class Play extends AppCompatActivity implements SurfaceHolder.Callback, O player.setDurationChangedListener(new Player.DurationChangedListener() { public void durationChanged(Player player, final long duration) { - runOnUiThread(new Runnable() { + runOnUiThread (new Runnable() { public void run() { sb.setMax((int) (duration / 1000000)); updateTimeWidget(); @@ -107,35 +109,31 @@ public class Play extends AppCompatActivity implements SurfaceHolder.Callback, O }); final GStreamerSurfaceView gsv = (GStreamerSurfaceView) this.findViewById(R.id.surface_video); - player.setVideoDimensionsChangedListener(new Player.VideoDimensionsChangedListener() { public void videoDimensionsChanged(Player player, final int width, final int height) { - runOnUiThread(new Runnable() { + runOnUiThread (new Runnable() { public void run() { - Log.i("GStreamer", "Media size changed to " + width + "x" + height); - if (width > 0 && height > 0) { - gsv.media_width = width; - gsv.media_height = height; - runOnUiThread(new Runnable() { - public void run() { - gsv.requestLayout(); - } - }); - } else { - Log.i("GStreamer", "Ignoring media size."); - } + Log.i ("GStreamer", "Media size changed to " + width + "x" + height); + gsv.media_width = width; + gsv.media_height = height; + runOnUiThread(new Runnable() { + public void run() { + gsv.requestLayout(); + } + }); } }); } }); - SurfaceHolder sh = gsv.getHolder(); + SurfaceView sv = (SurfaceView) this.findViewById(R.id.surface_video); + SurfaceHolder sh = sv.getHolder(); sh.addCallback(this); String mediaUri = null; Intent intent = getIntent(); android.net.Uri uri = intent.getData(); - Log.i("GStreamer", "Received URI: " + uri); + Log.i ("GStreamer", "Received URI: " + uri); if (uri.getScheme().equals("content")) { android.database.Cursor cursor = getContentResolver().query(uri, null, null, null, null); cursor.moveToFirst(); @@ -154,7 +152,7 @@ public class Play extends AppCompatActivity implements SurfaceHolder.Callback, O super.onDestroy(); } - private void updateTimeWidget() { + private void updateTimeWidget () { final TextView tv = (TextView) this.findViewById(R.id.textview_time); final SeekBar sb = (SeekBar) this.findViewById(R.id.seek_bar); final int pos = sb.getProgress(); @@ -162,12 +160,14 @@ public class Play extends AppCompatActivity implements SurfaceHolder.Callback, O SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("UTC")); - final String message = df.format(new Date(pos)) + " / " + df.format(new Date(max)); + final String message = df.format(new Date (pos)) + " / " + df.format(new Date (max)); tv.setText(message); } - public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - Log.d("GStreamer", "Surface changed to format " + format + " width " + width + " height " + height); + public void surfaceChanged(SurfaceHolder holder, int format, int width, + int height) { + Log.d("GStreamer", "Surface changed to format " + format + " width " + + width + " height " + height); player.setSurface(holder.getSurface()); }