tablib编译学习

1.关于tablib

1.1 . 什么是tablib

TagLib is a library for reading and editing the meta-data of several popular audio formats. Currently it supports both ID3v1 and ID3v2 for MP3 files, Ogg Vorbis comments and ID3 tags and Vorbis comments in FLAC, MPC, Speex, WavPack, TrueAudio, WAV, AIFF, MP4 and ASF files.

TagLib is distributed under the GNU Lesser General Public License (LGPL) and Mozilla Public License (MPL). Essentially that means that it may be used in proprietary applications, but if changes are made to TagLib they must be contributed back to the project. Please review the licenses if you are considering using TagLib in your project.

There is some general information about the motivation and workings of TagLib that can be found in the API documentation.

1.2.taglib官网:https://taglib.org/

1.3.tablib下载

1.3.1打开taglib官网,如下图:

2.tablib编译

我的编译环境:

Qt5.12.3

Cmake 3.15.0

2.1.配置Qtcreator的环境变量,如下图:

 

2.2.解压tablib,如下图:

2.3.使用cmake选择编译目录

 然后点击configure

选择Specify native compilers 然后点击next 

c和c++选择你qt版本对应的gcc和g++,此处我选择的是:

D:/Qt/Qt5.13.0/Tools/mingw730_64/bin/gcc.exe
D:/Qt/Qt5.13.0/Tools/mingw730_64/bin/c++.exe

选好后,点击finish,然后等待:

 

到这里,已经配置完毕了,但是还需要做一些修改,重新选择下配置编译输出的目录:

 

如果不选中的话,不会编译*.dll文件。 

配置完成后,点击Generate

接下来cd到你配置编译的目录,我的是:E:\work\taglib_learn\taglib_build

软后输入如下命令:

mingw32-make

开始编译如图:

 

编译完成如下图:

最后使用命令: mingw32-make install 安装编译的文件。

最后来看成果:

dll

include

 example

3.taglib简单使用

#define MPT 1

int main()
{
    QString sname;
    QString singer;
    QString album;
    const char *fileName = "D:/111.flac";
    QFileInfo fileInfo(fileName);
    qDebug() << fileInfo.absoluteFilePath();

#ifdef MPT
    TagLib::FileRef mp3(fileName);
    TagLib::String artist = mp3.tag()->artist();
    TagLib::String ch_album = mp3.tag()->album();
    TagLib::String ch_singer = mp3.tag()->title();
    qDebug()<<"Artist : "<<artist.toCString(true);
    qDebug()<<"Album : "<<ch_album.toCString(true);
    qDebug()<<"Record album. : "<<ch_album.toCString(true);
#endif


#ifdef FLAC
    TagLib::FLAC::File flac(fileName);
    TagLib::String artist = flac.tag()->artist();
    TagLib::String ch_album = flac.tag()->album();
    TagLib::String ch_singer = flac.tag()->title();
    qDebug()<<"Artist : "<<artist.toCString(true);
    qDebug()<<"Album : "<<ch_album.toCString(true);
    qDebug()<<"Record album. : "<<ch_album.toCString(true);
#endif
    return 0;
#if 0
    //not good

    TagLib::MPEG::File *mpegFile = new TagLib::MPEG::File(fileName);
    qDebug() << "mpegFile: " << mpegFile;
    if(false == mpegFile->isOpen())
    {
        qDebug() << "-----open failed---";
    }
    else
    {
        sname = QString(mpegFile->tag()->title().toCString(true));
        singer = QString(mpegFile->tag()->artist().toCString(true));
        album = QString(mpegFile->tag()->album().toCString(true));
        qDebug() << sname;
        qDebug() << singer;
        qDebug() << album;
    }
#endif
}

#endif

继续探索中...

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Liu-Eleven

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值