ENCODER_main.c File Reference


Detailed Description

This module provides encoder interface handle.

REVISION

Definition in file ENCODER_main.c.

#include "../SYSTEM/sys_hardware.h"
#include "../coder/coder.h"
#include "encoder.h"

Include dependency graph for ENCODER_main.c:

Include dependency graph

Go to the source code of this file.

Functions

int * ENCODER_main (void)
 Function fetches next available encoder input upon PCM data arrival.
BOOL ENCODER_getInputBuf (int **left, int **right)
 Function fetches next available encoder input buffer.
void ENCODER_putInputBuf (void)
 Function advances encoder input buffer.
void ENCODER_resetInputBuf (void)
 Function resets encoder input buffer.


Function Documentation

BOOL ENCODER_getInputBuf int **  left,
int **  right
 

Function fetches next available encoder input buffer.

Returns:
TRUE if buffer is available, otherwise FALSE.

Definition at line 74 of file ENCODER_main.c.

References st_PCM::encode.

Referenced by CODEC_linePcmGet(), CODEC_micPcmGet(), and CODEC_tunerPcmPut().

00075 {
00076     if( 0 == frameCounter )
00077     {
00078         pDstLeft  = Pcm.encode();
00079         pDstRight = pDstLeft + ENCODER_PIPE_FRAMELEN/2;
00080         if( NULL == pDstLeft )
00081         {
00082             // Second attempt failed, encoder can not keep up, 
00083             // out of sync.
00084             *left  = NULL;
00085             *right = NULL;
00086             return FALSE;
00087         }
00088         else frameCounter++;
00089     }
00090 
00091     *left = pDstLeft;
00092     *right = pDstRight; 
00093     return TRUE;
00094 }

int* ENCODER_main void   ) 
 

Function fetches next available encoder input upon PCM data arrival.

All encoders share this same pipe interface although they might use different sized pipes.

Returns:
Writable pipe frame if available, otherwise NULL.

Definition at line 44 of file ENCODER_main.c.

References Encoder, st_ENCODER::flag, st_ENCODER::pipe, PIPE_writeNext(), and SEM_coder.

Referenced by AUDIO_start().

00045 {
00046     PIPE_Obj *  pipe = &Encoder.pipe;
00047     
00048     if(Encoder.flag & ENC_PIPE_WRITENEXT_PENDING)
00049     {
00050         PIPE_writeNext(pipe);
00051         Encoder.flag &= ~ENC_PIPE_WRITENEXT_PENDING;
00052         
00053         if(SEM_count(SEM_coder) == 0) SEM_post(SEM_coder);
00054     }
00055     
00056     if( PIPE_writeFrameNum(pipe) )
00057     {
00058         Encoder.flag |= ENC_PIPE_WRITENEXT_PENDING;
00059         return pipe->WrFrame.Frame;
00060     }
00061     
00062     if(SEM_count(SEM_coder) == 0) SEM_post(SEM_coder);
00063     return NULL;    
00064 }

Here is the call graph for this function:


Generated on Wed Jan 19 01:12:56 2005 for neuros-firmware by  doxygen 1.3.9.1