几年前读大一的时候搞过,Very麻烦.需要对文件格式Very了解.MPV实际上是没有声音的mpg文件:
/////////////////////////////////////////////////////////////////////////////////
//START CODE DEFINE
/////////////////////////////////////////////////////////////////////////////////
const SEQUENCE_HEADER_START_CODE =$000001B3;
const SEQUENCE_END_CODE =$000001B7;
const GROUP_START_CODE =$000001B8;
const ISO_11172_END_CODE =$000001B9;
const PACK_START_CODE =$000001BA;
const SYSTEM_HEADER_START_CODE =$000001BB;
const PADDING_START_CODE =$000001BE;
const MPEG_AUDIO_STREAM_0 =$000001C0;
const MPEG_VIDEO_STREAM_0 =$000001E0;
/////////////////////////////////////////////////////////////////////////////////
//RIFF/CDXA CODE DEFINE
/////////////////////////////////////////////////////////////////////////////////
const CDXA_SECTOR_SIZE =$930;
const CDXA_SECTOR_START_CODE :TGUID=
(D1:$FFFFFF00;
D2:$FFFF;
D3:$FFFF;
D4: ($FF, $FF, $FF, $00, $00, $00, $00, $00 ));
/////////////////////////////////////////////////////////////////////////////////
//MPEG1 AUDIO BIT RATE DEFINE
/////////////////////////////////////////////////////////////////////////////////
MPEG1LAYER1:array[0..14] of DWORD =(0,32,64,96,128,160,192,224,256,288,320,352,384,416,448);
MPEG1LAYER2:array[0..14] of DWORD =(0,32,48,56,64,80,96,112,128,160,192,224,256,320,384);
MPEG1LAYER3:array[0..14] of DWORD =(0,32,40,48,56,64,80,96,112,128,160,192,224,256,320);
1
ACK_START_CODE===>MPG
2:SEQUENCE_HEADER_START_CODE===>MPV
3:'RIFF'+4(#20)+ 'CDXA'=DAT
then
//Parse RIFF/CDXA Header
begin
Inc(dwCount, 4);
//"RIFF"
Inc(dwCount, 4);
//File Size
Inc(dwCount, 4);
//"CDXA"
Inc(dwCount, 4);
//"fmt "
dwSize :=(pData + dwCount);
Inc(dwCount, 4);
//Header Size
Inc(dwCount, dwSize);
//Size body
Inc(dwCount, 4);
//"data"
dwSize := GetDWORD(pData + dwCount);
Inc(dwCount, 4);
//data_size
....