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
a201233b
Commit
a201233b
authored
Sep 10, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warning in Android camera code
parent
36f91226
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
camera_activity.cpp
modules/androidcamera/src/camera_activity.cpp
+31
-31
No files found.
modules/androidcamera/src/camera_activity.cpp
View file @
a201233b
...
...
@@ -169,8 +169,8 @@ CameraActivity::ErrorCode CameraWrapperConnector::connectToLib()
string
folderPath
=
getPathLibFolder
();
if
(
folderPath
.
empty
())
{
LOGD
(
"Trying to find native camera in default OpenCV packages"
);
folderPath
=
getDefaultPathLibFolder
();
LOGD
(
"Trying to find native camera in default OpenCV packages"
);
folderPath
=
getDefaultPathLibFolder
();
}
LOGD
(
"CameraWrapperConnector::connectToLib: folderPath=%s"
,
folderPath
.
c_str
());
...
...
@@ -270,21 +270,21 @@ std::string CameraWrapperConnector::getDefaultPathLibFolder()
const
string
packageList
[]
=
{
"tegra3"
,
"armv7a_neon"
,
"armv7a"
,
"armv5"
,
"x86"
};
for
(
size_t
i
=
0
;
i
<
5
;
i
++
)
{
char
path
[
128
];
sprintf
(
path
,
"/data/data/org.opencv.lib_v%d%d_%s/lib/"
,
CV_MAJOR_VERSION
,
CV_MINOR_VERSION
,
packageList
[
i
].
c_str
());
LOGD
(
"Trying package
\"
%s
\"
(
\"
%s
\"
)"
,
packageList
[
i
]
,
path
);
DIR
*
dir
=
opendir
(
path
);
if
(
!
dir
)
{
LOGD
(
"Package not found"
);
continue
;
}
else
{
closedir
(
dir
);
return
path
;
}
char
path
[
128
];
sprintf
(
path
,
"/data/data/org.opencv.lib_v%d%d_%s/lib/"
,
CV_MAJOR_VERSION
,
CV_MINOR_VERSION
,
packageList
[
i
].
c_str
());
LOGD
(
"Trying package
\"
%s
\"
(
\"
%s
\"
)"
,
packageList
[
i
].
c_str
()
,
path
);
DIR
*
dir
=
opendir
(
path
);
if
(
!
dir
)
{
LOGD
(
"Package not found"
);
continue
;
}
else
{
closedir
(
dir
);
return
path
;
}
}
return
string
();
...
...
@@ -301,18 +301,18 @@ std::string CameraWrapperConnector::getPathLibFolder()
LOGD
(
"Library name: %s"
,
dl_info
.
dli_fname
);
LOGD
(
"Library base address: %p"
,
dl_info
.
dli_fbase
);
const
char
*
libName
=
dl_info
.
dli_fname
;
while
(
((
*
libName
)
==
'/'
)
||
((
*
libName
)
==
'.'
)
)
libName
++
;
const
char
*
libName
=
dl_info
.
dli_fname
;
while
(
((
*
libName
)
==
'/'
)
||
((
*
libName
)
==
'.'
)
)
libName
++
;
char
lineBuf
[
2048
];
FILE
*
file
=
fopen
(
"/proc/self/smaps"
,
"rt"
);
if
(
file
)
{
while
(
fgets
(
lineBuf
,
sizeof
lineBuf
,
file
)
!=
NULL
)
{
//verify that line ends with library name
while
(
fgets
(
lineBuf
,
sizeof
lineBuf
,
file
)
!=
NULL
)
{
//verify that line ends with library name
int
lineLength
=
strlen
(
lineBuf
);
int
libNameLength
=
strlen
(
libName
);
...
...
@@ -325,7 +325,7 @@ std::string CameraWrapperConnector::getPathLibFolder()
if
(
0
!=
strncmp
(
lineBuf
+
lineLength
-
libNameLength
,
libName
,
libNameLength
))
{
//the line does not contain the library name
//the line does not contain the library name
continue
;
}
...
...
@@ -344,18 +344,18 @@ std::string CameraWrapperConnector::getPathLibFolder()
fclose
(
file
);
return
pathBegin
;
}
fclose
(
file
);
LOGE
(
"Could not find library path"
);
}
fclose
(
file
);
LOGE
(
"Could not find library path"
);
}
else
{
LOGE
(
"Could not read /proc/self/smaps"
);
LOGE
(
"Could not read /proc/self/smaps"
);
}
}
else
{
LOGE
(
"Could not get library name and base address"
);
LOGE
(
"Could not get library name and base address"
);
}
return
string
();
...
...
@@ -429,7 +429,7 @@ int CameraActivity::getFrameWidth()
{
LOGD
(
"CameraActivity::getFrameWidth()"
);
if
(
frameWidth
<=
0
)
frameWidth
=
getProperty
(
ANDROID_CAMERA_PROPERTY_FRAMEWIDTH
);
frameWidth
=
getProperty
(
ANDROID_CAMERA_PROPERTY_FRAMEWIDTH
);
return
frameWidth
;
}
...
...
@@ -437,7 +437,7 @@ int CameraActivity::getFrameHeight()
{
LOGD
(
"CameraActivity::getFrameHeight()"
);
if
(
frameHeight
<=
0
)
frameHeight
=
getProperty
(
ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT
);
frameHeight
=
getProperty
(
ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT
);
return
frameHeight
;
}
...
...
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