×
Namespaces

Variants
Actions
Revision as of 08:17, 2 February 2012 by hamishwillee (Talk | contribs)

Audio Metadata Reader API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: ltomuta (16 Jun 2007)
Last edited: hamishwillee (02 Feb 2012)


Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.

Purpose

The Audio Metadata Reader API provides classes useful to get metadata information of an audio file.

Use cases

Some of the basic uses of this API are to retrieve the count of metadata fields, fields information like artist name, length of the file, year of album, etc.

Example code

Header files

#include <MetaDataFieldContainer.h>
#include <MetaDataUtility.h>
#include <MetaDataField.hrh>

Link against:

LIBRARY MetaDataUtility.lib

The classes used are CMetaDataFieldContainer and CMetaDataUtility.

_LIT(KFileName,"c:\\FileName.mp3");
 
void CTestAudioMetadataReaderAPIAppUi::ConstructL()
{
CMetaDataUtility* iMDUtility = CMetaDataUtility::NewL();
iMDUtility->OpenFileL(KFileName);
}
void CTestAudioMetadataReaderAPIAppUi::GetMetadataL()
{
//Returns the number of metadata fields.
TInt iMetaCount = iMDUtility->MetaDataCount();
 
TBuf<64> itext;
itext.AppendNum(iMetaCount);
CEikonEnv::InfoWinL(_L("METADATA COUNT:"),itext);
 
//Returns the metadata fields found in this source.
const CMetaDataFieldContainer& iMDfield = iMDUtility->MetaDataFieldsL();
TMetaDataFieldId aFieldId;
 
for(TInt i=0;i < iMetaCount;i++)
{
//Returns the field at given location, first element at position 0.
iMDfield.At(i,aFieldId);
TBuf<50> iMetaField;
iMetaField.AppendNum(aFieldId);
CEikonEnv::InfoWinL(_L("METADATA FIELD ID:"),iMetaField);
iMetaField.Zero();
 
//Returns the metadata field that corresponds to the field ID.
TPtrC iMetaData = iMDfield.Field(aFieldId);
iMetaField.Append(iMetaData);
CEikonEnv::InfoWinL(_L("METADATA FIELD:"),iMetaField);
iMetaField.Zero();
}
}

Example Application

75 page views in the last 30 days.