mirror of
https://github.com/openharmony/applications_sample_camera.git
synced 2026-07-20 13:44:37 -04:00
remove audio capture sample and change recorder path
Signed-off-by: starfish002 <shaoyuan.zhang@huawei.com>
This commit is contained in:
@@ -29,22 +29,6 @@ executable("camera_sample") {
|
||||
output_dir = "$root_out_dir/dev_tools"
|
||||
}
|
||||
|
||||
executable("audio_capture_sample") {
|
||||
sources = [
|
||||
"audio_capture_sample.cpp",
|
||||
]
|
||||
cflags = ["-Wall"]
|
||||
cflags_cc = cflags
|
||||
|
||||
ldflags = ["-lstdc++"]
|
||||
ldflags += ["-lpthread"]
|
||||
ldflags += ["-Wl,-rpath-link=$ohos_root_path/$root_out_dir"]
|
||||
deps = [
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
"//foundation/multimedia/audio_lite/frameworks:audio_capturer_lite",
|
||||
]
|
||||
output_dir = "$root_out_dir/dev_tools"
|
||||
}
|
||||
executable("player_sample") {
|
||||
sources = [ "player_sample.cpp" ]
|
||||
cflags = [ "-Wall" ]
|
||||
@@ -64,6 +48,5 @@ lite_component("media_sample") {
|
||||
features = [
|
||||
":camera_sample",
|
||||
":player_sample",
|
||||
":audio_capture_sample",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ static char *GernerateFileName(AudioCodecFormat format)
|
||||
}
|
||||
(void)memset_s(name, size, 0, size);
|
||||
/* create file for save stream */
|
||||
if (snprintf_s(name, size, size - 1, "/sdcard/audio_%s.%s", aszDatetime, postfix.c_str()) < 0) {
|
||||
if (snprintf_s(name, size, size - 1, "/userdata/audio_%s.%s", aszDatetime, postfix.c_str()) < 0) {
|
||||
std::cout << "snprintf_s failed " << std::endl;
|
||||
free(name);
|
||||
return nullptr;
|
||||
|
||||
@@ -40,9 +40,9 @@ static int32_t SampleGetRecordFd()
|
||||
if (ltm != nullptr) {
|
||||
ostringstream ss("Capture_");
|
||||
ss << "Record" << ltm->tm_hour << "-" << ltm->tm_min << "-" << ltm->tm_sec << ".mp4";
|
||||
fd = open(("/userdata/video/" + ss.str()).c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
fd = open(("/userdata/" + ss.str()).c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
cout << "Open "
|
||||
<< "/userdata/video/" << ss.str() << endl;
|
||||
<< "/userdata/" << ss.str() << endl;
|
||||
|
||||
if (fd == -1) {
|
||||
cout << "Open recorder file failed. strerr=" << strerror(errno) << endl;
|
||||
@@ -61,7 +61,7 @@ static void SampleSaveCapture(const char *p, uint32_t size)
|
||||
ostringstream ss("Capture_");
|
||||
ss << "Capture" << ltm->tm_hour << "-" << ltm->tm_min << "-" << ltm->tm_sec << ".jpg";
|
||||
|
||||
ofstream pic("/sdcard/" + ss.str(), ofstream::out | ofstream::trunc);
|
||||
ofstream pic("/userdata/" + ss.str(), ofstream::out | ofstream::trunc);
|
||||
cout << "write " << size << " bytes" << endl;
|
||||
pic.write(p, size);
|
||||
pic.close();
|
||||
|
||||
Reference in New Issue
Block a user