Fix double unlock of slot mutex in user stops scneario
[platform/core/multimedia/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_types.h>
27
28 #define MAX_STREAM_TYPE_LEN 64
29 #define MM_SOUND_MAX_FILENAME 256
30
31 enum MMSoundSupportedCodec {
32         MM_SOUND_SUPPORTED_CODEC_INVALID = -1,  /**< Invalid codec type */
33         MM_SOUND_SUPPORTED_CODEC_WAVE,                  /**< WAVE codec         */
34         MM_SOUND_SUPPORTED_CODEC_DTMF,                  /**< DTMF codec         */
35         MM_SOUND_SUPPORTED_CODEC_NUM,                   /**< Number of audio codec type */
36 };
37
38 typedef struct {
39         int codec;
40         int channels;
41         int samplerate;
42         int format;
43         int doffset;
44         int size;
45         int duration;                   /**the wav file play duration, Unit: ms*/
46 } mmsound_codec_info_t;
47
48 typedef struct {
49         int (*stop_cb)(int, bool);
50         int pid;
51         int param;
52         int tone;
53         int repeat_count;
54         double volume;
55         int volume_config;
56         int keytone;
57         char *pfilename;
58         char stream_type[MAX_STREAM_TYPE_LEN];
59         int stream_index;
60         pthread_mutex_t *codec_wave_mutex;
61 } mmsound_codec_param_t;
62
63 typedef struct {
64         int* (*GetSupportTypes)(void);
65         int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
66         int (*Parse)(const char*, mmsound_codec_info_t*);
67         int (*Create)(mmsound_codec_param_t*, mmsound_codec_info_t*, MMHandleType*);
68         int (*Play)(MMHandleType);
69         int (*Stop)(MMHandleType);
70         int (*Destroy)(MMHandleType);
71 } mmsound_codec_interface_t;
72
73 /* Utility Functions */
74 #define CODEC_GET_INTERFACE_FUNC_NAME "MMSoundPlugCodecGetInterface"
75 #define MMSoundPlugCodecCastGetInterface(func) ((int (*)(mmsound_codec_interface_t*))(func))
76
77 int MMSoundPlugCodecGetInterface(mmsound_codec_interface_t *intf);
78
79 #endif /* __MM_SOUND_PLUGIN_CODEC_H__ */
80