Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
baf75dd4
Commit
baf75dd4
authored
Feb 25, 2015
by
Ghislain MARY
Browse files
Add JNI wrapper to set audio/video codecs and to enable DNS SRV.
parent
b285efeb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
5 deletions
+82
-5
coreapi/linphonecore_jni.cc
coreapi/linphonecore_jni.cc
+30
-0
java/common/org/linphone/core/LinphoneCore.java
java/common/org/linphone/core/LinphoneCore.java
+23
-3
java/impl/org/linphone/core/LinphoneCoreImpl.java
java/impl/org/linphone/core/LinphoneCoreImpl.java
+28
-1
java/impl/org/linphone/core/PayloadTypeImpl.java
java/impl/org/linphone/core/PayloadTypeImpl.java
+1
-1
No files found.
coreapi/linphonecore_jni.cc
View file @
baf75dd4
...
...
@@ -1639,6 +1639,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTy
return
jCodecs
;
}
JNIEXPORT
void
JNICALL
Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lc
,
jlongArray
jCodecs
)
{
MSList
*
pts
=
NULL
;
int
codecsCount
=
env
->
GetArrayLength
(
jCodecs
);
jlong
*
codecs
=
env
->
GetLongArrayElements
(
jCodecs
,
NULL
);
for
(
int
i
=
0
;
i
<
codecsCount
;
i
++
)
{
PayloadType
*
pt
=
(
PayloadType
*
)
codecs
[
i
];
ms_list_append
(
pts
,
pt
);
}
linphone_core_set_video_codecs
((
LinphoneCore
*
)
lc
,
pts
);
env
->
ReleaseLongArrayElements
(
jCodecs
,
codecs
,
0
);
}
extern
"C"
jlongArray
Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lc
)
{
...
...
@@ -1657,6 +1669,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy
return
jCodecs
;
}
JNIEXPORT
void
JNICALL
Java_org_linphone_core_LinphoneCoreImpl_setAudioCodecs
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lc
,
jlongArray
jCodecs
)
{
MSList
*
pts
=
NULL
;
int
codecsCount
=
env
->
GetArrayLength
(
jCodecs
);
jlong
*
codecs
=
env
->
GetLongArrayElements
(
jCodecs
,
NULL
);
for
(
int
i
=
0
;
i
<
codecsCount
;
i
++
)
{
PayloadType
*
pt
=
(
PayloadType
*
)
codecs
[
i
];
pts
=
ms_list_append
(
pts
,
pt
);
}
linphone_core_set_audio_codecs
((
LinphoneCore
*
)
lc
,
pts
);
env
->
ReleaseLongArrayElements
(
jCodecs
,
codecs
,
0
);
}
extern
"C"
jint
Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lc
...
...
@@ -5861,4 +5885,10 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMultica
return
linphone_core_video_multicast_enabled
((
LinphoneCore
*
)
ptr
);
}
JNIEXPORT
void
JNICALL
Java_org_linphone_core_LinphoneCoreImpl_enableDnsSrv
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lc
,
jboolean
yesno
)
{
linphone_core_enable_dns_srv
((
LinphoneCore
*
)
lc
,
yesno
);
}
JNIEXPORT
jboolean
JNICALL
Java_org_linphone_core_LinphoneCoreImpl_dnsSrvEnabled
(
JNIEnv
*
env
,
jobject
thiz
,
jlong
lc
)
{
return
linphone_core_dns_srv_enabled
((
LinphoneCore
*
)
lc
);
}
java/common/org/linphone/core/LinphoneCore.java
View file @
baf75dd4
...
...
@@ -1127,11 +1127,21 @@ public interface LinphoneCore {
* @return
*/
PayloadType
[]
getAudioCodecs
();
/**
* Set the list of audio codecs.
* @param codecs List of PayloadType objects
*/
void
setAudioCodecs
(
PayloadType
[]
codecs
);
/**
* Returns the currently supported video codecs, as PayloadType elements
* @return
*/
PayloadType
[]
getVideoCodecs
();
/**
* Set the list of video codecs.
* @param codecs List of PayloadType objects
*/
void
setVideoCodecs
(
PayloadType
[]
codecs
);
/**
* enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
*/
...
...
@@ -2000,7 +2010,17 @@ public interface LinphoneCore {
* @return true if subsequent calls will propose multicast ip set by {@link linphone_core_set_video_multicast_addr}
**/
public
boolean
videoMulticastEnabled
();
/**
* Enable or disable DNS SRV resolution.
* @param yesno true to enable DNS SRV resolution, false to disable it.
*/
public
void
enableDnsSrv
(
boolean
yesno
);
/**
* Tells whether DNS SRV resolution is enabled.
* @return true if DNS SRV resolution is enabled, false if disabled.
*/
public
boolean
dnsSrvEnabled
();
}
java/impl/org/linphone/core/LinphoneCoreImpl.java
View file @
baf75dd4
...
...
@@ -114,12 +114,14 @@ class LinphoneCoreImpl implements LinphoneCore {
private
native
void
setRing
(
long
nativePtr
,
String
path
);
private
native
String
getRing
(
long
nativePtr
);
private
native
void
setRootCA
(
long
nativePtr
,
String
path
);
private
native
void
setRingback
(
long
nativePtr
,
String
path
);
private
native
void
setRingback
(
long
nativePtr
,
String
path
);
private
native
long
[]
listVideoPayloadTypes
(
long
nativePtr
);
private
native
void
setVideoCodecs
(
long
nativePtr
,
long
[]
codecs
);
private
native
LinphoneProxyConfig
[]
getProxyConfigList
(
long
nativePtr
);
private
native
long
[]
getAuthInfosList
(
long
nativePtr
);
private
native
long
findAuthInfos
(
long
nativePtr
,
String
username
,
String
realm
,
String
domain
);
private
native
long
[]
listAudioPayloadTypes
(
long
nativePtr
);
private
native
void
setAudioCodecs
(
long
nativePtr
,
long
[]
codecs
);
private
native
void
enableKeepAlive
(
long
nativePtr
,
boolean
enable
);
private
native
boolean
isKeepAliveEnabled
(
long
nativePtr
);
private
native
int
startEchoCalibration
(
long
nativePtr
,
Object
data
);
...
...
@@ -560,6 +562,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return
codecs
;
}
public
synchronized
void
setVideoCodecs
(
PayloadType
[]
codecs
)
{
long
[]
typesPtr
=
new
long
[
codecs
.
length
];
for
(
int
i
=
0
;
i
<
codecs
.
length
;
i
++)
{
typesPtr
[
i
]
=
((
PayloadTypeImpl
)
codecs
[
i
]).
nativePtr
;
}
setVideoCodecs
(
nativePtr
,
typesPtr
);
}
public
synchronized
PayloadType
[]
getAudioCodecs
()
{
long
[]
typesPtr
=
listAudioPayloadTypes
(
nativePtr
);
if
(
typesPtr
==
null
)
return
null
;
...
...
@@ -572,6 +581,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return
codecs
;
}
public
synchronized
void
setAudioCodecs
(
PayloadType
[]
codecs
)
{
long
[]
typesPtr
=
new
long
[
codecs
.
length
];
for
(
int
i
=
0
;
i
<
codecs
.
length
;
i
++)
{
typesPtr
[
i
]
=
((
PayloadTypeImpl
)
codecs
[
i
]).
nativePtr
;
}
setAudioCodecs
(
nativePtr
,
typesPtr
);
}
public
synchronized
boolean
isNetworkReachable
()
{
return
isNetworkStateReachable
(
nativePtr
);
}
...
...
@@ -1446,4 +1462,15 @@ class LinphoneCoreImpl implements LinphoneCore {
public
boolean
videoMulticastEnabled
()
{
return
videoMulticastEnabled
(
nativePtr
);
}
private
native
void
enableDnsSrv
(
long
ptr
,
boolean
yesno
);
@Override
public
void
enableDnsSrv
(
boolean
yesno
)
{
enableDnsSrv
(
nativePtr
,
yesno
);
}
private
native
boolean
dnsSrvEnabled
(
long
ptr
);
@Override
public
boolean
dnsSrvEnabled
()
{
return
dnsSrvEnabled
(
nativePtr
);
}
}
java/impl/org/linphone/core/PayloadTypeImpl.java
View file @
baf75dd4
...
...
@@ -21,7 +21,7 @@ package org.linphone.core;
class
PayloadTypeImpl
implements
PayloadType
{
p
rotected
final
long
nativePtr
;
p
ublic
final
long
nativePtr
;
private
native
String
toString
(
long
ptr
);
private
native
String
getMime
(
long
ptr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment