citing Lam Yick Yan superylam@netscape.net:
Hi,
The problem is there are a lot of junk before the stream begin,
and there is so many consecutive 12 or 11 1's in the program ( for those who dont understand what I mean, please see document of mpeg header). I have trouble determining the begin of of MP3 stream!! Some decoder does not have this ability and I must tell it the begin of MP3 stream.
Can any one point out where I can find the C/C++ source code
to do that?
There's a possibility to find out the correct sync start of the mp3 file. Just search your stream for the first occurence of the 0xff byte, then try to decode the header with mad_header_decode(). If it returns -1, the header was not a valid one. It still might be, that a successfully decoded frame header might not be the real one.
If you want to look at some source, look at: http://cvs.sourceforge.net/cgi- bin/viewcvs.cgi/winlame/winlame/source/winlame/encoder/wlMadMpegInputModule.cpp
I just recently built the detection of valid MPEG frames into winLAME.
bye Michael