[DROID][JNI] Add AudioFormat class bits.
authorTrent Nelson <trent.a.b.nelson@gmail.com>
Wed, 11 Dec 2013 21:31:15 +0000 (16:31 -0500)
committerTrent Nelson <trent.a.b.nelson@gmail.com>
Thu, 19 Dec 2013 18:00:10 +0000 (13:00 -0500)
xbmc/android/jni/AudioFormat.cpp [new file with mode: 0644]
xbmc/android/jni/AudioFormat.h [new file with mode: 0644]
xbmc/android/jni/Context.cpp
xbmc/android/jni/Makefile.in

diff --git a/xbmc/android/jni/AudioFormat.cpp b/xbmc/android/jni/AudioFormat.cpp
new file mode 100644 (file)
index 0000000..760fe13
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ *      Copyright (C) 2013 Team XBMC
+ *      http://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 "AudioFormat.h"
+#include "JNIBase.h"
+#include "jutils/jutils-details.hpp"
+
+using namespace jni;
+
+int CJNIAudioFormat::ENCODING_PCM_16BIT = 0x00000002;
+int CJNIAudioFormat::CHANNEL_OUT_STEREO = 0x0000000c;
+
+void CJNIAudioFormat::PopulateStaticFields()
+{
+  int sdk = CJNIBase::GetSDKVersion();
+  if (sdk >= 3)
+  {
+    jhclass c = find_class("android/media/AudioFormat");
+    CJNIAudioFormat::ENCODING_PCM_16BIT = get_static_field<int>(c, "ENCODING_PCM_16BIT");
+    if (sdk >= 5)
+      CJNIAudioFormat::CHANNEL_OUT_STEREO = get_static_field<int>(c, "CHANNEL_OUT_STEREO");
+  }
+}
+
diff --git a/xbmc/android/jni/AudioFormat.h b/xbmc/android/jni/AudioFormat.h
new file mode 100644 (file)
index 0000000..ab50254
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once
+/*
+ *      Copyright (C) 2013 Team XBMC
+ *      http://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/>.
+ *
+ */
+
+namespace jni
+{
+
+class CJNIAudioFormat
+{
+  public:
+    static void PopulateStaticFields();
+
+    static int ENCODING_PCM_16BIT;
+    static int CHANNEL_OUT_STEREO;
+};
+
+};
+
index 70e26e9..d1fd9dd 100644 (file)
@@ -35,6 +35,7 @@
 #include "PowerManager.h"
 #include "Cursor.h"
 #include "ConnectivityManager.h"
+#include "AudioFormat.h"
 #include "AudioManager.h"
 #include "Surface.h"
 #include "MediaCodec.h"
@@ -76,6 +77,7 @@ void CJNIContext::PopulateStaticFields()
   CJNICursor::PopulateStaticFields();
   CJNIContentResolver::PopulateStaticFields();
   CJNIConnectivityManager::PopulateStaticFields();
+  CJNIAudioFormat::PopulateStaticFields();
   CJNIAudioManager::PopulateStaticFields();
   CJNISurface::PopulateStaticFields();
   CJNIMediaCodec::PopulateStaticFields();
index 35cb840..3a879de 100644 (file)
@@ -4,6 +4,7 @@ SRCS      += Context.cpp
 SRCS      += BroadcastReceiver.cpp
 SRCS      += Intent.cpp
 SRCS      += PackageManager.cpp
+SRCS      += AudioFormat.cpp
 SRCS      += AudioManager.cpp
 SRCS      += PowerManager.cpp
 SRCS      += WakeLock.cpp