Update coreapi to improve Android app

parent 0ce2d7cd
......@@ -1109,6 +1109,8 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
}
if (!is_inactive){
video_stream_set_direction (call->videostream, dir);
ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
video_stream_set_device_rotation(call->videostream, lc->device_rotation);
video_stream_start(call->videostream,
call->video_profile, addr, vstream->port,
vstream->port+1,
......@@ -1424,5 +1426,3 @@ void linphone_call_log_completed(LinphoneCall *call){
}
call_logs_write_to_config_file(lc);
}
......@@ -3480,6 +3480,12 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc)
**/
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){
lc->preview_window_id=id;
#ifdef VIDEO_ENABLED
LinphoneCall *call=linphone_core_get_current_call(lc);
if (call!=NULL && call->videostream){
video_stream_set_native_preview_window_id(call->videostream,id);
}
#endif
}
/**
......@@ -3491,6 +3497,24 @@ void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno){
lc->use_preview_window=yesno;
}
/**
* Tells the core the device current orientation. This can be used by capture filters
* on mobile devices to select between portrait/landscape mode and to produce properly
* orientated images. The exact meaning of the value in rotation if left to each device
* specific implementations.
*
**/
void linphone_core_set_device_rotation(LinphoneCore *lc, int rotation) {
ms_message("%s : rotation=%d\n", __FUNCTION__, rotation);
lc->device_rotation = rotation;
#ifdef VIDEO_ENABLED
LinphoneCall *call=linphone_core_get_current_call(lc);
if (call!=NULL && call->videostream){
video_stream_set_device_rotation(call->videostream,rotation);
}
#endif
}
static MSVideoSizeDef supported_resolutions[]={
#ifdef ENABLE_HD
{ {MS_VIDEO_SIZE_1080P_W,MS_VIDEO_SIZE_1080P_H} , "1080p" },
......
......@@ -934,6 +934,7 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc)
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id);
void linphone_core_use_preview_window(LinphoneCore *lc, bool_t yesno);
void linphone_core_set_device_rotation(LinphoneCore *lc, int rotation);
/*play/record support: use files instead of soundcard*/
void linphone_core_use_files(LinphoneCore *lc, bool_t yesno);
......
......@@ -20,8 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphonecore_utils.h"
#include <ortp/zrtp.h>
extern "C" {
#include "mediastreamer2/mediastream.h"
}
#include "mediastreamer2/msjava.h"
#include "private.h"
#include <cpu-features.h>
#ifdef ANDROID
......@@ -1164,6 +1167,20 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv*
linphone_core_set_native_video_window_id((LinphoneCore*)lc,(unsigned long)obj);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPreviewWindowId(JNIEnv* env
,jobject thiz
,jlong lc
,jobject obj) {
linphone_core_set_native_preview_window_id((LinphoneCore*)lc,(unsigned long)obj);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDeviceRotation(JNIEnv* env
,jobject thiz
,jlong lc
,jint rotation) {
linphone_core_set_device_rotation((LinphoneCore*)lc,rotation);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setFirewallPolicy(JNIEnv *env, jobject thiz, jlong lc, int enum_value){
linphone_core_set_firewall_policy((LinphoneCore*)lc,(LinphoneFirewallPolicy)enum_value);
......@@ -1334,6 +1351,25 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIE
}
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_setVideoDevice(JNIEnv *env,jobject thiz,jlong pCore,jint id) {
LinphoneCore* lc = (LinphoneCore *) pCore;
const char** devices = linphone_core_get_video_devices(lc);
if (devices == NULL) {
ms_error("No existing video devices\n");
return -1;
}
int i;
for(i=0; i<=id; i++) {
if (devices[i] == NULL)
break;
ms_message("Existing device %d : %s\n", i, devices[i]);
if (i==id) {
return linphone_core_set_video_device(lc, devices[i]);
}
}
return -1;
}
extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getAuthenticationToken(JNIEnv* env,jobject thiz,jlong ptr) {
LinphoneCall *call = (LinphoneCall *) ptr;
const char* token = linphone_call_get_authentication_token(call);
......@@ -1356,4 +1392,3 @@ extern "C" void Java_org_linphone_LinphoneManager_hackSpeakerState(JNIEnv* env,
msandroid_hack_speaker_state(speakerOn);
// End Galaxy S hack functions
}
......@@ -447,6 +447,7 @@ struct _LinphoneCore
bool_t auto_net_state_mon;
bool_t network_reachable;
bool_t use_preview_window;
int device_rotation;
bool_t ringstream_autorelease;
char* zrtp_secrets_cache;
};
......
......@@ -39,7 +39,7 @@ public interface LinphoneCall {
*/
IncomingReceived(1, "IncomingReceived"),
/**
* Outgoing call initialiazed.
* Outgoing call initialized.
*/
OutgoingInit(2, "OutgoingInit"),
/**
......
......@@ -474,6 +474,10 @@ public interface LinphoneCore {
void setVideoWindow(Object w);
void setPreviewWindow(Object w);
void setDeviceRotation(int rotation);
void setVideoDevice(int id);
/**
* Enables video globally.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment