1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Merge pull request #27284 from dkurt:java_video_capture_read

Java VideoCapture buffered stream constructor #27284

### Pull Request Readiness Checklist

resolves #26809

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:
Dmitry Kurtaev
2025-05-14 17:01:45 +03:00
committed by GitHub
parent 547cef4e88
commit 67ba045e3b
11 changed files with 296 additions and 11 deletions
+15 -7
View File
@@ -65,6 +65,7 @@ type_dict = {
"char" : { "j_type" : "char", "jn_type" : "char", "jni_type" : "jchar", "suffix" : "C" },
"int" : { "j_type" : "int", "jn_type" : "int", "jni_type" : "jint", "suffix" : "I" },
"long" : { "j_type" : "int", "jn_type" : "int", "jni_type" : "jint", "suffix" : "I" },
"long long" : { "j_type" : "long", "jn_type" : "long", "jni_type" : "jlong", "suffix" : "J" },
"float" : { "j_type" : "float", "jn_type" : "float", "jni_type" : "jfloat", "suffix" : "F" },
"double" : { "j_type" : "double", "jn_type" : "double", "jni_type" : "jdouble", "suffix" : "D" },
"size_t" : { "j_type" : "long", "jn_type" : "long", "jni_type" : "jlong", "suffix" : "J" },
@@ -89,6 +90,13 @@ type_dict = {
'v_type': 'string',
'j_import': 'java.lang.String'
},
"byte[]": {
"j_type" : "byte[]",
"jn_type": "byte[]",
"jni_type": "jbyteArray",
"jni_name": "n_%(n)s",
"jni_var": "char* n_%(n)s = reinterpret_cast<char*>(env->GetByteArrayElements(%(n)s, NULL))",
},
}
# Defines a rule to add extra prefixes for names from specific namespaces.
@@ -511,14 +519,14 @@ class JavaWrapperGenerator(object):
if classinfo.base:
classinfo.addImports(classinfo.base)
type_dict.setdefault("Ptr_"+name, {}).update(
{ "j_type" : classinfo.jname,
"jn_type" : "long", "jn_args" : (("__int64", ".getNativeObjAddr()"),),
"jni_name" : "*((Ptr<"+classinfo.fullNameCPP()+">*)%(n)s_nativeObj)", "jni_type" : "jlong",
"suffix" : "J",
"j_import" : "org.opencv.%s.%s" % (self.module, classinfo.jname)
if ("Ptr_"+name) not in type_dict:
type_dict["Ptr_"+name] = {
"j_type" : classinfo.jname,
"jn_type" : "long", "jn_args" : (("__int64", ".getNativeObjAddr()"),),
"jni_name" : "*((Ptr<"+classinfo.fullNameCPP()+">*)%(n)s_nativeObj)", "jni_type" : "jlong",
"suffix" : "J",
"j_import" : "org.opencv.%s.%s" % (self.module, classinfo.jname)
}
)
logging.info('ok: class %s, name: %s, base: %s', classinfo, name, classinfo.base)
def add_const(self, decl, enumType=None): # [ "const cname", val, [], [] ]