mirror of
https://github.com/immich-app/immich.git
synced 2026-04-28 12:00:39 -04:00
* use shared client in dart fix android * websocket integration platform-side headers update comment consistent platform check tweak websocket handling support streaming * redundant logging * fix proguard * formatting * handle onProgress * support videos on ios * inline return * improved ios impl * cleanup * sync stopForegroundBackup * voidify * future already completed * stream request on android * outdated ios ws code * use `choosePrivateKeyAlias` * return result * formatting * update tests * redundant check * handle custom headers * move completer outside of state * persist auth * dispose old socket * use group id for cookies * redundant headers * cache global ref * handle network switching * handle basic auth * apply custom headers immediately * video player update * fix * persist url * potential logout fix --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
53 lines
1.5 KiB
C
53 lines
1.5 KiB
C
#include <jni.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
JNIEXPORT jlong JNICALL
|
|
Java_app_alextran_immich_NativeBuffer_allocate(
|
|
JNIEnv *env, jclass clazz, jint size) {
|
|
void *ptr = malloc(size);
|
|
return (jlong) ptr;
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_app_alextran_immich_NativeBuffer_free(
|
|
JNIEnv *env, jclass clazz, jlong address) {
|
|
free((void *) address);
|
|
}
|
|
|
|
JNIEXPORT jlong JNICALL
|
|
Java_app_alextran_immich_NativeBuffer_realloc(
|
|
JNIEnv *env, jclass clazz, jlong address, jint size) {
|
|
void *ptr = realloc((void *) address, size);
|
|
return (jlong) ptr;
|
|
}
|
|
|
|
JNIEXPORT jobject JNICALL
|
|
Java_app_alextran_immich_NativeBuffer_wrap(
|
|
JNIEnv *env, jclass clazz, jlong address, jint capacity) {
|
|
return (*env)->NewDirectByteBuffer(env, (void *) address, capacity);
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_app_alextran_immich_NativeBuffer_copy(
|
|
JNIEnv *env, jclass clazz, jobject buffer, jlong destAddress, jint offset, jint length) {
|
|
void *src = (*env)->GetDirectBufferAddress(env, buffer);
|
|
if (src != NULL) {
|
|
memcpy((void *) destAddress, (char *) src + offset, length);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Creates a JNI global reference to the given object and returns its address.
|
|
* The caller is responsible for deleting the global reference when it's no longer needed.
|
|
*/
|
|
JNIEXPORT jlong JNICALL
|
|
Java_app_alextran_immich_NativeBuffer_createGlobalRef(JNIEnv *env, jobject clazz, jobject obj) {
|
|
if (obj == NULL) {
|
|
return 0;
|
|
}
|
|
|
|
jobject globalRef = (*env)->NewGlobalRef(env, obj);
|
|
return (jlong) globalRef;
|
|
}
|