ios
This commit is contained in:
parent
0c769a84b3
commit
7846d90c8e
|
@ -1,3 +1,5 @@
|
|||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_framework")
|
||||
|
||||
cc_library(
|
||||
name = "ios_olarender",
|
||||
srcs = [
|
||||
|
@ -31,3 +33,58 @@ cc_library(
|
|||
}),
|
||||
)
|
||||
|
||||
|
||||
|
||||
objc_library(
|
||||
name = "OlaRenderLibrary",
|
||||
srcs = [
|
||||
"OlaRenderManager.mm",
|
||||
"image_queue.cpp",
|
||||
"image.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
"OlaRenderManager.h",
|
||||
"image_queue.h",
|
||||
"image.h",
|
||||
"LockFreeQueue.h",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//mediapipe/modules/render_queue:ios_olarender",
|
||||
],
|
||||
copts = select({
|
||||
"//mediapipe:apple": [
|
||||
"-x objective-c++",
|
||||
"-fobjc-arc", # enable reference-counting
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
sdk_frameworks = [
|
||||
"AVFoundation",
|
||||
"CoreGraphics",
|
||||
"CoreMedia",
|
||||
"OpenGLES",
|
||||
"CoreVideo",
|
||||
"IOSurface",
|
||||
"Foundation",
|
||||
"UIKit",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ios_framework(
|
||||
name = "OlaRenderFramework",
|
||||
hdrs = [
|
||||
"OlaRenderManager.h",
|
||||
"image.h",
|
||||
"image_queue.h",
|
||||
"LockFreeQueue.h",
|
||||
],
|
||||
infoplists = ["Info.plist"],
|
||||
bundle_id = "com.ola.dartrenderplugin",
|
||||
families = ["iphone", "ipad"],
|
||||
minimum_os_version = "11.0",
|
||||
deps = [
|
||||
"//mediapipe/modules/render_queue:OlaRenderLibrary",
|
||||
],
|
||||
)
|
||||
|
|
45
mediapipe/modules/render_queue/RenderJni.cpp
Normal file
45
mediapipe/modules/render_queue/RenderJni.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// Created by Felix Wang on 2022/6/29.
|
||||
//
|
||||
|
||||
#include <jni.h>
|
||||
#include <malloc.h>
|
||||
#include "OlaRender.hpp"
|
||||
#include "image_queue.h"
|
||||
|
||||
|
||||
#include <android/log.h>
|
||||
#include <jni.h>
|
||||
|
||||
#define TAG "ImageQueue-jni" // 这个是自定义的LOG的标识
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,TAG,__VA_ARGS__) // 定义LOGI类型
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,TAG,__VA_ARGS__) // 定义LOGE类型
|
||||
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_weatherfish_render_RenderJni_create(JNIEnv *env, jobject thiz) {
|
||||
auto *render = OLARender::OlaRender::create();
|
||||
return reinterpret_cast<int64_t>(render);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_weatherfish_render_RenderJni_render(JNIEnv *env, jobject thiz, jlong render_context, jint texture_id,
|
||||
jint width, jint height, jlong timestamp, jboolean exportFlag) {
|
||||
auto *render = reinterpret_cast<OLARender::OlaRender *>(render_context);
|
||||
OLARender::TextureInfo info;
|
||||
info.textureId = texture_id;
|
||||
info.width = width;
|
||||
info.height = height;
|
||||
info.frameTime = timestamp;
|
||||
auto res = render->render(info, exportFlag);
|
||||
return res.textureId;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_weatherfish_render_RenderJni_release(JNIEnv *env, jobject thiz, jlong renderId) {
|
||||
auto *render = reinterpret_cast<OLARender::OlaRender *>(renderId);
|
||||
render->release();
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_framework")
|
||||
|
||||
objc_library(
|
||||
name = "OlaRenderLibrary",
|
||||
srcs = ["OlaRenderManager.mm"],
|
||||
hdrs = ["OlaRenderManager.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//mediapipe/modules/render_queue:ios_olarender",
|
||||
],
|
||||
copts = select({
|
||||
"//mediapipe:apple": [
|
||||
"-x objective-c++",
|
||||
"-fobjc-arc", # enable reference-counting
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
sdk_frameworks = [
|
||||
"AVFoundation",
|
||||
"CoreGraphics",
|
||||
"CoreMedia",
|
||||
"OpenGLES",
|
||||
"CoreVideo",
|
||||
"IOSurface",
|
||||
"Foundation",
|
||||
"UIKit",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ios_framework(
|
||||
name = "OlaRenderFramework",
|
||||
hdrs = ["OlaRenderManager.h"],
|
||||
infoplists = ["Info.plist"],
|
||||
bundle_id = "com.ola.dartrenderplugin",
|
||||
families = ["iphone", "ipad"],
|
||||
minimum_os_version = "11.0",
|
||||
deps = [
|
||||
"//mediapipe/modules/render_queue/ios:OlaRenderLibrary",
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue
Block a user