![Symbian Developer Library](../../../../a_stock/images/mainheading.gif)
![]() |
![]() |
|
The Apparc framework uses data type recognizers derived from
CApaDataRecognizerType
to determine the MIME type of files
in Symbian OS. Apparc supplies the filename and a buffer containing bytes read
from the start of the file. If a file is recognized, the recognizer must return
the MIME type and the degree of confidence in recognizing the file — a
TInt
ranging from KMinInt
(Not Recognized) to
KMaxInt
(Certain).
The implementation of DRM presents a problem when determining the MIME
type. Usually, a DRM file stores one or more content objects. For example, an
OMA file with MIME type application/vnd.oma.drm.content
might
store an image file with MIME type image/jpeg
. Apparc expects only
one MIME type to be returned, not two.
The CAF recognizer RECCAF.DLL
uses the
ContentAccess::CAgentResolver::DoRecognize()
function (see
below) to determine whether or
not a file is recognized by the content access framework and if so, retrieves
these two MIME types.
The mapping of these two MIME types returned by CAF to a single MIME type follows these rules:
File MIME Type |
Content MIME Type |
Apparc MIME Type |
Present |
Present |
|
Present |
Not Present |
|
Present |
|
|
The rationale for the above mapping is as follows:
Users and applications will be interested in the MIME type of the content within a file, not the packaging. CAF abstracts the packaging.
If the content is recognized with only the MIME type of the content within the file, it would confuse legacy applications who thought the entire file was that MIME type
Prefixing the content type with x-caf-
shows it is a
file that can be opened by CAF to read that content type without confusing
legacy applications
A file that needs to be passed through the supplier interface before it can be used will just be recognized as the file MIME type. The content type is irrelevant before the supply operation.
A file containing many content objects should just be recognized as
application/x-caf
since the packaging of the archive is
irrelevant. CAF abstracts the packaging.
Note:
The concept of "confidence" has also been eliminated for the files within the Content Access Framework. A file is either recognized by an agent or it is not recognized.
When recognizing a file, Apparc supplies the name of the file to be
recognized, and a buffer containing the start of the file, to all
CApaDataRecognizerType::DoRecognizeL()
implementations.
These two parameters can be passed to the
ContentAccess::CAgentResolver::DoRecognize()
function to
determine whether one of the Content Access Agents recognizes the file.
CApaDataRecognizer::DoRecognize(TDesC& aFilename, TDesC8& aBuffer)
{
TBool recognized;
CAgentResolver *resolver = CAgentResolver::NewL();
....
recognized = resolver->DoRecognize(filename, buffer, fileMimeType, contentMimeType);
....
ContentAccess::CAgentResolver::DoRecognize()
passes the filename and buffer to each of the agents in turn. The agents
perform the recognition, and the result is returned as either
ETrue
if the file was recognized, or EFalse
if it was
not. If the file is recognized, the fileMimeType
and
contentMimeType
parameters are populated with the correct MIME
types.
The recognition is distributed to the agents because they are able to recognize a file belonging to their agent. They are also able to examine the contents to work out the content MIME type. This allows one generic CAF recognizer to be used for all the agents implemented with the content access framework.
The following diagram illustrates the recognition of an OMA file with JPEG content.
The CAF recognizer configuration file is stored in the apparc server's
private directory \private\10003a3f\RecCaf\RecCafMimeTypes.txt
.
It is just a list of all known content MIME types. The list allows the
recognizer to return a fixed set of MIME types when apparc calls the
recognizer's CApaCafRecognizer::SupportedDataTypeL()
function.
image/jpeg
image/gif
text/plain
text/html
... etc
If this file is replaced (to support new content types), the recognizer will only implement the changes during the next power on. Similarly if a new agent is added, the recognizer will only rebuild its list of agents after the next power on.
In order to use CAF content, applications will need to update their
registration resource files (for example AppName_reg.rss
) to
include the new CAF MIME types. For example, in the past, an image viewer may
have only included image/jpeg
in the list of MIME types it could
open. If the application is updated to use the Content Access Framework, it
should support image/jpeg
and x-caf-image/jpeg
in
order to support unprotected and protected content respectively. See the
registration file examples below.
All file operations should be conducted through the CAF framework, so that the application will not need to know anything about a specific DRM scheme.
...
datatype_list =
{
DATATYPE { priority= EDataTypePriorityHigh ; type="image/jpeg";},
}
...
...
datatype_list =
{
DATATYPE { priority= EDataTypePriorityHigh ; type="image/jpeg"; },
DATATYPE { priority= EDataTypePriorityHigh ; type="x-caf-image/jpeg"; },
}
...