vmbitstream_sdk.h
12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
#ifndef _VM_BITSTREAM_SDK_H
#define _VM_BITSTREAM_SDK_H
/* SDK header file */
#ifdef __cplusplus
extern "C" {
#endif
#include "vmsys.h"
#define VM_BITSTREAM_SUCCEED 0
#define VM_BITSTREAM_BUFFER_OVERFLOW 8001
#define VM_BITSTREAM_BUFFER_UNDERFLOW 8002
#define VM_BITSTREAM_EVENT_NONE 8003
#define VM_BITSTREAM_EVENT_DATA_REQUEST 8004
#define VM_BITSTREAM_EVENT_ERROR 8005
#define VM_BITSTREAM_RECOVER 8006
#define VM_BITSTREAM_INTERRUPT 8100
#define VM_BITSTREAM_INTERRUPT_RESUME 8101
#define VM_BITSTREAM_ERR_FAILED -8001
#define VM_BITSTREAM_ERR_INVALID_RESOULTION -8002
#define VM_BITSTREAM_ERR_UNSUPPORTED_FORMAT -8003
#define VM_BITSTREAM_ERR_INVALID_BITSTREAM -8004
#define VM_BITSTREAM_ERR_MEMORY_INSUFFICIENT -8005
#define VM_BITSTREAM_ERR_INSUFFICIENT_MEMORY -8006 /* MED memory is not enough, should check MED memory scenario */
#define VM_BITSTREAM_ERR_INVALID_FORMAT -8007 /* there is some error while decoding the frame, the frame may not be a valid one */
#define VM_BITSTREAM_NOT_SUPPORTED -8008 /* Something which is not supported by Bitstream API, e.g. incorrect invoking sequence, features not available */
#define VM_BITSTREAM_INVALID_PARAMETER -8009 /* The parameter passed through the API is invalid */
#define VM_BITSTREAM_FAILED -1
/* format type */
typedef enum
{
VM_BITSTREAM_CODEC_TYPE_NONE, /* No type */
VM_BITSTREAM_CODEC_TYPE_SILENT, /* To play silence frame for video only file */
VM_BITSTREAM_CODEC_TYPE_AMR, /* AMR */
VM_BITSTREAM_CODEC_TYPE_AMRWB, /* Wideband AMR */
VM_BITSTREAM_CODEC_TYPE_AAC, /* AAC */
VM_BITSTREAM_CODEC_TYPE_DAF, /* DAF */
VM_BITSTREAM_CODEC_TYPE_MP4A, /* Mpeg-4 audio */
VM_BITSTREAM_CODEC_TYPE_MP4AG,
VM_BITSTREAM_CODEC_TYPE_WAV, /* RAW data wav */
VM_BITSTREAM_CODEC_TYPE_ADPCM, /* compressed wav*/
VM_BITSTREAM_CODEC_TYPE_PCM, /*RAW data, for input data strengh calculation*/
VM_BITSTREAM_CODEC_TYPE_TOTAL /* Total codec type */
} vm_bitstream_codec_type_enum;
typedef enum
{
VM_BITSTREAM_SAMPLE_FREQ_8000, /* 8000 */
VM_BITSTREAM_SAMPLE_FREQ_11025, /* 11025 */
VM_BITSTREAM_SAMPLE_FREQ_16000, /* 16000 */
VM_BITSTREAM_SAMPLE_FREQ_22050, /* 22050 */
VM_BITSTREAM_SAMPLE_FREQ_24000, /* 24000 */
VM_BITSTREAM_SAMPLE_FREQ_32000, /* 32000 */
VM_BITSTREAM_SAMPLE_FREQ_44100, /* 44100 */
VM_BITSTREAM_SAMPLE_FREQ_48000, /* 48000 */
VM_BITSTREAM_SAMPLE_FREQ_TOTAL /* Total sample frequency number */
} vm_bitstream_sample_freq_enum;
/* bitstream aduio configuration structure*/
typedef struct
{
vm_bitstream_codec_type_enum vm_codec_type;
} vm_bitstream_audio_cfg_struct;
/* PCM bitstream aduio configuration structure*/
typedef struct
{
vm_bitstream_codec_type_enum vm_codec_type;
VMBOOL isStereo; /* FALSE: mono, TRUE: stereo*/
VMUINT8 bitPerSample; /* 8 or 16, commonly use 16 bits*/
vm_bitstream_sample_freq_enum sampleFreq; /* 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000*/
} vm_bitstream_pcm_audio_cfg_struct;
/* buffer status */
typedef struct
{
VMUINT total_buf_size;
VMUINT free_buf_size;
} vm_bitstream_audio_buffer_status;
/* paly audio parameters */
typedef struct
{
VMUINT start_time;
VMUINT8 volume;
VMUINT8 audio_path;
} vm_bitstream_audio_start_param;
/* callback function */
typedef void (*vm_bitstream_audio_result_callback)(VMINT handle, VMINT result);
/* ======================== BitStream Audio ============================= */
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_open
* DESCRIPTION
* open bitstream audio.
* PARAMETERS
* handle : [OUT] bitstream handle.
* audio_type : [IN] current type, support ARM,AAC,MP3.
* callback : [IN] callback function.
* RETURNS
* open success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : open success.
* VM_BITSTREAM_FAILED : open failed.
*****************************************************************************/
VMINT vm_bitstream_audio_open(
VMINT* handle,
vm_bitstream_audio_cfg_struct *audio_type,
vm_bitstream_audio_result_callback callback);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_open_pcm
* DESCRIPTION
* open pcm type bitstream audio.
* PARAMETERS
* handle : [OUT] bitstream handle.
* audio_type : [IN] current type, support PCM.
* callback : [IN] callback function.
* RETURNS
* open success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : open success.
* VM_BITSTREAM_FAILED : open failed.
*****************************************************************************/
VMINT vm_bitstream_audio_open_pcm(
VMINT* handle,
vm_bitstream_pcm_audio_cfg_struct *audio_type,
vm_bitstream_audio_result_callback callback);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_finished
* DESCRIPTION
* tell driver no data to put any more.
* PARAMETERS
* handle : [IN] bitstream handle which is getted by vm_bitstream_audio_open.
* RETURNS
* close success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : finished success.
* VM_BITSTREAM_FAILED : finished failed.
*****************************************************************************/
VMINT vm_bitstream_audio_finished(VMINT handle);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_close
* DESCRIPTION
* close bitstream audio.
* PARAMETERS
* handle : [IN] bitstream handle which is getted by vm_bitstream_audio_open.
* RETURNS
* close success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : close success.
* VM_BITSTREAM_FAILED : close failed.
*****************************************************************************/
VMINT vm_bitstream_audio_close(VMINT handle);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_get_buffer_status
* DESCRIPTION
* get data buffer status include free buffer and total buffer size
* PARAMETERS
* handle : [IN] bitstream handle.
* status : [OUT] the status of buffer, please refer the stucture of vm_bitstream_audio_buffer_status.
* RETURNS
* get status success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : get status success.
* VM_BITSTREAM_FAILED : get status failed.
*****************************************************************************/
VMINT vm_bitstream_audio_get_buffer_status(
VMINT handle,
vm_bitstream_audio_buffer_status *status);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_put_data
* DESCRIPTION
* put audio data to buffer.
* PARAMETERS
* handle : [IN] bitstream handle.
* buffer : [IN] buffer data to put.
* buffer_size : [IN] data buffer size.
* written : [OUT] the real data size to put.
* RETURNS
* put data to buffer success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : put data success.
* VM_BITSTREAM_FAILED : put data failed.
*****************************************************************************/
VMINT vm_bitstream_audio_put_data(
VMINT handle,
VMUINT8 *buffer,
VMUINT buffer_size,
VMUINT *written);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_start
* DESCRIPTION
* start to play audio.
* PARAMETERS
* handle : [IN] bitstream handle.
* para : [IN] audio paremeters,refer the structure of vm_bitstream_audio_start_param.
* RETURNS
* play audio success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : play audio success.
* VM_BITSTREAM_FAILED : play audio failed.
*****************************************************************************/
VMINT vm_bitstream_audio_start(
VMINT handle,
vm_bitstream_audio_start_param *para);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_stop
* DESCRIPTION
* stop play audio.
* PARAMETERS
* handle : [IN] bitstream handle.
* RETURNS
* stop audio success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : stop audio success.
* VM_BITSTREAM_FAILED : stop audio failed.
*****************************************************************************/
VMINT vm_bitstream_audio_stop(VMINT handle);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_get_play_time
* DESCRIPTION
* get current play time.
* PARAMETERS
* handle : [IN] bitstream handle.
* current_time : [OUT] current play time(ms).
* RETURNS
* get current play time success or not.
* RETURN VALUES
* VM_BITSTREAM_SUCCEED : get time success.
* VM_BITSTREAM_FAILED : get time failed.
*****************************************************************************/
VMINT vm_bitstream_audio_get_play_time(
VMINT handle,
VMUINT* current_time);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_register_interrupt_callback
* DESCRIPTION
* register interrupt callback.
* PARAMETERS
* callback : [IN] callback function pointer.
* RETURNS
* handle of register function
* RETURN VALUES
* 0 : failed.
*****************************************************************************/
VMINT vm_bitstream_audio_register_interrupt_callback(vm_bitstream_audio_result_callback callback);
/*****************************************************************************
* FUNCTION
* vm_bitstream_audio_clear_interrupt_callback
* DESCRIPTION
* clear the interrupt callback.
* PARAMETERS
* handle : [IN] handle from vm_bitstream_audio_register_interrupt_callback.
*****************************************************************************/
void vm_bitstream_audio_clear_interrupt_callback(VMINT handle);
#ifdef __cplusplus
}
#endif
#endif /* _VM_BITSTREAM_SDK_H */