diff --git a/WORKSPACE b/WORKSPACE index 1112c0385..36b0d33e5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -417,7 +417,9 @@ libedgetpu_dependencies() load("@coral_crosstool//:configure.bzl", "cc_crosstool") cc_crosstool(name = "crosstool") -android_sdk_repository(name = "androidsdk", path = "/Users/wangrenzhu/Library/Android/sdk") -android_ndk_repository(name = "androidndk", api_level=21, path = "/Users/wangrenzhu/Library/Android/sdk/ndk/21.2.6472646") +# android_sdk_repository(name = "androidsdk", path = "/Users/wangrenzhu/Library/Android/sdk") +# android_ndk_repository(name = "androidndk", api_level=21, path = "/Users/wangrenzhu/Library/Android/sdk/ndk/21.2.6472646") # android_sdk_repository(name = "androidsdk", path = "/Users/wangrenzhu/Android/sdk") # android_ndk_repository(name = "androidndk", api_level=21, path = "/Users/wangrenzhu/Android/sdk/ndk/android-ndk-r21") +android_sdk_repository(name = "androidsdk") +android_ndk_repository(name = "androidndk", api_level=22) diff --git a/WORKSPACE-e b/WORKSPACE-e index 1112c0385..0f3a6acd4 100644 --- a/WORKSPACE-e +++ b/WORKSPACE-e @@ -417,7 +417,7 @@ libedgetpu_dependencies() load("@coral_crosstool//:configure.bzl", "cc_crosstool") cc_crosstool(name = "crosstool") -android_sdk_repository(name = "androidsdk", path = "/Users/wangrenzhu/Library/Android/sdk") -android_ndk_repository(name = "androidndk", api_level=21, path = "/Users/wangrenzhu/Library/Android/sdk/ndk/21.2.6472646") +# android_sdk_repository(name = "androidsdk", path = "/Users/wangrenzhu/Library/Android/sdk") +# android_ndk_repository(name = "androidndk", api_level=21, path = "/Users/wangrenzhu/Library/Android/sdk/ndk/21.2.6472646") # android_sdk_repository(name = "androidsdk", path = "/Users/wangrenzhu/Android/sdk") # android_ndk_repository(name = "androidndk", api_level=21, path = "/Users/wangrenzhu/Android/sdk/ndk/android-ndk-r21") diff --git a/mediapipe/examples/android/solutions/.gradle/7.4/checksums/checksums.lock b/mediapipe/examples/android/solutions/.gradle/7.4/checksums/checksums.lock new file mode 100644 index 000000000..339192710 Binary files /dev/null and b/mediapipe/examples/android/solutions/.gradle/7.4/checksums/checksums.lock differ diff --git a/mediapipe/examples/android/solutions/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock b/mediapipe/examples/android/solutions/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 000000000..b20d7a24e Binary files /dev/null and b/mediapipe/examples/android/solutions/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock differ diff --git a/mediapipe/examples/android/solutions/.gradle/7.4/dependencies-accessors/gc.properties b/mediapipe/examples/android/solutions/.gradle/7.4/dependencies-accessors/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/mediapipe/examples/android/solutions/.gradle/7.4/executionHistory/executionHistory.lock b/mediapipe/examples/android/solutions/.gradle/7.4/executionHistory/executionHistory.lock new file mode 100644 index 000000000..00655d4e4 Binary files /dev/null and b/mediapipe/examples/android/solutions/.gradle/7.4/executionHistory/executionHistory.lock differ diff --git a/mediapipe/examples/android/solutions/.gradle/7.4/fileChanges/last-build.bin b/mediapipe/examples/android/solutions/.gradle/7.4/fileChanges/last-build.bin new file mode 100644 index 000000000..f76dd238a Binary files /dev/null and b/mediapipe/examples/android/solutions/.gradle/7.4/fileChanges/last-build.bin differ diff --git a/mediapipe/examples/android/solutions/.gradle/7.4/fileHashes/fileHashes.lock b/mediapipe/examples/android/solutions/.gradle/7.4/fileHashes/fileHashes.lock new file mode 100644 index 000000000..7c6f0f2a1 Binary files /dev/null and b/mediapipe/examples/android/solutions/.gradle/7.4/fileHashes/fileHashes.lock differ diff --git a/mediapipe/examples/android/solutions/.gradle/7.4/gc.properties b/mediapipe/examples/android/solutions/.gradle/7.4/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/mediapipe/examples/android/solutions/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/mediapipe/examples/android/solutions/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 000000000..5cda3254c Binary files /dev/null and b/mediapipe/examples/android/solutions/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/mediapipe/examples/android/solutions/.gradle/buildOutputCleanup/cache.properties b/mediapipe/examples/android/solutions/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 000000000..ea21cf2f1 --- /dev/null +++ b/mediapipe/examples/android/solutions/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Tue Jul 19 14:43:33 CST 2022 +gradle.version=7.4 diff --git a/mediapipe/examples/android/solutions/.gradle/vcs-1/gc.properties b/mediapipe/examples/android/solutions/.gradle/vcs-1/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/mediapipe/render/module/render_queue/BUILD b/mediapipe/render/module/render_queue/BUILD index bff9a9b79..087c7a628 100644 --- a/mediapipe/render/module/render_queue/BUILD +++ b/mediapipe/render/module/render_queue/BUILD @@ -1,7 +1,96 @@ load("@build_bazel_rules_apple//apple:ios.bzl", "ios_framework") +load("@build_bazel_rules_android//android:rules.bzl", "android_library") + + + + +GL_BASE_LINK_OPTS = select({ + "//conditions:default": [], + "//mediapipe:android": [ + "-lGLESv3", + "-lEGL", + # Note: on Android, libGLESv3.so is normally a symlink to + # libGLESv2.so, so we don't need to link to it. In fact, we + # do not _want_ to link to it, or we would be unable to load + # on API level < 18, where the symlink is missing entirely. + # Note: if we ever find a strange version of Android where the + # GLESv3 library is not a symlink, we will have to load it at + # runtime. Weak GLESv3 symbols will still be resolved if we + # load it early enough. + ], + "//mediapipe:ios": [ + "-framework OpenGLES", + "-framework CoreVideo", + ], + "//mediapipe:macos": [ + "-framework OpenGL", + "-framework CoreVideo", + ], +}) + +# This is @unused internally. +GL_BASE_LINK_OPTS_OSS = GL_BASE_LINK_OPTS + select({ + "//conditions:default": [ + # Use GLES/EGL on linux. + # Requires support from graphics card driver (nvidia,mesa,etc..) + # and libraries to be installed. + # Ex: libegl1-mesa-dev libgles2-mesa-dev, or libegl1-nvidia libgles2-nvidia, etc... + "-lGLESv2", + "-lEGL", + ], + "//mediapipe:android": [], + "//mediapipe:ios": [], +}) + cc_library( - name = "ios_olarender", + name = "gl_base", + defines = select({ + "//mediapipe:apple": [ + "GLES_SILENCE_DEPRECATION=1", + ], + "//conditions:default": [], + }), + features = ["-layering_check"], + linkopts = GL_BASE_LINK_OPTS_OSS, + textual_hdrs = ["gl_base.h"], + visibility = ["//visibility:public"], + deps = [":gl_base_hdr"] + select({ + "//mediapipe:android": [], + "//mediapipe:apple": [], + "//conditions:default": [ + ], + }), +) + +cc_library( + name = "gl_base_hdr", + hdrs = ["gl_base.h"], + features = ["-layering_check"], + # Note: need the frameworks on Apple platforms to get the headers. + linkopts = select({ + "//conditions:default": [], + "//mediapipe:ios": [ + "-framework OpenGLES", + "-framework CoreVideo", + ], + "//mediapipe:macos": [ + "-framework OpenGL", + "-framework CoreVideo", + ], + }), + visibility = ["//visibility:public"], + deps = select({ + "//mediapipe:android": [], + "//mediapipe:apple": [], + "//conditions:default": [ + ], + }), +) + + +cc_library( + name = "olarender", srcs = [ "util.cpp", "image_queue.cpp", @@ -20,10 +109,11 @@ cc_library( ], # Use -Dverbose=-1 to turn off zlib's trace logging. (#3280) linkstatic = True, + linkopts = GL_BASE_LINK_OPTS_OSS, includes = ["."], visibility = ["//visibility:public"], deps = [ - "//mediapipe/modules/render_queue/math:math", + "//mediapipe/render/module/render_queue/math:math", ], copts = select({ "//mediapipe:apple": [ @@ -35,13 +125,11 @@ cc_library( alwayslink = True, ) - - objc_library( name = "OlaRenderLibrary", visibility = ["//visibility:public"], deps = [ - "//mediapipe/modules/render_queue:ios_olarender", + "//mediapipe/render/module/render_queue:olarender", ], copts = select({ "//mediapipe:apple": [ @@ -54,8 +142,6 @@ objc_library( "AVFoundation", "CoreGraphics", "CoreMedia", - "OpenGLES", - "CoreVideo", "IOSurface", "Foundation", "UIKit", @@ -81,6 +167,17 @@ ios_framework( families = ["iphone", "ipad"], minimum_os_version = "10.0", deps = [ - "//mediapipe/modules/render_queue:OlaRenderLibrary", + "//mediapipe/render/module/render_queue:OlaRenderLibrary", ], ) + +####### android ######## +android_library( + name = "ola_render", + srcs = [ + "src/com/ola/render/RenderJni.java" + ], + deps = [ + "//mediapipe/render/module/render_queue:olarender", + ], +) \ No newline at end of file diff --git a/mediapipe/render/module/render_queue/OlaRender.h b/mediapipe/render/module/render_queue/OlaRender.h index f3adb8fe9..55705fba3 100644 --- a/mediapipe/render/module/render_queue/OlaRender.h +++ b/mediapipe/render/module/render_queue/OlaRender.h @@ -21,7 +21,7 @@ #define USE_NEED_RECREATE 0 #include -#include "macros.h" +// #include "macros.h" #if USE_OLARENDER #include @@ -30,12 +30,12 @@ #endif #endif -#if PLATFORM == PLATFORM_IOS - +// #if PLATFORM == PLATFORM_IOS +#ifdef __APPLE__ #import #import -#elif PLATFORM == PLATFORM_ANDROID - +// #elif PLATFORM == PLATFORM_ANDROID +#else #include #include diff --git a/mediapipe/render/module/render_queue/src/com/ola/render/RenderJni.java b/mediapipe/render/module/render_queue/src/com/ola/render/RenderJni.java new file mode 100644 index 000000000..19e0f4e51 --- /dev/null +++ b/mediapipe/render/module/render_queue/src/com/ola/render/RenderJni.java @@ -0,0 +1,29 @@ +/** + * @ProjectName: MyLrcRender + * @Package: com.ola.render + * @ClassName: RenderJni2 + * @Description: + * @Author: 王强 + * @CreateDate: 2022/7/19 14:41 + */ + +package com.ola.render; + +public class RenderJni{ + static { + System.loadLibrary("render"); + } + + public static native Long create(); + + public static native int render( + Long renderContext, + int textureId, + int width, + int height, + Long timestamp, + boolean export + ); + + public static native void release(Long render); +}