There are two structures: tmmioinfo and tmmckinfo.
Tmmioinfo is the status information after the multimedia file is opened. The second parameter of the mmioopen function is the pointer to this structure.
Now I first used tmmckinfo, which is the information of the "Block" in the file, which consists of the following:
Tmmckinfo = record ckid: fourcc; {block ID} cksize: DWORD; {block size} fcctype: fourcc; {format type ID} dwdataoffset: DWORD; {offset address} dwflags: DWORD; {Additional information} end;
To search for "blocks", you must use mmiodescend and mmioascend functions.
Mmioascend jumps out of the sub-block;
Mmiodescend is used to enter the child block. Entering the child block refers to the ckid and parent block information of the Child block;
Mmiodescend is also used to find the primary block (riff). You can find the primary block with little information.
TestCode:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses mmsystem; const filepath = 'C: \ windows \ media \ Windows XP start .wav '; // obtain the riff block information procedure tform1.button1click (Sender: tobject); var hfile: hmmio; ckiriff: tmmckinfo; begin // clear the ckiriff struct. Some functions must be cleared before use, even if they are not required. fillchar (ckiriff, sizeof (tmmckinfo), 0); {local variables have junk data before clearing} // open the file and obtain the handle hfile: = mmioopen (pchar (filepath ), nil, mmio_read); // obtain the information of the riff block mmiodescend (hfile, {file handle} @ ckiriff, {pointer to the block information structure, used to obtain block information} nil, {structure information of the parent block. Riff does not have a parent block, so you do not need to specify} mmio_findriff {if it is a subblock, the flag here is mmio_findchunk}); {0 indicates that the query is successful, verification is ignored here} // The following information is obtained for verification showmessagefmt ('% d, % d, % d', [ckiriff. ckid, ckiriff. cksize, ckiriff. fcctype, ckiriff. dwdataoffset, ckiriff. dwflags]); {1179011410,424 636, 1163280727, 8, 0} If ckiriff. ckid = fourcc_riff then showmessage ('yesriff'); If ckiriff. fcctype = mmiostringtofourcc ('wave ', 0) Then showmessage (' is a wave '); // close mmioclose (hfile, 0); end; // obtain the sub-block information procedure tform1.button2click (Sender: tobject); var hfile: hmmio; ckiriff, ckisub: tmmckinfo; N: integer; begin // clear the structure fillchar (ckiriff, sizeof (tmmckinfo), 0); fillchar (ckisub, sizeof (tmmckinfo), 0); hfile: = mmioopen (pchar (filepath), nil, mmio_read); // first obtain the information of the primary block (riff) mmiodescend (hfile, @ ckiriff, nil, mmio_findriff ); // obtain the FMT sub-block information ckisub. ckid: = mmiostringtofourcc ('fmt', 0); If mmiodescend (hfile, @ ckisub, @ ckiriff, expiration) = mmsyserr_noerror then begin showmessagefmt ('% d, % d, % d, % d, % d', [ckisub. ckid, ckisub. cksize, ckisub. fcctype, ckisub. dwdataoffset, ckisub. dwflags]); end; // if you want to continue searching, you need to jump out of the sub-block. The following will jump from offset 20 to 36 mmioascend (hfile, @ ckisub, 0 ); {The third parameter of ckisub is always 0, which is a standby parameter} // obtain the data sub-block information. ckid: = mmiostringtofourcc ('data', 0); If mmiodescend (hfile, @ ckisub, @ ckiriff, expiration) = mmsyserr_noerror then begin showmessagefmt ('% d, % d, % d, % d, % d', [ckisub. ckid, ckisub. cksize, ckisub. fcctype, ckisub. dwdataoffset, ckisub. dwflags]); end; mmioclose (hfile, 0); end.