×
Namespaces

Variants
Actions

Reading Meta data from audio files

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: symbianyucca (22 Mar 2007)
Last edited: hamishwillee (26 Jul 2012)

Following GetMetaDataL() function illustrates how to read meta data entries from the audio file. As shown with the function it requires a CMdaAudioPlayerUtility (could also be CMdaAudioRecorderUtility) which also needs to be fully opened with the file, see Audio playing example to see how to open a audio file with CMdaAudioPlayerUtility.

With this example only Title, Album, Artist and Genre entries are retrieved, for information on the other metadata entry IDs you could have a look into the MmfMeta.h header.


GetMetaDataL

#include <MmfMeta.h>
 
void GetMetaDataL(TDes& aTitle,TDes& aAlbum,TDes& aArtist,TDes& aGenre,CMdaAudioPlayerUtility& aUtility)
{
TInt MDNumEntries(0);
User::LeaveIfError(aUtility.GetNumberOfMetaDataEntries(MDNumEntries));
 
for ( TInt i(0); i < MDNumEntries; ++i )
{
CMMFMetaDataEntry* entry(NULL);
TRAPD(error, entry = aUtility.GetMetaDataEntryL(i));
CleanupStack::PushL(entry);
 
if (error == KErrNone)
{
if (entry->Name().CompareF(KMMFMetaEntrySongTitle) == KErrNone)
{
aTitle.Copy(entry->Value());
}
else if (entry->Name().CompareF(KMMFMetaEntryAlbum) == KErrNone)
{
aAlbum.Copy(entry->Value());
}
else if (entry->Name().CompareF(KMMFMetaEntryArtist) == KErrNone)
{
aArtist.Copy(entry->Value());
}
else if (entry->Name().CompareF(KMMFMetaEntryGenre) == KErrNone)
{
aGenre.Copy(entry->Value());
}
}
 
CleanupStack::PopAndDestroy(entry);
}
}
This page was last modified on 26 July 2012, at 08:02.
32 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×