From: SeokHoon Lee Date: Fri, 8 Sep 2017 06:31:33 +0000 (+0900) Subject: Add state check in cancel X-Git-Tag: submit/tizen/20170912.082420~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=452c7f33a67c0fc8a43d0cd98aa8fb4470e9451d;p=platform%2Fcore%2Fapi%2Fmediastreamrecorder.git Add state check in cancel - Cancel api should works in recording or paused state - remove audio io depandency Signed-off-by: SeokHoon Lee Change-Id: I3ce4a6ab0f5b9e9a4bbf80156faa9d48a919a5f5 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 195f9c8..cdf2b4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,8 @@ SET(service "media") SET(submodule "streamrecorder") # for package file -SET(dependents "dlog mm-streamrecorder capi-media-audio-io capi-media-tool") -SET(pc_dependents "capi-base-common capi-media-audio-io capi-media-tool") +SET(dependents "dlog mm-streamrecorder capi-media-tool") +SET(pc_dependents "capi-base-common capi-media-tool") SET(fw_name "${project_prefix}-${service}-${submodule}") diff --git a/packaging/capi-media-streamrecorder.spec b/packaging/capi-media-streamrecorder.spec index a4b50b3..88e17e4 100644 --- a/packaging/capi-media-streamrecorder.spec +++ b/packaging/capi-media-streamrecorder.spec @@ -1,6 +1,6 @@ Name: capi-media-streamrecorder Summary: A Streamrecorder library in Tizen Native API -Version: 0.0.14 +Version: 0.0.15 Release: 0 Group: Multimedia/Other License: Apache-2.0 @@ -10,7 +10,6 @@ BuildRequires: pkgconfig(dlog) Buildrequires: pkgconfig(mm-streamrecorder) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-media-tool) -BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(libtbm) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/streamrecorder_private.c b/src/streamrecorder_private.c index 6f7cc7b..54444fc 100644 --- a/src/streamrecorder_private.c +++ b/src/streamrecorder_private.c @@ -391,13 +391,25 @@ int _streamrecorder_commit(streamrecorder_h recorder) int _streamrecorder_cancel(streamrecorder_h recorder) { + int ret = MM_ERROR_NONE; streamrecorder_s *handle = (streamrecorder_s *)recorder; + streamrecorder_state_e state = STREAMRECORDER_STATE_NONE; if (recorder == NULL) { LOGE("NULL pointer handle"); return STREAMRECORDER_ERROR_INVALID_PARAMETER; } + ret = streamrecorder_get_state(recorder, &state); + if (ret != MM_ERROR_NONE) { + return __convert_streamrecorder_error_code(__func__, ret); + } + + if (!(state == STREAMRECORDER_STATE_RECORDING || state == STREAMRECORDER_STATE_PAUSED)) { + LOGE("STREAMRECORDER_ERROR_INVALID_STATE (state:%d)", state); + return STREAMRECORDER_ERROR_INVALID_STATE; + } + return __convert_streamrecorder_error_code(__func__, mm_streamrecorder_cancel(handle->mm_handle)); }