Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
0f64f847
Commit
0f64f847
authored
Dec 04, 2012
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Info library loading implemeneted.
parent
9823b7cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
12 deletions
+83
-12
OpenCVLibraryInfo.cpp
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp
+82
-11
OpenCVLibraryInfo.java
...rvice/engine/src/org/opencv/engine/OpenCVLibraryInfo.java
+1
-1
No files found.
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp
View file @
0f64f847
#include "OpenCVLibraryInfo.h"
#include "EngineCommon.h"
#include <utils/Log.h>
#include <dlfcn.h>
JNIEXPORT
jlong
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_open
(
JNIEnv
*
env
,
jobject
,
jstring
)
(
JNIEnv
*
env
,
jobject
,
jstring
str
)
{
return
255
;
const
char
*
infoLibPath
=
env
->
GetStringUTFChars
(
str
,
NULL
);
if
(
infoLibPath
==
NULL
)
return
0
;
LOGD
(
"Trying to load info library
\"
%s
\"
"
,
infoLibPath
);
void
*
handle
;
handle
=
dlopen
(
infoLibPath
,
RTLD_LAZY
);
if
(
handle
==
NULL
)
LOGI
(
"Info library not found by path
\"
%s
\"
"
,
infoLibPath
);
return
(
jlong
)
handle
;
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
(
JNIEnv
*
env
,
jobject
,
jlong
)
(
JNIEnv
*
env
,
jobject
,
jlong
handle
)
{
return
env
->
NewStringUTF
(
"org.opencv.lib_v24_tegra3"
);
const
char
*
(
*
info_func
)();
const
char
*
result
;
const
char
*
error
;
dlerror
();
*
(
void
**
)
(
&
info_func
)
=
dlsym
((
void
*
)
handle
,
"GetPackageName"
);
if
((
error
=
dlerror
())
==
NULL
)
result
=
(
*
info_func
)();
else
{
LOGE
(
"dlsym error:
\"
%s
\"
"
,
error
);
result
=
"unknown"
;
}
return
env
->
NewStringUTF
(
result
);
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getPublicName
(
JNIEnv
*
env
,
jobject
,
jlong
)
{
return
env
->
NewStringUTF
(
"OpenCV library for Tegra3"
);
const
char
*
(
*
info_func
)();
const
char
*
result
;
const
char
*
error
;
dlerror
();
*
(
void
**
)
(
&
info_func
)
=
dlsym
((
void
*
)
handle
,
"GetPublicName"
);
if
((
error
=
dlerror
())
==
NULL
)
result
=
(
*
info_func
)();
else
{
LOGE
(
"dlsym error:
\"
%s
\"
"
,
error
);
result
=
"unknown"
;
}
return
env
->
NewStringUTF
(
result
);
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
(
JNIEnv
*
env
,
jobject
,
jlong
)
(
JNIEnv
*
env
,
jobject
,
jlong
handle
)
{
return
env
->
NewStringUTF
(
""
);
const
char
*
(
*
info_func
)();
const
char
*
result
;
const
char
*
error
;
dlerror
();
*
(
void
**
)
(
&
info_func
)
=
dlsym
((
void
*
)
handle
,
"GetLibraryList"
);
if
((
error
=
dlerror
())
==
NULL
)
result
=
(
*
info_func
)();
else
{
LOGE
(
"dlsym error:
\"
%s
\"
"
,
error
);
result
=
"unknown"
;
}
return
env
->
NewStringUTF
(
result
);
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
(
JNIEnv
*
env
,
jobject
,
jlong
)
(
JNIEnv
*
env
,
jobject
,
jlong
handle
)
{
return
env
->
NewStringUTF
(
"9.9"
);
const
char
*
(
*
info_func
)();
const
char
*
result
;
const
char
*
error
;
dlerror
();
*
(
void
**
)
(
&
info_func
)
=
dlsym
((
void
*
)
handle
,
"GetRevision"
);
if
((
error
=
dlerror
())
==
NULL
)
result
=
(
*
info_func
)();
else
{
LOGE
(
"dlsym error:
\"
%s
\"
"
,
error
);
result
=
"unknown"
;
}
return
env
->
NewStringUTF
(
result
);
}
JNIEXPORT
void
JNICALL
Java_org_opencv_engine_OpenCVLibraryInfo_close
(
JNIEnv
*
env
,
jobject
,
jlong
)
(
JNIEnv
*
,
jobject
,
jlong
handle
)
{
dlclose
((
void
*
)
handle
);
}
android/service/engine/src/org/opencv/engine/OpenCVLibraryInfo.java
View file @
0f64f847
...
...
@@ -2,7 +2,7 @@ package org.opencv.engine;
public
class
OpenCVLibraryInfo
{
public
OpenCVLibraryInfo
(
String
packagePath
)
{
mNativeObj
=
open
(
packagePath
);
mNativeObj
=
open
(
packagePath
+
"/libopencv_info.so"
);
if
(
mNativeObj
!=
0
)
{
mPackageName
=
getPackageName
(
mNativeObj
);
mLibraryList
=
getLibraryList
(
mNativeObj
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment