mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 08:39:20 +00:00
Add JNI to handle media directions.
This commit is contained in:
parent
f11874a26a
commit
db3c815956
5 changed files with 115 additions and 4 deletions
|
|
@ -290,14 +290,14 @@ LINPHONE_PUBLIC LinphoneMediaDirection linphone_call_params_get_audio_direction
|
|||
LINPHONE_PUBLIC LinphoneMediaDirection linphone_call_params_get_video_direction(const LinphoneCallParams *cp);
|
||||
|
||||
/**
|
||||
* Set the audio stream direction. Only relevant for multicast
|
||||
* Set the audio stream direction.
|
||||
* @param[in] cl LinphoneCallParams object
|
||||
* @param[in] The audio stream direction associated with this call params.
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams *cp, LinphoneMediaDirection dir);
|
||||
|
||||
/**
|
||||
* Set the video stream direction. Only relevant for multicast
|
||||
* Set the video stream direction.
|
||||
* @param[in] cl LinphoneCallParams object
|
||||
* @param[in] The video stream direction associated with this call params.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -3744,6 +3744,23 @@ extern "C" jintArray Java_org_linphone_core_LinphoneCallParamsImpl_getReceivedVi
|
|||
return arr;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_getAudioDirection(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
return (jint)linphone_call_params_get_audio_direction((LinphoneCallParams *)ptr);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_getVideoDirection(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
return (jint)linphone_call_params_get_video_direction((LinphoneCallParams *)ptr);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_setAudioDirection(JNIEnv *env, jobject thiz, jlong ptr, jint jdir) {
|
||||
linphone_call_params_set_audio_direction((LinphoneCallParams *)ptr, (LinphoneMediaDirection)jdir);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_setVideoDirection(JNIEnv *env, jobject thiz, jlong ptr, jint jdir) {
|
||||
linphone_call_params_set_video_direction((LinphoneCallParams *)ptr, (LinphoneMediaDirection)jdir);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_destroy(JNIEnv *env, jobject thiz, jlong lc){
|
||||
return linphone_call_params_destroy((LinphoneCallParams*)lc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ 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.core;
|
||||
import org.linphone.core.LinphoneCore.MediaDirection;
|
||||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||
import org.linphone.core.LinphoneCore.StreamType;
|
||||
/**
|
||||
|
|
@ -201,6 +202,28 @@ public interface LinphoneCallParams {
|
|||
* @returns returns true if call rtt is activated.
|
||||
**/
|
||||
boolean realTimeTextEnabled();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the audio stream direction.
|
||||
* @return The audio stream direction associated with the call params.
|
||||
**/
|
||||
MediaDirection getAudioDirection();
|
||||
|
||||
/**
|
||||
* Get the video stream direction.
|
||||
* @return The video stream direction associated with the call params.
|
||||
**/
|
||||
MediaDirection getVideoDirection();
|
||||
|
||||
/**
|
||||
* Set the audio stream direction.
|
||||
* @param The audio stream direction associated with this call params.
|
||||
**/
|
||||
void setAudioDirection(MediaDirection dir);
|
||||
|
||||
/**
|
||||
* Set the video stream direction.
|
||||
* @param The video stream direction associated with this call params.
|
||||
**/
|
||||
void setVideoDirection(MediaDirection dir);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,6 +292,52 @@ public interface LinphoneCore {
|
|||
return mStringValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Stream type enum-like.
|
||||
*
|
||||
*/
|
||||
static public final class MediaDirection {
|
||||
|
||||
static private Vector<MediaDirection> values = new Vector<MediaDirection>();
|
||||
/**
|
||||
* Invalid
|
||||
*/
|
||||
static public final MediaDirection Invalid = new MediaDirection(-1, "Invalid");
|
||||
/**
|
||||
* Inactive
|
||||
*/
|
||||
static public final MediaDirection Inactive = new MediaDirection(0, "Inactive");
|
||||
/**
|
||||
* SendOnly
|
||||
*/
|
||||
static public final MediaDirection SendOnly = new MediaDirection(1, "SendOnly");
|
||||
/**
|
||||
* RecvOnly
|
||||
*/
|
||||
static public final MediaDirection RecvOnly = new MediaDirection(2, "RecvOnly");
|
||||
/**
|
||||
* SendRecv
|
||||
*/
|
||||
static public final MediaDirection SendRecv = new MediaDirection(3, "SendRecv");
|
||||
protected final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
private MediaDirection(int value, String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue = stringValue;
|
||||
}
|
||||
public static MediaDirection fromInt(int value) {
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
MediaDirection dir = (MediaDirection) values.elementAt(i);
|
||||
if (dir.mValue == value) return dir;
|
||||
}
|
||||
throw new RuntimeException("MediaDirection not found [" + value + "]");
|
||||
}
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Media (RTP) encryption enum-like.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
import org.linphone.core.LinphoneCore.MediaDirection;
|
||||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||
import org.linphone.core.LinphoneCore.StreamType;
|
||||
|
||||
|
|
@ -208,4 +209,28 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams {
|
|||
public boolean realTimeTextEnabled() {
|
||||
return realTimeTextEnabled(nativePtr);
|
||||
}
|
||||
|
||||
private native int getAudioDirection(long nativePtr);
|
||||
@Override
|
||||
public MediaDirection getAudioDirection() {
|
||||
return MediaDirection.fromInt(getAudioDirection(nativePtr));
|
||||
}
|
||||
|
||||
private native int getVideoDirection(long nativePtr);
|
||||
@Override
|
||||
public MediaDirection getVideoDirection() {
|
||||
return MediaDirection.fromInt(getVideoDirection(nativePtr));
|
||||
}
|
||||
|
||||
private native void setAudioDirection(long nativePtr, int direction);
|
||||
@Override
|
||||
public void setAudioDirection(MediaDirection direction) {
|
||||
setAudioDirection(nativePtr, direction.mValue);
|
||||
}
|
||||
|
||||
private native void setVideoDirection(long nativePtr, int direction);
|
||||
@Override
|
||||
public void setVideoDirection(MediaDirection direction) {
|
||||
setVideoDirection(nativePtr, direction.mValue);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue