mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
jni: rename Ringservice to JamiService
Change-Id: I8ae187c0a175c05bc7e1421999ff067935b32dbb
This commit is contained in:
6
bin/jni/.gitignore
vendored
6
bin/jni/.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
ringservice_loader.c
|
||||
ring_wrapper.cpp
|
||||
ring_wrapper.h
|
||||
jamiservice_loader.c
|
||||
jami_wrapper.cpp
|
||||
jami_wrapper.h
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
JavaVM *gJavaVM;
|
||||
const char *kringservicePath = "net/jami/daemon/RingserviceJNI";
|
||||
const char *kjamiservicePath = "net/jami/daemon/JamiServiceJNI";
|
||||
|
||||
void deinitClassHelper(JNIEnv *env, jobject obj) {
|
||||
JAMI_INFO("deinitClassHelper");
|
||||
@ -53,9 +53,9 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
}
|
||||
JAMI_INFO("JNI_Onload: GetEnv %p", env);
|
||||
|
||||
clazz = env->FindClass (kringservicePath);
|
||||
clazz = env->FindClass (kjamiservicePath);
|
||||
if (!clazz) {
|
||||
JAMI_ERR("JNI_Onload: whoops, %s class not found!", kringservicePath);
|
||||
JAMI_ERR("JNI_Onload: whoops, %s class not found!", kjamiservicePath);
|
||||
}
|
||||
gJavaVM = vm;
|
||||
JAMI_INFO("JNI_Onload: JavaVM %p", gJavaVM);
|
||||
@ -87,9 +87,9 @@ void JNI_OnUnLoad(JavaVM* vm, void* reserved) {
|
||||
JAMI_INFO("JNI_OnUnLoad: GetEnv %p", env);
|
||||
|
||||
/* Get jclass with env->FindClass */
|
||||
clazz = env->FindClass(kringservicePath);
|
||||
clazz = env->FindClass(kjamiservicePath);
|
||||
if (!clazz) {
|
||||
JAMI_ERR("JNI_OnUnLoad: whoops, %s class not found!", kringservicePath);
|
||||
JAMI_ERR("JNI_OnUnLoad: whoops, %s class not found!", kjamiservicePath);
|
||||
}
|
||||
|
||||
/* remove instances of class object we need into cache */
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/* File : jni_interface.i */
|
||||
%module (directors="1") Ringservice
|
||||
%module (directors="1") JamiService
|
||||
|
||||
#define SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON
|
||||
%include "typemaps.i"
|
||||
|
@ -39,22 +39,22 @@ fi
|
||||
|
||||
mkdir -p $PACKAGEDIR
|
||||
|
||||
echo "Generating ring_wrapper.cpp..."
|
||||
echo "Generating jami_wrapper.cpp..."
|
||||
swig -v -c++ -java \
|
||||
-package $PACKAGE \
|
||||
-outdir $PACKAGEDIR \
|
||||
-o $JNIDIR/ring_wrapper.cpp $JNIDIR/jni_interface.i
|
||||
-o $JNIDIR/jami_wrapper.cpp $JNIDIR/jni_interface.i
|
||||
|
||||
echo "Generating ringservice_loader.c..."
|
||||
echo "Generating jamiservice_loader.c..."
|
||||
python $JNIDIR/JavaJNI2CJNI_Load.py \
|
||||
-i $PACKAGEDIR/RingserviceJNI.java \
|
||||
-o $JNIDIR/ringservice_loader.c \
|
||||
-t $JNIDIR/ringservice.c.template \
|
||||
-m Ringservice \
|
||||
-i $PACKAGEDIR/JamiServiceJNI.java \
|
||||
-o $JNIDIR/jamiservice_loader.c \
|
||||
-t $JNIDIR/jamiservice.c.template \
|
||||
-m JamiService \
|
||||
-p $PACKAGE
|
||||
|
||||
echo "Appending ring_wrapper.cpp..."
|
||||
cat $JNIDIR/ringservice_loader.c >> $JNIDIR/ring_wrapper.cpp
|
||||
echo "Appending jami_wrapper.cpp..."
|
||||
cat $JNIDIR/jamiservice_loader.c >> $JNIDIR/jami_wrapper.cpp
|
||||
|
||||
echo "SWIG bindings successfully generated !"
|
||||
exit 0
|
||||
|
@ -119,7 +119,7 @@ void rotateNV21(uint8_t* yinput, uint8_t* uvinput, unsigned ystride, unsigned uv
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_setVideoFrame(JNIEnv *jenv, jclass jcls, jbyteArray frame, int frame_size, jlong target, int w, int h, int rotation)
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_setVideoFrame(JNIEnv *jenv, jclass jcls, jbyteArray frame, int frame_size, jlong target, int w, int h, int rotation)
|
||||
{
|
||||
uint8_t* f_target = (uint8_t*) ((intptr_t) target);
|
||||
if (rotation == 0)
|
||||
@ -149,7 +149,7 @@ int AndroidFormatToAVFormat(int androidformat) {
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_captureVideoPacket(JNIEnv *jenv, jclass jcls, jobject buffer, jint size, jint offset, jboolean keyframe, jlong timestamp, jint rotation)
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_captureVideoPacket(JNIEnv *jenv, jclass jcls, jobject buffer, jint size, jint offset, jboolean keyframe, jlong timestamp, jint rotation)
|
||||
{
|
||||
try {
|
||||
auto frame = DRing::getNewFrame();
|
||||
@ -180,7 +180,7 @@ JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_captureVideoPacket(JN
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_captureVideoFrame(JNIEnv *jenv, jclass jcls, jobject image, jint rotation)
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_captureVideoFrame(JNIEnv *jenv, jclass jcls, jobject image, jint rotation)
|
||||
{
|
||||
static jclass imageClass = jenv->GetObjectClass(image);
|
||||
static jmethodID imageGetFormat = jenv->GetMethodID(imageClass, "getFormat", "()I");
|
||||
@ -283,19 +283,19 @@ JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_captureVideoFrame(JNI
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_net_jami_daemon_RingserviceJNI_acquireNativeWindow(JNIEnv *jenv, jclass jcls, jobject javaSurface)
|
||||
JNIEXPORT jlong JNICALL Java_net_jami_daemon_JamiServiceJNI_acquireNativeWindow(JNIEnv *jenv, jclass jcls, jobject javaSurface)
|
||||
{
|
||||
return (jlong)(intptr_t)ANativeWindow_fromSurface(jenv, javaSurface);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_releaseNativeWindow(JNIEnv *jenv, jclass jcls, jlong window_)
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_releaseNativeWindow(JNIEnv *jenv, jclass jcls, jlong window_)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(windows_mutex);
|
||||
ANativeWindow *window = (ANativeWindow*)((intptr_t) window_);
|
||||
ANativeWindow_release(window);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_setNativeWindowGeometry(JNIEnv *jenv, jclass jcls, jlong window_, int width, int height)
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_setNativeWindowGeometry(JNIEnv *jenv, jclass jcls, jlong window_, int width, int height)
|
||||
{
|
||||
ANativeWindow *window = (ANativeWindow*)((intptr_t) window_);
|
||||
ANativeWindow_setBuffersGeometry(window, width, height, WINDOW_FORMAT_RGBA_8888);
|
||||
@ -351,7 +351,7 @@ std::unique_ptr<DRing::FrameBuffer> sinkTargetPullCallback(ANativeWindow *window
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_registerVideoCallback(JNIEnv *jenv, jclass jcls, jstring sinkId, jlong window)
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_registerVideoCallback(JNIEnv *jenv, jclass jcls, jstring sinkId, jlong window)
|
||||
{
|
||||
if(!sinkId) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
|
||||
@ -372,7 +372,7 @@ JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_registerVideoCallback
|
||||
DRing::registerSinkTarget(sink, DRing::SinkTarget {.pull=p_display_cb, .push=f_display_cb});
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_RingserviceJNI_unregisterVideoCallback(JNIEnv *jenv, jclass jcls, jstring sinkId, jlong window)
|
||||
JNIEXPORT void JNICALL Java_net_jami_daemon_JamiServiceJNI_unregisterVideoCallback(JNIEnv *jenv, jclass jcls, jstring sinkId, jlong window)
|
||||
{
|
||||
if(!sinkId) {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string");
|
||||
|
Reference in New Issue
Block a user