<P><FONT face=宋体>interface</FONT></P>
<P><FONT face=宋体>uses<BR> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<BR> Dialogs, StdCtrls;</FONT></P>
<P><FONT face=宋体>type<BR> TID3Tag=packed record //128字节<BR> TAGID: array[0..2] of Char; //3字节:必须是TAG<BR> Title: array[0..29] of Char; //30字节:歌曲标题<BR> Artist: array[0..29] of Char; //30字节:歌曲的艺术家<BR> Album: array[0..29] of Char; //30字节:歌曲专辑<BR> Year: array[0..3] of Char; //4字节:出版年<BR> Comment: array[0..29] of Char; //30字节: 评论<BR> Genre: byte; //1 字节: 种类标识<BR> end; </FONT></P>
<P><FONT face=宋体> TForm1 = class(TForm)<BR> Button1: TButton;<BR> procedure Button1Click(Sender: TObject);<BR> private<BR> { Private declarations }<BR> public<BR> { Public declarations }<BR> end;</FONT></P>
<P><FONT face=宋体>var<BR> Form1: TForm1;</FONT></P>
<P><FONT face=宋体>implementation</FONT></P>
<P><FONT face=宋体>{$R *.dfm}</FONT></P>
<P><FONT face=宋体>function GetMp3TAG(const Mp3FileName:string):TID3Tag;<BR>var<BR> mp3file: TFileStream;<BR>begin<BR> mp3file:=TFileStream.create(Mp3FileName,$0000);<BR> try<BR> mp3file.Position:=mp3file.size-128; //跳到id3-tag<BR> mp3file.Read(Result,SizeOf(Result));<BR> finally<BR> mp3file.free;<BR> end;<BR>end;</FONT></P>
<P><FONT face=宋体>procedure TForm1.Button1Click(Sender: TObject);<BR> var <BR> m:TID3TAg;<BR>begin<BR> m:=GetMp3tag('E:\Music\MYLOVE\test.mp3');<BR> ShowMessage(m.Title+' '+m.Artist+' '+m.Album+' '+m.Year+' '+m.Comment);<BR>end;</FONT></P>
<P><FONT face=宋体>end.<BR></FONT></P>
Delphi中如何读取出MP3文件的信息
最新推荐文章于 2023-12-03 12:48:50 发布