diff --git a/libs/armeabi-v7a/liblinphone.so b/libs/armeabi-v7a/liblinphone.so
index fe03a6a88..0af120b85 100755
Binary files a/libs/armeabi-v7a/liblinphone.so and b/libs/armeabi-v7a/liblinphone.so differ
diff --git a/libs/armeabi-v7a/libmsandroiddisplay.so b/libs/armeabi-v7a/libmsandroiddisplay.so
new file mode 100755
index 000000000..2fb162954
Binary files /dev/null and b/libs/armeabi-v7a/libmsandroiddisplay.so differ
diff --git a/libs/armeabi/liblinphone.so b/libs/armeabi/liblinphone.so
index a8d6b2321..78a83cfe4 100755
Binary files a/libs/armeabi/liblinphone.so and b/libs/armeabi/liblinphone.so differ
diff --git a/libs/armeabi/libmsandroiddisplay.so b/libs/armeabi/libmsandroiddisplay.so
new file mode 100755
index 000000000..d9dbdcf93
Binary files /dev/null and b/libs/armeabi/libmsandroiddisplay.so differ
diff --git a/res/layout/videocall.xml b/res/layout/videocall.xml
index e79e30c28..ba58b1963 100644
--- a/res/layout/videocall.xml
+++ b/res/layout/videocall.xml
@@ -1,7 +1,6 @@
-
+ android:layout_height="fill_parent" android:layout_width="fill_parent">
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 57f6e9297..e0680a7da 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,5 +1,7 @@
+ Enable video
+ pref_escape_plus_key
Replace + by 00
pref_escape_plus_key
iLBC might be unavailable depending on ARM processor and Android OS version.
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index d86d2334d..f5210a697 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -35,6 +35,7 @@
+
diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java
index 69d77a884..76c30f320 100644
--- a/src/org/linphone/DialerActivity.java
+++ b/src/org/linphone/DialerActivity.java
@@ -33,6 +33,7 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.os.Build;
@@ -99,7 +100,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
static String PREF_CHECK_CONFIG = "pref_check_config";
private static String CURRENT_ADDRESS = "org.linphone.current-address";
private static String CURRENT_DISPLAYNAME = "org.linphone.current-displayname";
-
+ static int VIDEO_VIEW_ACTIVITY = 100;
/**
*
* @return null if not ready yet
@@ -463,6 +464,13 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
routeAudioToReceiver();
}
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
+ if (LinphoneService.instance().getLinphoneCore().isVideoEnabled()) {
+ //start video view
+ Intent lIntent = new Intent();
+ lIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ lIntent.setClass(this, VideoCallActivity.class);
+ startActivityForResult(lIntent,VIDEO_VIEW_ACTIVITY);
+ }
}
private void exitCallMode() {
mCallControlRow.setVisibility(View.VISIBLE);
@@ -475,6 +483,9 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
mMute.setChecked(true);
mSpeaker.setChecked(false);
mDecline.setEnabled(false);
+ if (LinphoneService.instance().getLinphoneCore().isVideoEnabled()) {
+ finishActivity(VIDEO_VIEW_ACTIVITY);
+ }
if (mWakeLock.isHeld())mWakeLock.release();
}
private void routeAudioToSpeaker() {
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 17bc557f4..10b1c55e6 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -315,6 +315,15 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
} catch (LinphoneCoreException e) {
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
}
+ boolean isVideoEnabled = mPref.getBoolean(getString(R.string.pref_video_enable_key),false);
+ if (isVideoEnabled) {
+ try {
+ System.loadLibrary("msandroiddisplay");
+ } catch (Throwable e) {
+ Log.e(TAG, "cannot load video plugin", e);
+ }
+ }
+ mLinphoneCore.enableVideo(isVideoEnabled, isVideoEnabled);
//1 read proxy config from preferences
String lUserName = mPref.getString(getString(R.string.pref_username_key), null);
if (lUserName == null || lUserName.length()==0) {
diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java
new file mode 100644
index 000000000..14c9a6d8d
--- /dev/null
+++ b/src/org/linphone/VideoCallActivity.java
@@ -0,0 +1,35 @@
+/*
+VideoCallActivity.java
+Copyright (C) 2010 Belledonne Communications, Grenoble, France
+
+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
+of the License, 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 this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+package org.linphone;
+
+import org.linphone.core.Object;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.SurfaceView;
+
+public class VideoCallActivity extends Activity {
+ SurfaceView mVideoView;
+
+ public void onCreate(Bundle savedInstanceState) {
+ setContentView(R.layout.videocall);
+ mVideoView = (SurfaceView) findViewById(R.id.video_surface);
+ LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView) ;
+ }
+}
diff --git a/src/org/linphone/core/AndroidVideoWindowImpl.java b/src/org/linphone/core/AndroidVideoWindowImpl.java
index f1927e184..2bba92d72 100644
--- a/src/org/linphone/core/AndroidVideoWindowImpl.java
+++ b/src/org/linphone/core/AndroidVideoWindowImpl.java
@@ -9,7 +9,7 @@ import android.view.SurfaceView;
import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceHolder.Callback;
-public class AndroidVideoWindowImpl implements VideoWindow {
+public class AndroidVideoWindowImpl implements Object {
private Bitmap mBitmap;
private SurfaceView mView;
private Surface mSurface;
diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java
index 657cdc407..e8d13a4cd 100644
--- a/src/org/linphone/core/LinphoneCoreImpl.java
+++ b/src/org/linphone/core/LinphoneCoreImpl.java
@@ -22,6 +22,8 @@ import java.io.File;
import java.io.IOException;
import java.util.Vector;
+import android.view.SurfaceView;
+
class LinphoneCoreImpl implements LinphoneCore {
@@ -71,6 +73,9 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void addFriend(long nativePtr,long friend);
private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status);
private native long createChatRoom(long nativePtr,String to);
+ private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled);
+ private native boolean isVideoEnabled(long nativePtr);
+
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
mListener=listener;
@@ -296,10 +301,10 @@ class LinphoneCoreImpl implements LinphoneCore {
public LinphoneChatRoom createChatRoom(String to) {
return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to));
}
- public void setPreviewWindow(VideoWindow w) {
+ public void setPreviewWindow(Object w) {
if (mPreviewWindow!=null)
mPreviewWindow.setListener(null);
- mPreviewWindow=(AndroidVideoWindowImpl)w;
+ mPreviewWindow=new AndroidVideoWindowImpl((SurfaceView)w);
mPreviewWindow.setListener(new AndroidVideoWindowImpl.VideoWindowListener(){
public void onSurfaceDestroyed(AndroidVideoWindowImpl vw) {
setPreviewWindowId(nativePtr,null);
@@ -310,7 +315,7 @@ class LinphoneCoreImpl implements LinphoneCore {
}
});
}
- public void setVideoWindow(VideoWindow w) {
+ public void setVideoWindow(Object w) {
if (mVideoWindow!=null)
mVideoWindow.setListener(null);
mVideoWindow=(AndroidVideoWindowImpl)w;
@@ -324,5 +329,11 @@ class LinphoneCoreImpl implements LinphoneCore {
}
});
}
+ public void enableVideo(boolean vcap_enabled, boolean display_enabled) {
+ enableVideo(nativePtr,vcap_enabled, display_enabled);
+ }
+ public boolean isVideoEnabled() {
+ return isVideoEnabled(nativePtr);
+ }
}