Old 23rd December 2011, 15:01   #1
emilles
Member
 
Join Date: Mar 2006
Posts: 52
Help with Album Art API

Hello. I am working on adding additional features to an output plug-in. To that end, I am trying to get the album art for the currently playing track. I have had reasonable success in working with the SDK version 5.55 to get the album art of an mp3 with the cover art embedded within the ID3 tag (see below). I have not been able to successfully get the album art for a file where the artwork is linked using the artwork browser provided in Winamp (mp3 and jpg are in same directory). Is it possible to get the artwork for a track that is in an external file through the plug-in APIs?

I am including below what I am currently doing from my output plug-in. Excess checks and what not have been removed to keep it focused on happy path...

code:

_apiService = reinterpret_cast<api_service*>(
SendMessage(_playerWindow, WM_WA_IPC, 0, IPC_GET_API_SERVICE));
if (_apiService == reinterpret_cast<api_service*>(1)) {
// service interface not supported
_apiService = NULL;
} else if (_apiService != NULL) {
_memMgmtServiceFactory =
_apiService->service_getServiceByGuid(memMgrApiServiceGuid);
_memMgmtService =
reinterpret_cast<api_memmgr*>(_memMgmtServiceFactory->getInterface());
_albumArtServiceFactory =
_apiService->service_enumService(svc_albumArtProvider::getServiceType(), 0);
_albumArtService =
reinterpret_cast<svc_albumArtProvider*>(_albumArtServiceFactory->getInterface());
}

if (_albumArtService != NULL && _memMgmtService != NULL) {
void* imageData = 0;
size_t imageSize = 0;
wchar_t* imageType = 0;
const int returnCode = _albumArtService->GetAlbumArtData(
filePath, L"cover", &imageData, &imageSize, &imageType);
if (returnCode == 0) {
assert(imageData != NULL && imageSize > 0 && imageType != NULL);
artworkData.resize(imageSize);
std::memcpy(&artworkData[0], imageData, imageSize);
_memMgmtService->sysFree(imageData);
ConvertWideCharStringToUTF8(imageType, artworkType);
artworkType = "image/" + artworkType;
_memMgmtService->sysFree(imageType);
}
}


Remote Speakers Output Plug-In
Stream audio from Nullsoft Winamp to the Apple AirPort Express (aka AirTunes)
emilles is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > Winamp Development

Tags
album art, artwork, cover art, output plug-in, winamp api

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump