PDA

View Full Version : راهنمايي در استخراج بخش summary از فايل mp3



Answer
پنج شنبه 23 خرداد 1387, 16:50 عصر
با سلام
ميخواستم ببينم چطور ميشه نام artist و نام album رو از فايلهاي mp3 نمايش داد
اين قسمت ها در بخش summary فايلهاي mp3 ذخيره ميشوند.

behrooz
پنج شنبه 23 خرداد 1387, 22:34 عصر
زحمت ترجمه با خودت عزیز


The file info is not something Microsoft controls, but a feature they added to their OS to allow viewing this information. Every MP3-file contains an ID3-Tag, which is used to give information about artist, title, album, publishing year and genre about a song. The header is always 128 bytes long and is located at very end of the MP3-file.

The ID3-Tag structure is described as follows:

type
TID3Tag = packed record // 128 bytes
TAGID: array[0..2] of char; // 3 bytes: Must contain TAG
Title: array[0..29] of char; // 30 bytes: Song's title
Artist: array[0..29] of char; // 30 bytes: Song's artist
Album: array[0..29] of char; // 30 bytes: Song's album
Year: array[0..3] of char; // 4 bytes: Publishing year
Comment: array[0..29] of char; // 30 bytes: Comment
Genre: byte; // 1 byte: Genere-ID
end;

To read information about the ID3-Tag and display it in a dialog-box, try this function:

procedure TForm1.Button1Click(Sender: TObject);
const
FileName='G:\Mp3\Miscellaneous\ATC - Around The World.mp3';
var
id3tag: Tid3tag;
mp3file: Tfilestream;
begin
mp3file := Tfilestream.Create(FileName, fmOpenRead);
try
mp3file.Position := mp3file.size - 128; // jump to id3-tag
mp3file.Read(id3tag, SizeOf(id3tag));
showmessage(' Title: '+id3tag.title+#13+
' Artist: '+id3tag.artist+#13+
' Album: '+id3tag.album+#13+
' Year: '+id3tag.year+#13+
' Comment: '+id3tag.comment+#13+
' Genre-ID: '+inttostr(id3tag.genre)
);
finally
mp3file.free;
end;
end;

This function simply reads the file described as FileName, jumps to the last 128 bytes, reads it and display the informations in a dialog box.

You could also open the file for ReadWrite and modify this structure. Be careful or you may damage the file contents and the MP3 may no longer play.

WMA files must also have such a structure, but I'm not sure off hand. A Google search should find something though.

Randy

hp1361
پنج شنبه 28 دی 1391, 14:07 عصر
سلام

برای یک فایل فونت که نصب نشده آیا تگی وجود داره؟