用id3lib提取mp3文件中的图片信息的实例
2008-10-20 17:34
417 查看
//define
typedef struct
{
unsigned char* picture;
size_t *len;
}PICTURE;
PICTURE *m_p = NULL;
//function's implemation
PICTURE* CMpExtractInfo::getPicture()
{
if(m_p!=NULL)
{
delete [] m_p;
cout<<"******************delete m_p"<<endl;
m_p = NULL;
}
if(&m_tag==NULL)
{
return NULL;
}
else
{
m_p = new PICTURE;
ID3_Frame *tp_frame =m_tag.Find(ID3FID_PICTURE);
if (NULL != tp_frame)
{
qDebug()<<"getpicture here";
//tp_frame->Field(ID3FN_DATA).ToFile("output.bmp");
ID3_Field & tmp = tp_frame->Field(ID3FN_DATA);
m_p->len = new size_t(0);
*(m_p->len) = tp_frame->GetDataSize();
cout << " Len : " << *(m_p->len) << endl;
m_p->picture = new unsigned char[*(m_p->len) + 1]; //error here
memset(m_p->picture,0,*(m_p->len) + 1);
tmp.Get(m_p->picture, *(m_p->len) + 1);
return m_p;
}
}
}
reference size : www.id3.org
typedef struct
{
unsigned char* picture;
size_t *len;
}PICTURE;
PICTURE *m_p = NULL;
//function's implemation
PICTURE* CMpExtractInfo::getPicture()
{
if(m_p!=NULL)
{
delete [] m_p;
cout<<"******************delete m_p"<<endl;
m_p = NULL;
}
if(&m_tag==NULL)
{
return NULL;
}
else
{
m_p = new PICTURE;
ID3_Frame *tp_frame =m_tag.Find(ID3FID_PICTURE);
if (NULL != tp_frame)
{
qDebug()<<"getpicture here";
//tp_frame->Field(ID3FN_DATA).ToFile("output.bmp");
ID3_Field & tmp = tp_frame->Field(ID3FN_DATA);
m_p->len = new size_t(0);
*(m_p->len) = tp_frame->GetDataSize();
cout << " Len : " << *(m_p->len) << endl;
m_p->picture = new unsigned char[*(m_p->len) + 1]; //error here
memset(m_p->picture,0,*(m_p->len) + 1);
tmp.Get(m_p->picture, *(m_p->len) + 1);
return m_p;
}
}
}
reference size : www.id3.org
相关文章推荐
- 用taglib提取mp3文件中的图片和一些其它信息的实例
- iOS开发:提取MP3文件中的信息
- 获取MP3和M4A音乐文件的歌曲信息以及专辑图片--备用
- jaudiotagger获取MP3文件信息及封面图片
- 【ASP.NET 进阶】获取MP3文件信息并显示专辑图片
- 获取MP3和M4A音乐文件的歌曲信息以及专辑图片
- php中使用getimagesize获取图片、flash等文件的尺寸信息实例
- php中使用getimagesize获取图片、flash等文件的尺寸信息实例
- Python实例获取mp3文件的tag信息
- android提取视频多张图片和视频信息实例
- 获取MP3和M4A音乐文件的歌曲信息以及专辑图片
- Universal App图片文件和图片byte[]信息转换为bitmap
- C语言解析pcap文件得到HTTP信息实例
- JDBC JDBC的开发步骤 DriverManager Connection Statement ResultSet JDBC的资源释放 JDBC的配置信息提取到配置文件
- 用于获取Mp3文件信息的类
- GetImageSize()取得图片的长宽、文件格式信息
- 图片头文件信息解析
- 一个项目的数据库数据丢失,upload文件上传的图片都有,怎么能把数据库信息找到
- [Material Design]使用Palette类提取图片的颜色信息
- 统计文件信息及生成SQL语句(VBS)实例