source: svn/newcon3bcm2_21bu/nexus/modules/audio/7552/src/nexus_dts_encode.c

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

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

  • Property svn:executable set to *
File size: 6.9 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_dts_encode.c $
39* $brcm_Revision: 3 $
40* $brcm_Date: 3/1/11 7:25p $
41*
42* API Description:
43*   API name: DtsEncode
44*    Specific APIs related to DTS Audio Encoding
45*
46* Revision History:
47*
48* $brcm_Log: /nexus/modules/audio/7422_ape/src/nexus_dts_encode.c $
49*
50* 3   3/1/11 7:25p jgarrett
51* SW7422-146: Adding DTS/AC3 encoders
52*
53* 2   1/13/11 5:25p jgarrett
54* SW7422-146: Adding encoder hooks
55*
56* 1   1/10/11 3:26p jgarrett
57* SW7422-146: Adding full nexus API set
58*
59***************************************************************************/
60
61#include "nexus_audio_module.h"
62
63BDBG_MODULE(nexus_dts_encode);
64
65typedef struct NEXUS_AudioEncoder NEXUS_DtsEncode;
66
67/* This API is provided only for backward compatibility.  New codecs should only be added to NEXUS_AudioEncoder */
68
69void NEXUS_DtsEncode_GetDefaultSettings(
70    NEXUS_DtsEncodeSettings *pSettings   /* [out] default settings */
71    )
72{
73    /* No way to get codec specific defaults from PI, but the default is always to have spdif header generation enabled */
74    BDBG_ASSERT(NULL != pSettings);
75    BKNI_Memset(pSettings, 0, sizeof(*pSettings));
76    pSettings->spdifHeaderEnabled = true;
77}
78
79NEXUS_DtsEncodeHandle NEXUS_DtsEncode_Open( /* attr{destructor=NEXUS_DtsEncode_Close}  */
80    const NEXUS_DtsEncodeSettings *pSettings     /* Pass NULL for default settings */
81    )
82{
83    NEXUS_AudioEncoderSettings encoderSettings;
84    NEXUS_AudioEncoderCodecSettings codecSettings;
85    NEXUS_AudioEncoderHandle handle;
86    NEXUS_Error errCode;
87
88    NEXUS_AudioEncoder_GetDefaultSettings(&encoderSettings);
89    encoderSettings.codec = NEXUS_AudioCodec_eDts;
90    handle = NEXUS_AudioEncoder_Open(&encoderSettings);
91    if ( NULL == handle )
92    {
93        (void)BERR_TRACE(BERR_NOT_SUPPORTED);
94        return NULL;
95    }
96
97    if ( pSettings != NULL )
98    {
99        NEXUS_AudioEncoder_GetCodecSettings(handle, NEXUS_AudioCodec_eDts, &codecSettings);
100        BKNI_Memcpy(&codecSettings.codecSettings.dts, pSettings, sizeof(NEXUS_DtsEncodeSettings));
101        errCode = NEXUS_AudioEncoder_SetCodecSettings(handle, &codecSettings);
102        if ( errCode )
103        {
104            (void)BERR_TRACE(errCode);
105            NEXUS_AudioEncoder_Close(handle);
106            return NULL;
107        }
108    }
109
110    return (NEXUS_DtsEncodeHandle)handle;
111}
112
113void NEXUS_DtsEncode_Close(
114    NEXUS_DtsEncodeHandle handle
115    )
116{
117    NEXUS_AudioEncoder_Close((NEXUS_AudioEncoderHandle)handle);
118}
119
120void NEXUS_DtsEncode_GetSettings(
121    NEXUS_DtsEncodeHandle handle,
122    NEXUS_DtsEncodeSettings *pSettings    /* [out] Settings */
123    )
124{
125    NEXUS_AudioEncoderCodecSettings codecSettings;
126
127    NEXUS_AudioEncoder_GetCodecSettings((NEXUS_AudioEncoderHandle)handle, NEXUS_AudioCodec_eDts, &codecSettings);
128    BKNI_Memcpy(pSettings, &codecSettings.codecSettings.dts, sizeof(NEXUS_DtsEncodeSettings));
129}
130
131NEXUS_Error NEXUS_DtsEncode_SetSettings(
132    NEXUS_DtsEncodeHandle handle,
133    const NEXUS_DtsEncodeSettings *pSettings
134    )
135{
136    NEXUS_AudioEncoderCodecSettings codecSettings;
137    NEXUS_Error errCode;
138
139    NEXUS_AudioEncoder_GetCodecSettings((NEXUS_AudioEncoderHandle)handle, NEXUS_AudioCodec_eDts, &codecSettings);
140    BKNI_Memcpy(&codecSettings.codecSettings.dts, pSettings, sizeof(NEXUS_DtsEncodeSettings));
141    errCode = NEXUS_AudioEncoder_SetCodecSettings((NEXUS_AudioEncoderHandle)handle, &codecSettings);
142    if ( errCode )
143    {
144        return BERR_TRACE(errCode);
145    }
146    return BERR_SUCCESS;
147}
148
149NEXUS_AudioInput NEXUS_DtsEncode_GetConnector( /* attr{shutdown=NEXUS_AudioInput_Shutdown} */
150    NEXUS_DtsEncodeHandle handle
151    )
152{
153    return NEXUS_AudioEncoder_GetConnector((NEXUS_AudioEncoderHandle)handle);
154}
155
156NEXUS_Error NEXUS_DtsEncode_AddInput(
157    NEXUS_DtsEncodeHandle handle,
158    NEXUS_AudioInput input
159    )
160{
161    NEXUS_Error errCode;
162
163    errCode = NEXUS_AudioEncoder_AddInput((NEXUS_AudioEncoderHandle)handle, input);
164    if ( errCode )
165    {
166        return BERR_TRACE(errCode);
167    }
168    return BERR_SUCCESS;
169}
170
171NEXUS_Error NEXUS_DtsEncode_RemoveInput(
172    NEXUS_DtsEncodeHandle handle,
173    NEXUS_AudioInput input
174    )
175{
176    NEXUS_Error errCode;
177
178    errCode = NEXUS_AudioEncoder_RemoveInput((NEXUS_AudioEncoderHandle)handle, input);
179    if ( errCode )
180    {
181        return BERR_TRACE(errCode);
182    }
183    return BERR_SUCCESS;
184}
185
186NEXUS_Error NEXUS_DtsEncode_RemoveAllInputs(
187    NEXUS_DtsEncodeHandle handle
188    )
189{
190    NEXUS_Error errCode;
191
192    errCode = NEXUS_AudioEncoder_RemoveAllInputs((NEXUS_AudioEncoderHandle)handle);
193    if ( errCode )
194    {
195        return BERR_TRACE(errCode);
196    }
197    return BERR_SUCCESS;
198}
199
200
Note: See TracBrowser for help on using the repository browser.