📄 393.htm
字号:
<!-- saved from url=(0022)http://internet.e-mail -->
<html>
<head>
<title>从MP3文件中获得ID3-Tag(不使用组件) </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="inc.css">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="195434" alink="195434">
<table width="621" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="621"><a href="http://www.CoDelphi.com"><img src="images/logo.gif" border="0" width="153" height="60"><img src="images/bigbanner.gif" border="0" width="468" height="60"></a></td>
</tr>
</table><br>
<br>
<table width="621" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" valign="top" class="font9" height="155">
<div align="center" class="btitle">从MP3文件中获得ID3-Tag(不使用组件) <br>
<br>
</div>
<div align="center"><strong>Sebastian Volland </strong></div>
<b><br>
摘 要</b>:如何从MP3文件中获得ID3-Tag信息? (如歌曲标题、艺术<br>
<b> 关键字</b>:MP3 ID3 ID3-Tag <br>
<b> 类 别</b>:多媒体
<hr size="1" width="100%">
<span class="content"><br>每一个MP3文件包含有一个ID3-Tag头, 它用来提供艺术家、标题、专辑、出版年和歌曲流派等信息。这个头总是128字节长并位于MP3文件末尾。<br><br>ID3-Tag 结构是这样的: <br><br>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; <br><br>为读取ID3-Tag信息并在一个对话框中显示,试试这个函数: <br><br>procedure TForm1.Button1Click(Sender: TObject); <br>const<br> _mp3file='G:\Mp3\Miscellaneous\ATC - Around The World.mp3'; <br>var<br> id3tag: Tid3tag;<br> mp3file: Tfilestream; <br>begin<br> mp3file:=Tfilestream.create(_mp3file,fmOpenRead);<br> try<br> mp3file.position:=mp3file.size-128; // 跳到id3-tag<br> mp3file.Read(id3tag,SizeOf(id3tag));<br> showmessage(' Title: '+id3tag.title+#13+<br> ' Artist: '+id3tag.artist+#13+<br> ' Album: '+id3tag.album+#13+<br> ' Year: '+id3tag.year+#13+<br> ' Comment: '+id3tag.comment+#13+<br> ' Genre-ID: '+inttostr(id3tag.genre)<br> );<br> finally<br> mp3file.free;<br> end; <br>end; <br><br>这个函数读取_mp3file描述的文件,跳到倒数第128个字节,读取并在对话框中显示信息。</span>
<table border="0" cellspacing="0" cellpadding="1" class="font9" align="center" width="100%">
<tr align="left" valign="middle" bgcolor="195434">
<td height="1"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#C9C9C6" height="2"></td>
</tr>
</table>
<div align="center"><br>
中文开发在线<a href="http://www.codelphi.com" target="_blank">www.codelphi.com</a>授权使用。
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -