2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_MEDIA_AUDIO_IO_PRIVATE_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_PRIVATE_H__
19 #include <sound_manager.h>
27 #define AUDIO_IO_INTERRUPTED_BY_RESUMABLE_MEDIA (AUDIO_IO_INTERRUPTED_BY_NOTIFICATION + 1)
28 #define AUDIO_IO_INTERRUPTED_BY_RESUMABLE_CANCELED (AUDIO_IO_INTERRUPTED_BY_NOTIFICATION + 2)
30 #define AUDIO_IO_CHECK_CONDITION(condition,error,msg) \
31 if(condition) {} else \
32 { LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg,error); return error;}; \
34 #define AUDIO_IO_NULL_ARG_CHECK(arg) \
35 AUDIO_IO_CHECK_CONDITION(arg != NULL, AUDIO_IO_ERROR_INVALID_PARAMETER, "AUDIO_IO_ERROR_INVALID_PARAMETER" )
41 typedef struct _audio_in_s{
42 MMSoundPcmHandle_t mm_handle;
47 audio_channel_e _channel;
48 audio_sample_type_e _type;
49 audio_io_interrupted_cb user_cb;
51 audio_in_stream_cb stream_cb;
52 void* stream_userdata;
55 typedef struct _audio_out_s{
56 MMSoundPcmHandle_t mm_handle;
61 audio_channel_e _channel;
62 audio_sample_type_e _type;
63 sound_type_e _sound_type;
64 audio_io_interrupted_cb user_cb;
66 audio_out_stream_cb stream_cb;
67 void* stream_userdata;
70 int __convert_audio_io_error_code(int code, char *func_name);
71 int __check_parameter(int sample_rate, audio_channel_e channel, audio_sample_type_e type);
72 int __mm_sound_pcm_capture_msg_cb (int message, void *param, void *user_param);
73 audio_io_interrupted_code_e __translate_interrupted_code (int code);
75 int audio_in_create_private(int sample_rate, audio_channel_e channel, audio_sample_type_e type , int source_type, audio_in_h* input);
77 int audio_in_set_callback_private(audio_in_h input, audio_in_stream_cb callback, void* userdata);
79 int audio_out_create_private(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h* output);
81 int audio_out_set_callback_private(audio_out_h output, audio_out_stream_cb callback, void* userdata);
88 #endif //__TIZEN_MEDIA_AUDIO_IO_PRIVATE_H__