mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1003 B
49 lines
1003 B
/*
|
|
riff.c
|
|
|
|
This module contains functions which deal with RIFF files
|
|
|
|
*/
|
|
|
|
#include <windows.h>
|
|
#include <mmsystem.h>
|
|
#include "sbtest.h"
|
|
|
|
BOOL IsRiffWaveFormat(PUCHAR pView)
|
|
{
|
|
PRIFFHDR pHdr;
|
|
|
|
pHdr = (PRIFFHDR) pView;
|
|
|
|
// validate it's a wave file
|
|
|
|
if ((pHdr->rifftag != ckidRIFF)
|
|
|| (pHdr->wavetag != ckidWAVE)) {
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
PUCHAR FindRiffChunk(PULONG pChunkSize, PUCHAR pView, FOURCC Tag)
|
|
{
|
|
PRIFFHDR pHdr;
|
|
PRIFFCHUNKHDR pChHdr;
|
|
FOURCC ChTag;
|
|
ULONG Size;
|
|
|
|
pHdr = (PRIFFHDR) pView;
|
|
Size = pHdr->Size;
|
|
pView += sizeof(RIFFHDR); // point to the first chunk
|
|
while (Size) {
|
|
pChHdr = (PRIFFCHUNKHDR) pView;
|
|
ChTag = pChHdr->rifftag;
|
|
if (ChTag == Tag) {
|
|
*pChunkSize = pChHdr->Size;
|
|
return pView + sizeof(RIFFCHUNKHDR);
|
|
}
|
|
pView += pChHdr->Size + sizeof(RIFFCHUNKHDR);
|
|
Size -= (pChHdr->Size + sizeof(RIFFCHUNKHDR));
|
|
}
|
|
return NULL;
|
|
}
|