ID3 v1 tag 

ID3v1_fig.jpg

通常加在mp3檔案的最尾端, 總長度為128 bytes, 結構可以細分成以下幾個部分:  

(1) identifier (3 bytes): "TAG"

(2) Song Title (30 bytes): 歌曲名稱

(3) Artist (30 bytes): 演唱者

(4) Album (30 bytes): 專輯名稱

(5) Year (4 bytes): 年份 

(6)Comment (30 bytes): 備註

(7) Genre (1 byte): 曲風 ; 用0~79來表示 

 

我們只要分析mp3檔案尾端最後128bytes, 驗證該起始點是否帶有3 bytes大小的identifier "TAG", 就可以知道這個檔案是否帶有 ID3v1 tag. 確認TAG之後,可依照 ID3v1 的固定格式,建立結構體,再依序存取個別欄位輸出資料.

#include <stdio.h> 

 

struct ID3v1{

                       char identifier[3];

                       char title [30];

                       char artist[30]; 

                       char album[30];

                       int year[4];  

                       char comment[30];

                       int genre[1];

} arr;

 

int main (void){

     FILE *fp;

     fp=fopen("XX.mp3","r");

     fseek(fp,128,SEEK_END);

     fread(&arr ,sizeof(Struct ID3v1),fp);

     printf(........................

     .

     .

     .

     .

     fclose(fp);

}

 

 ID3v1_all.jpg


參考資料:

創作者介紹
創作者 我是威瑪吳 你好~ 的頭像
FivePlusOne

我是威瑪吳 你好~

FivePlusOne 發表在 痞客邦 留言(0) 人氣( 23 )