From: Jinkun Jang Date: Fri, 15 Mar 2013 16:11:40 +0000 (+0900) Subject: merge with master X-Git-Tag: submit/tizen_2.1/20130424.230234~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c48e05d828d40f7a0f484f86a2de7da12046ba2;p=platform%2Fcore%2Fapi%2Faudio-io.git merge with master --- diff --git a/include/audio_io.h b/include/audio_io.h index b8c415c..b9e7d6d 100644 --- a/include/audio_io.h +++ b/include/audio_io.h @@ -291,7 +291,7 @@ int audio_in_set_interrupted_cb(audio_in_h input, audio_io_interrupted_cb callba /** * @brief Unregisters the callback function. - * @param[in] output The handle to the audio output + * @param[in] input The handle to the audio input * @return 0 on success, otherwise a negative error value. * @retval #AUDIO_IO_ERROR_NONE Successful * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter @@ -300,7 +300,16 @@ int audio_in_set_interrupted_cb(audio_in_h input, audio_io_interrupted_cb callba */ int audio_in_unset_interrupted_cb(audio_in_h input); - +/** + * @brief Ignore session for input + * @param[in] input The handle to the audio input + * @return 0 on success, otherwise a negative error value. + * @retval #AUDIO_IO_ERROR_NONE Successful + * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation + * @see + */ +int audio_in_ignore_session(audio_in_h input); // // AUDIO OUTPUT @@ -356,7 +365,7 @@ int audio_out_destroy(audio_out_h output); /** * @brief Prepare playing audio out, this must be called before audio_out_write() - * @param[in] input The handle to the audio output + * @param[in] output The handle to the audio output * @return 0 on success, otherwise a negative error value. * @retval #AUDIO_IO_ERROR_NONE Successful * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter @@ -368,7 +377,7 @@ int audio_out_prepare(audio_out_h output); /** * @brief Unprepare playing audio out. - * @param[in] input The handle to the audio output + * @param[in] output The handle to the audio output * @return 0 on success, otherwise a negative error value. * @retval #AUDIO_IO_ERROR_NONE Successful * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter @@ -491,6 +500,16 @@ int audio_out_set_interrupted_cb(audio_out_h output, audio_io_interrupted_cb cal */ int audio_out_unset_interrupted_cb(audio_out_h output); +/** + * @brief Ignore session for output + * @param[in] output The handle to the audio output + * @return 0 on success, otherwise a negative error value. + * @retval #AUDIO_IO_ERROR_NONE Successful + * @retval #AUDIO_IO_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation + * @see + */ +int audio_out_ignore_session(audio_out_h output); /** diff --git a/packaging/capi-media-audio-io.spec b/packaging/capi-media-audio-io.spec index 6452546..473a8f4 100644 --- a/packaging/capi-media-audio-io.spec +++ b/packaging/capi-media-audio-io.spec @@ -1,7 +1,7 @@ Name: capi-media-audio-io Summary: An Audio Input & Audio Output library in Tizen Native API -Version: 0.1.1 -Release: 3 +Version: 0.2.0 +Release: 0 Group: TO_BE/FILLED_IN License: TO BE FILLED IN Source0: %{name}-%{version}.tar.gz diff --git a/src/audio_io.c b/src/audio_io.c index 46cc472..76304d9 100644 --- a/src/audio_io.c +++ b/src/audio_io.c @@ -384,6 +384,21 @@ int audio_in_unset_interrupted_cb(audio_in_h input) return AUDIO_IO_ERROR_NONE; } +int audio_in_ignore_session(audio_in_h input) +{ + AUDIO_IO_NULL_ARG_CHECK(input); + audio_in_s * handle = (audio_in_s *) input; + int ret = 0; + + ret = mm_sound_pcm_capture_ignore_session(handle->mm_handle); + if (ret != MM_ERROR_NONE) { + return __convert_error_code(ret, (char*)__FUNCTION__); + } + + LOGI("[%s] mm_sound_pcm_capture_ignore_session() success",__FUNCTION__); + return AUDIO_IO_ERROR_NONE; +} + /* Audio Out */ int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h* output) { @@ -588,3 +603,18 @@ int audio_out_unset_interrupted_cb(audio_out_h output) LOGI("[%s] current interrupted cb (%p) / data (%p)",__FUNCTION__, handle->user_cb, handle->user_data); return AUDIO_IO_ERROR_NONE; } + +int audio_out_ignore_session(audio_out_h output) +{ + AUDIO_IO_NULL_ARG_CHECK(output); + audio_out_s *handle = (audio_out_s *) output; + int ret = 0; + + ret = mm_sound_pcm_play_ignore_session(handle->mm_handle); + if (ret != MM_ERROR_NONE) { + return __convert_error_code(ret, (char*)__FUNCTION__); + } + LOGI("[%s] mm_sound_pcm_play_ignore_session() success",__FUNCTION__); + + return AUDIO_IO_ERROR_NONE; +} diff --git a/test/audio_io_test.c b/test/audio_io_test.c index 2647c16..9aba129 100755 --- a/test/audio_io_test.c +++ b/test/audio_io_test.c @@ -21,6 +21,33 @@ int audio_io_test() { + int ret, size; + audio_in_h input; + if ((ret = audio_in_create(44100, AUDIO_CHANNEL_STEREO ,AUDIO_SAMPLE_TYPE_S16_LE, &input)) == AUDIO_IO_ERROR_NONE) { + ret = audio_in_ignore_session(input); + if (ret != 0) { + printf ("ERROR, set session mix\n"); + audio_in_destroy(input); + return 0; + } + + audio_in_prepare(input); + if ((ret = audio_in_get_buffer_size(input, &size)) == AUDIO_IO_ERROR_NONE) { + size = 500000; + char *buffer = alloca(size); + if ((ret = audio_in_read(input, (void*)buffer, size)) > AUDIO_IO_ERROR_NONE) { + FILE* fp = fopen ("/root/test.raw", "wb+"); + fwrite (buffer, size, sizeof(char), fp); + fclose (fp); + printf ("PASS, size=%d, ret=%d\n", size, ret); + } + else { + printf ("FAIL, size=%d, ret=%d\n", size, ret); + } + } + audio_in_destroy(input); + } + return 1; }