REVISION
Definition in file ENCODER_config.c.
#include "../SYSTEM/sys_main.h"
#include "../SYSTEM/sys_hardware.h"
#include "../SYSTEM/sys_assert.h"
#include "../codec/codec.h"
#include "../coder/coder.h"
#include "../AUDIO/audio.h"
#include "../UI/ui.h"
#include "encoder.h"
Include dependency graph for ENCODER_config.c:

Go to the source code of this file.
Functions | |
| BOOL | ENCODER_config (ENC_TYPE eType) |
| Function configures the encoder module. | |
| void | ENCODER_releaseObj (void) |
| Function releases all encoder allocated objects. | |
| void | ENCODER_setSource (ES_SOURCE source) |
| Function sets up the encoder input source. | |
| ES_SOURCE | ENCODER_getSource (void) |
| Function returns the encoder input source. | |
| USHORT | ENCODER_getAudioMode (USHORT source) |
| Function returns current encoding audio mode. | |
| USHORT | ENCODER_getAudioFormat (void) |
| Function returns current encoding format. | |
Variables | |
| st_ENCODER | Encoder |
| Encoder globals. | |
| EncoderInputBitstream | eib = { 0, 0, 1, 0 } |
| encoder input bitstream data object. | |
| EncoderOutputBitstream | eob = { 0, 0, 1 } |
| encoder output bitstream data object. | |
|
|
Function configures the encoder module.
Definition at line 82 of file ENCODER_config.c. References st_CODER::cache, st_CODER::cacheInit, CODEC_recordHdlReset(), st_CODER::coder, st_ENCODER::encode, Encoder, ENCODER_getSource(), st_CODER::flag, st_ENCODER::flag, st_ENCODER::garbage, GEN_malloc(), st_CODER::init, st_CODER::media, st_CODER::mediaInit, st_ENCODER::mediaPipe, st_ENCODER::pipe, PIPE_init(), st_SYSPARAM::recQuality, SYS_die(), st_ENCODER::type, and WAV_RECQUALITY_INDEX. Referenced by AUDIO_config(). 00083 {
00084 Encoder.type = eType;
00085 Encoder.flag = 0;
00086
00087 Coder.cache = ENCODER_cache;
00088 Coder.cacheInit = ENCODER_cacheInit;
00089 Coder.mediaInit = ENCODER_mediaInit;
00090
00091 Encoder.garbage = THROW_AWAY_SAMPLES;
00092
00093 if(ENCMP3 == eType)
00094 {
00095 Coder.coder = ENCODER__mp3;
00096 Coder.media = ENCODER__mp3media;
00097 Coder.init = ENCODER__mp3first;
00098
00099 if((sram_frameQ = GEN_malloc(ENCODER_SRAM_BUFLEN)) == 0L)
00100 SYS_die(SYS_ENCODER_CONFIG);
00101 sram_frameNum = MAX_SRAM_QFRAME;
00102 sram_wrptr =
00103 sram_rdptr = 0;
00104
00105 switch(_getBitrateIndex())
00106 {
00107 case 0:
00108 sram_noiseFrameNum = (4000/5)/ENCODER_MEDIA_PIPE_FRAMELEN;
00109 break;
00110 case 1:
00111 sram_noiseFrameNum = (6000/5)/ENCODER_MEDIA_PIPE_FRAMELEN;
00112 break;
00113 case 2:
00114 sram_noiseFrameNum = (8000/5)/ENCODER_MEDIA_PIPE_FRAMELEN;
00115 break;
00116 case 3:
00117 sram_noiseFrameNum = (10000/5)/ENCODER_MEDIA_PIPE_FRAMELEN;
00118 break;
00119 }
00120
00121 mprFrameIdx = 0L;
00122 mprWordCounter = 0;
00123
00124 Encoder.encode.nested = 0;
00125 Encoder.encode.posted = 0;
00126 Encoder.encode.initialized = 0;
00127 Encoder.encode.pipeAllocated = 0;
00128
00129 Encoder.encode.play = 0;
00130 Encoder.encode.flush_len = 0;
00131 Encoder.encode.test = 0;
00132 Encoder.encode.data_start = 0;
00133 Encoder.encode.data_new = 0;
00134 Encoder.encode.data_len = 0;
00135 Encoder.encode.req_pending = 0;
00136
00137 /* tells encoder whether a record file is open. */
00138 Encoder.encode.record_file_open = 0;
00139
00140 /* tells encoder whether a record file is closed. */
00141 Encoder.encode.record_file_closed = 0;
00142
00143 /* tells encoder to close record file */
00144 Encoder.encode.close_record_file = 0;
00145
00146 Encoder.encode.bsi.avail = 0;
00147 Encoder.encode.bsi.sample_rate = SR_44KHZ;
00148 Encoder.encode.bsi.bit_rate = _getBitrateIndex();
00149 Encoder.encode.bsi.frame_size = 0;
00150
00151 #ifndef MONO
00152 Encoder.encode.bsi.no_of_channels = 2;
00153 #else
00154 Encoder.encode.bsi.no_of_channels = 1;
00155 #endif
00156
00157 Encoder.encode.src_in_buf_size = 0;
00158
00159 Encoder.encode.tx_buf_size = MMDRV_NUM_TXBUF_SAMPLES;
00160 Encoder.encode.quality = 2;
00161
00162 /*
00163 Encoder.encode.decode_out_buf_size = 0;
00164 Encoder.encode.fastfwd_chunk_size = 0;
00165 */
00166 }
00167
00168 #ifdef WAV_SUPPORT
00169 else
00170 {
00171 Coder.coder = ENCODER__wav;
00172 Coder.media = ENCODER__wavmedia;
00173 Coder.init = ENCODER__wavfirst;
00174
00175 wavrFrameIdx = 0L;
00176 wavrChNum = (ES_MIC == ENCODER_getSource())? 1:2;
00177
00178 if( (!SYS_isHDDpresent())&&(WAV_RECQUALITY_INDEX+2 == sysParam.recQuality) )
00179 {
00180 // Due file system overhead, we are not able to support 48KHz WAV
00181 // stereo recording into NAND flash.
00182 wavrChNum = 1;
00183 }
00184
00185 if((2==wavrChNum)&&(WAV_RECQUALITY_INDEX<sysParam.recQuality))
00186 {
00187 Coder.flag &= ~F_CODER_USE_CACHE;
00188 }
00189
00190 fsram_frameQ = &FakeSRAM[0];
00191 fsram_frameNum = MAX_FSRAM_QFRAME;
00192 fsram_wrptr =
00193 fsram_rdptr = 0;
00194 Encoder.encode.nested = 0;
00195 }
00196 #endif
00197
00198 if( PIPE_init(&Encoder.mediaPipe, ENCODER_MEDIA_PIPE_FRAMELEN, 4, 0, 0) == 0 )
00199 SYS_die(SYS_ENCODER_CONFIG2);
00200
00201 if( PIPE_init(&Encoder.pipe, ENCODER_PIPE_FRAMELEN, 2, 0, 0) == 0 )
00202 SYS_die(SYS_ENCODER_CONFIG4);
00203
00204 CODEC_recordHdlReset();
00205 return TRUE;
00206 }
|
Here is the call graph for this function:

|
|
Function returns current encoding format.
Definition at line 285 of file ENCODER_config.c. References st_SYSPARAM::recQuality. Referenced by UI_PSF_record(). 00286 {
00287 #ifdef WAV_SUPPORT
00288 if(sysParam.recQuality >= WAV_RECQUALITY_INDEX) return AF_WAV;
00289 #endif
00290 return AF_MP3;
00291 }
|
|
|
Function returns current encoding audio mode.
Definition at line 270 of file ENCODER_config.c. Referenced by UI_PSF_hisi(), and UI_PSF_record(). 00271 {
00272 if (ES_LINEIN == source) return AM_RECLINE;
00273 else if(ES_RADIO == source) return AM_RECFM;
00274 return AM_RECMIC;
00275 }
|
|
|
Function returns the encoder input source.
Definition at line 256 of file ENCODER_config.c. References st_CODER::encSource. Referenced by ENCODER__createWaveHeader(), ENCODER_config(), UI_PSF_hisidone(), and UI_PSF_recorddone(). 00257 {
00258 return (ES_SOURCE)Coder.encSource;
00259 }
|
|
|
Function sets up the encoder input source.
Definition at line 244 of file ENCODER_config.c. References st_CODER::encSource. Referenced by UI_PSF_hisi(), and UI_PSF_record(). 00245 {
00246 Coder.encSource = (USHORT)source;
00247 }
|
|
|
Encoder globals. Note that this global will be used by PCM SWIs, it has to be resident all the time. Definition at line 43 of file ENCODER_config.c. Referenced by ENCODER__mp3(), ENCODER__mp3first(), ENCODER__mp3media(), ENCODER__wav(), ENCODER__wavmedia(), ENCODER_config(), ENCODER_main(), ENCODER_putData(), and ENCODER_releaseObj(). |
1.3.9.1