Tizen 2.0 Release
[profile/ivi/libmm-sound.git] / server / include / mm_sound_plugin_codec.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_SOUND_PLUGIN_CODEC_H__
23 #define __MM_SOUND_PLUGIN_CODEC_H__
24
25 #include "mm_sound_plugin.h"
26 #include <mm_source.h>
27 #include <mm_types.h>
28
29 enum MMSoundSupportedCodec {
30         MM_SOUND_SUPPORTED_CODEC_INVALID = -1,  /**< Invalid codec type */
31         MM_SOUND_SUPPORTED_CODEC_WAVE,                  /**< WAVE codec         */
32         MM_SOUND_SUPPORTED_CODEC_DTMF,                  /**< DTMF codec         */
33         MM_SOUND_SUPPORTED_CODEC_MP3,                   /**< MP3 codec          */
34         MM_SOUND_SUPPORTED_CODEC_NUM,                   /**< Number of audio codec type */
35 };
36
37 typedef struct {
38         int codec;
39         int channels;
40         int samplerate;
41         int format;
42         int doffset;
43         int size;
44 } mmsound_codec_info_t;
45
46 typedef struct {
47         int (*stop_cb)(int);
48         int pid;
49         int param;
50         int tone;
51         int repeat_count;
52         double volume;
53         int priority;
54         int volume_config;
55         int keytone;
56         MMSourceType *source;
57         int handle_route;
58 } mmsound_codec_param_t;
59
60 typedef struct {
61     int* (*GetSupportTypes)(void);
62     int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
63     int (*Parse)(MMSourceType*, mmsound_codec_info_t*);
64     int (*Create)(mmsound_codec_param_t*, mmsound_codec_info_t*, MMHandleType*);
65     int (*Play_wav)(mmsound_codec_param_t *, mmsound_codec_info_t *, MMHandleType );
66     int (*Play)(MMHandleType);
67     int (*Stop)(MMHandleType);
68     int (*Destroy)(MMHandleType);
69 } mmsound_codec_interface_t;
70
71 /* Utility Functions */
72 #define CODEC_GET_INTERFACE_FUNC_NAME "MMSoundPlugCodecGetInterface"
73 #define MMSoundPlugCodecCastGetInterface(func) ((int (*)(mmsound_codec_interface_t*))(func))
74
75 int MMSoundPlugCodecGetInterface(mmsound_codec_interface_t *intf);
76
77 #endif /* __MM_SOUND_PLUGIN_CODEC_H__ */
78