From 4e0b9a63c31d76dfdc2e1858128f0e9d6dab8adf Mon Sep 17 00:00:00 2001 From: starfish002 Date: Mon, 27 Sep 2021 16:00:28 +0800 Subject: [PATCH] fixed a8f3858 from https://gitee.com/starfish002/applications_sample_camera/pulls/54 remove audio capture sample and change recorder path Signed-off-by: starfish002 --- media/BUILD.gn | 19 +------------------ media/audio_capture_sample.cpp | 2 +- media/camera_sample.cpp | 6 +++--- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/media/BUILD.gn b/media/BUILD.gn index 5a95f70..3096e0f 100755 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -28,23 +28,7 @@ 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", ] } diff --git a/media/audio_capture_sample.cpp b/media/audio_capture_sample.cpp index dd3366f..6d32140 100644 --- a/media/audio_capture_sample.cpp +++ b/media/audio_capture_sample.cpp @@ -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; diff --git a/media/camera_sample.cpp b/media/camera_sample.cpp index cd4caa0..a271802 100755 --- a/media/camera_sample.cpp +++ b/media/camera_sample.cpp @@ -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(); -- Gitee