![]() |
![]() |
![]() |
The "new" procedure |
This procedure only works if codecs implementing the new CUniCodec API are present on the device. Such codecs come with a class CUniCodecList, a convenient API for obtaining information about the codecs present on the device.
To obtain a CUniCodecList object, proceed as follows:
RLibrary dll;
_LIT(KUfcodecDllName, "\\System\\Unifep\\Ufcodec.dll");
TInt err = dll.Load(KUfcodecDllName);
if (err == KErrNotFound) {
// New API not present - suggest to user to upgrade,
// or fall back on old API
// ...
} else {
User::LeaveIfError(err);
TLibraryFunction entry = dll.Lookup(1);
CUniCodecList *list = (CUniCodecList *) ((*entry)());
User::LeaveIfNull(list);
CleanupStack::PushL(list);
list->ConstructL(CEikonEnv::Static()->FsSession());
// ... use the list object ...
CleanupStack::PopAndDestroy(); // list
dll.Close();
}
Of course, dll and list would likely be members of one of your classes, typically the AppUi class.
Once a CUniCodecList object is available, you can easily search for codecs by UID or MIME-name. You can also use the object itself as the parameter for CEikChoiceList::SetArrayL if you wish to allow the user to select an encoding from all available ones. (Don't forget to call CEikChoiceList::SetArrayExternalOwnership(ETrue) to avoid destruction of the codec list by the choice list.)
CUniCodecList obtains its information from codec information files (CIF files) in \system\unifep\encoding. A CIF file lists a number of encodings with their MIME names, a long name (for presentation to the user), and a reference to the DLL that implements the encoding, with the export number to be used. The format is not formally documented, and future versions may include more information.
![]() |
![]() |
![]() |
The "new" procedure |