Audio Metadata Reader API
Article Metadata
Code Example
Source file: Media:AudioMetaDataReaderEx_v1.zip
Article
Created: ltomuta
(16 Jun 2007)
Last edited: hamishwillee
(08 May 2013)
Note: :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.libThe 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();
}
}


29 Sep
2009
Audio Metadata Reader API are useful get metadata information of an audio file. This article demonstrates the use of Audio Metadata Reader API to retrieve the count of metadata fields and fields information of metadata files. Note that this API, Audio Metadata Reader API, is not part of the public SDK. So you have to download it from SDK API Plug-in before using it. Furthermore, the author added a working demo project, which can be used for more detailed study of new opportunities for various kinds of experiments.