1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #24592 from savuor:recorder_android

Android sample for VideoWriter #24592

This PR:
* adds an Android sample for video recording with MediaNDK and built-in MJPEG.
* adds a flag `--no_media_ndk` for `build_sdk.py` script to disable MediaNDK linkage.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Rostislav Vasilikhin
2023-12-13 13:54:31 +01:00
committed by GitHub
parent 2e37a697b9
commit 500fd453a1
9 changed files with 475 additions and 2 deletions
+6 -2
View File
@@ -215,7 +215,7 @@ class Builder:
for d in ["CMakeCache.txt", "CMakeFiles/", "bin/", "libs/", "lib/", "package/", "install/samples/"]:
rm_one(d)
def build_library(self, abi, do_install):
def build_library(self, abi, do_install, no_media_ndk):
cmd = [self.cmake_path, "-GNinja"]
cmake_vars = dict(
CMAKE_TOOLCHAIN_FILE=self.get_toolchain_file(),
@@ -260,6 +260,9 @@ class Builder:
if do_install:
cmd.extend(["-DBUILD_TESTS=ON", "-DINSTALL_TESTS=ON"])
if no_media_ndk:
cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF"
cmake_vars.update(abi.cmake_vars)
cmd += [ "-D%s='%s'" % (k, v) for (k, v) in cmake_vars.items() if v is not None]
cmd.append(self.opencvdir)
@@ -370,6 +373,7 @@ if __name__ == "__main__":
parser.add_argument('--opencl', action="store_true", help="Enable OpenCL support")
parser.add_argument('--no_kotlin', action="store_true", help="Disable Kotlin extensions")
parser.add_argument('--shared', action="store_true", help="Build shared libraries")
parser.add_argument('--no_media_ndk', action="store_true", help="Do not link Media NDK (required for video I/O support)")
args = parser.parse_args()
log.basicConfig(format='%(message)s', level=log.DEBUG)
@@ -447,7 +451,7 @@ if __name__ == "__main__":
os.chdir(builder.libdest)
builder.clean_library_build_dir()
builder.build_library(abi, do_install)
builder.build_library(abi, do_install, args.no_media_ndk)
builder.gather_results()