Article View: borland.public.cppbuilder.multimedia
Article #1116Re: mpeg audio headers
From: Dave Richards
Date: Tue, 11 Dec 2001 17:57
Date: Tue, 11 Dec 2001 17:57
27 lines
1981 bytes
1981 bytes
"Adam Casperson" <casper2700@yahoo.com.au> wrote in message
news:3c13328e_1@dnews...
> Im having a lot of trouble trying to read mp3 file headers (its driving me
> nuts actually).
I know the feeling ... and sadly I don't think I have the answer to your
problem. The only comments I'd make are that it's not necessarily safe to
assume that the start of an MP3 file is aligned with a block and possibly
you could improve reliability by looking for the sync pulse in the stream
(although I'm not entirely sure).
I have a slight suspicion that the ExtractBinary routine doesn't do exactly
what you want (like it is leaving one more MSB on than you want (?) ). You
could do something altogether more elegant along the lines of:
// leastSig, mostSig are integers from 0 to 31 indicating the bit position
DWORD __fastcall TForm1::ExtractBinary(DWORD binary, int leastSig, int
mostSig)
{
unsigned long msb_mask = (1<<mostSig)-1;
unsigned long lsb_mask = (1<<leastSig)-1;
unsigned long data_mask = msb_mask & ~lsb_mask;
return (binary & data_mask) >> leastSig;
}
Dave.
Technical Details
Message-ID:
<3c164900_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub1.nntpserver.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3c13328e_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d0fc,3b37c3bd0be588af X-Google-Attributes: gid10d0fc,public X-Google-ArrivalTime: 2001-12-11 10:41:03 PST From: "Dave Richards" <dadeece@hotmail.com> Newsgroups: borland.public.cppbuilder.multimedia References: <3c13328e_1@dnews> Subject: Re: mpeg audio headers Date: Tue, 11 Dec 2001 17:57:19 -0000 Lines: 30 Organization: 1 Limited X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 212.18.230.146 Message-ID: <3c164900_1@dnews> X-Trace: dnews 1008093440 212.18.230.146 (11 Dec 2001 09:57:20 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub1.nntpserver.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews