source: svn/newcon3bcm2_21bu/nexus/modules/audio/7552/include/nexus_audio_capture.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 13.8 KB
Line 
1/***************************************************************************
2*     (c)2004-2011 Broadcom Corporation
3
4*  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5*  and may only be used, duplicated, modified or distributed pursuant to the terms and
6*  conditions of a separate, written license agreement executed between you and Broadcom
7*  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8*  no license (express or implied), right to use, or waiver of any kind with respect to the
9*  Software, and Broadcom expressly reserves all rights in and to the Software and all
10*  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11*  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12*  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. 
13*   
14*  Except as expressly set forth in the Authorized License,
15*   
16*  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17*  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18*  and to use this information only in connection with your use of Broadcom integrated circuit products.
19*   
20*  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21*  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22*  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23*  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24*  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25*  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26*  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27*  USE OR PERFORMANCE OF THE SOFTWARE.
28
29*  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30*  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31*  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32*  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33*  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34*  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35*  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36*  ANY LIMITED REMEDY.
37*
38* $brcm_Workfile: nexus_audio_capture.h $
39* $brcm_Revision: 7 $
40* $brcm_Date: 5/23/11 6:49p $
41*
42* API Description:
43*   API name: AudioCapture
44*    Specific APIs related to PCM audio capture.  This supports capture
45*    of data into memory from a decoder or other source.
46*
47* Revision History:
48*
49* $brcm_Log: /nexus/modules/audio/7400/include/nexus_audio_capture.h $
50*
51* 7   5/23/11 6:49p jgarrett
52* SW7425-402: Adding multichannel capture support
53*
54* 6   4/22/11 10:43a erickson
55* SW7420-1148: remove attr{shutdown=NEXUS_AudioInput_Shutdown}
56*
57* 5   12/14/10 3:18p erickson
58* SW7420-1285: add null_allowed attribute
59*
60* 4   8/10/10 3:58p erickson
61* SW7420-934: rename NEXUS_AudioCapture_WriteComplete to
62*  NEXUS_AudioCapture_ReadComplete
63*
64* 3   8/28/09 4:00p jgarrett
65* SW7405-2928: Adding multichannel capture support
66*
67* 2   10/6/08 4:16a jgarrett
68* PR 46143: Adding mixed mono capture option
69*
70* 1   7/11/08 10:30a jgarrett
71* PR 44645: Adding capture API
72*
73***************************************************************************/
74#ifndef NEXUS_AUDIO_CAPTURE_H__
75#define NEXUS_AUDIO_CAPTURE_H__
76
77#include "nexus_types.h"
78#include "nexus_audio_types.h"
79
80/*=************************************
81Interface: AudioCapture
82
83Header file: nexus_audio_capture.h
84
85Module: Audio
86
87Description: Capture audio PCM data
88
89**************************************/
90
91#ifdef __cplusplus
92extern "C" {
93#endif
94
95/***************************************************************************
96Summary:
97Handle for audio capture
98***************************************************************************/
99typedef struct NEXUS_AudioCapture *NEXUS_AudioCaptureHandle;
100
101/***************************************************************************
102Summary:
103Audio Capture Channel Open Settings
104
105Description:
106Audio Capture Channel Open Settings
107
108See Also:
109NEXUS_AudioCaptureStartSettings
110***************************************************************************/
111typedef struct NEXUS_AudioCaptureOpenSettings
112{
113    size_t fifoSize;                    /* FIFO size in bytes.  This value is a total FIFO size to hold
114                                           all channels of data interleaved into a single buffer.
115                                           If not set, a default size will be used. */
116    size_t threshold;                   /* FIFO data callback threshold in bytes.  When the amount of data
117                                           remaining in the FIFO drops below this level, the dataCallback
118                                           routine provided in NEXUS_AudioCaptureStartSettings will be called. 
119                                           If this value is 0, a default threshold percentage will be used. */
120    NEXUS_AudioMultichannelFormat multichannelFormat;   /* This defines the maximum width of data that can be captured. 
121                                                           Default is NEXUS_AudioMultichannelFormat_eStereo to capture stereo
122                                                           data.  5.1 or 7.1 will increase the number of buffers allocated. */
123} NEXUS_AudioCaptureOpenSettings;
124
125/***************************************************************************
126Summary:
127Get default settings for opening an audio capture channel
128***************************************************************************/
129void NEXUS_AudioCapture_GetDefaultOpenSettings(
130    NEXUS_AudioCaptureOpenSettings *pSettings      /* [out] default settings */
131    );
132
133/***************************************************************************
134Summary:
135Open an audio capture channel
136
137Description:
138The captured data will be formatted with the settings provided in
139NEXUS_AudioCaptureSettings.  The sample rate of the data is determined by
140the sample rate of the input data.  For example, if the decoder is outputting
14148kHz, the data will be the same sample rate.  If the decoder is not active,
142the output will be 48kHz.  Data will automatically start flowing once the
143source device starts and stop when the source device stops.
144***************************************************************************/
145NEXUS_AudioCaptureHandle NEXUS_AudioCapture_Open(     /* attr{destructor=NEXUS_AudioCapture_Close}  */
146    unsigned index,
147    const NEXUS_AudioCaptureOpenSettings *pSettings    /* attr{null_allowed=y} */
148    );
149
150/***************************************************************************
151Summary:
152Close an audio capture channel
153***************************************************************************/
154void NEXUS_AudioCapture_Close(
155    NEXUS_AudioCaptureHandle handle
156    );
157
158/***************************************************************************
159Summary:
160Enumeration for capture data format
161
162Description:
163Captured data will always be stored in host endian mode. 
164
165For 16-bit data:
166Address Byte   0  1  2  3
167
168               -----------
169Little-Endian |R0|R1|L0|L1|
170               -----------
171
172               -----------
173Big-Endian    |L1|L0|R1|R0|
174               -----------
175
176For 24-bit Data:
177Address Byte   0  1  2  3    4  5  6  7
178
179               -----------  -----------
180Little-Endian |L0|L1|L2|00||R0|R1|R2|00|
181               -----------  -----------
182
183               -----------  -----------
184Big-Endian    |L2|L1|L0|00||R2|R1|R0|00|
185               -----------  -----------
186***************************************************************************/
187typedef enum NEXUS_AudioCaptureFormat
188{
189    NEXUS_AudioCaptureFormat_e16BitStereo,    /* Stereo, 16 bits per sample interleaved into a 32-bit word. */                                               
190    NEXUS_AudioCaptureFormat_e24BitStereo,    /* Stereo, 24 bits per sample.  The data is aligned to 32-bits,
191                                                 left-justified.  Left and right channels will interleave
192                                                 one sample per 32-bit word.  */
193    NEXUS_AudioCaptureFormat_e16BitMonoLeft,  /* Mono, 16 bits per sample interleaved into a 32-bit word. Left channel samples only. */
194    NEXUS_AudioCaptureFormat_e16BitMonoRight, /* Mono, 16 bits per sample interleaved into a 32-bit word. Right channel samples only. */
195    NEXUS_AudioCaptureFormat_e16BitMono,      /* Mono, 16 bits per sample interleaved into a 32-bit word. Left and Right channels mixed. */
196    NEXUS_AudioCaptureFormat_e24Bit5_1,       /* 5.1 Multichannel, 24 bits per sample.  The data is aligned to 32-bits,
197                                                 left-justified.  Channels will interleave
198                                                 one sample per 32-bit word, ordered L,R,Ls,Rs,C,LFE.  */
199    NEXUS_AudioCaptureFormat_eMax
200} NEXUS_AudioCaptureFormat;
201
202/***************************************************************************
203Summary:
204Audio Capture Channel Settings
205
206Description:
207Audio Capture Channel Settings.  Please note, some members may only be
208changed while the capture channel is disconnected from all inputs.
209***************************************************************************/
210typedef struct NEXUS_AudioCaptureSettings
211{
212    NEXUS_AudioCaptureFormat format;    /* Captured data format.  Default is 16bit stereo.
213                                           This value is ignored for compressed data, and
214                                           can not be changed while connected to any inputs. */
215} NEXUS_AudioCaptureSettings;
216
217/***************************************************************************
218Summary:
219Get Audio Capture Channel Settings
220***************************************************************************/
221void NEXUS_AudioCapture_GetSettings(
222    NEXUS_AudioCaptureHandle handle,
223    NEXUS_AudioCaptureSettings *pSettings /* [out] */
224    );
225
226/***************************************************************************
227Summary:
228Set Audio Capture Channel Settings
229***************************************************************************/
230NEXUS_Error NEXUS_AudioCapture_SetSettings(
231    NEXUS_AudioCaptureHandle handle,
232    const NEXUS_AudioCaptureSettings *pSettings
233    );
234
235/***************************************************************************
236Summary:
237Audio Capture Channel Start Settings
238
239Description:
240Audio Capture Channel Start Settings
241
242See Also:
243NEXUS_AudioCaptureStartSettings
244***************************************************************************/
245typedef struct NEXUS_AudioCaptureStartSettings
246{
247    NEXUS_CallbackDesc dataCallback;    /* Callback when data becomes available. User should call NEXUS_AudioCapture_GetBuffer.
248                                           You will not receive another callback until NEXUS_AudioCapture_GetBuffer is called. */
249} NEXUS_AudioCaptureStartSettings;
250
251/***************************************************************************
252Summary:
253Get current setting of the audio capture channel
254***************************************************************************/
255void NEXUS_AudioCapture_GetDefaultStartSettings(
256    NEXUS_AudioCaptureStartSettings *pSettings  /* [out] default settings */
257    );
258
259/***************************************************************************
260Summary:
261Start capturing data. 
262
263Decription:
264An input must be connected prior to starting.
265
266See Also:
267NEXUS_AudioCapture_Stop
268NEXUS_AudioCapture_GetConnector
269***************************************************************************/
270NEXUS_Error NEXUS_AudioCapture_Start(
271    NEXUS_AudioCaptureHandle handle,
272    const NEXUS_AudioCaptureStartSettings *pSettings
273    );
274
275/***************************************************************************
276Summary:
277Stop capturing data.
278***************************************************************************/
279void NEXUS_AudioCapture_Stop(
280    NEXUS_AudioCaptureHandle handle
281    );
282
283/***************************************************************************
284Summary:
285Get a pointer and size for the next location in the buffer that contains data
286
287Description:
288NEXUS_AudioCapture_GetBuffer is non-destructive. You can safely call it
289multiple times.
290***************************************************************************/
291NEXUS_Error NEXUS_AudioCapture_GetBuffer(
292    NEXUS_AudioCaptureHandle handle,
293    void **ppBuffer,    /* [out] attr{memory=cached} pointer to memory mapped
294                                 region that contains captured data. */
295    size_t *pSize       /* [out] total number of readable, contiguous bytes which the buffers are pointing to */
296    );
297
298/***************************************************************************
299Summary:
300Notify AudioCapture how much data removed from the buffer.
301
302Description:
303You can only call NEXUS_AudioCapture_ReadComplete once after a
304NEXUS_AudioCapture_GetBuffer call.  After calling it, you must call
305NEXUS_AudioCapture_GetBuffer before reading more data.
306***************************************************************************/
307NEXUS_Error NEXUS_AudioCapture_ReadComplete(
308    NEXUS_AudioCaptureHandle handle,
309    size_t amountWritten            /* The number of bytes read from the buffer */
310    );
311
312/* backward compatibility */
313#define NEXUS_AudioCapture_WriteComplete NEXUS_AudioCapture_ReadComplete
314
315/***************************************************************************
316Summary:
317Get an audio connector to attach this output to a source.
318
319Description:
320Capture may be connected to a stereo source device or a compressed source
321device, depending on the data format desired.
322**************************************************************************/
323NEXUS_AudioOutput NEXUS_AudioCapture_GetConnector( 
324    NEXUS_AudioCaptureHandle handle
325    );
326
327#ifdef __cplusplus
328}
329#endif
330#endif /* #ifndef NEXUS_AUDIO_CAPTURE_H__ */
331
Note: See TracBrowser for help on using the repository browser.