DECODER__mp3first.c File Reference


Detailed Description

This module provides function to set up mp3 decoder data input.

REVISION

Definition in file DECODER__mp3first.c.

#include "../SYSTEM/sys_hardware.h"
#include "../codec/codec.h"
#include "../coder/coder.h"
#include "decoder.h"

Include dependency graph for DECODER__mp3first.c:

Include dependency graph

Go to the source code of this file.

Functions

BOOL DECODER__mp3first (void)
 Function check to set up mp3 decoder input bit stream.


Function Documentation

BOOL DECODER__mp3first void   ) 
 

Function check to set up mp3 decoder input bit stream.

Returns:
TRUE if valid MP3 sync is found, otherwise FALSE.

Definition at line 37 of file DECODER__mp3first.c.

References Audio, st_DECODER::averageWordRate, st_DECODER::decodeBitstrm, Decoder, DECODER__mp3(), st_AUDIO::duration, st_AUDIO::file, st_DECODER::firstPacketOffset, st_DECODER::flag, st_AUDIO::fptr, st_AUDIO::offset, st_PCM::sampleRate, File::size, and st_DECODER::status.

00038 {
00039     USHORT    strmLen;
00040     //USHORT *  pDst;
00041     
00042     /* Locate first available frame sync. */
00043     //while(1)
00044     {       
00045         /* This will cause potential reentry problem in media task!     
00046         BITSTRM_pack(Decoder.inputBitstrm);
00047         strmLen = BITSTRM_numWordsFree(Decoder.inputBitstrm);       
00048         pDst = (unsigned short *)BITSTRM_writePtr(Decoder.inputBitstrm);
00049         strmLen = DECODER_getData((int*)pDst, strmLen);
00050         
00051         // Is data available?
00052         if(strmLen == 0) break;
00053         
00054         // Add to decoder bitstream object.
00055         BITSTRM_add(Decoder.inputBitstrm, strmLen);  
00056         */
00057         
00058         BITSTRM_pack(Decoder.decodeBitstrm);
00059         strmLen = BITSTRM_numDataWords(Decoder.decodeBitstrm); 
00060         if(strmLen > 32)
00061         {
00062             if( DECODER__mp3findSync(&Decoder, 0) == 0 ) 
00063             {
00064                 PCM_samplerateChanged();
00065                 Pcm.sampleRate = Decoder.status.sampleRate;
00066                 // Initialize status frameSize, which will then be used
00067                 // in DECODER__mp3 to determine if enough data is
00068                 // available in input bitstream.
00069                 Decoder.status.frameSize = MAX_INPUT_FRAME_SIZE;
00070                 mp3FastFwdLen = 5L*Decoder.status.bitRate>>4;
00071                 
00072                 BITSTRM_pack(Decoder.decodeBitstrm); 
00073                 strmLen = BITSTRM_numDataWords(Decoder.decodeBitstrm); 
00074                 Decoder.firstPacketOffset = Audio.fptr - strmLen;
00075                 
00076                 Decoder.averageWordRate = 
00077                     (Audio.file.size-Decoder.firstPacketOffset)/(Audio.duration+1);
00078                 if(0 == Decoder.averageWordRate) 
00079                     Decoder.averageWordRate = Decoder.status.bitRate>>4;
00080                 
00081                 if(Audio.offset)
00082                 {
00083                     Decoder.flag |= DEC_FFWD|DEC_MEDIASEEK;
00084                     DECODER__mp3();
00085                 }
00086                 return TRUE;
00087             }
00088         }
00089     }   
00090     // Return FALSE if sync is not found, coder will keep calling this routine
00091     // until sync is found or media has been gone through completely.
00092     return FALSE;
00093 }

Here is the call graph for this function:


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