DECODER__wma.c File Reference


Detailed Description

This module provides WMA decoder handle.

REVISION

Definition in file DECODER__wma.c.

#include "../SYSTEM/sys_hardware.h"
#include "../MESSAGE/message.h"
#include "../codec/codec.h"
#include "../coder/coder.h"
#include "../TISTD/wma_ti.h"
#include "decoder.h"

Include dependency graph for DECODER__wma.c:

Include dependency graph

Go to the source code of this file.

Functions

BOOL DECODER__wma (void)
 Function serves as the WMA decoder data output task handle.
BOOL DECODER__wmatask (void)
 Function serves as the WMA decoder task handle.


Function Documentation

BOOL DECODER__wma void   ) 
 

Function serves as the WMA decoder data output task handle.

Returns:
FALSE if more data is needed, otherwise TRUE; NOTE: this data ouput task always returns TRUE.

Definition at line 61 of file DECODER__wma.c.

References Audio, st_DECODER::averageWordRate, st_DECODER::decode, st_DECODER::decodeBitstrm, Decoder, st_DECODER::decrypt, st_DECODER::firstPacketOffset, st_DECODER::flag, st_DECODER::inputBitstrm, st_DECODER::pipe, PIPE_writeNext(), st_AUDIO::playtime, SAUDIOTIME_UPDT, and st_DECODER::status.

00062 {
00063     PIPE_Obj *      pipe = &Decoder.pipe;
00064     int             error = DECODE_NO_ERROR;
00065     ULONG           tmpUL;
00066     
00067     // Try to decode as long as output pipe is open.
00068     while( PIPE_writeFrameNum(pipe) ) 
00069     {       
00070         if ( Decoder.flag & (DEC_FFWD|DEC_FRWD) )
00071         {
00072             if(0== SEM_count(SEM_subcoder)) SEM_post(SEM_subcoder);
00073         }
00074 
00075         error = DECODE_decode(  Decoder.decode, 
00076                                 Decoder.decodeBitstrm, 
00077                                 (Int *)pipe->WrFrame.Frame );
00078         DECODE_getStatus(Decoder.decode, &Decoder.status);
00079         
00080         if (error == DECODE_NO_ERROR)
00081         {
00082             // no error, so output the data, prepare for the next write as well. 
00083             PIPE_writeNext(pipe);
00084             
00085             //if ( Decoder.status.bitRate ) 
00086             if(Decoder.averageWordRate)
00087             {
00088                 // (wordsize*2)/(bitrate/8)
00089                 //tmpUL = (wmadecode.startOfDataFileAdr-FIRST_PACKET_OFFSET)
00090                 //          /(Decoder.status.bitRate>>4); 
00091                 tmpUL = 0;
00092                 if(wmadecode.startOfDataFileAdr > Decoder.firstPacketOffset)
00093                     tmpUL = (wmadecode.startOfDataFileAdr-Decoder.firstPacketOffset)/
00094                             Decoder.averageWordRate;
00095                 if ( Audio.playtime != tmpUL )
00096                 {
00097                     Audio.playtime = tmpUL;
00098                     mMSG_send(sysMsgQ, SYS_MSG_ID, SAUDIOTIME_UPDT, DONTCARE, 0);
00099                 }
00100             }
00101             
00102         }
00103         else if(error == DECODE_ERROR)  
00104         {
00105             // Error, resync on the next call. Note that the output 
00106             // pipe frame is kept for next decoding attempt. 
00107             SCRYPT_reset(Decoder.decrypt);
00108             DECODE_reset(Decoder.decode);                   
00109             BITSTRM_reset(Decoder.inputBitstrm); 
00110         }
00111         else if(error == DECODE_NO_DATA)
00112         {
00113             if(0 == SEM_count(SEM_subcoder)) SEM_post(SEM_subcoder);
00114             break;
00115         }
00116     }   
00117     
00118     return TRUE;    
00119 }

Here is the call graph for this function:

BOOL DECODER__wmatask void   ) 
 

Function serves as the WMA decoder task handle.

Returns:
FALSE if more data is needed, otherwise TRUE;

Definition at line 129 of file DECODER__wma.c.

References Audio, st_DECODER::decodeBitstrm, Decoder, st_DECODER::flag, and st_AUDIO::offset.

Referenced by DECODER__wmainit().

00130 {
00131     // Try to decode as long as output buffer is available.
00132     while( sramPP_isWritable( &SRAMPP ) ) 
00133     {   
00134         BITSTRM_pack(Decoder.decodeBitstrm); 
00135         if ( Decoder.flag & (DEC_FFWD|DEC_MEDIASEEK) )
00136         {
00137             seekMode = 1;
00138             if(Decoder.flag & DEC_MEDIASEEK)
00139             {
00140                 g_ErrorRetryPos = Audio.offset<<1;
00141                 Decoder.flag &= ~DEC_MEDIASEEK;
00142             }
00143             else g_ErrorRetryPos += wmaFastFwdLen;
00144             Decoder.flag &= ~DEC_FFWD;
00145         }
00146         else if ( Decoder.flag & DEC_FRWD )
00147         {
00148             seekMode = -1;
00149             g_ErrorRetryPos -= wmaFastFwdLen;
00150             Decoder.flag &= ~DEC_FRWD;
00151         }
00152         WMA_task(); 
00153     }
00154     BITSTRM_pack(Decoder.decodeBitstrm); 
00155     return TRUE;
00156     
00157 }     


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