aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/android/jni/BitSet.cpp5
-rw-r--r--xbmc/android/jni/Buffer.cpp129
-rw-r--r--xbmc/android/jni/Buffer.h48
-rw-r--r--xbmc/android/jni/Build.cpp74
-rw-r--r--xbmc/android/jni/Build.h55
-rw-r--r--xbmc/android/jni/ByteBuffer.cpp189
-rw-r--r--xbmc/android/jni/ByteBuffer.h57
-rw-r--r--xbmc/android/jni/Context.cpp21
-rw-r--r--xbmc/android/jni/Context.h5
-rw-r--r--xbmc/android/jni/Cursor.cpp4
-rw-r--r--xbmc/android/jni/Cursor.h2
-rw-r--r--xbmc/android/jni/Intent.cpp14
-rw-r--r--xbmc/android/jni/Intent.h14
-rw-r--r--xbmc/android/jni/JNIBase.cpp11
-rw-r--r--xbmc/android/jni/JNIBase.h6
-rw-r--r--xbmc/android/jni/Makefile.in11
-rw-r--r--xbmc/android/jni/MediaCodec.cpp248
-rw-r--r--xbmc/android/jni/MediaCodec.h79
-rw-r--r--xbmc/android/jni/MediaCodecBufferInfo.cpp60
-rw-r--r--xbmc/android/jni/MediaCodecBufferInfo.h35
-rw-r--r--xbmc/android/jni/MediaCodecCryptoInfo.cpp127
-rw-r--r--xbmc/android/jni/MediaCodecCryptoInfo.h45
-rw-r--r--xbmc/android/jni/MediaCodecInfo.cpp349
-rw-r--r--xbmc/android/jni/MediaCodecInfo.h203
-rw-r--r--xbmc/android/jni/MediaCodecList.cpp41
-rw-r--r--xbmc/android/jni/MediaCodecList.h38
-rw-r--r--xbmc/android/jni/MediaCrypto.h29
-rw-r--r--xbmc/android/jni/MediaFormat.cpp166
-rw-r--r--xbmc/android/jni/MediaFormat.h68
-rw-r--r--xbmc/android/jni/Surface.cpp59
-rw-r--r--xbmc/android/jni/Surface.h24
-rw-r--r--xbmc/android/jni/SurfaceTexture.cpp62
-rw-r--r--xbmc/android/jni/SurfaceTexture.h18
-rw-r--r--xbmc/android/jni/View.cpp131
-rw-r--r--xbmc/android/jni/View.h76
-rw-r--r--xbmc/android/jni/WifiConfiguration.cpp154
-rw-r--r--xbmc/android/jni/WifiConfiguration.h50
-rw-r--r--xbmc/android/jni/WifiManager.cpp14
-rw-r--r--xbmc/android/jni/WifiManager.h4
-rw-r--r--xbmc/android/jni/Window.cpp32
-rw-r--r--xbmc/android/jni/Window.h32
-rw-r--r--xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideoPrivate.cpp2
42 files changed, 2699 insertions, 92 deletions
diff --git a/xbmc/android/jni/BitSet.cpp b/xbmc/android/jni/BitSet.cpp
index d71da1092e..b573c87cdc 100644
--- a/xbmc/android/jni/BitSet.cpp
+++ b/xbmc/android/jni/BitSet.cpp
@@ -23,12 +23,13 @@
using namespace jni;
-CJNIBitSet::CJNIBitSet() : CJNIBase("java.util.BitSet")
+CJNIBitSet::CJNIBitSet() : CJNIBase("java/util/BitSet")
{
m_object = new_object(GetClassName());
+ m_object.setGlobal();
}
-CJNIBitSet::CJNIBitSet(int bitCount) : CJNIBase("java.util.BitSet")
+CJNIBitSet::CJNIBitSet(int bitCount) : CJNIBase("java/util/BitSet")
{
m_object = new_object(GetClassName(),
"<init>", "(I)V",
diff --git a/xbmc/android/jni/Buffer.cpp b/xbmc/android/jni/Buffer.cpp
new file mode 100644
index 0000000000..868989405a
--- /dev/null
+++ b/xbmc/android/jni/Buffer.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "Buffer.h"
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+int CJNIBuffer::capacity()
+{
+ return call_method<int>(m_object,
+ "capacity", "()I");
+}
+
+int CJNIBuffer::position()
+{
+ return call_method<int>(m_object,
+ "position", "()I");
+}
+
+CJNIBuffer CJNIBuffer::position(int newPosition)
+{
+ return call_method<jhobject>(m_object,
+ "position", "(I)Ljava/nio/Buffer;",
+ newPosition);
+}
+
+int CJNIBuffer::limit()
+{
+ return call_method<int>(m_object,
+ "limit", "()I");
+}
+
+CJNIBuffer CJNIBuffer::limit(int newLimit)
+{
+ return call_method<jhobject>(m_object,
+ "limit", "(I)Ljava/nio/Buffer;",
+ newLimit);
+}
+
+CJNIBuffer CJNIBuffer::mark()
+{
+ return call_method<jhobject>(m_object,
+ "mark", "()Ljava/nio/Buffer;");
+}
+
+CJNIBuffer CJNIBuffer::reset()
+{
+ return call_method<jhobject>(m_object,
+ "reset", "()Ljava/nio/Buffer;");
+}
+
+CJNIBuffer CJNIBuffer::clear()
+{
+ return call_method<jhobject>(m_object,
+ "clear", "()Ljava/nio/Buffer;");
+}
+
+CJNIBuffer CJNIBuffer::flip()
+{
+ return call_method<jhobject>(m_object,
+ "flip", "()Ljava/nio/Buffer;");
+}
+
+CJNIBuffer CJNIBuffer::rewind()
+{
+ return call_method<jhobject>(m_object,
+ "rewind", "()Ljava/nio/Buffer;");
+}
+
+int CJNIBuffer::remaining()
+{
+ return call_method<int>(m_object,
+ "remaining", "()I");
+}
+
+bool CJNIBuffer::hasRemaining()
+{
+ return call_method<jboolean>(m_object,
+ "hasRemaining", "()Z");
+}
+
+bool CJNIBuffer::isReadOnly()
+{
+ return call_method<jboolean>(m_object,
+ "isReadOnly", "()Z");
+}
+
+bool CJNIBuffer::hasArray()
+{
+ return call_method<jboolean>(m_object,
+ "hasArray", "()Z");
+}
+
+/*
+CJNIObject CJNIBuffer::array()
+{
+}
+*/
+
+int CJNIBuffer::arrayOffset()
+{
+ return call_method<int>(m_object,
+ "arrayOffset", "()I");
+}
+
+bool CJNIBuffer::isDirect()
+{
+ return call_method<jboolean>(m_object,
+ "isDirect", "()Z");
+}
+
diff --git a/xbmc/android/jni/Buffer.h b/xbmc/android/jni/Buffer.h
new file mode 100644
index 0000000000..dd07564060
--- /dev/null
+++ b/xbmc/android/jni/Buffer.h
@@ -0,0 +1,48 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIBuffer : public CJNIBase
+{
+protected:
+ CJNIBuffer(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNIBuffer() {};
+
+ int capacity();
+ int position();
+ CJNIBuffer position(int newPosition);
+ int limit();
+ CJNIBuffer limit(int newLimit);
+ CJNIBuffer mark();
+ CJNIBuffer reset();
+ CJNIBuffer clear();
+ CJNIBuffer flip();
+ CJNIBuffer rewind();
+ int remaining();
+ bool hasRemaining();
+
+ virtual bool isReadOnly();
+ virtual bool hasArray();
+//virtual CJNIObject array();
+ virtual int arrayOffset();
+ virtual bool isDirect();
+};
diff --git a/xbmc/android/jni/Build.cpp b/xbmc/android/jni/Build.cpp
new file mode 100644
index 0000000000..a400dcd438
--- /dev/null
+++ b/xbmc/android/jni/Build.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "Build.h"
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+const char *CJNIBuild::m_classname = "android/os/Build";
+
+std::string CJNIBuild::UNKNOWN;
+std::string CJNIBuild::DISPLAY;
+std::string CJNIBuild::PRODUCT;
+std::string CJNIBuild::DEVICE;
+std::string CJNIBuild::BOARD;
+std::string CJNIBuild::CPU_ABI;
+std::string CJNIBuild::CPU_ABI2;
+std::string CJNIBuild::MANUFACTURER;
+std::string CJNIBuild::BRAND;
+std::string CJNIBuild::MODEL;
+std::string CJNIBuild::BOOTLOADER;
+std::string CJNIBuild::RADIO;
+std::string CJNIBuild::HARDWARE;
+std::string CJNIBuild::SERIAL;
+std::string CJNIBuild::TAGS;
+std::string CJNIBuild::FINGERPRINT;
+int64_t CJNIBuild::TIME;
+std::string CJNIBuild::USER;
+std::string CJNIBuild::HOST;
+
+void CJNIBuild::PopulateStaticFields()
+{
+ UNKNOWN = jcast<std::string>(get_static_field<jhstring>(m_classname,"UNKNOWN"));
+ DISPLAY = jcast<std::string>(get_static_field<jhstring>(m_classname,"DISPLAY"));
+ PRODUCT = jcast<std::string>(get_static_field<jhstring>(m_classname,"PRODUCT"));
+ DEVICE = jcast<std::string>(get_static_field<jhstring>(m_classname,"DEVICE"));
+ BOARD = jcast<std::string>(get_static_field<jhstring>(m_classname,"BOARD"));
+ CPU_ABI = jcast<std::string>(get_static_field<jhstring>(m_classname,"CPU_ABI"));
+ CPU_ABI2 = jcast<std::string>(get_static_field<jhstring>(m_classname,"CPU_ABI2"));
+ MANUFACTURER = jcast<std::string>(get_static_field<jhstring>(m_classname,"MANUFACTURER"));
+ BRAND = jcast<std::string>(get_static_field<jhstring>(m_classname,"BRAND"));
+ MODEL = jcast<std::string>(get_static_field<jhstring>(m_classname,"MODEL"));
+ BOOTLOADER = jcast<std::string>(get_static_field<jhstring>(m_classname,"BOOTLOADER"));
+ RADIO = jcast<std::string>(get_static_field<jhstring>(m_classname,"RADIO"));
+ HARDWARE = jcast<std::string>(get_static_field<jhstring>(m_classname,"HARDWARE"));
+ SERIAL = jcast<std::string>(get_static_field<jhstring>(m_classname,"SERIAL"));
+ TAGS = jcast<std::string>(get_static_field<jhstring>(m_classname,"TAGS"));
+ FINGERPRINT = jcast<std::string>(get_static_field<jhstring>(m_classname,"FINGERPRINT"));
+ TIME = get_static_field<jlong>(m_classname,"TIME");
+ USER = jcast<std::string>(get_static_field<jhstring>(m_classname,"USER"));
+ HOST = jcast<std::string>(get_static_field<jhstring>(m_classname,"HOST"));
+}
+
+std::string CJNIBuild::getRadioVersion()
+{
+ return jcast<std::string>(call_static_method<jhstring>(m_classname,
+ "getRadioVersion", "()Ljava/lang/String;"));
+}
diff --git a/xbmc/android/jni/Build.h b/xbmc/android/jni/Build.h
new file mode 100644
index 0000000000..2032787e8f
--- /dev/null
+++ b/xbmc/android/jni/Build.h
@@ -0,0 +1,55 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIBuild
+{
+public:
+ static std::string UNKNOWN;
+ static std::string ID;
+ static std::string DISPLAY;
+ static std::string PRODUCT;
+ static std::string DEVICE;
+ static std::string BOARD;
+ static std::string CPU_ABI;
+ static std::string CPU_ABI2;
+ static std::string MANUFACTURER;
+ static std::string BRAND;
+ static std::string MODEL;
+ static std::string BOOTLOADER;
+ static std::string RADIO;
+ static std::string HARDWARE;
+ static std::string SERIAL;
+ static std::string TYPE;
+ static std::string TAGS;
+ static std::string FINGERPRINT;
+ static int64_t TIME;
+ static std::string USER;
+ static std::string HOST;
+ static std::string getRadioVersion();
+
+ static void PopulateStaticFields();
+private:
+ CJNIBuild();
+ ~CJNIBuild() {};
+ static const char *m_classname;
+};
diff --git a/xbmc/android/jni/ByteBuffer.cpp b/xbmc/android/jni/ByteBuffer.cpp
new file mode 100644
index 0000000000..19ef08f5d7
--- /dev/null
+++ b/xbmc/android/jni/ByteBuffer.cpp
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ByteBuffer.h"
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+const char* CJNIByteBuffer::m_classname = "java/nio/ByteBuffer";
+
+CJNIByteBuffer CJNIByteBuffer::CJNIByteBuffer::allocateDirect(int capacity)
+{
+ return CJNIByteBuffer(call_static_method<jhobject>(m_classname,
+ "allocateDirect", "(I)Ljava/nio/ByteBuffer;",
+ capacity));
+}
+
+CJNIByteBuffer CJNIByteBuffer::allocate(int capacity)
+{
+ return CJNIByteBuffer(call_static_method<jhobject>(m_classname,
+ "allocate", "(I)Ljava/nio/ByteBuffer;",
+ capacity));
+}
+
+CJNIByteBuffer CJNIByteBuffer::wrap(const std::vector<char> &array, int start, int byteCount)
+{
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = array.size();
+ jbyteArray bytearray = env->NewByteArray(size);
+ env->SetByteArrayRegion(bytearray, 0, size, (jbyte*)&array[0]);
+
+ return CJNIByteBuffer(call_static_method<jhobject>(m_classname,
+ "wrap","([BII)Ljava/nio/ByteBuffer;",
+ bytearray, start, byteCount));
+}
+
+CJNIByteBuffer CJNIByteBuffer::wrap(const std::vector<char> &array)
+{
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = array.size();
+ jbyteArray bytearray = env->NewByteArray(size);
+ env->SetByteArrayRegion(bytearray, 0, size, (jbyte*)&array[0]);
+
+ return CJNIByteBuffer(call_static_method<jhobject>(m_classname,
+ "wrap","([B)Ljava/nio/ByteBuffer;",
+ bytearray));
+}
+
+CJNIByteBuffer CJNIByteBuffer::get(const std::vector<char> &dst, int dstOffset, int byteCount)
+{
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = dst.size();
+ jbyteArray bytearray = env->NewByteArray(size);
+ env->SetByteArrayRegion(bytearray, 0, size, (jbyte*)&dst[0]);
+
+ return CJNIByteBuffer(call_method<jhobject>(m_object,
+ "get","([BII)Ljava/nio/ByteBuffer;",
+ bytearray, dstOffset, byteCount));
+}
+
+CJNIByteBuffer CJNIByteBuffer::get(const std::vector<char> &dst)
+{
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = dst.size();
+ jbyteArray bytearray = env->NewByteArray(size);
+ env->SetByteArrayRegion(bytearray, 0, size, (jbyte*)&dst[0]);
+
+ return CJNIByteBuffer(call_method<jhobject>(m_object,
+ "get","([B)Ljava/nio/ByteBuffer;",
+ bytearray));
+}
+
+CJNIByteBuffer CJNIByteBuffer::put(const CJNIByteBuffer &src)
+{
+ return CJNIByteBuffer(call_method<jhobject>(m_object,
+ "put","(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;",
+ src.get_raw()));
+}
+
+CJNIByteBuffer CJNIByteBuffer::put(const std::vector<char> &src, int srcOffset, int byteCount)
+{
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = src.size();
+ jbyteArray bytearray = env->NewByteArray(size);
+ env->SetByteArrayRegion(bytearray, 0, size, (jbyte*)&src[0]);
+
+ return CJNIByteBuffer(call_method<jhobject>(m_object,
+ "put","([BII)Ljava/nio/ByteBuffer;",
+ bytearray, srcOffset, byteCount));
+}
+
+CJNIByteBuffer CJNIByteBuffer::put(const std::vector<char> &src)
+{
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = src.size();
+ jbyteArray bytearray = env->NewByteArray(size);
+ env->SetByteArrayRegion(bytearray, 0, size, (jbyte*)&src[0]);
+
+ return CJNIByteBuffer(call_method<jhobject>(m_object,
+ "put","([B)Ljava/nio/ByteBuffer;",
+ bytearray));
+}
+
+bool CJNIByteBuffer::hasArray()
+{
+ return call_method<jboolean>(m_object,
+ "hasArray", "()Z");
+}
+
+std::vector<char> CJNIByteBuffer::array()
+{
+ JNIEnv *env = xbmc_jnienv();
+ jhbyteArray array = call_method<jhbyteArray>(m_object,
+ "array", "()[B");
+
+ jsize size = env->GetArrayLength(array.get());
+
+ std::vector<char> result;
+ result.resize(size);
+ env->GetByteArrayRegion(array.get(), 0, size, (jbyte*)result.data());
+
+ return result;
+}
+
+int CJNIByteBuffer::arrayOffset()
+{
+ return call_method<int>(m_object,
+ "arrayOffset", "()I");
+}
+
+std::string CJNIByteBuffer::toString()
+{
+ return jcast<std::string>(call_method<jhstring>(m_object,
+ "toString", "()Ljava/lang/String;"));
+}
+
+int CJNIByteBuffer::hashCode()
+{
+ return call_method<int>(m_object,
+ "hashCode", "()I");
+}
+
+/*
+bool CJNIByteBuffer::equals(CJNIObject other)
+{
+}
+*/
+
+int CJNIByteBuffer::compareTo(const CJNIByteBuffer &otherBuffer)
+{
+ return call_method<int>(m_object,
+ "compareTo","(Ljava/nio/ByteBuffer;)I",
+ otherBuffer.get_raw());
+}
+
+/*
+CJNIByteOrder CJNIByteBuffer::order()
+{
+}
+
+CJNIByteBuffer CJNIByteBuffer::order(CJNIByteOrder byteOrder)
+{
+}
+
+CJNIObject CJNIByteBuffer::array()
+{
+}
+
+int CJNIByteBuffer::compareTo(const CJNIObject &otherBuffer)
+{
+}
+*/
diff --git a/xbmc/android/jni/ByteBuffer.h b/xbmc/android/jni/ByteBuffer.h
new file mode 100644
index 0000000000..335384a49a
--- /dev/null
+++ b/xbmc/android/jni/ByteBuffer.h
@@ -0,0 +1,57 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "Buffer.h"
+
+class CJNIByteBuffer : public CJNIBuffer
+{
+public:
+ CJNIByteBuffer(const jni::jhobject &object) : CJNIBuffer(object) {};
+ ~CJNIByteBuffer(){};
+
+ static CJNIByteBuffer allocateDirect(int capacity);
+ static CJNIByteBuffer allocate(int capacity);
+ static CJNIByteBuffer wrap(const std::vector<char> &array, int start, int byteCount);
+ static CJNIByteBuffer wrap(const std::vector<char> &array);
+
+ CJNIByteBuffer get(const std::vector<char> &dst, int dstOffset, int byteCount);
+ CJNIByteBuffer get(const std::vector<char> &dst);
+ CJNIByteBuffer put(const CJNIByteBuffer &src);
+ CJNIByteBuffer put(const std::vector<char> &src, int srcOffset, int byteCount);
+ CJNIByteBuffer put(const std::vector<char> &src);
+
+ bool hasArray();
+ std::vector<char> array();
+ int arrayOffset();
+ std::string toString();
+ int hashCode();
+ //bool equals(const CJNIObject &other);
+ int compareTo(const CJNIByteBuffer &otherBuffer);
+ //CJNIByteOrder order();
+ //CJNIByteBuffer order(const CJNIByteOrder &byteOrder);
+ //CJNIObject array();
+ //int compareTo(const CJNIObject &otherBuffer);
+
+private:
+ static const char *m_classname;
+};
+
+typedef std::vector<CJNIByteBuffer> CJNIByteBuffers;
diff --git a/xbmc/android/jni/Context.cpp b/xbmc/android/jni/Context.cpp
index b0de7cc994..defa2be1cf 100644
--- a/xbmc/android/jni/Context.cpp
+++ b/xbmc/android/jni/Context.cpp
@@ -36,6 +36,13 @@
#include "Cursor.h"
#include "ConnectivityManager.h"
#include "AudioManager.h"
+#include "Surface.h"
+#include "MediaCodec.h"
+#include "MediaCodecInfo.h"
+#include "MediaFormat.h"
+#include "Window.h"
+#include "View.h"
+#include "Build.h"
#include <android/native_activity.h>
@@ -48,6 +55,7 @@ CJNIContext::CJNIContext(const ANativeActivity *nativeActivity)
{
m_context.reset(nativeActivity->clazz);
xbmc_jni_on_load(nativeActivity->vm, nativeActivity->env);
+ CJNIBase::SetSDKVersion(nativeActivity->sdkVersion);
PopulateStaticFields();
m_appInstance = this;
}
@@ -70,6 +78,13 @@ void CJNIContext::PopulateStaticFields()
CJNIContentResolver::PopulateStaticFields();
CJNIConnectivityManager::PopulateStaticFields();
CJNIAudioManager::PopulateStaticFields();
+ CJNISurface::PopulateStaticFields();
+ CJNIMediaCodec::PopulateStaticFields();
+ CJNIMediaCodecInfoCodecProfileLevel::PopulateStaticFields();
+ CJNIMediaCodecInfoCodecCapabilities::PopulateStaticFields();
+ CJNIMediaFormat::PopulateStaticFields();
+ CJNIView::PopulateStaticFields();
+ CJNIBuild::PopulateStaticFields();
}
CJNIPackageManager CJNIContext::GetPackageManager()
@@ -177,6 +192,12 @@ CJNIContentResolver CJNIContext::getContentResolver()
"getContentResolver", "()Landroid/content/ContentResolver;");
}
+CJNIWindow CJNIContext::getWindow()
+{
+ return call_method<jhobject>(m_context,
+ "getWindow", "()Landroid/view/Window;");
+}
+
void CJNIContext::_onNewIntent(JNIEnv *env, jobject context, jobject intent)
{
(void)env;
diff --git a/xbmc/android/jni/Context.h b/xbmc/android/jni/Context.h
index c577bd97b6..b6e8b2ef33 100644
--- a/xbmc/android/jni/Context.h
+++ b/xbmc/android/jni/Context.h
@@ -22,7 +22,7 @@
#include "JNIBase.h"
#include "BroadcastReceiver.h"
-struct ANativeActivity;
+class ANativeActivity;
class CJNIIntent;
class CJNIPackageManager;
class CJNIBroadcastReceiver;
@@ -31,6 +31,7 @@ class CJNIClassLoader;
class CJNIApplicationInfo;
class CJNIFile;
class CJNIContentResolver;
+class CJNIWindow;
class CJNIContext
{
@@ -51,6 +52,8 @@ public:
static CJNIFile getDir(const std::string &path, int mode);
static CJNIFile getExternalFilesDir(const std::string &path);
static CJNIContentResolver getContentResolver();
+ static CJNIWindow getWindow();
+
static CJNIContext* GetAppInstance() { return m_appInstance; };
static void _onNewIntent(JNIEnv *env, jobject context, jobject intent);
diff --git a/xbmc/android/jni/Cursor.cpp b/xbmc/android/jni/Cursor.cpp
index 7417986b8f..7625dbcabd 100644
--- a/xbmc/android/jni/Cursor.cpp
+++ b/xbmc/android/jni/Cursor.cpp
@@ -160,9 +160,9 @@ int CJNICursor::getInt(int columnIndex)
columnIndex);
}
-long CJNICursor::getLong(int columnIndex)
+int64_t CJNICursor::getLong(int columnIndex)
{
- return call_method<jint>(m_object,
+ return call_method<jlong>(m_object,
"getLong", "()J",
columnIndex);
}
diff --git a/xbmc/android/jni/Cursor.h b/xbmc/android/jni/Cursor.h
index 97b5100983..30521ca5fb 100644
--- a/xbmc/android/jni/Cursor.h
+++ b/xbmc/android/jni/Cursor.h
@@ -49,7 +49,7 @@ public:
std::string getString(int columnIndex);
short getShort(int columnIndex);
int getInt(int columnIndex);
- long getLong(int columnIndex);
+ int64_t getLong(int columnIndex);
float getFloat(int columnIndex);
double getDouble(int columnIndex);
int getType(int columnIndex);
diff --git a/xbmc/android/jni/Intent.cpp b/xbmc/android/jni/Intent.cpp
index 9557411fab..b09b6c9d34 100644
--- a/xbmc/android/jni/Intent.cpp
+++ b/xbmc/android/jni/Intent.cpp
@@ -34,45 +34,45 @@ CJNIIntent::CJNIIntent(const std::string &action) : CJNIBase("android/content/In
jcast<jhstring>(action));
}
-std::string CJNIIntent::getAction()
+std::string CJNIIntent::getAction() const
{
return jcast<std::string>(call_method<jhstring>(m_object,
"getAction", "()Ljava/lang/String;"));
}
-std::string CJNIIntent::getDataString()
+std::string CJNIIntent::getDataString() const
{
return jcast<std::string>(call_method<jhstring>(m_object,
"getDataString", "()Ljava/lang/String;"));
}
-std::string CJNIIntent::getPackage()
+std::string CJNIIntent::getPackage() const
{
return jcast<std::string>(call_method<jhstring>(m_object,
"getPackage", "()Ljava/lang/String;"));
}
-std::string CJNIIntent::getType()
+std::string CJNIIntent::getType() const
{
return jcast<std::string>(call_method<jhstring>(m_object,
"getType", "()Ljava/lang/String;"));
}
-int CJNIIntent::getIntExtra(const std::string &name, int defaultValue)
+int CJNIIntent::getIntExtra(const std::string &name, int defaultValue) const
{
return call_method<jint>(m_object,
"getIntExtra", "(Ljava/lang/String;I)I",
jcast<jhstring>(name), defaultValue);
}
-bool CJNIIntent::hasExtra(const std::string &name)
+bool CJNIIntent::hasExtra(const std::string &name) const
{
return call_method<jboolean>(m_object,
"hasExtra", "(Ljava/lang/String;)Z",
jcast<jhstring>(name));
}
-bool CJNIIntent::hasCategory(const std::string &category)
+bool CJNIIntent::hasCategory(const std::string &category) const
{
return call_method<jboolean>(m_object,
"hasCategory", "(Ljava/lang/String;)Z",
diff --git a/xbmc/android/jni/Intent.h b/xbmc/android/jni/Intent.h
index c31c989c1f..a944b03248 100644
--- a/xbmc/android/jni/Intent.h
+++ b/xbmc/android/jni/Intent.h
@@ -29,15 +29,15 @@ public:
CJNIIntent(const jni::jhobject &intent) : CJNIBase(intent) {};
~CJNIIntent() {};
- std::string getAction();
- std::string getDataString();
- std::string getPackage();
- std::string getType();
+ std::string getAction() const;
+ std::string getDataString() const ;
+ std::string getPackage() const;
+ std::string getType() const ;
- int getIntExtra(const std::string &name, int defaultValue);
+ int getIntExtra(const std::string &name, int defaultValue) const;
- bool hasExtra(const std::string &name);
- bool hasCategory(const std::string &category);
+ bool hasExtra(const std::string &name) const;
+ bool hasCategory(const std::string &category) const;
void addFlags(int flags);
void addCategory(const std::string &category);
diff --git a/xbmc/android/jni/JNIBase.cpp b/xbmc/android/jni/JNIBase.cpp
index 92663ecbdb..57bfa5ffb5 100644
--- a/xbmc/android/jni/JNIBase.cpp
+++ b/xbmc/android/jni/JNIBase.cpp
@@ -21,6 +21,7 @@
#include "JNIBase.h"
using namespace jni;
+int CJNIBase::m_sdk_version = -1;
CJNIBase::CJNIBase(std::string classname)
{
@@ -39,3 +40,13 @@ CJNIBase::~CJNIBase()
if(!m_object)
return;
}
+
+void CJNIBase::SetSDKVersion(int version)
+{
+ m_sdk_version = version;
+}
+
+int CJNIBase::GetSDKVersion()
+{
+ return m_sdk_version;
+}
diff --git a/xbmc/android/jni/JNIBase.h b/xbmc/android/jni/JNIBase.h
index d9eada27fe..3f567202a5 100644
--- a/xbmc/android/jni/JNIBase.h
+++ b/xbmc/android/jni/JNIBase.h
@@ -20,15 +20,17 @@
*/
#include "jutils/jutils.hpp"
-
class CJNIBase
{
+ friend class CJNIContext; //for SetSDKVersion()
+
typedef void (CJNIBase::*safe_bool_type)();
void non_null_object() {}
public:
operator safe_bool_type() const { return !m_object ? 0 : &CJNIBase::non_null_object; }
const jni::jhobject& get_raw() const { return m_object; }
+ static int GetSDKVersion();
protected:
CJNIBase(jni::jhobject const& object);
@@ -40,6 +42,8 @@ protected:
jni::jhobject m_object;
private:
+ static void SetSDKVersion(int);
std::string m_className;
+ static int m_sdk_version;
};
diff --git a/xbmc/android/jni/Makefile.in b/xbmc/android/jni/Makefile.in
index 728b046d92..35cb84002c 100644
--- a/xbmc/android/jni/Makefile.in
+++ b/xbmc/android/jni/Makefile.in
@@ -32,10 +32,21 @@ SRCS += BitmapDrawable.cpp
SRCS += CharSequence.cpp
SRCS += ContentResolver.cpp
SRCS += Cursor.cpp
+SRCS += Buffer.cpp
+SRCS += ByteBuffer.cpp
SRCS += BaseColumns.cpp
SRCS += MediaStore.cpp
SRCS += Surface.cpp
+SRCS += MediaCodec.cpp
+SRCS += MediaCodecBufferInfo.cpp
+SRCS += MediaCodecCryptoInfo.cpp
+SRCS += MediaCodecInfo.cpp
+SRCS += MediaCodecList.cpp
+SRCS += MediaFormat.cpp
SRCS += SurfaceTexture.cpp
+SRCS += View.cpp
+SRCS += Window.cpp
+SRCS += Build.cpp
LIB = jni.a
diff --git a/xbmc/android/jni/MediaCodec.cpp b/xbmc/android/jni/MediaCodec.cpp
new file mode 100644
index 0000000000..10eb216c06
--- /dev/null
+++ b/xbmc/android/jni/MediaCodec.cpp
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MediaCodec.h"
+#include "MediaCrypto.h"
+#include "MediaCodecCryptoInfo.h"
+#include "NetworkInfo.h"
+#include "Surface.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+int CJNIMediaCodec::BUFFER_FLAG_CODEC_CONFIG(2);
+int CJNIMediaCodec::BUFFER_FLAG_END_OF_STREAM(4);
+int CJNIMediaCodec::BUFFER_FLAG_SYNC_FRAME(1);
+int CJNIMediaCodec::CONFIGURE_FLAG_ENCODE(1);
+int CJNIMediaCodec::CONFIGURE_FLAG_DECODE(0);
+int CJNIMediaCodec::CRYPTO_MODE_AES_CTR(1);
+int CJNIMediaCodec::CRYPTO_MODE_UNENCRYPTED(0);
+int CJNIMediaCodec::INFO_OUTPUT_BUFFERS_CHANGED(-3);
+int CJNIMediaCodec::INFO_OUTPUT_FORMAT_CHANGED(-2);
+int CJNIMediaCodec::INFO_TRY_AGAIN_LATER(-1);
+int CJNIMediaCodec::VIDEO_SCALING_MODE_SCALE_TO_FIT(1);
+int CJNIMediaCodec::VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING(2);
+const char *CJNIMediaCodec::m_classname = "android/media/MediaCodec";
+
+void CJNIMediaCodec::PopulateStaticFields()
+{
+ if(GetSDKVersion() >= 16)
+ {
+ jhclass clazz = find_class("android/media/MediaCodec");
+ BUFFER_FLAG_CODEC_CONFIG = (get_static_field<int>(clazz, "BUFFER_FLAG_CODEC_CONFIG"));
+ BUFFER_FLAG_END_OF_STREAM = (get_static_field<int>(clazz, "BUFFER_FLAG_END_OF_STREAM"));
+ BUFFER_FLAG_SYNC_FRAME = (get_static_field<int>(clazz, "BUFFER_FLAG_SYNC_FRAME"));
+ CONFIGURE_FLAG_ENCODE = (get_static_field<int>(clazz, "CONFIGURE_FLAG_ENCODE"));
+ // CONFIGURE_FLAG_DECODE is ours to make it easy on params
+ CRYPTO_MODE_AES_CTR = (get_static_field<int>(clazz, "CRYPTO_MODE_AES_CTR"));
+ CRYPTO_MODE_UNENCRYPTED = (get_static_field<int>(clazz, "CRYPTO_MODE_UNENCRYPTED"));
+ INFO_OUTPUT_BUFFERS_CHANGED = (get_static_field<int>(clazz, "INFO_OUTPUT_BUFFERS_CHANGED"));
+ INFO_OUTPUT_FORMAT_CHANGED= (get_static_field<int>(clazz, "INFO_OUTPUT_FORMAT_CHANGED"));
+ INFO_TRY_AGAIN_LATER = (get_static_field<int>(clazz, "INFO_TRY_AGAIN_LATER"));
+ VIDEO_SCALING_MODE_SCALE_TO_FIT = (get_static_field<int>(clazz, "VIDEO_SCALING_MODE_SCALE_TO_FIT"));
+ VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = (get_static_field<int>(clazz, "VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING"));
+ }
+}
+
+const CJNIMediaCodec CJNIMediaCodec::createDecoderByType(const std::string &type)
+{
+ // This method doesn't handle errors nicely, it crashes if the codec isn't found.
+ // This is fixed in latest AOSP, but not in current 4.1 devices.
+ return call_static_method<jhobject>(m_classname,
+ "createDecoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;",
+ jcast<jhstring>(type));
+}
+
+const CJNIMediaCodec CJNIMediaCodec::createEncoderByType(const std::string &type)
+{
+ // This method doesn't handle errors nicely, it crashes if the codec isn't found.
+ // This is fixed in latest AOSP, but not in current 4.1 devices.
+ return call_static_method<jhobject>(m_classname,
+ "createEncoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;",
+ jcast<jhstring>(type));
+}
+
+const CJNIMediaCodec CJNIMediaCodec::createByCodecName(const std::string &name)
+{
+ // This method doesn't handle errors nicely, it crashes if the codec isn't found.
+ // This is fixed in latest AOSP, but not in current 4.1 devices.
+ return call_static_method<jhobject>(m_classname,
+ "createByCodecName", "(Ljava/lang/String;)Landroid/media/MediaCodec;",
+ jcast<jhstring>(name));
+}
+
+void CJNIMediaCodec::release()
+{
+ call_method<void>(m_object,
+ "release", "()V");
+}
+
+void CJNIMediaCodec::configure(const CJNIMediaFormat &format, const CJNISurface &surface, const CJNIMediaCrypto &crypto, int flags)
+{
+ call_method<void>(m_object,
+ "configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V",
+ format.get_raw(), surface.get_raw(), crypto.get_raw(), flags);
+}
+
+void CJNIMediaCodec::start()
+{
+ call_method<void>(m_object,
+ "start", "()V");
+}
+
+void CJNIMediaCodec::stop()
+{
+ call_method<void>(m_object,
+ "stop", "()V");
+}
+
+void CJNIMediaCodec::flush()
+{
+ call_method<void>(m_object,
+ "flush", "()V");
+}
+
+void CJNIMediaCodec::queueInputBuffer(int index, int offset, int size, int64_t presentationTimeUs, int flags)
+{
+ call_method<void>(m_object,
+ "queueInputBuffer", "(IIIJI)V",
+ index, offset, size, presentationTimeUs, flags);
+}
+
+void CJNIMediaCodec::queueSecureInputBuffer(int index, int offset, const CJNIMediaCodecCryptoInfo &info, int64_t presentationTimeUs, int flags)
+{
+ call_method<void>(m_object,
+ "queueSecureInputBuffer", "(IILandroid/media/MediaCodec$CryptoInfo;JI)V",
+ index, offset, info.get_raw(), presentationTimeUs, flags);
+}
+
+int CJNIMediaCodec::dequeueInputBuffer(int64_t timeoutUs)
+{
+ return call_method<int>(m_object,
+ "dequeueInputBuffer", "(J)I",
+ timeoutUs);
+}
+
+int CJNIMediaCodec::dequeueOutputBuffer(const CJNIMediaCodecBufferInfo &info, int64_t timeoutUs)
+{
+ return call_method<int>(m_object,
+ "dequeueOutputBuffer", "(Landroid/media/MediaCodec$BufferInfo;J)I",
+ info.get_raw(), timeoutUs);
+}
+
+void CJNIMediaCodec::releaseOutputBuffer(int index, bool render)
+{
+ jboolean jboolean_render = (jboolean)render;
+ call_method<void>(m_object,
+ "releaseOutputBuffer", "(IZ)V",
+ index, jboolean_render);
+}
+
+const CJNIMediaFormat CJNIMediaCodec::getOutputFormat()
+{
+ return call_method<jhobject>(m_object,
+ "getOutputFormat", "()Landroid/media/MediaFormat;");
+}
+
+std::vector<CJNIByteBuffer> CJNIMediaCodec::getInputBuffers()
+{
+ jhobjectArray oByteBuffers = call_method<jhobjectArray>(m_object,
+ "getInputBuffers", "()[Ljava/nio/ByteBuffer;");
+
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = env->GetArrayLength(oByteBuffers.get());
+
+ CJNIByteBuffers buffers;
+ buffers.reserve(size);
+
+ for (int i = 0; i < size; i++)
+ {
+ jobject j_object = env->GetObjectArrayElement(oByteBuffers.get(), i);
+ CJNIByteBuffer buffer = CJNIByteBuffer(jhobject(xbmc_jnienv()->NewGlobalRef(j_object)));
+ buffers.push_back(buffer);
+ }
+
+ return buffers;
+}
+
+std::vector<CJNIByteBuffer> CJNIMediaCodec::getOutputBuffers()
+{
+ jhobjectArray oByteBuffers = call_method<jhobjectArray>(m_object,
+ "getOutputBuffers", "()[Ljava/nio/ByteBuffer;");
+
+ JNIEnv *env = xbmc_jnienv();
+ jsize size = env->GetArrayLength(oByteBuffers.get());
+
+ CJNIByteBuffers buffers;
+ buffers.reserve(size);
+
+ for (int i = 0; i < size; i++)
+ {
+ jobject j_object = env->GetObjectArrayElement(oByteBuffers.get(), i);
+ CJNIByteBuffer buffer = CJNIByteBuffer(jhobject(xbmc_jnienv()->NewGlobalRef(j_object)));
+ buffers.push_back(buffer);
+ }
+
+ return buffers;
+}
+
+int CJNIMediaCodec::getInputBufferSize()
+{
+ jhobjectArray oByteBuffers = call_method<jhobjectArray>(m_object,
+ "getInputBuffers", "()[Ljava/nio/ByteBuffer;");
+
+ JNIEnv *env = xbmc_jnienv();
+ return env->GetArrayLength(oByteBuffers.get());
+}
+
+int CJNIMediaCodec::getOutputBufferSize()
+{
+ jhobjectArray oByteBuffers = call_method<jhobjectArray>(m_object,
+ "getOutputBuffers", "()[Ljava/nio/ByteBuffer;");
+
+ JNIEnv *env = xbmc_jnienv();
+ return env->GetArrayLength(oByteBuffers.get());
+}
+
+const CJNIByteBuffer CJNIMediaCodec::getInputBuffer(int index)
+{
+ jhobjectArray oByteBuffers = call_method<jhobjectArray>(m_object,
+ "getInputBuffers", "()[Ljava/nio/ByteBuffer;");
+
+ JNIEnv *env = xbmc_jnienv();
+ return CJNIByteBuffer(jhobject(env->GetObjectArrayElement(oByteBuffers.get(), index)));
+}
+
+const CJNIByteBuffer CJNIMediaCodec::getOutputBuffer(int index)
+{
+ jhobjectArray oByteBuffers = call_method<jhobjectArray>(m_object,
+ "getOutputBuffers", "()[Ljava/nio/ByteBuffer;");
+
+ JNIEnv *env = xbmc_jnienv();
+ return CJNIByteBuffer(jhobject(env->GetObjectArrayElement(oByteBuffers.get(), index)));
+}
+
+void CJNIMediaCodec::setVideoScalingMode(int mode)
+{
+ call_method<void>(m_object,
+ "setVideoScalingMode", "(I)V",
+ mode);
+}
diff --git a/xbmc/android/jni/MediaCodec.h b/xbmc/android/jni/MediaCodec.h
new file mode 100644
index 0000000000..2f365b5ab5
--- /dev/null
+++ b/xbmc/android/jni/MediaCodec.h
@@ -0,0 +1,79 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+#include "ByteBuffer.h"
+#include "MediaCodecBufferInfo.h"
+#include "MediaFormat.h"
+
+class CJNISurface;
+class CJNIMediaCodec;
+class CJNIMediaCrypto;
+class CJNIMediaCodecCryptoInfo;
+
+class CJNIMediaCodec : public CJNIBase
+{
+public:
+ CJNIMediaCodec(const jni::jhobject &object) : CJNIBase(object) {};
+ //~CJNIMediaCodec() {};
+
+ void release();
+ void configure(const CJNIMediaFormat &format, const CJNISurface &surface, const CJNIMediaCrypto &crypto, int flags);
+ void start();
+ void stop();
+ void flush();
+ void queueInputBuffer(int index, int offset, int size, int64_t presentationTimeUs, int flags);
+ void queueSecureInputBuffer(int index, int offset, const CJNIMediaCodecCryptoInfo &info, int64_t presentationTimeUs, int flags);
+ int dequeueInputBuffer(int64_t timeoutUs);
+ int dequeueOutputBuffer(const CJNIMediaCodecBufferInfo &info, int64_t timeoutUs);
+ void releaseOutputBuffer(int index, bool render);
+ const CJNIMediaFormat getOutputFormat();
+ std::vector<CJNIByteBuffer> getInputBuffers();
+ std::vector<CJNIByteBuffer> getOutputBuffers();
+ int getInputBufferSize();
+ int getOutputBufferSize();
+ const CJNIByteBuffer getInputBuffer(int index);
+ const CJNIByteBuffer getOutputBuffer(int index);
+ void setVideoScalingMode(int mode);
+
+ static void PopulateStaticFields();
+ static const CJNIMediaCodec createDecoderByType(const std::string &type);
+ static const CJNIMediaCodec createEncoderByType(const std::string &type);
+ static const CJNIMediaCodec createByCodecName( const std::string &name);
+
+ static int BUFFER_FLAG_CODEC_CONFIG;
+ static int BUFFER_FLAG_END_OF_STREAM;
+ static int BUFFER_FLAG_SYNC_FRAME;
+ static int CONFIGURE_FLAG_ENCODE;
+ static int CONFIGURE_FLAG_DECODE;
+ static int CRYPTO_MODE_AES_CTR;
+ static int CRYPTO_MODE_UNENCRYPTED;
+ static int INFO_OUTPUT_BUFFERS_CHANGED;
+ static int INFO_OUTPUT_FORMAT_CHANGED;
+ static int INFO_TRY_AGAIN_LATER;
+ static int VIDEO_SCALING_MODE_SCALE_TO_FIT;
+ static int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING;
+
+private:
+ CJNIMediaCodec();
+
+ static const char *m_classname;
+};
diff --git a/xbmc/android/jni/MediaCodecBufferInfo.cpp b/xbmc/android/jni/MediaCodecBufferInfo.cpp
new file mode 100644
index 0000000000..1a4a408957
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecBufferInfo.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MediaCodecBufferInfo.h"
+#include "Context.h"
+#include "ClassLoader.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+CJNIMediaCodecBufferInfo::CJNIMediaCodecBufferInfo() : CJNIBase("android/media/MediaCodec$BufferInfo")
+{
+ m_object = new_object(GetClassName(), "<init>", "()V");
+ //m_object.setGlobal();
+}
+
+void CJNIMediaCodecBufferInfo::set(int newOffset, int newSize, int64_t newTimeUs, int newFlags)
+{
+ call_method<void>(m_object,
+ "set", "(IIJI)V",
+ newOffset, newSize, newTimeUs, newFlags);
+}
+
+int CJNIMediaCodecBufferInfo::offset() const
+{
+ return get_field<int>(m_object, "offset");
+}
+
+int CJNIMediaCodecBufferInfo::size() const
+{
+ return get_field<int>(m_object, "size");
+}
+
+int64_t CJNIMediaCodecBufferInfo::presentationTimeUs() const
+{
+ return get_field<jlong>(m_object, "presentationTimeUs");
+}
+
+int CJNIMediaCodecBufferInfo::flags() const
+{
+ return get_field<int>(m_object, "flags");
+}
diff --git a/xbmc/android/jni/MediaCodecBufferInfo.h b/xbmc/android/jni/MediaCodecBufferInfo.h
new file mode 100644
index 0000000000..4b53a73ab4
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecBufferInfo.h
@@ -0,0 +1,35 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIMediaCodecBufferInfo : public CJNIBase
+{
+public:
+ CJNIMediaCodecBufferInfo();
+ //~CJNIMediaCodecBufferInfo() {};
+
+ void set(int newOffset, int newSize, int64_t newTimeUs, int newFlags);
+ int offset() const;
+ int size() const;
+ int64_t presentationTimeUs() const;
+ int flags() const;
+};
diff --git a/xbmc/android/jni/MediaCodecCryptoInfo.cpp b/xbmc/android/jni/MediaCodecCryptoInfo.cpp
new file mode 100644
index 0000000000..6ee2bcb5ed
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecCryptoInfo.cpp
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MediaCodecCryptoInfo.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+int CJNIMediaCodecCryptoInfo::numSubSamples() const
+{
+ return get_field<int>(m_object, "numSubSamples");
+}
+
+std::vector<int> CJNIMediaCodecCryptoInfo::numBytesOfClearData() const
+{
+ JNIEnv *env = xbmc_jnienv();
+
+ jhintArray numBytesOfClearData = get_field<jhintArray>(m_object, "numBytesOfClearData");
+ jsize size = env->GetArrayLength(numBytesOfClearData.get());
+ std::vector<int> intarray;
+ intarray.resize(size);
+ env->GetIntArrayRegion(numBytesOfClearData.get(), 0, size, (jint*)intarray.data());
+
+ return intarray;
+}
+
+std::vector<int> CJNIMediaCodecCryptoInfo::numBytesOfEncryptedData() const
+{
+ JNIEnv *env = xbmc_jnienv();
+
+ jhintArray numBytesOfEncryptedData = get_field<jhintArray>(m_object, "numBytesOfEncryptedData");
+ jsize size = env->GetArrayLength(numBytesOfEncryptedData.get());
+ std::vector<int> intarray;
+ intarray.resize(size);
+ env->GetIntArrayRegion(numBytesOfEncryptedData.get(), 0, size, (jint*)intarray.data());
+
+ return intarray;
+}
+
+std::vector<char> CJNIMediaCodecCryptoInfo::key() const
+{
+ JNIEnv *env = xbmc_jnienv();
+
+ jhbyteArray key = get_field<jhbyteArray>(m_object, "key");
+ jsize size = env->GetArrayLength(key.get());
+ std::vector<char> chararray;
+ chararray.resize(size);
+ env->GetByteArrayRegion(key.get(), 0, size, (jbyte*)chararray.data());
+
+ return chararray;
+}
+
+std::vector<char> CJNIMediaCodecCryptoInfo::iv() const
+{
+ JNIEnv *env = xbmc_jnienv();
+
+ jhbyteArray iv = get_field<jhbyteArray>(m_object, "iv");
+ jsize size = env->GetArrayLength(iv.get());
+ std::vector<char> chararray;
+ chararray.resize(size);
+ env->GetByteArrayRegion(iv.get(), 0, size, (jbyte*)chararray.data());
+
+ return chararray;
+}
+
+int CJNIMediaCodecCryptoInfo::mode() const
+{
+ return get_field<int>(m_object, "mode");
+}
+
+void CJNIMediaCodecCryptoInfo::set(int newNumSubSamples,
+ const std::vector<int> &newNumBytesOfClearData,
+ const std::vector<int> &newNumBytesOfEncryptedData,
+ const std::vector<char> &newKey,
+ const std::vector<char> &newIV,
+ int newMode)
+{
+ jsize size;
+ JNIEnv *env = xbmc_jnienv();
+
+ size = newNumBytesOfClearData.size();
+ jintArray numBytesOfClearData = env->NewIntArray(size);
+ jint *intdata = (jint*)newNumBytesOfClearData.data();
+ env->SetIntArrayRegion(numBytesOfClearData, 0, size, intdata);
+
+ size = newNumBytesOfEncryptedData.size();
+ jintArray numBytesOfEncryptedData = env->NewIntArray(size);
+ intdata = (jint*)newNumBytesOfEncryptedData.data();
+ env->SetIntArrayRegion(numBytesOfEncryptedData, 0, size, intdata);
+
+ size = newKey.size();
+ jbyteArray Key = env->NewByteArray(size);
+ jbyte *bytedata = (jbyte*)newKey.data();
+ env->SetByteArrayRegion(Key, 0, size, bytedata);
+
+ size = newIV.size();
+ jbyteArray IV = env->NewByteArray(size);
+ bytedata = (jbyte*)newIV.data();
+ env->SetByteArrayRegion(IV, 0, size, bytedata);
+
+ call_method<void>(m_object,
+ "set", "(I[I[I[B[BI)V",
+ newNumSubSamples, numBytesOfClearData, numBytesOfEncryptedData, Key, IV, newMode);
+
+ env->DeleteLocalRef(numBytesOfClearData);
+ env->DeleteLocalRef(numBytesOfEncryptedData);
+ env->DeleteLocalRef(Key);
+ env->DeleteLocalRef(IV);
+}
diff --git a/xbmc/android/jni/MediaCodecCryptoInfo.h b/xbmc/android/jni/MediaCodecCryptoInfo.h
new file mode 100644
index 0000000000..658a8f9de7
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecCryptoInfo.h
@@ -0,0 +1,45 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIMediaCodecCryptoInfo : public CJNIBase
+{
+public:
+ CJNIMediaCodecCryptoInfo(const jni::jhobject &object) : CJNIBase(object) {};
+ //~CJNIMediaCodecCryptoInfo() {};
+
+ int numSubSamples() const;
+ std::vector<int> numBytesOfClearData() const;
+ std::vector<int> numBytesOfEncryptedData() const;
+ std::vector<char> key() const;
+ std::vector<char> iv() const;
+ int mode() const;
+ void set(int newNumSubSamples,
+ const std::vector<int> &newNumBytesOfClearData,
+ const std::vector<int> &newNumBytesOfEncryptedData,
+ const std::vector<char> &newKey,
+ const std::vector<char> &newIV,
+ int newMode);
+
+private:
+ CJNIMediaCodecCryptoInfo();
+};
diff --git a/xbmc/android/jni/MediaCodecInfo.cpp b/xbmc/android/jni/MediaCodecInfo.cpp
new file mode 100644
index 0000000000..731697b113
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecInfo.cpp
@@ -0,0 +1,349 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MediaCodecInfo.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileBaseline(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileMain(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileExtended(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh10(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh422(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh444(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel1(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel1b(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel11(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel12(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel13(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel2(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel21(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel22(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel3(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel31(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel32(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel4(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel41(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel42(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel5(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel51(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileBaseline(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileH320Coding(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileBackwardCompatible(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileISWV2(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileISWV3(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileHighCompression(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileInternet(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileInterlace(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileHighLatency(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level10(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level20(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level30(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level40(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level45(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level50(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level60(0);
+int CJNIMediaCodecInfoCodecProfileLevel::H263Level70(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimple(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimpleScalable(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileCore(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileMain(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileNbit(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileScalableTexture(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimpleFace(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimpleFBA(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileBasicAnimated(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileHybrid(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedRealTime(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileCoreScalable(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedCoding(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedCore(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedScalable(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedSimple(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level0(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level0b(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level1(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level2(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level3(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level4(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level4a(0);
+int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level5(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectMain(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectLC(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectSSR(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectLTP(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectHE(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectScalable(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectERLC(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectLD(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectHE_PS(0);
+int CJNIMediaCodecInfoCodecProfileLevel::AACObjectELD(0);
+const char *CJNIMediaCodecInfoCodecProfileLevel::m_classname = "android/media/MediaCodecInfo$CodecProfileLevel";
+
+void CJNIMediaCodecInfoCodecProfileLevel::PopulateStaticFields()
+{
+ if(GetSDKVersion() >= 16)
+ {
+ jhclass clazz = find_class(m_classname);
+ AVCProfileBaseline = (get_static_field<int>(clazz, "AVCProfileBaseline"));
+ AVCProfileMain = (get_static_field<int>(clazz, "AVCProfileMain"));
+ AVCProfileExtended = (get_static_field<int>(clazz, "AVCProfileExtended"));
+ AVCProfileHigh = (get_static_field<int>(clazz, "AVCProfileHigh"));
+ AVCProfileHigh10 = (get_static_field<int>(clazz, "AVCProfileHigh10"));
+ AVCProfileHigh422 = (get_static_field<int>(clazz, "AVCProfileHigh422"));
+ AVCProfileHigh444 = (get_static_field<int>(clazz, "AVCProfileHigh444"));
+ AVCLevel1 = (get_static_field<int>(clazz, "AVCLevel1"));
+ AVCLevel1b = (get_static_field<int>(clazz, "AVCLevel1b"));
+ AVCLevel11 = (get_static_field<int>(clazz, "AVCLevel11"));
+ AVCLevel12 = (get_static_field<int>(clazz, "AVCLevel12"));
+ AVCLevel13 = (get_static_field<int>(clazz, "AVCLevel13"));
+ AVCLevel2 = (get_static_field<int>(clazz, "AVCLevel2"));
+ AVCLevel21 = (get_static_field<int>(clazz, "AVCLevel21"));
+ AVCLevel22 = (get_static_field<int>(clazz, "AVCLevel22"));
+ AVCLevel3 = (get_static_field<int>(clazz, "AVCLevel3"));
+ AVCLevel31 = (get_static_field<int>(clazz, "AVCLevel31"));
+ AVCLevel32 = (get_static_field<int>(clazz, "AVCLevel32"));
+ AVCLevel4 = (get_static_field<int>(clazz, "AVCLevel4"));
+ AVCLevel41 = (get_static_field<int>(clazz, "AVCLevel41"));
+ AVCLevel42 = (get_static_field<int>(clazz, "AVCLevel42"));
+ AVCLevel5 = (get_static_field<int>(clazz, "AVCLevel5"));
+ AVCLevel51 = (get_static_field<int>(clazz, "AVCLevel51"));
+ H263ProfileBaseline = (get_static_field<int>(clazz, "H263ProfileBaseline"));
+ H263ProfileH320Coding = (get_static_field<int>(clazz, "H263ProfileH320Coding"));
+ H263ProfileBackwardCompatible = (get_static_field<int>(clazz, "H263ProfileBackwardCompatible"));
+ H263ProfileISWV2 = (get_static_field<int>(clazz, "H263ProfileISWV2"));
+ H263ProfileISWV3 = (get_static_field<int>(clazz, "H263ProfileISWV3"));
+ H263ProfileHighCompression = (get_static_field<int>(clazz, "H263ProfileHighCompression"));
+ H263ProfileInternet = (get_static_field<int>(clazz, "H263ProfileInternet"));
+ H263ProfileInterlace = (get_static_field<int>(clazz, "H263ProfileInterlace"));
+ H263ProfileHighLatency = (get_static_field<int>(clazz, "H263ProfileHighLatency"));
+ H263Level10 = (get_static_field<int>(clazz, "H263Level10"));
+ H263Level20 = (get_static_field<int>(clazz, "H263Level20"));
+ H263Level30 = (get_static_field<int>(clazz, "H263Level30"));
+ H263Level40 = (get_static_field<int>(clazz, "H263Level40"));
+ H263Level45 = (get_static_field<int>(clazz, "H263Level45"));
+ H263Level50 = (get_static_field<int>(clazz, "H263Level50"));
+ H263Level60 = (get_static_field<int>(clazz, "H263Level60"));
+ H263Level70 = (get_static_field<int>(clazz, "H263Level70"));
+ MPEG4ProfileSimple = (get_static_field<int>(clazz, "MPEG4ProfileSimple"));
+ MPEG4ProfileSimpleScalable = (get_static_field<int>(clazz, "MPEG4ProfileSimpleScalable"));
+ MPEG4ProfileCore = (get_static_field<int>(clazz, "MPEG4ProfileCore"));
+ MPEG4ProfileMain = (get_static_field<int>(clazz, "MPEG4ProfileMain"));
+ MPEG4ProfileNbit = (get_static_field<int>(clazz, "MPEG4ProfileNbit"));
+ MPEG4ProfileScalableTexture = (get_static_field<int>(clazz, "MPEG4ProfileScalableTexture"));
+ MPEG4ProfileSimpleFace = (get_static_field<int>(clazz, "MPEG4ProfileSimpleFace"));
+ MPEG4ProfileSimpleFBA = (get_static_field<int>(clazz, "MPEG4ProfileSimpleFBA"));
+ MPEG4ProfileBasicAnimated = (get_static_field<int>(clazz, "MPEG4ProfileBasicAnimated"));
+ MPEG4ProfileHybrid = (get_static_field<int>(clazz, "MPEG4ProfileHybrid"));
+ MPEG4ProfileAdvancedRealTime = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedRealTime"));
+ MPEG4ProfileCoreScalable = (get_static_field<int>(clazz, "MPEG4ProfileCoreScalable"));
+ MPEG4ProfileAdvancedCoding = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedCoding"));
+ MPEG4ProfileAdvancedCore = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedCore"));
+ MPEG4ProfileAdvancedScalable= (get_static_field<int>(clazz, "MPEG4ProfileAdvancedScalable"));
+ MPEG4ProfileAdvancedSimple = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedSimple"));
+ MPEG4Level0 = (get_static_field<int>(clazz, "MPEG4Level0"));
+ MPEG4Level0b = (get_static_field<int>(clazz, "MPEG4Level0b"));
+ MPEG4Level1 = (get_static_field<int>(clazz, "MPEG4Level1"));
+ MPEG4Level2 = (get_static_field<int>(clazz, "MPEG4Level2"));
+ MPEG4Level3 = (get_static_field<int>(clazz, "MPEG4Level3"));
+ MPEG4Level4 = (get_static_field<int>(clazz, "MPEG4Level4"));
+ MPEG4Level4a = (get_static_field<int>(clazz, "MPEG4Level4a"));
+ MPEG4Level5 = (get_static_field<int>(clazz, "MPEG4Level5"));
+ AACObjectMain = (get_static_field<int>(clazz, "AACObjectMain"));
+ AACObjectLC = (get_static_field<int>(clazz, "AACObjectLC"));
+ AACObjectSSR = (get_static_field<int>(clazz, "AACObjectSSR"));
+ AACObjectLTP = (get_static_field<int>(clazz, "AACObjectLTP"));
+ AACObjectHE = (get_static_field<int>(clazz, "AACObjectHE"));
+ AACObjectScalable = (get_static_field<int>(clazz, "AACObjectScalable"));
+ AACObjectERLC = (get_static_field<int>(clazz, "AACObjectERLC"));
+ AACObjectLD = (get_static_field<int>(clazz, "AACObjectLD"));
+ AACObjectHE_PS = (get_static_field<int>(clazz, "AACObjectHE_PS"));
+ AACObjectELD = (get_static_field<int>(clazz, "AACObjectELD"));
+ }
+}
+
+int CJNIMediaCodecInfoCodecProfileLevel::profile() const
+{
+ return get_field<int>(m_object, "profile");
+}
+
+int CJNIMediaCodecInfoCodecProfileLevel::level() const
+{
+ return get_field<int>(m_object, "level");
+}
+
+/**********************************************************************************/
+/**********************************************************************************/
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatMonochrome(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format8bitRGB332(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format12bitRGB444(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitARGB4444(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitARGB1555(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitRGB565(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitBGR565(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format18bitRGB666(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format18bitARGB1665(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format19bitARGB1666(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24bitRGB888(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24bitBGR888(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24bitARGB1887(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format25bitARGB1888(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format32bitBGRA8888(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format32bitARGB8888(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV411Planar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV411PackedPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420Planar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420PackedPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420SemiPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422Planar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422PackedPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422SemiPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYCbYCr(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYCrYCb(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatCbYCrY(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatCrYCbY(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV444Interleaved(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatRawBayer8bit(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatRawBayer10bit(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatRawBayer8bitcompressed(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL2(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL4(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL8(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL16(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL24(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL32(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420PackedSemiPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422PackedSemiPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format18BitBGR666(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24BitARGB6666(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24BitABGR6666(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_TI_FormatYUV420PackedSemiPlanar(0);
+int CJNIMediaCodecInfoCodecCapabilities::COLOR_QCOM_FormatYUV420SemiPlanar(0);
+const char *CJNIMediaCodecInfoCodecCapabilities::m_classname = "android/media/MediaCodecInfo$CodecCapabilities";
+
+void CJNIMediaCodecInfoCodecCapabilities::PopulateStaticFields()
+{
+ if(GetSDKVersion() >= 16)
+ {
+ jhclass clazz = find_class(m_classname);
+ COLOR_FormatMonochrome = (get_static_field<int>(clazz, "COLOR_FormatMonochrome"));
+ COLOR_Format8bitRGB332 = (get_static_field<int>(clazz, "COLOR_Format8bitRGB332"));
+ COLOR_Format12bitRGB444 = (get_static_field<int>(clazz, "COLOR_Format12bitRGB444"));
+ COLOR_Format16bitARGB4444 = (get_static_field<int>(clazz, "COLOR_Format16bitARGB4444"));
+ COLOR_Format16bitARGB1555 = (get_static_field<int>(clazz, "COLOR_Format16bitARGB1555"));
+ COLOR_Format16bitRGB565 = (get_static_field<int>(clazz, "COLOR_Format16bitRGB565"));
+ COLOR_Format16bitBGR565 = (get_static_field<int>(clazz, "COLOR_Format16bitBGR565"));
+ COLOR_Format18bitRGB666 = (get_static_field<int>(clazz, "COLOR_Format18bitRGB666"));
+ COLOR_Format18bitARGB1665 = (get_static_field<int>(clazz, "COLOR_Format18bitARGB1665"));
+ COLOR_Format19bitARGB1666 = (get_static_field<int>(clazz, "COLOR_Format19bitARGB1666"));
+ COLOR_Format24bitRGB888 = (get_static_field<int>(clazz, "COLOR_Format24bitRGB888"));
+ COLOR_Format24bitBGR888 = (get_static_field<int>(clazz, "COLOR_Format24bitBGR888"));
+ COLOR_Format24bitARGB1887 = (get_static_field<int>(clazz, "COLOR_Format24bitARGB1887"));
+ COLOR_Format25bitARGB1888 = (get_static_field<int>(clazz, "COLOR_Format25bitARGB1888"));
+ COLOR_Format32bitBGRA8888 = (get_static_field<int>(clazz, "COLOR_Format32bitBGRA8888"));
+ COLOR_Format32bitARGB8888 = (get_static_field<int>(clazz, "COLOR_Format32bitARGB8888"));
+ COLOR_FormatYUV411Planar = (get_static_field<int>(clazz, "COLOR_FormatYUV411Planar"));
+ COLOR_FormatYUV411PackedPlanar = (get_static_field<int>(clazz, "COLOR_FormatYUV411PackedPlanar"));
+ COLOR_FormatYUV420Planar = (get_static_field<int>(clazz, "COLOR_FormatYUV420Planar"));
+ COLOR_FormatYUV420PackedPlanar = (get_static_field<int>(clazz, "COLOR_FormatYUV420PackedPlanar"));
+ COLOR_FormatYUV420SemiPlanar = (get_static_field<int>(clazz, "COLOR_FormatYUV420SemiPlanar"));
+ COLOR_FormatYUV422Planar = (get_static_field<int>(clazz, "COLOR_FormatYUV422Planar"));
+ COLOR_FormatYUV422PackedPlanar = (get_static_field<int>(clazz, "COLOR_FormatYUV422PackedPlanar"));
+ COLOR_FormatYUV422SemiPlanar = (get_static_field<int>(clazz, "COLOR_FormatYUV422SemiPlanar"));
+ COLOR_FormatYCbYCr = (get_static_field<int>(clazz, "COLOR_FormatYCbYCr"));
+ COLOR_FormatYCrYCb = (get_static_field<int>(clazz, "COLOR_FormatYCrYCb"));
+ COLOR_FormatCbYCrY = (get_static_field<int>(clazz, "COLOR_FormatCbYCrY"));
+ COLOR_FormatCrYCbY = (get_static_field<int>(clazz, "COLOR_FormatCrYCbY"));
+ COLOR_FormatYUV444Interleaved = (get_static_field<int>(clazz, "COLOR_FormatYUV444Interleaved"));
+ COLOR_FormatRawBayer8bit = (get_static_field<int>(clazz, "COLOR_FormatRawBayer8bit"));
+ COLOR_FormatRawBayer10bit = (get_static_field<int>(clazz, "COLOR_FormatRawBayer10bit"));
+ COLOR_FormatRawBayer8bitcompressed= (get_static_field<int>(clazz, "COLOR_FormatRawBayer8bitcompressed"));
+ COLOR_FormatL2 = (get_static_field<int>(clazz, "COLOR_FormatL2"));
+ COLOR_FormatL4 = (get_static_field<int>(clazz, "COLOR_FormatL4"));
+ COLOR_FormatL8 = (get_static_field<int>(clazz, "COLOR_FormatL8"));
+ COLOR_FormatL16 = (get_static_field<int>(clazz, "COLOR_FormatL16"));
+ COLOR_FormatL24 = (get_static_field<int>(clazz, "COLOR_FormatL24"));
+ COLOR_FormatL32 = (get_static_field<int>(clazz, "COLOR_FormatL32"));
+ COLOR_FormatYUV420PackedSemiPlanar= (get_static_field<int>(clazz, "COLOR_FormatYUV420PackedSemiPlanar"));
+ COLOR_FormatYUV422PackedSemiPlanar= (get_static_field<int>(clazz, "COLOR_FormatYUV422PackedSemiPlanar"));
+ COLOR_Format18BitBGR666 = (get_static_field<int>(clazz, "COLOR_Format18BitBGR666"));
+ COLOR_Format24BitARGB6666 = (get_static_field<int>(clazz, "COLOR_Format24BitARGB6666"));
+ COLOR_Format24BitABGR6666 = (get_static_field<int>(clazz, "COLOR_Format24BitABGR6666"));
+ COLOR_TI_FormatYUV420PackedSemiPlanar = (get_static_field<int>(clazz, "COLOR_TI_FormatYUV420PackedSemiPlanar"));
+ COLOR_QCOM_FormatYUV420SemiPlanar = (get_static_field<int>(clazz, "COLOR_QCOM_FormatYUV420SemiPlanar"));
+ }
+}
+
+std::vector<int> CJNIMediaCodecInfoCodecCapabilities::colorFormats() const
+{
+ JNIEnv *env = xbmc_jnienv();
+
+ jhintArray colorFormats = get_field<jhintArray>(m_object, "numBytesOfEncryptedData");
+ jsize size = env->GetArrayLength(colorFormats.get());
+ std::vector<int> intarray;
+ intarray.resize(size);
+ env->GetIntArrayRegion(colorFormats.get(), 0, size, (jint*)intarray.data());
+
+ return intarray;
+}
+
+std::vector<CJNIMediaCodecInfoCodecProfileLevel> CJNIMediaCodecInfoCodecCapabilities::profileLevels() const
+{
+ JNIEnv *env = xbmc_jnienv();
+
+ jhobjectArray oprofileLevels = get_field<jhobjectArray>(m_object, "profileLevels");
+ jsize size = env->GetArrayLength(oprofileLevels.get());
+ std::vector<CJNIMediaCodecInfoCodecProfileLevel> profileLevels;
+ profileLevels.reserve(size);
+ for (int i = 0; i < size; i++)
+ profileLevels.push_back(CJNIMediaCodecInfoCodecProfileLevel(jhobject(env->GetObjectArrayElement(oprofileLevels.get(), i))));
+
+ return profileLevels;
+}
+
+/**********************************************************************************/
+/**********************************************************************************/
+std::string CJNIMediaCodecInfo::getName() const
+{
+ return jcast<std::string>(call_method<jhstring>(m_object,
+ "getName", "()Ljava/lang/String;"));
+}
+
+bool CJNIMediaCodecInfo::isEncoder() const
+{
+ return call_method<jboolean>(m_object,
+ "isEncoder", "()Z");
+}
+
+std::vector<std::string> CJNIMediaCodecInfo::getSupportedTypes() const
+{
+ return jcast<std::vector<std::string>>(call_method<jhobjectArray>(m_object,
+ "getSupportedTypes", "()[Ljava/lang/String;"));
+}
+
+const CJNIMediaCodecInfoCodecCapabilities CJNIMediaCodecInfo::getCapabilitiesForType(const std::string &type) const
+{
+ return call_method<jhobject>(m_object,
+ "getCapabilitiesForType", "(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;",
+ jcast<jhstring>(type));
+}
diff --git a/xbmc/android/jni/MediaCodecInfo.h b/xbmc/android/jni/MediaCodecInfo.h
new file mode 100644
index 0000000000..48a3272f15
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecInfo.h
@@ -0,0 +1,203 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIMediaCodecInfoCodecProfileLevel : public CJNIBase
+{
+public:
+ CJNIMediaCodecInfoCodecProfileLevel(const jni::jhobject &object) : CJNIBase(object) {};
+ //~CJNIMediaCodecInfoCodecProfileLevel(){};
+
+ int profile() const;
+ int level() const;
+
+ static void PopulateStaticFields();
+
+ static int AVCProfileBaseline;
+ static int AVCProfileMain;
+ static int AVCProfileExtended;
+ static int AVCProfileHigh;
+ static int AVCProfileHigh10;
+ static int AVCProfileHigh422;
+ static int AVCProfileHigh444;
+ static int AVCLevel1;
+ static int AVCLevel1b;
+ static int AVCLevel11;
+ static int AVCLevel12;
+ static int AVCLevel13;
+ static int AVCLevel2;
+ static int AVCLevel21;
+ static int AVCLevel22;
+ static int AVCLevel3;
+ static int AVCLevel31;
+ static int AVCLevel32;
+ static int AVCLevel4;
+ static int AVCLevel41;
+ static int AVCLevel42;
+ static int AVCLevel5;
+ static int AVCLevel51;
+ static int H263ProfileBaseline;
+ static int H263ProfileH320Coding;
+ static int H263ProfileBackwardCompatible;
+ static int H263ProfileISWV2;
+ static int H263ProfileISWV3;
+ static int H263ProfileHighCompression;
+ static int H263ProfileInternet;
+ static int H263ProfileInterlace;
+ static int H263ProfileHighLatency;
+ static int H263Level10;
+ static int H263Level20;
+ static int H263Level30;
+ static int H263Level40;
+ static int H263Level45;
+ static int H263Level50;
+ static int H263Level60;
+ static int H263Level70;
+ static int MPEG4ProfileSimple;
+ static int MPEG4ProfileSimpleScalable;
+ static int MPEG4ProfileCore;
+ static int MPEG4ProfileMain;
+ static int MPEG4ProfileNbit;
+ static int MPEG4ProfileScalableTexture;
+ static int MPEG4ProfileSimpleFace;
+ static int MPEG4ProfileSimpleFBA;
+ static int MPEG4ProfileBasicAnimated;
+ static int MPEG4ProfileHybrid;
+ static int MPEG4ProfileAdvancedRealTime;
+ static int MPEG4ProfileCoreScalable;
+ static int MPEG4ProfileAdvancedCoding;
+ static int MPEG4ProfileAdvancedCore;
+ static int MPEG4ProfileAdvancedScalable;
+ static int MPEG4ProfileAdvancedSimple;
+ static int MPEG4Level0;
+ static int MPEG4Level0b;
+ static int MPEG4Level1;
+ static int MPEG4Level2;
+ static int MPEG4Level3;
+ static int MPEG4Level4;
+ static int MPEG4Level4a;
+ static int MPEG4Level5;
+ static int AACObjectMain;
+ static int AACObjectLC;
+ static int AACObjectSSR;
+ static int AACObjectLTP;
+ static int AACObjectHE;
+ static int AACObjectScalable;
+ static int AACObjectERLC;
+ static int AACObjectLD;
+ static int AACObjectHE_PS;
+ static int AACObjectELD;
+
+private:
+ CJNIMediaCodecInfoCodecProfileLevel();
+ static const char *m_classname;
+};
+/*
+Compiled from "MediaCodecInfo.java"
+public final class android.media.MediaCodecInfo$CodecProfileLevel extends java.lang.Object{
+public int profile;
+ Signature: I
+public int level;
+ Signature: I
+public android.media.MediaCodecInfo$CodecProfileLevel();
+ Signature: ()V
+}
+*/
+
+class CJNIMediaCodecInfoCodecCapabilities : public CJNIBase
+{
+public:
+ CJNIMediaCodecInfoCodecCapabilities(const jni::jhobject &object) : CJNIBase(object) {};
+ //~CJNIMediaCodecInfoCodecCapabilities() {};
+
+ std::vector<int> colorFormats() const;
+ std::vector<CJNIMediaCodecInfoCodecProfileLevel> profileLevels() const;
+
+ static void PopulateStaticFields();
+
+ static int COLOR_FormatMonochrome;
+ static int COLOR_Format8bitRGB332;
+ static int COLOR_Format12bitRGB444;
+ static int COLOR_Format16bitARGB4444;
+ static int COLOR_Format16bitARGB1555;
+ static int COLOR_Format16bitRGB565;
+ static int COLOR_Format16bitBGR565;
+ static int COLOR_Format18bitRGB666;
+ static int COLOR_Format18bitARGB1665;
+ static int COLOR_Format19bitARGB1666;
+ static int COLOR_Format24bitRGB888;
+ static int COLOR_Format24bitBGR888;
+ static int COLOR_Format24bitARGB1887;
+ static int COLOR_Format25bitARGB1888;
+ static int COLOR_Format32bitBGRA8888;
+ static int COLOR_Format32bitARGB8888;
+ static int COLOR_FormatYUV411Planar;
+ static int COLOR_FormatYUV411PackedPlanar;
+ static int COLOR_FormatYUV420Planar;
+ static int COLOR_FormatYUV420PackedPlanar;
+ static int COLOR_FormatYUV420SemiPlanar;
+ static int COLOR_FormatYUV422Planar;
+ static int COLOR_FormatYUV422PackedPlanar;
+ static int COLOR_FormatYUV422SemiPlanar;
+ static int COLOR_FormatYCbYCr;
+ static int COLOR_FormatYCrYCb;
+ static int COLOR_FormatCbYCrY;
+ static int COLOR_FormatCrYCbY;
+ static int COLOR_FormatYUV444Interleaved;
+ static int COLOR_FormatRawBayer8bit;
+ static int COLOR_FormatRawBayer10bit;
+ static int COLOR_FormatRawBayer8bitcompressed;
+ static int COLOR_FormatL2;
+ static int COLOR_FormatL4;
+ static int COLOR_FormatL8;
+ static int COLOR_FormatL16;
+ static int COLOR_FormatL24;
+ static int COLOR_FormatL32;
+ static int COLOR_FormatYUV420PackedSemiPlanar;
+ static int COLOR_FormatYUV422PackedSemiPlanar;
+ static int COLOR_Format18BitBGR666;
+ static int COLOR_Format24BitARGB6666;
+ static int COLOR_Format24BitABGR6666;
+ static int COLOR_TI_FormatYUV420PackedSemiPlanar;
+ static int COLOR_QCOM_FormatYUV420SemiPlanar;
+
+private:
+ CJNIMediaCodecInfoCodecCapabilities();
+
+ static const char *m_classname;
+};
+
+class CJNIMediaCodecInfo : public CJNIBase
+{
+public:
+ CJNIMediaCodecInfo(const jni::jhobject &object) : CJNIBase(object) {};
+ //~CJNIMediaCodecInfo() {};
+
+ std::string getName() const;
+ bool isEncoder() const;
+ std::vector<std::string> getSupportedTypes() const;
+ const CJNIMediaCodecInfoCodecCapabilities getCapabilitiesForType(const std::string &type) const;
+
+private:
+ CJNIMediaCodecInfo();
+};
+
diff --git a/xbmc/android/jni/MediaCodecList.cpp b/xbmc/android/jni/MediaCodecList.cpp
new file mode 100644
index 0000000000..9cd8b72f82
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecList.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MediaCodecList.h"
+#include "MediaCodecInfo.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+const char* CJNIMediaCodecList::m_classname = "android/media/MediaCodecList";
+
+int CJNIMediaCodecList::getCodecCount()
+{
+ return call_static_method<int>(m_classname,
+ "getCodecCount", "()I");
+}
+
+const CJNIMediaCodecInfo CJNIMediaCodecList::getCodecInfoAt(int index)
+{
+ return call_static_method<jhobject>(m_classname,
+ "getCodecInfoAt", "(I)Landroid/media/MediaCodecInfo;",
+ index);
+}
diff --git a/xbmc/android/jni/MediaCodecList.h b/xbmc/android/jni/MediaCodecList.h
new file mode 100644
index 0000000000..804428cdc0
--- /dev/null
+++ b/xbmc/android/jni/MediaCodecList.h
@@ -0,0 +1,38 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+#include "MediaCodecInfo.h"
+
+class CJNIMediaCodecList : public CJNIBase
+{
+public:
+ CJNIMediaCodecList(const jni::jhobject &object) : CJNIBase(object) {};
+ //~CJNIMediaCodecList() {};
+
+ static int getCodecCount();
+ static const CJNIMediaCodecInfo getCodecInfoAt(int index);
+
+private:
+ CJNIMediaCodecList();
+
+ static const char *m_classname;
+};
diff --git a/xbmc/android/jni/MediaCrypto.h b/xbmc/android/jni/MediaCrypto.h
new file mode 100644
index 0000000000..b080952501
--- /dev/null
+++ b/xbmc/android/jni/MediaCrypto.h
@@ -0,0 +1,29 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIMediaCrypto : public CJNIBase
+{
+public:
+ CJNIMediaCrypto(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNIMediaCrypto() {};
+};
diff --git a/xbmc/android/jni/MediaFormat.cpp b/xbmc/android/jni/MediaFormat.cpp
new file mode 100644
index 0000000000..17316fc8c4
--- /dev/null
+++ b/xbmc/android/jni/MediaFormat.cpp
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+#include "MediaFormat.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+std::string CJNIMediaFormat::KEY_MIME;
+std::string CJNIMediaFormat::KEY_SAMPLE_RATE;
+std::string CJNIMediaFormat::KEY_CHANNEL_COUNT;
+std::string CJNIMediaFormat::KEY_WIDTH;
+std::string CJNIMediaFormat::KEY_HEIGHT;
+std::string CJNIMediaFormat::KEY_MAX_INPUT_SIZE;
+std::string CJNIMediaFormat::KEY_BIT_RATE;
+std::string CJNIMediaFormat::KEY_COLOR_FORMAT;
+std::string CJNIMediaFormat::KEY_FRAME_RATE;
+std::string CJNIMediaFormat::KEY_I_FRAME_INTERVAL;
+std::string CJNIMediaFormat::KEY_DURATION;
+std::string CJNIMediaFormat::KEY_IS_ADTS;
+std::string CJNIMediaFormat::KEY_CHANNEL_MASK;
+std::string CJNIMediaFormat::KEY_AAC_PROFILE;
+std::string CJNIMediaFormat::KEY_FLAC_COMPRESSION_LEVEL;
+const char *CJNIMediaFormat::m_classname = "android/media/MediaFormat";
+
+void CJNIMediaFormat::PopulateStaticFields()
+{
+ if(GetSDKVersion() >= 16)
+ {
+ jhclass clazz = find_class("android/media/MediaFormat");
+ KEY_MIME = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_MIME"));
+ KEY_SAMPLE_RATE = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_SAMPLE_RATE"));
+ KEY_CHANNEL_COUNT = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_CHANNEL_COUNT"));
+ KEY_WIDTH = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_WIDTH"));
+ KEY_HEIGHT = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_HEIGHT"));
+ KEY_MAX_INPUT_SIZE = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_MAX_INPUT_SIZE"));
+ KEY_BIT_RATE = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_BIT_RATE"));
+ KEY_COLOR_FORMAT = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_COLOR_FORMAT"));
+ KEY_FRAME_RATE = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_FRAME_RATE"));
+ KEY_I_FRAME_INTERVAL= jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_I_FRAME_INTERVAL"));
+ KEY_DURATION = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_DURATION"));
+ KEY_IS_ADTS = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_IS_ADTS"));
+ KEY_CHANNEL_MASK = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_CHANNEL_MASK"));
+ KEY_AAC_PROFILE = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_AAC_PROFILE"));
+ KEY_FLAC_COMPRESSION_LEVEL = jcast<std::string>(get_static_field<jhstring>(clazz, "KEY_FLAC_COMPRESSION_LEVEL"));
+ }
+}
+
+const CJNIMediaFormat CJNIMediaFormat::createAudioFormat(const std::string &mime, int sampleRate, int channelCount)
+{
+ return call_static_method<jhobject>(m_classname,
+ "createAudioFormat", "(Ljava/lang/String;II)Landroid/media/MediaFormat;",
+ jcast<jhstring>(mime), sampleRate, channelCount);
+}
+
+const CJNIMediaFormat CJNIMediaFormat::createVideoFormat(const std::string &mime, int width, int height)
+{
+ return call_static_method<jhobject>(m_classname,
+ "createVideoFormat", "(Ljava/lang/String;II)Landroid/media/MediaFormat;",
+ jcast<jhstring>(mime), width, height);
+}
+
+bool CJNIMediaFormat::containsKey(const std::string &name)
+{
+ return call_method<jboolean>(m_object,
+ "containsKey", "(Ljava/lang/String;)Z",
+ jcast<jhstring>(name));
+}
+
+int CJNIMediaFormat::getInteger(const std::string &name)
+{
+ return call_method<jint>(m_object,
+ "getInteger",
+ "(Ljava/lang/String;)I",
+ jcast<jhstring>(name));
+}
+
+int64_t CJNIMediaFormat::getLong(const std::string &name)
+{
+ return call_method<jlong>(m_object,
+ "getLong", "(Ljava/lang/String;)J",
+ jcast<jhstring>(name));
+}
+
+float CJNIMediaFormat::getFloat(const std::string &name)
+{
+ return call_method<jfloat>(m_object,
+ "getFloat", "(Ljava/lang/String;)F",
+ jcast<jhstring>(name));
+}
+
+std::string CJNIMediaFormat::getString(const std::string &name)
+{
+ jhstring jhstring_rtn = call_method<jhstring>(m_object,
+ "getString", "(Ljava/lang/String;)Ljava/lang/String;",
+ jcast<jhstring>(name));
+ return jcast<std::string>(jhstring_rtn);
+}
+
+const CJNIByteBuffer CJNIMediaFormat::getByteBuffer(const std::string &name)
+{
+ return call_method<jhobject>(m_object,
+ "getByteBuffer", "(Ljava/lang/String;)Ljava/nio/ByteBuffer;",
+ jcast<jhstring>(name));
+}
+
+void CJNIMediaFormat::setInteger(const std::string &name, int value)
+{
+ call_method<void>(m_object,
+ "setInteger", "(Ljava/lang/String;I)V",
+ jcast<jhstring>(name), value);
+}
+
+void CJNIMediaFormat::setLong(const std::string &name, int64_t value)
+{
+ call_method<void>(m_object,
+ "setLong", "(Ljava/lang/String;J)V",
+ jcast<jhstring>(name), value);
+}
+
+void CJNIMediaFormat::setFloat(const std::string &name, float value)
+{
+ call_method<void>(m_object,
+ "setFloat", "(Ljava/lang/String;F)V",
+ jcast<jhstring>(name), value);
+}
+
+void CJNIMediaFormat::setString(const std::string &name,const std::string &value)
+{
+ call_method<void>(m_object,
+ "setString", "(Ljava/lang/String;Ljava/lang/String;)V",
+ jcast<jhstring>(name), jcast<jhstring>(value));
+}
+
+void CJNIMediaFormat::setByteBuffer(const std::string &name, CJNIByteBuffer &bytes)
+{
+ call_method<void>(m_object,
+ "setByteBuffer", "(Ljava/lang/String;Ljava/nio/ByteBuffer;)V",
+ jcast<jhstring>(name), bytes.get_raw());
+}
+
+std::string CJNIMediaFormat::toString() const
+{
+ jhstring jhstring_rtn = call_method<jhstring>(m_object,
+ "toString", "()Ljava/lang/String;");
+ return jcast<std::string>(jhstring_rtn);
+}
diff --git a/xbmc/android/jni/MediaFormat.h b/xbmc/android/jni/MediaFormat.h
new file mode 100644
index 0000000000..bb40f24036
--- /dev/null
+++ b/xbmc/android/jni/MediaFormat.h
@@ -0,0 +1,68 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+#include "ByteBuffer.h"
+
+class CJNIMediaFormat : public CJNIBase
+{
+public:
+ CJNIMediaFormat(const jni::jhobject &object) : CJNIBase(object) {};
+ //~CJNIMediaFormat() {};
+
+ bool containsKey(const std::string &name);
+ int getInteger( const std::string &name);
+ int64_t getLong( const std::string &name);
+ float getFloat( const std::string &name);
+ std::string getString( const std::string &name);
+ const CJNIByteBuffer getByteBuffer(const std::string &name);
+ void setInteger( const std::string &name, int value);
+ void setLong( const std::string &name, int64_t value);
+ void setFloat( const std::string &name, float value);
+ void setString( const std::string &name, const std::string &value);
+ void setByteBuffer(const std::string &name, CJNIByteBuffer &bytes);
+ std::string toString() const;
+
+ static void PopulateStaticFields();
+ static const CJNIMediaFormat createAudioFormat(const std::string &mime, int sampleRate, int channelCount);
+ static const CJNIMediaFormat createVideoFormat(const std::string &mime, int width, int height);
+
+ static std::string KEY_MIME;
+ static std::string KEY_SAMPLE_RATE;
+ static std::string KEY_CHANNEL_COUNT;
+ static std::string KEY_WIDTH;
+ static std::string KEY_HEIGHT;
+ static std::string KEY_MAX_INPUT_SIZE;
+ static std::string KEY_BIT_RATE;
+ static std::string KEY_COLOR_FORMAT;
+ static std::string KEY_FRAME_RATE;
+ static std::string KEY_I_FRAME_INTERVAL;
+ static std::string KEY_DURATION;
+ static std::string KEY_IS_ADTS;
+ static std::string KEY_CHANNEL_MASK;
+ static std::string KEY_AAC_PROFILE;
+ static std::string KEY_FLAC_COMPRESSION_LEVEL;
+
+private:
+ CJNIMediaFormat();
+
+ static const char *m_classname;
+};
diff --git a/xbmc/android/jni/Surface.cpp b/xbmc/android/jni/Surface.cpp
index 07fef75a72..5e49e629ce 100644
--- a/xbmc/android/jni/Surface.cpp
+++ b/xbmc/android/jni/Surface.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,27 +18,70 @@
*
*/
+#include "JNIBase.h"
#include "Surface.h"
#include "SurfaceTexture.h"
+
#include "jutils/jutils-details.hpp"
using namespace jni;
-CJNISurface::CJNISurface(CJNISurfaceTexture *surf_texture) : CJNIBase("android/view/Surface")
+int CJNISurface::ROTATION_0;
+int CJNISurface::ROTATION_90;
+int CJNISurface::ROTATION_180;
+int CJNISurface::ROTATION_270;
+const char* CJNISurface::m_classname = "android/view/Surface";
+
+void CJNISurface::PopulateStaticFields()
+{
+ jhclass clazz = find_class(m_classname);
+ ROTATION_0 = get_static_field<int>(clazz, "ROTATION_0");
+ ROTATION_90 = get_static_field<int>(clazz, "ROTATION_90");
+ ROTATION_180= get_static_field<int>(clazz, "ROTATION_180");
+ ROTATION_270= get_static_field<int>(clazz, "ROTATION_270");
+}
+
+
+CJNISurface::CJNISurface(const CJNISurfaceTexture &surfaceTexture) : CJNIBase(m_classname)
{
- m_object = new_object(GetClassName(),
- "<init>", "(Landroid/graphics/SurfaceTexture;)V",
- surf_texture->get_raw());
+ m_object = new_object(m_classname, "<init>", "(Landroid/graphics/SurfaceTexture;)V", surfaceTexture.get_raw());
m_object.setGlobal();
}
-CJNISurface::~CJNISurface()
+bool CJNISurface::isValid()
{
- release();
+ return call_method<jboolean>(m_object,
+ "isValid", "()Z");
}
void CJNISurface::release()
{
- call_method<jhobject>(m_object,
+ call_method<jboolean>(m_object,
"release", "()V");
}
+
+/*
+CJNICanvas CJNISurface::lockCanvas(const CJNIRect &rect)
+{
+}
+
+void CJNISurface::unlockCanvasAndPost(const CJNICanvas &canvas)
+{
+}
+
+void CJNISurface::unlockCanvas(const CJNICanvas &canvas)
+{
+}
+*/
+
+std::string CJNISurface::toString()
+{
+ return jcast<std::string>(call_method<jhstring>(m_object,
+ "toString", "()Ljava/lang/String;"));
+}
+
+int CJNISurface::describeContents()
+{
+ return call_method<int>(m_object,
+ "describeContents", "()I");
+}
diff --git a/xbmc/android/jni/Surface.h b/xbmc/android/jni/Surface.h
index af514c91f2..bddd57afe0 100644
--- a/xbmc/android/jni/Surface.h
+++ b/xbmc/android/jni/Surface.h
@@ -1,7 +1,7 @@
#pragma once
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,8 +25,24 @@ class CJNISurfaceTexture;
class CJNISurface : public CJNIBase
{
public:
- CJNISurface(CJNISurfaceTexture *surf_texture);
- ~CJNISurface();
+ CJNISurface(const CJNISurfaceTexture &surfaceTexture);
+ CJNISurface(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNISurface() {};
- void release();
+ bool isValid();
+ void release();
+//CJNICanvas lockCanvas(CJNIRect);
+//void unlockCanvasAndPost(const CJNICanvas &canvas);
+//void unlockCanvas(const CJNICanvas &canvas);
+ std::string toString();
+
+ int describeContents();
+ static void PopulateStaticFields();
+ static int ROTATION_0;
+ static int ROTATION_90;
+ static int ROTATION_180;
+ static int ROTATION_270;
+
+private:
+ static const char *m_classname;
};
diff --git a/xbmc/android/jni/SurfaceTexture.cpp b/xbmc/android/jni/SurfaceTexture.cpp
index f8a0c60a46..e5eb337753 100644
--- a/xbmc/android/jni/SurfaceTexture.cpp
+++ b/xbmc/android/jni/SurfaceTexture.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,45 +18,69 @@
*
*/
+#include "JNIBase.h"
#include "SurfaceTexture.h"
+
#include "jutils/jutils-details.hpp"
using namespace jni;
-CJNISurfaceTexture::CJNISurfaceTexture(int texid) : CJNIBase("android/graphics/SurfaceTexture")
+CJNISurfaceTexture::CJNISurfaceTexture(int texName) : CJNIBase("android/graphics/SurfaceTexture")
{
- m_object = new_object(GetClassName(),
- "<init>", "(I)V",
- texid);
+ m_object = new_object(GetClassName(), "<init>", "(I)V", texName);
m_object.setGlobal();
}
-CJNISurfaceTexture::~CJNISurfaceTexture()
+/*
+void setOnFrameAvailableListener(const CJNISurfaceTextureOnFrameAvailableListener &listener)
+{
+}
+*/
+
+void CJNISurfaceTexture::setDefaultBufferSize(int width, int height)
{
- release();
+ call_method<void>(m_object,
+ "setDefaultBufferSize", "(II)V", width, height);
}
void CJNISurfaceTexture::updateTexImage()
{
- call_method<jhobject>(m_object,
+ call_method<void>(m_object,
"updateTexImage", "()V");
}
-void CJNISurfaceTexture::release()
+void CJNISurfaceTexture::detachFromGLContext()
{
- call_method<jhobject>(m_object,
- "release", "()V");
+ call_method<void>(m_object,
+ "detachFromGLContext", "()V");
}
-void CJNISurfaceTexture::getTransformMatrix(float* transformMatrix)
+void CJNISurfaceTexture::attachToGLContext(int texName)
{
- JNIEnv* env = xbmc_jnienv();
- jfloatArray arr = (jfloatArray)env->NewFloatArray(16);
- env->SetFloatArrayRegion(arr, 0, 16, transformMatrix);
+ call_method<void>(m_object,
+ "attachToGLContext", "(I)V", texName);
+}
- call_method<jhobject>(m_object,
- "getTransformMatrix", "([F)V", arr);
+void CJNISurfaceTexture::getTransformMatrix(float* mtx)
+{
+ jsize size = 16; // hard-coded 4x4 matrix.
+ JNIEnv *env = xbmc_jnienv();
+ jfloatArray floatarray = env->NewFloatArray(size);
+ call_method<void>(m_object,
+ "getTransformMatrix", "([F)V", floatarray);
+ env->GetFloatArrayRegion(floatarray, 0, size, mtx);
- env->GetFloatArrayRegion(arr, 0, 16, transformMatrix);
- env->DeleteLocalRef(arr);
+ env->DeleteLocalRef(floatarray);
+}
+
+int64_t CJNISurfaceTexture::getTimestamp()
+{
+ return call_method<jlong>(m_object,
+ "getTimestamp", "()J");
+}
+
+void CJNISurfaceTexture::release()
+{
+ call_method<void>(m_object,
+ "attachToGLContext", "()V");
}
diff --git a/xbmc/android/jni/SurfaceTexture.h b/xbmc/android/jni/SurfaceTexture.h
index fa81ece8dc..d1965f99cd 100644
--- a/xbmc/android/jni/SurfaceTexture.h
+++ b/xbmc/android/jni/SurfaceTexture.h
@@ -1,7 +1,7 @@
#pragma once
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,10 +24,16 @@
class CJNISurfaceTexture : public CJNIBase
{
public:
- CJNISurfaceTexture(int texid);
- ~CJNISurfaceTexture();
+ CJNISurfaceTexture(const jni::jhobject &object) : CJNIBase(object) {};
+ CJNISurfaceTexture(int texName);
+ ~CJNISurfaceTexture() {};
- void updateTexImage();
- void release();
- void getTransformMatrix(float* transformMatrix);
+ //void setOnFrameAvailableListener(const CJNISurfaceTextureOnFrameAvailableListener &listener)
+ void setDefaultBufferSize(int width, int height);
+ void updateTexImage();
+ void detachFromGLContext();
+ void attachToGLContext(int texName);
+ void getTransformMatrix(float* mtx); // mtx MUST BE a preallocated 4x4 float array
+ int64_t getTimestamp();
+ void release();
};
diff --git a/xbmc/android/jni/View.cpp b/xbmc/android/jni/View.cpp
new file mode 100644
index 0000000000..252e6759ad
--- /dev/null
+++ b/xbmc/android/jni/View.cpp
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "Window.h"
+#include "View.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+/************************************************************************/
+/************************************************************************/
+int CJNIViewInputDeviceMotionRange::getAxis() const
+{
+ return call_method<int>(m_object,
+ "getAxis", "()I");
+}
+
+float CJNIViewInputDeviceMotionRange::getFlat() const
+{
+ return call_method<jfloat>(m_object,
+ "getFlat", "()F");
+}
+
+float CJNIViewInputDeviceMotionRange::getFuzz() const
+{
+ return call_method<jfloat>(m_object,
+ "getFuzz", "()F");
+}
+
+float CJNIViewInputDeviceMotionRange::getMax() const
+{
+ return call_method<jfloat>(m_object,
+ "getMax", "()F");
+}
+
+float CJNIViewInputDeviceMotionRange::getMin() const
+{
+ return call_method<jfloat>(m_object,
+ "getMin", "()F");
+}
+
+float CJNIViewInputDeviceMotionRange::getRange() const
+{
+ return call_method<jfloat>(m_object,
+ "getRange", "()F");
+}
+
+int CJNIViewInputDeviceMotionRange::getSource() const
+{
+ return call_method<int>(m_object,
+ "getSource", "()I");
+}
+
+/************************************************************************/
+/************************************************************************/
+const char *CJNIViewInputDevice::m_classname = "android/view/InputDevice";
+
+const CJNIViewInputDevice CJNIViewInputDevice::getDevice(int id)
+{
+ return call_static_method<jhobject>(m_classname,
+ "getDevice", "(I)Landroid/view/InputDevice;",
+ id);
+}
+
+std::string CJNIViewInputDevice::getName() const
+{
+ return jcast<std::string>(call_method<jhstring>(m_object,
+ "getName", "()Ljava/lang/String;"));
+}
+
+const CJNIViewInputDeviceMotionRange CJNIViewInputDevice::getMotionRange(int axis) const
+{
+ return call_method<jhobject>(m_object,
+ "getMotionRange", "(I)Landroid/view/InputDevice$MotionRange;",
+ axis);
+}
+
+/************************************************************************/
+/************************************************************************/
+int CJNIView::SYSTEM_UI_FLAG_FULLSCREEN(0);
+int CJNIView::SYSTEM_UI_FLAG_HIDE_NAVIGATION(0);
+int CJNIView::SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN(0);
+int CJNIView::SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION(0);
+int CJNIView::SYSTEM_UI_FLAG_LAYOUT_STABLE(0);
+int CJNIView::SYSTEM_UI_FLAG_LOW_PROFILE(0);
+int CJNIView::SYSTEM_UI_FLAG_VISIBLE(0);
+
+void CJNIView::PopulateStaticFields()
+{
+ jhclass clazz = find_class("android/view/View");
+ if(GetSDKVersion() >= 16)
+ {
+ SYSTEM_UI_FLAG_FULLSCREEN = (get_static_field<int>(clazz, "SYSTEM_UI_FLAG_FULLSCREEN"));
+ SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = (get_static_field<int>(clazz, "SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN"));
+ SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = (get_static_field<int>(clazz, "SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION"));
+ SYSTEM_UI_FLAG_LAYOUT_STABLE = (get_static_field<int>(clazz, "SYSTEM_UI_FLAG_LAYOUT_STABLE"));
+ }
+ SYSTEM_UI_FLAG_HIDE_NAVIGATION = (get_static_field<int>(clazz, "SYSTEM_UI_FLAG_HIDE_NAVIGATION"));
+ SYSTEM_UI_FLAG_LOW_PROFILE = (get_static_field<int>(clazz, "SYSTEM_UI_FLAG_LOW_PROFILE"));
+ SYSTEM_UI_FLAG_VISIBLE = (get_static_field<int>(clazz, "SYSTEM_UI_FLAG_VISIBLE"));
+}
+
+void CJNIView::setSystemUiVisibility(int visibility)
+{
+ call_method<void>(m_object,
+ "setSystemUiVisibility", "(I)V", visibility);
+}
+
+int CJNIView::getSystemUiVisibility()
+{
+ return call_method<int>(m_object,
+ "getSystemUiVisibility", "()I");
+}
diff --git a/xbmc/android/jni/View.h b/xbmc/android/jni/View.h
new file mode 100644
index 0000000000..bcb1e26e95
--- /dev/null
+++ b/xbmc/android/jni/View.h
@@ -0,0 +1,76 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIViewInputDeviceMotionRange : public CJNIBase
+{
+public:
+ CJNIViewInputDeviceMotionRange(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNIViewInputDeviceMotionRange() {};
+
+ int getAxis() const;
+ float getFlat() const;
+ float getFuzz() const;
+ float getMax() const;
+ float getMin() const;
+ float getRange() const;
+ int getSource() const;
+
+private:
+ CJNIViewInputDeviceMotionRange();
+};
+
+class CJNIViewInputDevice : public CJNIBase
+{
+public:
+ CJNIViewInputDevice(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNIViewInputDevice() {};
+
+ static const CJNIViewInputDevice getDevice(int id);
+
+ std::string getName() const;
+ const CJNIViewInputDeviceMotionRange getMotionRange(int axis) const;
+
+private:
+ CJNIViewInputDevice();
+
+ static const char *m_classname;
+};
+
+class CJNIView : public CJNIBase
+{
+public:
+ CJNIView(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNIView() {};
+
+ void setSystemUiVisibility(int visibility);
+ int getSystemUiVisibility();
+
+ static void PopulateStaticFields();
+ static int SYSTEM_UI_FLAG_FULLSCREEN;
+ static int SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+ static int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
+ static int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+ static int SYSTEM_UI_FLAG_LAYOUT_STABLE;
+ static int SYSTEM_UI_FLAG_LOW_PROFILE;
+ static int SYSTEM_UI_FLAG_VISIBLE;
+};
diff --git a/xbmc/android/jni/WifiConfiguration.cpp b/xbmc/android/jni/WifiConfiguration.cpp
index 25af0a71a6..e669039250 100644
--- a/xbmc/android/jni/WifiConfiguration.cpp
+++ b/xbmc/android/jni/WifiConfiguration.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,20 +23,146 @@
using namespace jni;
-CJNIWifiConfiguration::CJNIWifiConfiguration(const jhobject &object) : CJNIBase(object)
- ,networkId( get_field<jint>(m_object, "networkId"))
- ,status( get_field<jint>(m_object, "status"))
- ,SSID( jcast<std::string>(get_field<jhstring>(m_object, "SSID")))
- ,BSSID( jcast<std::string>(get_field<jhstring>(m_object, "BSSID")))
- ,preSharedKey( jcast<std::string>(get_field<jhstring>(m_object, "preSharedKey")))
- ,wepTxKeyIndex( get_field<jint>(m_object, "wepTxKeyIndex"))
- ,priority( get_field<jint>(m_object, "priority"))
- ,hiddenSSID( get_field<jboolean>(m_object, "hiddenSSID"))
- ,allowedKeyManagement( get_field<jhobject>(m_object, "allowedKeyManagement", "Ljava/util/BitSet;"))
- ,allowedProtocols( get_field<jhobject>(m_object, "allowedProtocols", "Ljava/util/BitSet;"))
- ,allowedPairwiseCiphers(get_field<jhobject>(m_object, "allowedPairwiseCiphers", "Ljava/util/BitSet;"))
- ,allowedGroupCiphers( get_field<jhobject>(m_object, "allowedGroupCiphers", "Ljava/util/BitSet;"))
+CJNIWifiConfiguration::CJNIWifiConfiguration() : CJNIBase("android/net/wifi/WifiConfiguration")
{
+ m_object = new_object(GetClassName());
+ m_object.setGlobal();
+}
+
+int CJNIWifiConfiguration::getnetworkId() const
+{
+ return get_field<jint>(m_object, "networkId");
+}
+
+int CJNIWifiConfiguration::getstatus() const
+{
+ return get_field<jint>(m_object, "status");
+}
+
+std::string CJNIWifiConfiguration::getSSID() const
+{
+ return jcast<std::string>(get_field<jhstring>(m_object, "SSID"));
+}
+
+std::string CJNIWifiConfiguration::getBSSID() const
+{
+ return jcast<std::string>(get_field<jhstring>(m_object, "BSSID"));
+}
+
+std::string CJNIWifiConfiguration::getpreSharedKey() const
+{
+ return jcast<std::string>(get_field<jhstring>(m_object, "preSharedKey"));
+}
+
+std::vector<std::string> CJNIWifiConfiguration::getwepKeys() const
+{
+ return jcast<std::vector<std::string>>(get_field<jhobjectArray>(m_object,"wepKeys", "[Ljava/lang/String;"));
+}
+
+int CJNIWifiConfiguration::getwepTxKeyIndex() const
+{
+ return get_field<jint>(m_object, "wepTxKeyIndex");
+}
+
+int CJNIWifiConfiguration::getpriority() const
+{
+ return get_field<jint>(m_object, "priority");
+}
+
+bool CJNIWifiConfiguration::gethiddenSSID() const
+{
+ return get_field<jboolean>(m_object, "hiddenSSID");
+}
+
+CJNIBitSet CJNIWifiConfiguration::getallowedKeyManagement() const
+{
+ return get_field<jhobject>(m_object, "allowedKeyManagement", "Ljava/util/BitSet;");
+}
+
+CJNIBitSet CJNIWifiConfiguration::getallowedProtocols() const
+{
+ return get_field<jhobject>(m_object, "allowedProtocols", "Ljava/util/BitSet;");
+}
+
+CJNIBitSet CJNIWifiConfiguration::getallowedPairwiseCiphers() const
+{
+ return get_field<jhobject>(m_object, "allowedPairwiseCiphers", "Ljava/util/BitSet;");
+}
+
+CJNIBitSet CJNIWifiConfiguration::getallowedGroupCiphers() const
+{
+ return get_field<jhobject>(m_object, "allowedGroupCiphers", "Ljava/util/BitSet;");
+}
+
+void CJNIWifiConfiguration::setnetworkId(int networkId)
+{
+ set_field(m_object,"networkId", networkId);
+}
+
+
+void CJNIWifiConfiguration::setstatus(int status)
+{
+ set_field(m_object,"networkId", status);
+}
+
+void CJNIWifiConfiguration::setSSID(const std::string &SSID)
+{
+ set_field(m_object, "SSID", jcast<jhstring>(SSID));
+}
+
+void CJNIWifiConfiguration::setBSSID(const std::string &BSSID)
+{
+ set_field(m_object, "BSSID", jcast<jhstring>(BSSID));
+}
+
+void CJNIWifiConfiguration::setpreSharedKey(const std::string &preSharedKey)
+{
+ set_field(m_object,"preSharedKey", jcast<jhstring>(preSharedKey));
+}
+
+void CJNIWifiConfiguration::setwepKeys(const std::vector<std::string> &wepKeys)
+{
+ set_field(m_object, "wepKeys", "[Ljava/lang/String;", jcast<jhobjectArray>(wepKeys));
+}
+
+void CJNIWifiConfiguration::setwepTxKeyIndex(int wepTxKeyIndex)
+{
+ set_field(m_object, "wepTxKeyIndex", wepTxKeyIndex);
+}
+
+void CJNIWifiConfiguration::setpriority(int priority)
+{
+ set_field(m_object, "priority", priority);
+}
+
+void CJNIWifiConfiguration::sethiddenSSID(bool hiddenSSID)
+{
+ set_field(m_object, "hiddenSSID", (jboolean)hiddenSSID);
+}
+
+void CJNIWifiConfiguration::setallowedKeyManagement(const CJNIBitSet& allowedKeyManagement)
+{
+ set_field(m_object, "allowedKeyManagement", "Ljava/util/BitSet;", allowedKeyManagement.get_raw());
+}
+
+void CJNIWifiConfiguration::setallowedProtocols(const CJNIBitSet& allowedProtocols)
+{
+ set_field(m_object, "allowedProtocols", "Ljava/util/BitSet;", allowedProtocols.get_raw());
+}
+
+void CJNIWifiConfiguration::setallowedAuthAlgorithms(const CJNIBitSet& allowedAuthAlgorithms)
+{
+ set_field(m_object, "allowedAuthAlgorithms", "Ljava/util/BitSet;", allowedAuthAlgorithms.get_raw());
+}
+
+void CJNIWifiConfiguration::setallowedPairwiseCiphers(const CJNIBitSet& allowedPairwiseCiphers)
+{
+ set_field(m_object, "allowedPairwiseCiphers", "Ljava/util/BitSet;", allowedPairwiseCiphers.get_raw());
+}
+
+void CJNIWifiConfiguration::setallowedGroupCiphers(const CJNIBitSet& allowedGroupCiphers)
+{
+ set_field(m_object, "allowedGroupCiphers", "Ljava/util/BitSet;", allowedGroupCiphers.get_raw());
}
std::string CJNIWifiConfiguration::toString()
diff --git a/xbmc/android/jni/WifiConfiguration.h b/xbmc/android/jni/WifiConfiguration.h
index f689d66b63..e0e126fbb6 100644
--- a/xbmc/android/jni/WifiConfiguration.h
+++ b/xbmc/android/jni/WifiConfiguration.h
@@ -1,7 +1,7 @@
#pragma once
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,27 +25,43 @@
class CJNIWifiConfiguration : public CJNIBase
{
public:
- CJNIWifiConfiguration(const jni::jhobject &object);
+ CJNIWifiConfiguration();
+ CJNIWifiConfiguration(const jni::jhobject &object) : CJNIBase(object) {};
~CJNIWifiConfiguration() {};
- int networkId;
- int status;
- std::string SSID;
- std::string BSSID;
- std::string preSharedKey;
-// std::string[] wepKeys;
- int wepTxKeyIndex;
- int priority;
- bool hiddenSSID;
- CJNIBitSet allowedKeyManagement;
- CJNIBitSet allowedProtocols;
- CJNIBitSet allowedAuthAlgorithms;
- CJNIBitSet allowedPairwiseCiphers;
- CJNIBitSet allowedGroupCiphers;
+ int getnetworkId() const;
+ int getstatus() const;
+ std::string getSSID() const;
+ std::string getBSSID() const;
+ std::string getpreSharedKey() const;
+ std::vector<std::string> getwepKeys() const;
+ int getwepTxKeyIndex() const;
+ int getpriority() const;
+ bool gethiddenSSID() const;
+ CJNIBitSet getallowedKeyManagement() const;
+ CJNIBitSet getallowedProtocols() const;
+ CJNIBitSet getallowedAuthAlgorithms() const;
+ CJNIBitSet getallowedPairwiseCiphers() const;
+ CJNIBitSet getallowedGroupCiphers() const;
+
+ void setnetworkId(int);
+ void setstatus(int);
+ void setSSID(const std::string &);
+ void setBSSID(const std::string &);
+ void setpreSharedKey(const std::string &);
+ void setwepKeys(const std::vector<std::string>&);
+ void setwepTxKeyIndex(int);
+ void setpriority(int);
+ void sethiddenSSID(bool);
+ void setallowedKeyManagement(const CJNIBitSet&);
+ void setallowedProtocols(const CJNIBitSet&);
+ void setallowedAuthAlgorithms(const CJNIBitSet&);
+ void setallowedPairwiseCiphers(const CJNIBitSet&);
+ void setallowedGroupCiphers(const CJNIBitSet&);
+
std::string toString();
int describeContents();
private:
- CJNIWifiConfiguration();
};
diff --git a/xbmc/android/jni/WifiManager.cpp b/xbmc/android/jni/WifiManager.cpp
index e836bd2a15..ed558f9c1b 100644
--- a/xbmc/android/jni/WifiManager.cpp
+++ b/xbmc/android/jni/WifiManager.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,18 @@ CJNIList<CJNIWifiConfiguration> CJNIWifiManager::getConfiguredNetworks()
"getConfiguredNetworks" , "()Ljava/util/List;");
}
+int CJNIWifiManager::addNetwork(const CJNIWifiConfiguration &config)
+{
+ return call_method<int>(m_object,
+ "addNetwork" , "(Landroid/net/wifi/WifiConfiguration;)I", config.get_raw());
+}
+
+int CJNIWifiManager::updateNetwork(const CJNIWifiConfiguration &config)
+{
+ return call_method<int>(m_object,
+ "updateNetwork" , "(Landroid/net/wifi/WifiConfiguration;)I", config.get_raw());
+}
+
CJNIList<CJNIScanResult> CJNIWifiManager::getScanResults()
{
return call_method<jhobject>(m_object,
diff --git a/xbmc/android/jni/WifiManager.h b/xbmc/android/jni/WifiManager.h
index 4e1b18c979..85424a7bc9 100644
--- a/xbmc/android/jni/WifiManager.h
+++ b/xbmc/android/jni/WifiManager.h
@@ -1,7 +1,7 @@
#pragma once
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,8 @@ public:
CJNIWifiManager(const jni::jhobject &object) : CJNIBase(object){};
CJNIList<CJNIWifiConfiguration> getConfiguredNetworks();
+ int addNetwork(const CJNIWifiConfiguration &config);
+ int updateNetwork(const CJNIWifiConfiguration &config);
bool removeNetwork(int);
bool enableNetwork(int, bool);
bool disableNetwork(int);
diff --git a/xbmc/android/jni/Window.cpp b/xbmc/android/jni/Window.cpp
new file mode 100644
index 0000000000..83b08576cf
--- /dev/null
+++ b/xbmc/android/jni/Window.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "Window.h"
+#include "View.h"
+
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+CJNIView CJNIWindow::getDecorView()
+{
+ return call_method<jhobject>(m_object,
+ "getDecorView", "()Landroid/view/View;");
+}
diff --git a/xbmc/android/jni/Window.h b/xbmc/android/jni/Window.h
new file mode 100644
index 0000000000..0b01a55555
--- /dev/null
+++ b/xbmc/android/jni/Window.h
@@ -0,0 +1,32 @@
+#pragma once
+/*
+ * Copyright (C) 2013 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "JNIBase.h"
+
+class CJNIView;
+class CJNIWindow : public CJNIBase
+{
+public:
+ CJNIWindow(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNIWindow() {};
+
+ CJNIView getDecorView();
+};
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideoPrivate.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideoPrivate.cpp
index f89fa630fd..84d29f2908 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideoPrivate.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideoPrivate.cpp
@@ -321,7 +321,7 @@ bool CStageFrightVideoPrivate::InitStagefrightSurface()
glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
mSurfTexture = new CJNISurfaceTexture(mVideoTextureId);
- mSurface = new CJNISurface(mSurfTexture);
+ mSurface = new CJNISurface(*mSurfTexture);
mVideoNativeWindow = ANativeWindow_fromSurface(env, mSurface->get_raw());