Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Applications Sample Camera
提交
c9da48d0
A
Applications Sample Camera
项目概览
OpenHarmony
/
Applications Sample Camera
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
c9da48d0
编写于
2月 17, 2022
作者:
O
openharmony_ci
提交者:
Gitee
2月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
!76 audio capturer 服务化
Merge pull request !76 from starfish/master
上级
5eb500e8
08f37f1b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
2 deletion
+24
-2
media/BUILD.gn
media/BUILD.gn
+19
-0
media/audio_capture_sample.cpp
media/audio_capture_sample.cpp
+5
-2
未找到文件。
media/BUILD.gn
浏览文件 @
c9da48d0
...
...
@@ -29,6 +29,24 @@ executable("camera_sample") {
output_dir = "$root_out_dir/dev_tools"
}
executable("audio_capture_sample") {
sources = [ "audio_capture_sample.cpp" ]
cflags = [ "-Wall" ]
cflags_cc = cflags
include_dirs = [ "//foundation/multimedia/audio_lite/interfaces/kits" ]
include_dirs += [ "//foundation/multimedia/utils/lite/interfaces/kits" ]
ldflags = [ "-lstdc++" ]
ldflags += [ "-lpthread" ]
ldflags += [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ]
deps = [
"//foundation/multimedia/audio_lite/frameworks:audio_capturer_lite",
"//third_party/bounds_checking_function:libsec_shared",
]
output_dir = "$root_out_dir/dev_tools"
}
executable("player_sample") {
sources = [ "player_sample.cpp" ]
cflags = [ "-Wall" ]
...
...
@@ -48,5 +66,6 @@ lite_component("media_sample") {
features = [
":camera_sample",
":player_sample",
":audio_capture_sample",
]
}
media/audio_capture_sample.cpp
浏览文件 @
c9da48d0
...
...
@@ -15,8 +15,9 @@
#include <ctime>
#include <iostream>
#include <thread>
#include <string>
#include <thread>
#include <unistd.h>
#include "audio_capturer.h"
#include "media_errors.h"
#include "securec.h"
...
...
@@ -93,6 +94,7 @@ static char *GernerateFileName(AudioCodecFormat format)
static
void
AudioInputSourceProcess
(
AudioSourceInput
*
audioSourceInput
)
{
const
int32_t
waitTimeUs
=
20000
;
std
::
cout
<<
"audioSourceInput: "
<<
audioSourceInput
<<
std
::
endl
;
if
(
audioSourceInput
==
nullptr
)
{
return
;
...
...
@@ -114,8 +116,9 @@ static void AudioInputSourceProcess(AudioSourceInput *audioSourceInput)
while
(
audioSourceInput
->
bThreadRun
)
{
int
ret
=
audioSourceInput
->
audioCap
->
Read
(
audioSourceInput
->
buffer
,
audioSourceInput
->
framesize
,
false
);
if
(
ret
==
-
1
)
{
if
(
ret
<=
0
)
{
std
::
cout
<<
"audioCap Read failed ret:"
<<
ret
<<
std
::
endl
;
usleep
(
waitTimeUs
);
continue
;
}
if
(
fwrite
(
audioSourceInput
->
buffer
,
1
,
ret
,
pfd
)
!=
ret
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录