1/*--------------------------------------------------------------------------
2Copyright (c) 2010, The Linux Foundation. All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions are met:
6    * Redistributions of source code must retain the above copyright
7      notice, this list of conditions and the following disclaimer.
8    * Redistributions in binary form must reproduce the above copyright
9      notice, this list of conditions and the following disclaimer in the
10      documentation and/or other materials provided with the distribution.
11    * Neither the name of The Linux Foundation nor
12      the names of its contributors may be used to endorse or promote
13      products derived from this software without specific prior written
14      permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27--------------------------------------------------------------------------*/
28#ifndef AENC_SVR_H
29#define AENC_SVR_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34#include <pthread.h>
35#include <sched.h>
36#include <utils/Log.h>
37
38#ifdef _ANDROID_
39#define LOG_TAG "QC_EVRCENC"
40#endif
41
42#ifndef LOGE
43#define LOGE ALOGE
44#endif
45
46#ifndef LOGW
47#define LOGW ALOGW
48#endif
49
50#ifndef LOGD
51#define LOGD ALOGD
52#endif
53
54#ifndef LOGV
55#define LOGV ALOGV
56#endif
57
58#ifndef LOGI
59#define LOGI ALOGI
60#endif
61
62#define DEBUG_PRINT_ERROR LOGE
63#define DEBUG_PRINT       LOGI
64#define DEBUG_DETAIL      LOGV
65
66typedef void (*message_func)(void* client_data, unsigned char id);
67
68/**
69 @brief audio encoder ipc info structure
70
71 */
72struct evrc_ipc_info
73{
74    pthread_t thr;
75    int pipe_in;
76    int pipe_out;
77    int dead;
78    message_func process_msg_cb;
79    void         *client_data;
80    char         thread_name[128];
81};
82
83/**
84 @brief This function starts command server
85
86 @param cb pointer to callback function from the client
87 @param client_data reference client wants to get back
88  through callback
89 @return handle to command server
90 */
91struct evrc_ipc_info *omx_evrc_thread_create(message_func cb,
92    void* client_data,
93    char *th_name);
94
95struct evrc_ipc_info *omx_evrc_event_thread_create(message_func cb,
96    void* client_data,
97    char *th_name);
98/**
99 @brief This function stop command server
100
101 @param svr handle to command server
102 @return none
103 */
104void omx_evrc_thread_stop(struct evrc_ipc_info *evrc_ipc);
105
106
107/**
108 @brief This function post message in the command server
109
110 @param svr handle to command server
111 @return none
112 */
113void omx_evrc_post_msg(struct evrc_ipc_info *evrc_ipc,
114                          unsigned char id);
115
116void* omx_evrc_comp_timer_handler(void *);
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif /* AENC_SVR */
123