mediainfo的官网:http://mediaarea.net/
#ifdef MEDIAINFO_LIBRARY
#include "MediaInfo.h" //Staticly-loaded library (.lib or .a or .so)
#define MediaInfoNameSpace MediaInfoLib;
#else //MEDIAINFO_LIBRARY
#include "MediaInfoDLL.h" //Dynamicly-loaded library (.dll or .so)
#define MediaInfoNameSpace MediaInfoDLL;
#endif //MEDIAINFO_LIBRARY
#include <iostream>
#include <iomanip>
#include <locale>
using namespace MediaInfoNameSpace;
void printTagInfo(String filePath)
{
MediaInfo mi;
mi.Open(filePath);
static const struct MATRIX {
std::wstring printStr;
String tagName;
} lookupInfo[] = {
{L"Title", L"Title"},
{L"Album", L"Album"},
{L"Artist", L"Artist"},
{L"Composer", L"Composer"},
{L"Genre", L"Genre"},
};
// set locale
std::wcout.imbue(std::locale(""));
std::wcout << L"file [" << filePath << L"] tag information:" << std::endl;
for (size_t i = 0; i < sizeof(lookupInfo)/sizeof(MATRIX); i++)
{
String tagInfo = mi.Get(Stream_General, 0, lookupInfo[i].tagName);
std::wcout << std::setw(10) << lookupInfo[i].printStr << L" : " << tagInfo << std::endl;
}
std::wcout << std::endl;
mi.Close();
}
int main()
{
printTagInfo(L"F:\\temp\\benow.mp3");
printTagInfo(L"F:\\temp\\benow.aac");
printTagInfo(L"F:\\temp\\benow.wma");
getchar();
}