Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Applications Sample Camera
提交
8c2a1bc9
A
Applications Sample Camera
项目概览
OpenHarmony
/
Applications Sample Camera
大约 1 年 前同步成功
通知
5
Star
25
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Applications Sample Camera
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8c2a1bc9
编写于
8月 13, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
!39 解决linux录像文件打开错误的问题
Merge pull request !39 from harmony_zhangjian/master
上级
afc6cd4e
33281f2a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
25 addition
and
2 deletion
+25
-2
cameraApp/cameraApp/src/main/cpp/camera_manager.cpp
cameraApp/cameraApp/src/main/cpp/camera_manager.cpp
+21
-2
media/camera_sample.cpp
media/camera_sample.cpp
+4
-0
未找到文件。
cameraApp/cameraApp/src/main/cpp/camera_manager.cpp
浏览文件 @
8c2a1bc9
...
@@ -112,6 +112,8 @@ static int32_t SampleGetThmFromJpg(const char* jpegPath, uint32_t* dstSize)
...
@@ -112,6 +112,8 @@ static int32_t SampleGetThmFromJpg(const char* jpegPath, uint32_t* dstSize)
fstat
(
fd
,
&
stStat
);
fstat
(
fd
,
&
stStat
);
pszFile
=
(
char
*
)
malloc
(
stStat
.
st_size
);
pszFile
=
(
char
*
)
malloc
(
stStat
.
st_size
);
if
((
pszFile
==
nullptr
)
||
(
stStat
.
st_size
<
6
))
{
/* 6 min size of thumb head */
if
((
pszFile
==
nullptr
)
||
(
stStat
.
st_size
<
6
))
{
/* 6 min size of thumb head */
fflush
(
fpJpg
);
fsync
(
fileno
(
fpJpg
));
fclose
(
fpJpg
);
fclose
(
fpJpg
);
if
(
pszFile
)
{
if
(
pszFile
)
{
free
(
pszFile
);
free
(
pszFile
);
...
@@ -122,6 +124,8 @@ static int32_t SampleGetThmFromJpg(const char* jpegPath, uint32_t* dstSize)
...
@@ -122,6 +124,8 @@ static int32_t SampleGetThmFromJpg(const char* jpegPath, uint32_t* dstSize)
}
}
if
(
fread
(
pszFile
,
stStat
.
st_size
,
1
,
fpJpg
)
<=
0
)
{
if
(
fread
(
pszFile
,
stStat
.
st_size
,
1
,
fpJpg
)
<=
0
)
{
fflush
(
fpJpg
);
fsync
(
fileno
(
fpJpg
));
fclose
(
fpJpg
);
fclose
(
fpJpg
);
free
(
pszFile
);
free
(
pszFile
);
printf
(
"fread jpeg src fail!
\n
"
);
printf
(
"fread jpeg src fail!
\n
"
);
...
@@ -173,6 +177,8 @@ int32_t SampleGetdcfinfo(const char* srcJpgPath, const char* dstThmPath)
...
@@ -173,6 +177,8 @@ int32_t SampleGetdcfinfo(const char* srcJpgPath, const char* dstThmPath)
u32WritenSize
+=
s32RtnVal
;
u32WritenSize
+=
s32RtnVal
;
}
}
if
(
fpTHM
!=
nullptr
)
{
if
(
fpTHM
!=
nullptr
)
{
fflush
(
fpTHM
);
fsync
(
fileno
(
fpTHM
));
fclose
(
fpTHM
);
fclose
(
fpTHM
);
fpTHM
=
0
;
fpTHM
=
0
;
}
}
...
@@ -197,6 +203,8 @@ static void SampleSaveCapture(const char* p, uint32_t size, int type, const char
...
@@ -197,6 +203,8 @@ static void SampleSaveCapture(const char* p, uint32_t size, int type, const char
fp
=
fopen
(
tmpFile
,
"w+"
);
fp
=
fopen
(
tmpFile
,
"w+"
);
if
(
fp
)
{
if
(
fp
)
{
fwrite
(
p
,
1
,
size
,
fp
);
fwrite
(
p
,
1
,
size
,
fp
);
fflush
(
fp
);
fsync
(
fileno
(
fp
));
fclose
(
fp
);
fclose
(
fp
);
}
}
}
}
...
@@ -211,6 +219,8 @@ static void SampleSaveCapture(const char* p, uint32_t size, int type, const char
...
@@ -211,6 +219,8 @@ static void SampleSaveCapture(const char* p, uint32_t size, int type, const char
return
;
return
;
}
}
fwrite
(
p
,
1
,
size
,
fp
);
fwrite
(
p
,
1
,
size
,
fp
);
fflush
(
fp
);
fsync
(
fileno
(
fp
));
fclose
(
fp
);
fclose
(
fp
);
if
(
type
==
0
)
{
if
(
type
==
0
)
{
...
@@ -397,8 +407,13 @@ SampleCameraStateMng::~SampleCameraStateMng()
...
@@ -397,8 +407,13 @@ SampleCameraStateMng::~SampleCameraStateMng()
recorder_
->
Release
();
recorder_
->
Release
();
delete
recorder_
;
delete
recorder_
;
}
}
if
(
gRecFd_
>=
0
)
if
(
gRecFd_
>=
0
)
{
close
(
gRecFd_
);
FILE
*
fp
=
fdopen
(
gRecFd_
,
"w+"
);
fflush
(
fp
);
fsync
(
gRecFd_
);
fclose
(
fp
);
close
(
gRecFd_
);
}
if
(
fc_
)
{
if
(
fc_
)
{
delete
fc_
;
delete
fc_
;
fc_
=
nullptr
;
fc_
=
nullptr
;
...
@@ -431,6 +446,10 @@ void SampleCameraStateMng::StartRecord(Surface *mSurface)
...
@@ -431,6 +446,10 @@ void SampleCameraStateMng::StartRecord(Surface *mSurface)
return
;
return
;
}
}
if
(
gRecFd_
>
0
)
{
if
(
gRecFd_
>
0
)
{
FILE
*
fp
=
fdopen
(
gRecFd_
,
"w+"
);
fflush
(
fp
);
fsync
(
gRecFd_
);
fclose
(
fp
);
close
(
gRecFd_
);
close
(
gRecFd_
);
gRecFd_
=
-
1
;
gRecFd_
=
-
1
;
}
}
...
...
media/camera_sample.cpp
浏览文件 @
8c2a1bc9
...
@@ -196,6 +196,10 @@ public:
...
@@ -196,6 +196,10 @@ public:
recorder_
=
nullptr
;
recorder_
=
nullptr
;
}
}
if
(
recordFd_
!=
-
1
)
{
if
(
recordFd_
!=
-
1
)
{
FILE
*
fp
=
fdopen
(
recordFd_
,
"w+"
);
fflush
(
fp
);
fsync
(
recordFd_
);
fclose
(
fp
);
close
(
recordFd_
);
close
(
recordFd_
);
recordFd_
=
-
1
;
recordFd_
=
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录