From faf79aff580d6e7fabd1304ff8bfed7f6ccc972c Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Fri, 23 Sep 2016 18:03:57 +0900 Subject: [PATCH] Fix filename issue for Tizen 2.4 compatibility [Version] 0.2.35 [Profile] Common [Issue Type] Bug fix [Dependency module] N/A [Dependency commit] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20160923.1] Change-Id: I930120bf74167948cf510346bcf5cb137f1bf8de Signed-off-by: Haesu Gwon --- CMakeLists.txt | 2 +- include/recorder_private.h | 1 + packaging/capi-media-recorder.spec | 3 ++- src/recorder.c | 27 ++++++++++++++++++++++++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1569e97..389fa2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ SET(service "media") SET(submodule "recorder") # for package file -SET(dependents "dlog capi-media-camera capi-media-audio-io mmsvc-recorder storage mused capi-media-sound-manager") +SET(dependents "dlog capi-media-camera capi-media-audio-io mmsvc-recorder storage mused capi-media-sound-manager libtzplatform-config") SET(pc_dependents "capi-base-common capi-media-camera capi-media-audio-io capi-media-sound-manager") SET(fw_name "${project_prefix}-${service}-${submodule}") diff --git a/include/recorder_private.h b/include/recorder_private.h index 0785d81..b42b831 100644 --- a/include/recorder_private.h +++ b/include/recorder_private.h @@ -29,6 +29,7 @@ extern "C" { #define RECORDER_PARSE_STRING_SIZE 30 #define RECORDER_MSG_LENGTH_MAX 5120 #define RECORDER_CB_TIMEOUT 5 +#define RECORDER_FILENAME_MAX 256 #define RECORDER_MSG_PARAM_SET(param, msg_type, set_value) { \ param.type = MUSE_TYPE_##msg_type; \ diff --git a/packaging/capi-media-recorder.spec b/packaging/capi-media-recorder.spec index 62542fa..3899ba8 100644 --- a/packaging/capi-media-recorder.spec +++ b/packaging/capi-media-recorder.spec @@ -1,6 +1,6 @@ Name: capi-media-recorder Summary: A Recorder API -Version: 0.2.34 +Version: 0.2.35 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(capi-media-tool) BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(storage) +BuildRequires: pkgconfig(libtzplatform-config) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/recorder.c b/src/recorder.c index ca37160..ee89521 100644 --- a/src/recorder.c +++ b/src/recorder.c @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef LOG_TAG #undef LOG_TAG @@ -1406,6 +1407,27 @@ _ERR_RECORDER_EXIT: } +int _recorder_replace_path(const char *path, char *replace_path) +{ + const char *old_path = "/opt/usr/media"; + + memset(replace_path, 0, RECORDER_FILENAME_MAX); + if (strncmp(path, old_path, strlen(old_path)) == 0) { + snprintf(replace_path, RECORDER_FILENAME_MAX, "%s%s", tzplatform_getenv(TZ_USER_CONTENT), path + strlen(old_path)); + LOGD("replaced path : %s -> %s", path, replace_path); + } else { + snprintf(replace_path, RECORDER_FILENAME_MAX, "%s", path); + } + + if (!(replace_path != NULL && strlen(replace_path) > 0)) { + LOGE("replace failed"); + return RECORDER_ERROR_INVALID_OPERATION; + } + + return RECORDER_ERROR_NONE; +} + + int recorder_create_videorecorder(camera_h camera, recorder_h *recorder) { return _recorder_create_common(recorder, MUSE_RECORDER_TYPE_VIDEO, camera); @@ -1812,6 +1834,7 @@ int recorder_set_filename(recorder_h recorder, const char *filename) muse_recorder_api_e api = MUSE_RECORDER_API_SET_FILENAME; recorder_cli_s *pc = (recorder_cli_s *)recorder; recorder_msg_param param; + char set_filename[RECORDER_FILENAME_MAX]; if (!pc || !pc->cb_info) { LOGE("NULL handle"); @@ -1825,7 +1848,9 @@ int recorder_set_filename(recorder_h recorder, const char *filename) LOGD("ENTER"); - RECORDER_MSG_PARAM_SET(param, STRING, filename); + _recorder_replace_path(filename, set_filename); + + RECORDER_MSG_PARAM_SET(param, STRING, set_filename); _recorder_msg_send_param1(api, pc->cb_info, &ret, ¶m); -- 2.7.4