Restructure ohos/ into proper OHOS Flutter HAR plugin layout with NAPI native support#344
Conversation
…set uri, decoders Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/c80e2b02-02c3-461e-b42e-5d57a5c3fdaa Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/c80e2b02-02c3-461e-b42e-5d57a5c3fdaa Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
… native C++ NAPI support Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/ef1c213b-5b60-48b4-99c5-c3c804e2db89 Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
|
@copilot there is a working ohos app example using libmdk: https://github.com/wang-bin/mdk-examples/tree/master/ohos , please review current code by referring to the code in that link |
… library links, abiFilters Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/9d6b16e9-81aa-45a1-b44e-c689b61dad7f Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/9d6b16e9-81aa-45a1-b44e-c689b61dad7f Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
Reviewed against https://github.com/wang-bin/mdk-examples/tree/master/ohos and applied the following corrections (commit a0e8022):
|
|
@copilot only arm64-v8a is available. keep c++20. no cmake version change. no need to change log. copyright year is 2026 |
…right 2026 Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/bf7fd620-dfce-4e1e-b381-7e616ab5d6d4 Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
Done in commit af06abd:
|
|
keep using NAPI_MODULE macro |
|
@copilot preferred video decoder for ohos is "OH" not "AMediaCodec". symbols in fvp_plugin.h must be visible |
…ugin.h Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/96c70a2a-728f-4489-aa87-8ba64606a28c Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
Done in commit 573aa9a — replaced the manual
Done in commit 573aa9a:
|
|
@copilot libnative_window not libnativewindow. cmake min version 3.17. change modified files copyright year, ends with 2026. |
…s, mdk-sdk-ohos.7z Agent-Logs-Url: https://github.com/wang-bin/fvp/sessions/d72442c9-83e4-43cc-bed3-8c4a9a5d85d7 Co-authored-by: wang-bin <785206+wang-bin@users.noreply.github.com>
Done in commit 4f2242c:
|
Replaces the incorrect
ohos/files (which used the Linux/desktop Flutter EGL plugin API) with the correct OHOS Flutter HAR plugin layout.New OHOS module structure
build-profile.json5— module build config withexternalNativeOptionspointing at the C++ CMakeLists, targetingarm64-v8ahvigorfile.ts— Hvigor build script usingimport { harTasks }+export default { system: harTasks, plugins: [] }patternindex.ets— re-exportsFvpPluginoh-package.json5— package descriptor with@ohos/flutter_ohosHAR dependencysrc/main/module.json5— HAR module descriptor (type: har)local.properties— machine-local SDK path template (added to.gitignore)ArkTS plugin (
src/main/ets/components/plugin/FvpPlugin.ets)Mirrors Android's
FvpPlugin.javain ArkTS: implementsFlutterPlugin+MethodCallHandleron channel"fvp", handlingCreateRT/ReleaseRT/MixWithOthers.CreateRTregisters an OHOSSurfaceTextureEntry, retrieves itssurfaceId, sets the buffer size, then calls the native NAPI module:Native NAPI module (
src/main/cpp/)NAPI_MODULE(fvp_plugin, Init)macronativeSetSurface— usesOH_NativeWindow_CreateNativeWindowFromSurfaceId()to bridge Flutter's surface ID to mdk'supdateNativeSurface()MdkGetPlayerVid(returnsOHNativeWindow*) andMdkIsEmulatorfor Dart FFI, marked withFVP_EXPORT(__attribute__((visibility("default")))) to ensure visibility despite hidden-by-default symbol presetcallbacks.cppinto the same.solibace_napi.z.so,libace_ndk.z.so,libnative_window.so; pulls mdk via the existingcmake/deps.cmakeCMake / deps
cmake/deps.cmake: downloadsmdk-sdk-ohos.7zfor the OHOS target (viaCMAKE_SYSTEM_NAME MATCHES "OHOS")Dart
lib/src/video_player_mdk.dart: preferred OHOS video decoder set to"OH"(hardware decoder) instead of"AMediaCodec"