source: svn/newcon3bcm2_21bu/nexus/modules/audio/7552/include/nexus_audio_playback.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.0 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_playback.h $
39* $brcm_Revision: 8 $
40* $brcm_Date: 4/22/11 10:43a $
41*
42* API Description:
43*   API name: AudioPlayback
44*    Specific APIs related to PCM audio playback.  This supports playback
45*    of data from memory.  It can be routed either to a mixer or directly
46*    to output devices.
47*
48* Revision History:
49*
50* $brcm_Log: /nexus/modules/audio/7400/include/nexus_audio_playback.h $
51*
52* 8   4/22/11 10:43a erickson
53* SW7420-1148: remove attr{shutdown=NEXUS_AudioInput_Shutdown}
54*
55* 7   12/14/10 3:18p erickson
56* SW7420-1285: add null_allowed attribute
57*
58* 6   10/4/10 4:09p jgarrett
59* SW7400-2848: Merge to main branch
60*
61* SW7400-2848/2   10/4/10 3:18p mward
62* SW7400-2848: SW7420-934: rename NEXUS_AudioPlayback_ReadComplete to
63*  NEXUS_AudioPlayback_WriteComplete
64*
65* 5   8/10/10 3:10p erickson
66* SW7420-934: rename NEXUS_AudioPlayback_ReadComplete to
67*  NEXUS_AudioPlayback_WriteComplete
68*
69* SW7400-2848/1   7/22/10 4:18p jgarrett
70* SW7400-2848: Adding option for runtime sample rate adjustment and loop
71*  around
72*
73* 4   8/31/09 3:23p jgarrett
74* SW7405-2706: Merging playback flush to main branch
75*
76* PR56656/1   8/19/09 4:53p jgarrett
77* PR 56656: Adding playback flush
78*
79* 3   5/14/09 9:46a jgarrett
80* PR 53780: Adding startThreshold
81*
82* PR53780/1   4/16/09 4:46p jgarrett
83* PR 53780: Adding startThreshold
84*
85* 2   6/19/08 3:17p jgarrett
86* PR 42243: Moving input volume control to specific inputs and out of
87*  mixer
88*
89* 1   3/11/08 4:38p jgarrett
90* pr 39983: Adding audio playback support
91*
92***************************************************************************/
93#ifndef NEXUS_AUDIO_PLAYBACK_H__
94#define NEXUS_AUDIO_PLAYBACK_H__
95
96#include "nexus_types.h"
97#include "nexus_audio_types.h"
98#include "nexus_timebase.h"
99
100/*=************************************
101Interface: AudioPlayback
102
103Header file: nexus_audio_playback.h
104
105Module: Audio
106
107Description: Playback audio PCM data
108
109**************************************/
110
111#ifdef __cplusplus
112extern "C" {
113#endif
114
115/***************************************************************************
116Summary:
117Handle for audio playback
118***************************************************************************/
119typedef struct NEXUS_AudioPlayback *NEXUS_AudioPlaybackHandle;
120
121/***************************************************************************
122Summary:
123Audio Playback Open Settings
124
125Description:
126Audio Playback Open Settings
127
128See Also:
129NEXUS_AudioPlaybackSettings
130***************************************************************************/
131typedef struct NEXUS_AudioPlaybackOpenSettings
132{
133    size_t fifoSize;        /* FIFO size in bytes */
134    size_t threshold;       /* FIFO data callback threshold in bytes.  When the amount of data
135                               remaining in the FIFO drops below this level, the dataCallback
136                               routine provided in NEXUS_AudioPlaybackSettings will be called.
137                               If this value is 0, a default threshold percentage will be used. */
138} NEXUS_AudioPlaybackOpenSettings;
139
140/***************************************************************************
141Summary:
142Get default settings for an audio playback channel
143***************************************************************************/
144void NEXUS_AudioPlayback_GetDefaultOpenSettings(
145    NEXUS_AudioPlaybackOpenSettings *pSettings      /* [out] default settings */
146    );
147
148/***************************************************************************
149Summary:
150Open an audio playback channel
151***************************************************************************/
152NEXUS_AudioPlaybackHandle NEXUS_AudioPlayback_Open(     /* attr{destructor=NEXUS_AudioPlayback_Close}  */
153    unsigned index,
154    const NEXUS_AudioPlaybackOpenSettings *pSettings    /* attr{null_allowed=y} */
155    );
156
157/***************************************************************************
158Summary:
159Close an audio playback channel
160***************************************************************************/
161void NEXUS_AudioPlayback_Close(
162    NEXUS_AudioPlaybackHandle handle
163    );
164
165/***************************************************************************
166Summary:
167Settings of an audio playback channel
168***************************************************************************/
169typedef struct NEXUS_AudioPlaybackStartSettings
170{
171    NEXUS_Timebase timebase;
172    unsigned sampleRate;                /* In Hz.  Pass 0 to use the value in NEXUS_AudioPlaybackSettings.sampleRate instead. */
173    unsigned bitsPerSample;             /* Currently supports 8 and 16. */
174    size_t startThreshold;              /* Starting threshold in bytes.  If set, the hardware will wait until the number of bytes
175                                           specified has been buffered before starting to consume the data. */
176    bool stereo;                        /* If true, data will be treated as stereo data.  If false, data will be treated as mono. */
177    bool signedData;                    /* If true, data will be treated as signed.  If false, data will be treated as unsigned. */
178    bool loopAround;                    /* If true, the buffer will loop around when empty instead of outputting zero samples. */
179    NEXUS_CallbackDesc dataCallback;    /* Callback when space becomes available. User should call NEXUS_AudioPlayback_GetBuffer.
180                                           You will not receive another callback until NEXUS_AudioPlayback_GetBuffer is called. */
181} NEXUS_AudioPlaybackStartSettings;
182
183/***************************************************************************
184Summary:
185Get default settings for an audio playback channel
186***************************************************************************/
187void NEXUS_AudioPlayback_GetDefaultStartSettings(
188    NEXUS_AudioPlaybackStartSettings *pSettings  /* [out] Default Settings */
189    );
190
191/***************************************************************************
192Summary:
193Start playing data data from an audio playback channel
194***************************************************************************/
195NEXUS_Error NEXUS_AudioPlayback_Start(
196    NEXUS_AudioPlaybackHandle handle,
197    const NEXUS_AudioPlaybackStartSettings *pSettings
198    );
199
200/***************************************************************************
201Summary:
202Stop playing data from an audio playback channel.
203
204Description:
205This will stop the channel and flush all data from the FIFO.
206***************************************************************************/
207void NEXUS_AudioPlayback_Stop(
208    NEXUS_AudioPlaybackHandle handle
209    );
210
211/***************************************************************************
212Summary:
213Flush all data from the playback FIFO.
214
215Description:
216This will flush all data from the FIFO without stopping the channel.
217***************************************************************************/
218void NEXUS_AudioPlayback_Flush(
219    NEXUS_AudioPlaybackHandle handle
220    );
221
222/***************************************************************************
223Summary:
224Get a pointer and size for the next location in the buffer which can accept data
225
226Description:
227NEXUS_AudioPlayback_GetBuffer is non-destructive. You can safely call it multiple times.
228***************************************************************************/
229NEXUS_Error NEXUS_AudioPlayback_GetBuffer(
230    NEXUS_AudioPlaybackHandle handle,
231    void **pBuffer, /* [out] attr{memory=cached} pointer to memory mapped region that is ready for playback data */
232    size_t *pSize   /* [out] total number of writeable, contiguous bytes which buffer is pointing to */
233    );
234
235/***************************************************************************
236Summary:
237Notify AudioPlayback how much data was added into the buffer.
238
239Description:
240You can only call NEXUS_AudioPlayback_WriteComplete once after a
241NEXUS_AudioPlayback_GetBuffer call.  After calling it, you must call
242NEXUS_AudioPlayback_GetBuffer before adding more data.
243***************************************************************************/
244NEXUS_Error NEXUS_AudioPlayback_WriteComplete(
245    NEXUS_AudioPlaybackHandle handle,
246    size_t amountWritten            /* The number of bytes written to the buffer */
247    );
248
249/* backward compatibility */
250#define NEXUS_AudioPlayback_ReadComplete NEXUS_AudioPlayback_WriteComplete
251
252/***************************************************************************
253Summary:
254Audio playback status
255***************************************************************************/
256typedef struct NEXUS_AudioPlaybackStatus
257{
258    NEXUS_AudioPlaybackStartSettings startSettings;
259    bool started;
260    size_t queuedBytes;
261    size_t fifoSize;
262    size_t playedBytes;
263} NEXUS_AudioPlaybackStatus;
264
265/***************************************************************************
266Summary:
267Get current status of the audio playback channel
268***************************************************************************/
269void NEXUS_AudioPlayback_GetStatus(
270    NEXUS_AudioPlaybackHandle handle,
271    NEXUS_AudioPlaybackStatus *pStatus      /* [out] Current Status */
272    );
273
274/***************************************************************************
275Summary:
276Audio playback settings
277***************************************************************************/
278typedef struct NEXUS_AudioPlaybackSettings
279{
280    int32_t leftVolume;         /* Linear volume level of left channel output */
281    int32_t rightVolume;        /* Linear volume level of right channel output */
282    bool muted;
283    unsigned sampleRate;        /* In Hz.  This value is ignored unless
284                                   NEXUS_AudioPlaybackStartSettings.sampleRate is
285                                   set to 0. */
286} NEXUS_AudioPlaybackSettings;
287
288/***************************************************************************
289Summary:
290Get current setting of the audio playback channel
291***************************************************************************/
292void NEXUS_AudioPlayback_GetSettings(
293    NEXUS_AudioPlaybackHandle handle,
294    NEXUS_AudioPlaybackSettings *pSettings  /* [out] Current settings */
295    );
296
297/***************************************************************************
298Summary:
299Set current setting of the audio playback channel
300***************************************************************************/
301NEXUS_Error NEXUS_AudioPlayback_SetSettings(
302    NEXUS_AudioPlaybackHandle handle,
303    const NEXUS_AudioPlaybackSettings *pSettings
304    );
305
306/***************************************************************************
307Summary:
308Get an audio connector for use with downstream components.
309**************************************************************************/
310NEXUS_AudioInput NEXUS_AudioPlayback_GetConnector(
311    NEXUS_AudioPlaybackHandle handle
312    );
313
314#ifdef __cplusplus
315}
316#endif
317
318#endif /* #ifndef NEXUS_AUDIO_PLAYBACK_H__ */
Note: See TracBrowser for help on using the repository browser.