id3.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 98 行

H
98
字号
/*********************************************************************
**  Copyright (C) 1999 Amlogic,Inc.                                	**
**  All rights reserved                                            	**
**		Filename: ID3.c     										**
**		Revision: 1.0                                           	**
**		Purpos	: Get MP3's tag(ID3)		                      	**
**		Author	: LiChao	10/15/2002/								**
*********************************************************************/
#ifndef	__ID3__
#define __ID3__

#define MAX_SEEK_SECTOR 2
#define SECTOR_SIZE 	2048
#define MAX_SEEK_LENGTH	4096  /*MAX_SEEK_SECTOR * SECTOR_SIZE */

#define ID3V2_TITLE 	0
#define ID3V2_ARTIST 	1
#define ID3V2_ALBUM		2
#define ID3V2_YEAR		3
#define ID3V2_COMMENT	4
#define ID3V2_GENRE		5

#define	ID3V2_FLAG_UNSYN	128
#define ID3V2_FLAG_EXN_HEAD	64
#define ID3V2_FLAG_EXP		32

#define FRAME_FLAG_COMPRESS	128 
#define FRAME_FLAG_ENCRY	64
#define FRAME_FLAG_GROUP	32

#define ID3V1_LENGTH		128

typedef struct{
		char 	ID3v2_ID[3] ;
		char	ID3v2_version[2];
		char	ID3v2_flag;
		char	ID3v2_size[4]; /* 4*%0xxxxxxx */
	} ID3v2_header_def ;
	
typedef struct{
		char			frame_ID[4];
		char 			frame_size[4] ;
		char			status_flag ;
		char			encode_falg ;
	} ID3v2_frame_header_def ;

typedef struct{
		char	tag[3] ;
		char	title[30] ;
		char	artist[30] ;
		char	album[30] ;
		char	year[4] ;
		char	comment[30] ; /*ID3 version 1.0's comment length is 30;version 1.1's comment length is 28,another two byte one is NULL and another is track value */
		char	genre ;
	} ID3v1_def ;		

typedef struct{
		char	title[30] ;
		char	artist[30] ;
		char	album[64] ;
		char	year[5] ;
		char	comment[128] ;
		char	track ;
		char	genre[3] ;
	} ID3_Tag ;

/* Type of song ; Genre value*/
#define GENRE_NUM		80
       

/******************************************************************************
*This function is for parse the ID3 tag of mp3 file which readed from ATAPI **
**		iStartSector: first sector of the file in CDROM ;can get from FileTbl**
**		iFileSize:the file's size                                            **
**		pTag : if this mp3 file have ID3 tag,it returned by pTag ;           ** 
**		Return value 0:No Tag; 1:ID3v1 Tag ; 2:ID3v2 Tag    				 **
******************************************************************************/
int	GetID3Tag( int fd,unsigned int iFileSize,ID3_Tag *pTag) ;

/******************************************************************************
**This function is for parse the ID3 tag of mp3 file which readed from OS	 **
**		pFilePath: the path of file 			                         	 **
**		pTag : if this mp3 file have ID3 tag,it returned by pTag ;           ** 
**		Return value 0:No Tag; 1:ID3v1 Tag ; 2:ID3v2 Tag    				 **
******************************************************************************/
/*
int	GetID3TagFromFile(char *pFilePath,ID3_Tag *pTag) ;
*/
char *FindMp3ID3Tag(unsigned int iStartSector,unsigned int iFileSize) ;

const char *GetGenreString(void) ;
const char *GetTitle(void ) ;
const char *GetArtist(void) ;
const char *GetAlbum(void) ;
const char *GetComment(void) ;

int	GetTitleArtist(ID3_Tag *pTag,char *pDesStr,int iStrLen) ;
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?