summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2013-06-03 08:48:30 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-03 08:48:30 -0700
commit4a02d4c60946c257ab48783493db67ca08e327bc (patch)
treec98c79c04625a9e6f669a4d643f2e9c326a4b4bc /media/jni
parent293665686e45ae7c969a51de9fe9c9b32604782f (diff)
parentc41a0eff938f825ef235b92efa7a31c3b7f8bfb4 (diff)
downloadframeworks_base-4a02d4c60946c257ab48783493db67ca08e327bc.zip
frameworks_base-4a02d4c60946c257ab48783493db67ca08e327bc.tar.gz
frameworks_base-4a02d4c60946c257ab48783493db67ca08e327bc.tar.bz2
am c41a0eff: am be22605d: Merge "Listen for HTTP proxy changes and propagate the information to the media" into jb-mr2-dev
* commit 'c41a0eff938f825ef235b92efa7a31c3b7f8bfb4': Listen for HTTP proxy changes and propagate the information to the media
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_MediaPlayer.cpp64
1 files changed, 63 insertions, 1 deletions
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index c5098ce..7c607ea 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -55,6 +55,10 @@ struct fields_t {
jfieldID surface_texture;
jmethodID post_event;
+
+ jmethodID proxyConfigGetHost;
+ jmethodID proxyConfigGetPort;
+ jmethodID proxyConfigGetExclusionList;
};
static fields_t fields;
@@ -622,6 +626,20 @@ android_media_MediaPlayer_native_init(JNIEnv *env)
if (fields.surface_texture == NULL) {
return;
}
+
+ clazz = env->FindClass("android/net/ProxyProperties");
+ if (clazz == NULL) {
+ return;
+ }
+
+ fields.proxyConfigGetHost =
+ env->GetMethodID(clazz, "getHost", "()Ljava/lang/String;");
+
+ fields.proxyConfigGetPort =
+ env->GetMethodID(clazz, "getPort", "()I");
+
+ fields.proxyConfigGetExclusionList =
+ env->GetMethodID(clazz, "getExclusionList", "()Ljava/lang/String;");
}
static void
@@ -823,6 +841,49 @@ android_media_MediaPlayer_setNextMediaPlayer(JNIEnv *env, jobject thiz, jobject
;
}
+static void
+android_media_MediaPlayer_updateProxyConfig(
+ JNIEnv *env, jobject thiz, jobject proxyProps)
+{
+ ALOGV("updateProxyConfig");
+ sp<MediaPlayer> thisplayer = getMediaPlayer(env, thiz);
+ if (thisplayer == NULL) {
+ return;
+ }
+
+ if (proxyProps == NULL) {
+ thisplayer->updateProxyConfig(
+ NULL /* host */, 0 /* port */, NULL /* exclusionList */);
+ } else {
+ jstring hostObj = (jstring)env->CallObjectMethod(
+ proxyProps, fields.proxyConfigGetHost);
+
+ const char *host = env->GetStringUTFChars(hostObj, NULL);
+
+ int port = env->CallIntMethod(proxyProps, fields.proxyConfigGetPort);
+
+ jstring exclusionListObj = (jstring)env->CallObjectMethod(
+ proxyProps, fields.proxyConfigGetExclusionList);
+
+ const char *exclusionList =
+ env->GetStringUTFChars(exclusionListObj, NULL);
+
+ if (host != NULL && exclusionListObj != NULL) {
+ thisplayer->updateProxyConfig(host, port, exclusionList);
+ }
+
+ if (exclusionList != NULL) {
+ env->ReleaseStringUTFChars(exclusionListObj, exclusionList);
+ exclusionList = NULL;
+ }
+
+ if (host != NULL) {
+ env->ReleaseStringUTFChars(hostObj, host);
+ host = NULL;
+ }
+ }
+}
+
// ----------------------------------------------------------------------------
static JNINativeMethod gMethods[] = {
@@ -832,7 +893,7 @@ static JNINativeMethod gMethods[] = {
(void *)android_media_MediaPlayer_setDataSourceAndHeaders
},
- {"setDataSource", "(Ljava/io/FileDescriptor;JJ)V", (void *)android_media_MediaPlayer_setDataSourceFD},
+ {"_setDataSource", "(Ljava/io/FileDescriptor;JJ)V", (void *)android_media_MediaPlayer_setDataSourceFD},
{"_setVideoSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaPlayer_setVideoSurface},
{"prepare", "()V", (void *)android_media_MediaPlayer_prepare},
{"prepareAsync", "()V", (void *)android_media_MediaPlayer_prepareAsync},
@@ -867,6 +928,7 @@ static JNINativeMethod gMethods[] = {
{"getParameter", "(ILandroid/os/Parcel;)V", (void *)android_media_MediaPlayer_getParameter},
{"native_setRetransmitEndpoint", "(Ljava/lang/String;I)I", (void *)android_media_MediaPlayer_setRetransmitEndpoint},
{"setNextMediaPlayer", "(Landroid/media/MediaPlayer;)V", (void *)android_media_MediaPlayer_setNextMediaPlayer},
+ {"updateProxyConfig", "(Landroid/net/ProxyProperties;)V", (void *)android_media_MediaPlayer_updateProxyConfig},
};
static const char* const kClassPathName = "android/media/MediaPlayer";