Album art from Mp3, AAC via QTKit question
Album art from Mp3, AAC via QTKit question
- Subject: Album art from Mp3, AAC via QTKit question
- From: Jerry Brace <email@hidden>
- Date: Sun, 29 Jan 2006 03:33:42 -0330
I've spent just about the whole day on this. I am trying to display
album artwork in a NSImageView which is retrieved from a mp3, aac,
mp4, etc audio file via the QuickTime Kit (QTKit).
I have the file loaded into the QTMovieView and it plays - so I know
the reference to the file is correct.
I know the key for the album art in the meta data is
kQTMetaDataCommonKeyArtist and it is in kQTMetaDataStorageFormatiTunes.
QTMetaDataRef movieMetaData = malloc (sizeof (QTMetaDataRef));
QTCopyMovieMetaData (movie, &movieMetaData);
QTMetaDataItem item = kQTMetaDataCommonKeyArtwork;
QTMetaDataGetNextItem (movieMetaData,
kQTMetaDataStorageFormatiTunes,
item,
kQTMetaDataKeyFormatCommon,
nil,
0,
&item)
// get value size, so you can allocate appropriate buffer
ByteCount valueSize = 0;
QTMetaDataGetItemValue (movieMetaData,
item,
NULL,
0,
&valueSize);
printf (" got value, size=%d\n", valueSize);
// get value
char valueBuf[valueSize];
QTMetaDataGetItemValue (movieMetaData,
item,
&valueBuf,
valueSize,
NULL);
// convert bytes to data to image and display
NSData *myData = [[NSData alloc] initWithBytes:&valueBuf
length:valueSize];
NSImage* albumArtwork = [[NSImage alloc] initWithData:myData];
[myView setImage:albumArtwork];
Right now it does nothing. Does anyone have any experience doing this
kind of thing?
Also just to note - I've tried the ID3Tag.Framework to get the album
art, but it only works on mp3s (not AAC, purchased songs, etc). This
is why I am trying the QuickTime route.
Jerry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden