unit Unit1mp3tag;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TID3Tag=packed record //128字节
TAGID: array[0..2] of Char; //3字节:必须是TAG
Title: array[0..29] of Char; //30字节:歌曲标题
Artist: array[0..29] of Char; //30字节:歌曲的艺术家
Album: array[0..29] of Char; //30字节:歌曲专辑
Year: array[0..3] of Char; //4字节:出版年
Comment: array[0..29] of Char; //30字节: 评论
Genre: byte; //1 字节: 种类标识
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetMp3TAG(const Mp3FileName:string):TID3Tag;
var
mp3file: TFileStream;
begin
mp3file:=TFileStream.create(Mp3FileName,$0000);
try
mp3file.Position:=mp3file.size-128; //跳到id3-tag
mp3file.Read(Result,SizeOf(Result));
finally
mp3file.free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
m:TID3TAg;
begin
m:=GetMp3tag('E:\Music\MYLOVE\test.mp3');
ShowMessage(m.Title+' '+m.Artist+' '+m.Album+' '+m.Year+' '+m.Comment);
end;
end.
迅雷专用高速下载