a few checks and fixes
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5735 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
228c585f82
commit
a665f2f9e1
@ -75,12 +75,27 @@ auReader::Sniff(int32 *streamCount)
|
||||
TRACE(" sampling_rate %ld\n", UINT32(header.sampling_rate));
|
||||
TRACE(" channel_count %ld\n", UINT32(header.channel_count));
|
||||
|
||||
fDataStart = 28 + UINT32(header.data_start);
|
||||
fDataStart = UINT32(header.data_start);
|
||||
fDataSize = UINT32(header.data_size);
|
||||
fChannelCount = UINT32(header.channel_count);
|
||||
fFrameRate = UINT32(header.sampling_rate);
|
||||
fFormatCode = UINT32(header.data_format);
|
||||
|
||||
if (fDataStart > filesize) {
|
||||
TRACE("auReader::Sniff: data start too large\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
if (fDataStart + fDataSize > filesize)
|
||||
fDataSize = filesize - fDataStart;
|
||||
if (fDataSize < 1) {
|
||||
TRACE("auReader::Sniff: data size too small\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
if (fChannelCount < 1)
|
||||
fChannelCount = 1;
|
||||
if (fFrameRate < 1)
|
||||
fFrameRate = 44100;
|
||||
|
||||
switch (fFormatCode) {
|
||||
case SND_FORMAT_UNSPECIFIED: TRACE("SND_FORMAT_UNSPECIFIED\n"); break;
|
||||
case SND_FORMAT_MULAW_8: TRACE("SND_FORMAT_MULAW_8\n"); break;
|
||||
|
Loading…
Reference in New Issue
Block a user