khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp
author hgs
Fri, 25 Jun 2010 17:36:03 -0500
changeset 28 ebf79c79991a
parent 25 6f7ceef7b1d1
child 33 5e8b14bae8c3
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
hgs
parents: 21
diff changeset
     1
/*
hgs
parents: 21
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents: 21
diff changeset
     3
 * All rights reserved.
hgs
parents: 21
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents: 21
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents: 21
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents: 21
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents: 21
diff changeset
     8
 *
hgs
parents: 21
diff changeset
     9
 * Initial Contributors:
hgs
parents: 21
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents: 21
diff changeset
    11
 *
hgs
parents: 21
diff changeset
    12
 * Contributors:
hgs
parents: 21
diff changeset
    13
 *
hgs
parents: 21
diff changeset
    14
 * Description: Metadata backend engine
hgs
parents: 21
diff changeset
    15
 *
hgs
parents: 21
diff changeset
    16
 */
hgs
parents: 21
diff changeset
    17
19
hgs
parents:
diff changeset
    18
#include <OpenMAXAL.h>
hgs
parents:
diff changeset
    19
#include <string.h>
hgs
parents:
diff changeset
    20
#include <ctype.h>
hgs
parents:
diff changeset
    21
#include <uri8.h>
25
hgs
parents: 21
diff changeset
    22
#include "cmetadatautilityitf.h"
19
hgs
parents:
diff changeset
    23
#include "profileutilmacro.h"
hgs
parents:
diff changeset
    24
25
hgs
parents: 21
diff changeset
    25
CMetadataUtilityItf::CMetadataUtilityItf() :
hgs
parents: 21
diff changeset
    26
    m_pS60Util(NULL), m_pHXUtil(NULL)
hgs
parents: 21
diff changeset
    27
    {
hgs
parents: 21
diff changeset
    28
    }
19
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
CMetadataUtilityItf::~CMetadataUtilityItf()
25
hgs
parents: 21
diff changeset
    31
    {
hgs
parents: 21
diff changeset
    32
    if (m_pS60Util)
hgs
parents: 21
diff changeset
    33
        {
hgs
parents: 21
diff changeset
    34
        delete m_pS60Util;
hgs
parents: 21
diff changeset
    35
        }
19
hgs
parents:
diff changeset
    36
25
hgs
parents: 21
diff changeset
    37
    if (m_pHXUtil)
hgs
parents: 21
diff changeset
    38
        {
hgs
parents: 21
diff changeset
    39
        delete m_pHXUtil;
hgs
parents: 21
diff changeset
    40
        }
hgs
parents: 21
diff changeset
    41
    }
19
hgs
parents:
diff changeset
    42
hgs
parents:
diff changeset
    43
CMetadataUtilityItf* CMetadataUtilityItf::New(char* uri)
25
hgs
parents: 21
diff changeset
    44
    {
hgs
parents: 21
diff changeset
    45
    CMetadataUtilityItf* p_mdutilitf = new CMetadataUtilityItf;
19
hgs
parents:
diff changeset
    46
25
hgs
parents: 21
diff changeset
    47
    p_mdutilitf->ParseSource(uri); //ignore error
hgs
parents: 21
diff changeset
    48
hgs
parents: 21
diff changeset
    49
    return p_mdutilitf;
hgs
parents: 21
diff changeset
    50
    }
19
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
TInt CMetadataUtilityItf::OpenSource(char* pOrigUri)
25
hgs
parents: 21
diff changeset
    53
    {
19
hgs
parents:
diff changeset
    54
    //Make a local copy for uri
25
hgs
parents: 21
diff changeset
    55
    if (!pOrigUri)
19
hgs
parents:
diff changeset
    56
        return XA_RESULT_PARAMETER_INVALID;
25
hgs
parents: 21
diff changeset
    57
19
hgs
parents:
diff changeset
    58
    int uriLen = strlen(pOrigUri);
25
hgs
parents: 21
diff changeset
    59
    char* uri = new char[uriLen + 1];
hgs
parents: 21
diff changeset
    60
    if (!uri)
19
hgs
parents:
diff changeset
    61
        {
hgs
parents:
diff changeset
    62
        return XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
    63
        }
hgs
parents:
diff changeset
    64
    strncpy(uri, pOrigUri, uriLen);
hgs
parents:
diff changeset
    65
    uri[uriLen] = '\0';
hgs
parents:
diff changeset
    66
    ////////////////////////////////////////////
hgs
parents:
diff changeset
    67
    _LIT8(KFileSlash,"file:///");
hgs
parents:
diff changeset
    68
    TInt fileslashlen = KFileSlash().Length();
hgs
parents:
diff changeset
    69
25
hgs
parents: 21
diff changeset
    70
    TPtr8 fileuri((TUint8*) uri, strlen(uri), strlen(uri));
hgs
parents: 21
diff changeset
    71
    TPtr8 filepath = fileuri.RightTPtr(strlen(uri) - fileslashlen);
hgs
parents: 21
diff changeset
    72
19
hgs
parents:
diff changeset
    73
    TInt pos = filepath.LocateReverse(':');
25
hgs
parents: 21
diff changeset
    74
    if (pos != KErrNotFound)
hgs
parents: 21
diff changeset
    75
        {
hgs
parents: 21
diff changeset
    76
        fileuri.Delete(fileslashlen + pos, 1);
hgs
parents: 21
diff changeset
    77
        }
19
hgs
parents:
diff changeset
    78
hgs
parents:
diff changeset
    79
    TUriParser8 localfileUri;
hgs
parents:
diff changeset
    80
    TInt ret = localfileUri.Parse(fileuri);
25
hgs
parents: 21
diff changeset
    81
    if (ret == KErrNone)
19
hgs
parents:
diff changeset
    82
        {
25
hgs
parents: 21
diff changeset
    83
        HBufC* file = NULL;
hgs
parents: 21
diff changeset
    84
        TRAP(ret,file = localfileUri.GetFileNameL());
hgs
parents: 21
diff changeset
    85
        if (ret == KErrNone)
hgs
parents: 21
diff changeset
    86
            {
hgs
parents: 21
diff changeset
    87
            if (m_pS60Util)
hgs
parents: 21
diff changeset
    88
                {
hgs
parents: 21
diff changeset
    89
                ret = m_pS60Util->ParseSource(*file);
hgs
parents: 21
diff changeset
    90
                }
hgs
parents: 21
diff changeset
    91
            else if (m_pHXUtil)
hgs
parents: 21
diff changeset
    92
                {
hgs
parents: 21
diff changeset
    93
                ret = m_pHXUtil->ParseSource(*file);
hgs
parents: 21
diff changeset
    94
                }
hgs
parents: 21
diff changeset
    95
            else
hgs
parents: 21
diff changeset
    96
                {
hgs
parents: 21
diff changeset
    97
                ret = KErrNotFound;
hgs
parents: 21
diff changeset
    98
                }
hgs
parents: 21
diff changeset
    99
            }
hgs
parents: 21
diff changeset
   100
hgs
parents: 21
diff changeset
   101
        delete file;
19
hgs
parents:
diff changeset
   102
        }
25
hgs
parents: 21
diff changeset
   103
hgs
parents: 21
diff changeset
   104
    if (uri)
hgs
parents: 21
diff changeset
   105
        {
hgs
parents: 21
diff changeset
   106
        delete[] uri;
hgs
parents: 21
diff changeset
   107
        }
hgs
parents: 21
diff changeset
   108
hgs
parents: 21
diff changeset
   109
    if (ret != KErrNone)
hgs
parents: 21
diff changeset
   110
        {
hgs
parents: 21
diff changeset
   111
        //delete the utilities
hgs
parents: 21
diff changeset
   112
        if (m_pS60Util)
hgs
parents: 21
diff changeset
   113
            {
hgs
parents: 21
diff changeset
   114
            delete m_pS60Util;
hgs
parents: 21
diff changeset
   115
            m_pS60Util = NULL;
hgs
parents: 21
diff changeset
   116
            }
hgs
parents: 21
diff changeset
   117
hgs
parents: 21
diff changeset
   118
        if (m_pHXUtil)
hgs
parents: 21
diff changeset
   119
            {
hgs
parents: 21
diff changeset
   120
            delete m_pHXUtil;
hgs
parents: 21
diff changeset
   121
            m_pHXUtil = NULL;
hgs
parents: 21
diff changeset
   122
            }
hgs
parents: 21
diff changeset
   123
hgs
parents: 21
diff changeset
   124
        }
hgs
parents: 21
diff changeset
   125
    return ret;
19
hgs
parents:
diff changeset
   126
    }
21
hgs
parents: 20
diff changeset
   127
25
hgs
parents: 21
diff changeset
   128
TInt CMetadataUtilityItf::ExtractUCS2(TDesC& inDes, char* outPtr, TInt maxLen)
hgs
parents: 21
diff changeset
   129
    {
hgs
parents: 21
diff changeset
   130
    TPtrC tempPtr = inDes.Left((maxLen / 2) - 1); //save last one for null terminator
hgs
parents: 21
diff changeset
   131
    TInt outLen = tempPtr.Length() + 1;
21
hgs
parents: 20
diff changeset
   132
25
hgs
parents: 21
diff changeset
   133
    TPtr16 outDes((unsigned short*) outPtr, outLen);
hgs
parents: 21
diff changeset
   134
    outDes.Copy(tempPtr);
hgs
parents: 21
diff changeset
   135
    outDes.ZeroTerminate();
19
hgs
parents:
diff changeset
   136
25
hgs
parents: 21
diff changeset
   137
    return outLen * 2; //return size
hgs
parents: 21
diff changeset
   138
    }
19
hgs
parents:
diff changeset
   139
hgs
parents:
diff changeset
   140
TInt CMetadataUtilityItf::CalculateNumMetadataItems(TUint*numItems)
25
hgs
parents: 21
diff changeset
   141
    {
hgs
parents: 21
diff changeset
   142
    *numItems = 0;
21
hgs
parents: 20
diff changeset
   143
25
hgs
parents: 21
diff changeset
   144
    if (m_pS60Util)
hgs
parents: 21
diff changeset
   145
        {
hgs
parents: 21
diff changeset
   146
        return m_pS60Util->CalculateNumMetadataItems(numItems);
hgs
parents: 21
diff changeset
   147
        }
hgs
parents: 21
diff changeset
   148
    else if (m_pHXUtil)
hgs
parents: 21
diff changeset
   149
        {
hgs
parents: 21
diff changeset
   150
        return m_pHXUtil->CalculateNumMetadataItems(numItems);
hgs
parents: 21
diff changeset
   151
        }
hgs
parents: 21
diff changeset
   152
hgs
parents: 21
diff changeset
   153
    return KErrNone;
hgs
parents: 21
diff changeset
   154
    }
19
hgs
parents:
diff changeset
   155
hgs
parents:
diff changeset
   156
char* CMetadataUtilityItf::GetKey(TInt index)
25
hgs
parents: 21
diff changeset
   157
    {
hgs
parents: 21
diff changeset
   158
    if (m_pS60Util)
hgs
parents: 21
diff changeset
   159
        {
hgs
parents: 21
diff changeset
   160
        return m_pS60Util->GetKey(index);
hgs
parents: 21
diff changeset
   161
        }
hgs
parents: 21
diff changeset
   162
    else if (m_pHXUtil)
hgs
parents: 21
diff changeset
   163
        {
hgs
parents: 21
diff changeset
   164
        return m_pHXUtil->GetKey(index);
hgs
parents: 21
diff changeset
   165
        }
21
hgs
parents: 20
diff changeset
   166
25
hgs
parents: 21
diff changeset
   167
    return NULL;
hgs
parents: 21
diff changeset
   168
    }
19
hgs
parents:
diff changeset
   169
hgs
parents:
diff changeset
   170
TInt CMetadataUtilityItf::GetValueSize(TInt index)
25
hgs
parents: 21
diff changeset
   171
    {
hgs
parents: 21
diff changeset
   172
    if (m_pS60Util)
hgs
parents: 21
diff changeset
   173
        {
hgs
parents: 21
diff changeset
   174
        return m_pS60Util->GetValueSize(index);
hgs
parents: 21
diff changeset
   175
        }
hgs
parents: 21
diff changeset
   176
    else if (m_pHXUtil)
hgs
parents: 21
diff changeset
   177
        {
hgs
parents: 21
diff changeset
   178
        return m_pHXUtil->GetValueSize(index);
hgs
parents: 21
diff changeset
   179
        }
21
hgs
parents: 20
diff changeset
   180
25
hgs
parents: 21
diff changeset
   181
    return 0;
hgs
parents: 21
diff changeset
   182
    }
19
hgs
parents:
diff changeset
   183
25
hgs
parents: 21
diff changeset
   184
TInt CMetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength,
hgs
parents: 21
diff changeset
   185
        TInt* outSize, TInt* encodingType)
hgs
parents: 21
diff changeset
   186
    {
hgs
parents: 21
diff changeset
   187
    if (m_pS60Util)
hgs
parents: 21
diff changeset
   188
        {
hgs
parents: 21
diff changeset
   189
        return m_pS60Util->GetValue(index, data, maxLength, outSize,
hgs
parents: 21
diff changeset
   190
                encodingType);
hgs
parents: 21
diff changeset
   191
        }
hgs
parents: 21
diff changeset
   192
    else if (m_pHXUtil)
hgs
parents: 21
diff changeset
   193
        {
hgs
parents: 21
diff changeset
   194
        return m_pHXUtil->GetValue(index, data, maxLength, outSize,
hgs
parents: 21
diff changeset
   195
                encodingType);
hgs
parents: 21
diff changeset
   196
        }
21
hgs
parents: 20
diff changeset
   197
25
hgs
parents: 21
diff changeset
   198
    return 0;
hgs
parents: 21
diff changeset
   199
    }
19
hgs
parents:
diff changeset
   200
hgs
parents:
diff changeset
   201
TInt CMetadataUtilityItf::ParseSource(char* uri)
25
hgs
parents: 21
diff changeset
   202
    {
hgs
parents: 21
diff changeset
   203
    char* tempPtr = NULL;
hgs
parents: 21
diff changeset
   204
    char extension[MAX_EXTENSION_SIZE] =
hgs
parents: 21
diff changeset
   205
        {
hgs
parents: 21
diff changeset
   206
        0
hgs
parents: 21
diff changeset
   207
        };
hgs
parents: 21
diff changeset
   208
hgs
parents: 21
diff changeset
   209
    tempPtr = strchr(uri, (int) '.');
hgs
parents: 21
diff changeset
   210
    strncpy(extension, tempPtr, sizeof(tempPtr));
19
hgs
parents:
diff changeset
   211
25
hgs
parents: 21
diff changeset
   212
    for (unsigned int i = 0; i < sizeof(extension); i++)
hgs
parents: 21
diff changeset
   213
        {
hgs
parents: 21
diff changeset
   214
        extension[i] = tolower(extension[i]);
hgs
parents: 21
diff changeset
   215
        }
hgs
parents: 21
diff changeset
   216
hgs
parents: 21
diff changeset
   217
    //if s60 util in use
hgs
parents: 21
diff changeset
   218
    if (m_pS60Util)
hgs
parents: 21
diff changeset
   219
        {
hgs
parents: 21
diff changeset
   220
        //reset existing instace
hgs
parents: 21
diff changeset
   221
        TInt ret = m_pS60Util->Reset();
hgs
parents: 21
diff changeset
   222
        if (!CS60MetadataUtilityItf::IsSupportedExtension(extension))
hgs
parents: 21
diff changeset
   223
            {
hgs
parents: 21
diff changeset
   224
            delete m_pS60Util;
hgs
parents: 21
diff changeset
   225
            m_pS60Util = NULL;
hgs
parents: 21
diff changeset
   226
            }
hgs
parents: 21
diff changeset
   227
        }
19
hgs
parents:
diff changeset
   228
25
hgs
parents: 21
diff changeset
   229
    if (m_pHXUtil)
hgs
parents: 21
diff changeset
   230
        {
hgs
parents: 21
diff changeset
   231
        //reset existing instace
hgs
parents: 21
diff changeset
   232
        TInt ret = m_pHXUtil->Reset();
hgs
parents: 21
diff changeset
   233
        if (CS60MetadataUtilityItf::IsSupportedExtension(extension))
hgs
parents: 21
diff changeset
   234
            {
hgs
parents: 21
diff changeset
   235
            delete m_pHXUtil;
hgs
parents: 21
diff changeset
   236
            m_pHXUtil = NULL;
hgs
parents: 21
diff changeset
   237
            }
hgs
parents: 21
diff changeset
   238
        }
19
hgs
parents:
diff changeset
   239
25
hgs
parents: 21
diff changeset
   240
    if (!m_pS60Util && !m_pHXUtil)
hgs
parents: 21
diff changeset
   241
        {
19
hgs
parents:
diff changeset
   242
25
hgs
parents: 21
diff changeset
   243
        if (CS60MetadataUtilityItf::IsSupportedExtension(extension))
hgs
parents: 21
diff changeset
   244
            {
hgs
parents: 21
diff changeset
   245
            m_pS60Util = CS60MetadataUtilityItf::New();
hgs
parents: 21
diff changeset
   246
            }
hgs
parents: 21
diff changeset
   247
        else
hgs
parents: 21
diff changeset
   248
            {
hgs
parents: 21
diff changeset
   249
            m_pHXUtil = CHXMetadataUtilityItf::New();
hgs
parents: 21
diff changeset
   250
            }
hgs
parents: 21
diff changeset
   251
        }
19
hgs
parents:
diff changeset
   252
25
hgs
parents: 21
diff changeset
   253
    return OpenSource(uri);
hgs
parents: 21
diff changeset
   254
    }
19
hgs
parents:
diff changeset
   255
hgs
parents:
diff changeset
   256
bool CS60MetadataUtilityItf::IsSupportedExtension(char *extn)
25
hgs
parents: 21
diff changeset
   257
    {
hgs
parents: 21
diff changeset
   258
    if ((!strcasecmp(extn, ".mp3")) || (!strcasecmp(extn, ".wma"))
hgs
parents: 21
diff changeset
   259
            || (!strcasecmp(extn, ".aac")) || (!strcasecmp(extn, ".wav"))
hgs
parents: 21
diff changeset
   260
            || (!strcasecmp(extn, ".m4a")))
hgs
parents: 21
diff changeset
   261
        {
hgs
parents: 21
diff changeset
   262
        return true;
hgs
parents: 21
diff changeset
   263
        }
19
hgs
parents:
diff changeset
   264
25
hgs
parents: 21
diff changeset
   265
    return false;
hgs
parents: 21
diff changeset
   266
    }
19
hgs
parents:
diff changeset
   267
hgs
parents:
diff changeset
   268
CS60MetadataUtilityItf* CS60MetadataUtilityItf::New()
25
hgs
parents: 21
diff changeset
   269
    {
hgs
parents: 21
diff changeset
   270
    CS60MetadataUtilityItf* self = new CS60MetadataUtilityItf();
hgs
parents: 21
diff changeset
   271
hgs
parents: 21
diff changeset
   272
    TInt err = KErrGeneral;
hgs
parents: 21
diff changeset
   273
    TRAP(err, self->ConstructL());
19
hgs
parents:
diff changeset
   274
25
hgs
parents: 21
diff changeset
   275
    if (err == KErrNone)
hgs
parents: 21
diff changeset
   276
        {
hgs
parents: 21
diff changeset
   277
        return self;
hgs
parents: 21
diff changeset
   278
        }
19
hgs
parents:
diff changeset
   279
25
hgs
parents: 21
diff changeset
   280
    delete self;
hgs
parents: 21
diff changeset
   281
    return NULL;
hgs
parents: 21
diff changeset
   282
    }
19
hgs
parents:
diff changeset
   283
25
hgs
parents: 21
diff changeset
   284
CS60MetadataUtilityItf::CS60MetadataUtilityItf() :
hgs
parents: 21
diff changeset
   285
    pMetaDataUtility(NULL)
hgs
parents: 21
diff changeset
   286
    {
hgs
parents: 21
diff changeset
   287
    }
19
hgs
parents:
diff changeset
   288
hgs
parents:
diff changeset
   289
void CS60MetadataUtilityItf::ConstructL()
25
hgs
parents: 21
diff changeset
   290
    {
hgs
parents: 21
diff changeset
   291
    TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   292
    pMetaDataUtility = CMetaDataUtility::NewL();
hgs
parents: 21
diff changeset
   293
    TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   294
    }
hgs
parents: 21
diff changeset
   295
19
hgs
parents:
diff changeset
   296
CS60MetadataUtilityItf::~CS60MetadataUtilityItf()
25
hgs
parents: 21
diff changeset
   297
    {
hgs
parents: 21
diff changeset
   298
    if (pMetaDataUtility)
hgs
parents: 21
diff changeset
   299
        {
hgs
parents: 21
diff changeset
   300
        TInt err = KErrGeneral;
19
hgs
parents:
diff changeset
   301
25
hgs
parents: 21
diff changeset
   302
        TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   303
        TRAP(err, pMetaDataUtility->ResetL());
hgs
parents: 21
diff changeset
   304
        delete pMetaDataUtility;
hgs
parents: 21
diff changeset
   305
        TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   306
        }
hgs
parents: 21
diff changeset
   307
hgs
parents: 21
diff changeset
   308
    pMetaDataUtility = NULL;
hgs
parents: 21
diff changeset
   309
    }
19
hgs
parents:
diff changeset
   310
hgs
parents:
diff changeset
   311
TInt CS60MetadataUtilityItf::ParseSource(TDesC& fileName)
25
hgs
parents: 21
diff changeset
   312
    {
hgs
parents: 21
diff changeset
   313
    TInt err = KErrGeneral;
hgs
parents: 21
diff changeset
   314
hgs
parents: 21
diff changeset
   315
    if (pMetaDataUtility)
hgs
parents: 21
diff changeset
   316
        {
19
hgs
parents:
diff changeset
   317
25
hgs
parents: 21
diff changeset
   318
        TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   319
        //open with the file handle
hgs
parents: 21
diff changeset
   320
        TRAP(err, pMetaDataUtility->OpenFileL(fileName)); 
hgs
parents: 21
diff changeset
   321
        TAG_TIME_PROFILING_END; 
hgs
parents: 21
diff changeset
   322
        PRINT_TO_CONSOLE_TIME_DIFF;
19
hgs
parents:
diff changeset
   323
25
hgs
parents: 21
diff changeset
   324
        if (err == KErrNone)
hgs
parents: 21
diff changeset
   325
            {
hgs
parents: 21
diff changeset
   326
            uNumMetadataItems = pMetaDataUtility->MetaDataCount();
hgs
parents: 21
diff changeset
   327
            }
hgs
parents: 21
diff changeset
   328
        }
19
hgs
parents:
diff changeset
   329
25
hgs
parents: 21
diff changeset
   330
    return err;
hgs
parents: 21
diff changeset
   331
    }
19
hgs
parents:
diff changeset
   332
hgs
parents:
diff changeset
   333
TInt CS60MetadataUtilityItf::CalculateNumMetadataItems(TUint* numItems)
25
hgs
parents: 21
diff changeset
   334
    {
hgs
parents: 21
diff changeset
   335
    TInt err = KErrGeneral;
19
hgs
parents:
diff changeset
   336
25
hgs
parents: 21
diff changeset
   337
    if (pMetaDataUtility && numItems)
hgs
parents: 21
diff changeset
   338
        {
hgs
parents: 21
diff changeset
   339
        *numItems = uNumMetadataItems;
hgs
parents: 21
diff changeset
   340
        err = KErrNone;
hgs
parents: 21
diff changeset
   341
        }
19
hgs
parents:
diff changeset
   342
25
hgs
parents: 21
diff changeset
   343
    return err;
hgs
parents: 21
diff changeset
   344
    }
19
hgs
parents:
diff changeset
   345
hgs
parents:
diff changeset
   346
char* CS60MetadataUtilityItf::KeyMapping(TMetaDataFieldId fldID)
25
hgs
parents: 21
diff changeset
   347
    {
hgs
parents: 21
diff changeset
   348
    switch (fldID)
hgs
parents: 21
diff changeset
   349
        {
19
hgs
parents:
diff changeset
   350
25
hgs
parents: 21
diff changeset
   351
        case EMetaDataSongTitle:
hgs
parents: 21
diff changeset
   352
            {
hgs
parents: 21
diff changeset
   353
            return "KhronosTitle";
hgs
parents: 21
diff changeset
   354
            }
hgs
parents: 21
diff changeset
   355
        case EMetaDataArtist:
hgs
parents: 21
diff changeset
   356
            {
hgs
parents: 21
diff changeset
   357
            return "KhronosArtist";
hgs
parents: 21
diff changeset
   358
            }
hgs
parents: 21
diff changeset
   359
        case EMetaDataAlbum:
hgs
parents: 21
diff changeset
   360
            {
hgs
parents: 21
diff changeset
   361
            return "KhronosAlbum";
hgs
parents: 21
diff changeset
   362
            }
hgs
parents: 21
diff changeset
   363
        case EMetaDataYear:
hgs
parents: 21
diff changeset
   364
            {
hgs
parents: 21
diff changeset
   365
            return "KhronosYear";
hgs
parents: 21
diff changeset
   366
            }
hgs
parents: 21
diff changeset
   367
        case EMetaDataComment:
hgs
parents: 21
diff changeset
   368
            {
hgs
parents: 21
diff changeset
   369
            return "KhronosComment";
hgs
parents: 21
diff changeset
   370
            }
hgs
parents: 21
diff changeset
   371
        case EMetaDataAlbumTrack:
hgs
parents: 21
diff changeset
   372
            {
hgs
parents: 21
diff changeset
   373
            return "KhronosTrackNumber";
hgs
parents: 21
diff changeset
   374
            }
hgs
parents: 21
diff changeset
   375
        case EMetaDataGenre:
hgs
parents: 21
diff changeset
   376
            {
hgs
parents: 21
diff changeset
   377
            return "KhronosGenre";
hgs
parents: 21
diff changeset
   378
            }
hgs
parents: 21
diff changeset
   379
        case EMetaDataComposer:
hgs
parents: 21
diff changeset
   380
            {
hgs
parents: 21
diff changeset
   381
            return "Composer"; //Non Standard
hgs
parents: 21
diff changeset
   382
            }
hgs
parents: 21
diff changeset
   383
        case EMetaDataCopyright:
hgs
parents: 21
diff changeset
   384
            {
hgs
parents: 21
diff changeset
   385
            return "KhronosCopyright";
hgs
parents: 21
diff changeset
   386
            }
hgs
parents: 21
diff changeset
   387
        case EMetaDataOriginalArtist:
hgs
parents: 21
diff changeset
   388
            {
hgs
parents: 21
diff changeset
   389
            return "Original Artist"; //Non Standard
hgs
parents: 21
diff changeset
   390
            }
hgs
parents: 21
diff changeset
   391
        case EMetaDataUserUrl:
hgs
parents: 21
diff changeset
   392
        case EMetaDataUrl:
hgs
parents: 21
diff changeset
   393
            {
hgs
parents: 21
diff changeset
   394
            return "KhronosContentURL";
hgs
parents: 21
diff changeset
   395
            }
hgs
parents: 21
diff changeset
   396
        case EMetaDataJpeg:
hgs
parents: 21
diff changeset
   397
            {
hgs
parents: 21
diff changeset
   398
            return "attachedpicture";//"KhronosAlbumArtJPEG";
hgs
parents: 21
diff changeset
   399
            }
hgs
parents: 21
diff changeset
   400
        case EMetaDataVendor:
hgs
parents: 21
diff changeset
   401
            {
hgs
parents: 21
diff changeset
   402
            return "Vendor"; //Non Standard
hgs
parents: 21
diff changeset
   403
            }
hgs
parents: 21
diff changeset
   404
        case EMetaDataRating:
hgs
parents: 21
diff changeset
   405
            {
hgs
parents: 21
diff changeset
   406
            return "KhronosRating";
hgs
parents: 21
diff changeset
   407
            }
hgs
parents: 21
diff changeset
   408
        case EMetaDataDuration:
hgs
parents: 21
diff changeset
   409
            {
hgs
parents: 21
diff changeset
   410
            return "Duration"; //Non Standard
hgs
parents: 21
diff changeset
   411
            }
hgs
parents: 21
diff changeset
   412
        default:
hgs
parents: 21
diff changeset
   413
            {
hgs
parents: 21
diff changeset
   414
            }
hgs
parents: 21
diff changeset
   415
        }
hgs
parents: 21
diff changeset
   416
hgs
parents: 21
diff changeset
   417
    return "UnSupported";
hgs
parents: 21
diff changeset
   418
    }
19
hgs
parents:
diff changeset
   419
hgs
parents:
diff changeset
   420
TInt CS60MetadataUtilityItf::ValueEncoding(TMetaDataFieldId fldID)
25
hgs
parents: 21
diff changeset
   421
    {
hgs
parents: 21
diff changeset
   422
    switch (fldID)
hgs
parents: 21
diff changeset
   423
        {
hgs
parents: 21
diff changeset
   424
        case EMetaDataJpeg:
hgs
parents: 21
diff changeset
   425
            {
hgs
parents: 21
diff changeset
   426
            return CMetadataUtilityItf::EBinaryEncoding;
hgs
parents: 21
diff changeset
   427
            }
hgs
parents: 21
diff changeset
   428
hgs
parents: 21
diff changeset
   429
        case EMetaDataSongTitle:
hgs
parents: 21
diff changeset
   430
        case EMetaDataArtist:
hgs
parents: 21
diff changeset
   431
        case EMetaDataAlbum:
hgs
parents: 21
diff changeset
   432
        case EMetaDataYear:
hgs
parents: 21
diff changeset
   433
        case EMetaDataComment:
hgs
parents: 21
diff changeset
   434
        case EMetaDataAlbumTrack:
hgs
parents: 21
diff changeset
   435
        case EMetaDataGenre:
hgs
parents: 21
diff changeset
   436
        case EMetaDataComposer:
hgs
parents: 21
diff changeset
   437
        case EMetaDataCopyright:
hgs
parents: 21
diff changeset
   438
        case EMetaDataOriginalArtist:
hgs
parents: 21
diff changeset
   439
        case EMetaDataUserUrl:
hgs
parents: 21
diff changeset
   440
        case EMetaDataUrl:
hgs
parents: 21
diff changeset
   441
        case EMetaDataVendor:
hgs
parents: 21
diff changeset
   442
        case EMetaDataRating:
hgs
parents: 21
diff changeset
   443
        case EMetaDataDuration:
hgs
parents: 21
diff changeset
   444
        default:
hgs
parents: 21
diff changeset
   445
            {
hgs
parents: 21
diff changeset
   446
            return CMetadataUtilityItf::EUnicodeEncoding;
hgs
parents: 21
diff changeset
   447
            }
hgs
parents: 21
diff changeset
   448
        }
hgs
parents: 21
diff changeset
   449
hgs
parents: 21
diff changeset
   450
    }
19
hgs
parents:
diff changeset
   451
char* CS60MetadataUtilityItf::GetKey(TInt index)
25
hgs
parents: 21
diff changeset
   452
    {
hgs
parents: 21
diff changeset
   453
hgs
parents: 21
diff changeset
   454
    if (pMetaDataUtility && index < uNumMetadataItems)
hgs
parents: 21
diff changeset
   455
        {
hgs
parents: 21
diff changeset
   456
hgs
parents: 21
diff changeset
   457
        TMetaDataFieldId fieldId;
19
hgs
parents:
diff changeset
   458
25
hgs
parents: 21
diff changeset
   459
        TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   460
        TInt err = KErrGeneral;
hgs
parents: 21
diff changeset
   461
        TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId )); 
hgs
parents: 21
diff changeset
   462
        TAG_TIME_PROFILING_END; 
hgs
parents: 21
diff changeset
   463
        PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   464
hgs
parents: 21
diff changeset
   465
        if ((err == KErrNone) && (fieldId != EUnknownMetaDataField))
hgs
parents: 21
diff changeset
   466
            {
hgs
parents: 21
diff changeset
   467
            return KeyMapping(fieldId);
hgs
parents: 21
diff changeset
   468
            }
hgs
parents: 21
diff changeset
   469
        }
hgs
parents: 21
diff changeset
   470
    return NULL;
hgs
parents: 21
diff changeset
   471
    }
19
hgs
parents:
diff changeset
   472
hgs
parents:
diff changeset
   473
TInt CS60MetadataUtilityItf::GetValueSize(TInt index)
25
hgs
parents: 21
diff changeset
   474
    {
hgs
parents: 21
diff changeset
   475
    if (pMetaDataUtility && index < uNumMetadataItems)
hgs
parents: 21
diff changeset
   476
        {
hgs
parents: 21
diff changeset
   477
hgs
parents: 21
diff changeset
   478
        TMetaDataFieldId fieldId;
hgs
parents: 21
diff changeset
   479
        TInt err = KErrGeneral;
hgs
parents: 21
diff changeset
   480
        TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId ));
19
hgs
parents:
diff changeset
   481
25
hgs
parents: 21
diff changeset
   482
        if ((err == KErrNone) && (fieldId != EUnknownMetaDataField))
hgs
parents: 21
diff changeset
   483
            {
hgs
parents: 21
diff changeset
   484
            const CMetaDataFieldContainer* iContainer = NULL;
hgs
parents: 21
diff changeset
   485
            TRAP(err, iContainer = &pMetaDataUtility->MetaDataFieldsL());
hgs
parents: 21
diff changeset
   486
            if (err == KErrNone)
hgs
parents: 21
diff changeset
   487
                {
hgs
parents: 21
diff changeset
   488
                if (ValueEncoding(fieldId)
hgs
parents: 21
diff changeset
   489
                        == CMetadataUtilityItf::EUnicodeEncoding)
hgs
parents: 21
diff changeset
   490
                    {
hgs
parents: 21
diff changeset
   491
                    TPtrC field = iContainer->Field(fieldId);
hgs
parents: 21
diff changeset
   492
                    if (field != KNullDesC)
hgs
parents: 21
diff changeset
   493
                        {
hgs
parents: 21
diff changeset
   494
                        return field.Size() + 2; //additional character (two bytes) for null terminator
hgs
parents: 21
diff changeset
   495
                        }
hgs
parents: 21
diff changeset
   496
                    }
hgs
parents: 21
diff changeset
   497
                else //Binary
hgs
parents: 21
diff changeset
   498
                    {
hgs
parents: 21
diff changeset
   499
                    TPtrC8 field8 = iContainer->Field8(fieldId);
hgs
parents: 21
diff changeset
   500
                    if (field8 != KNullDesC8)
hgs
parents: 21
diff changeset
   501
                        {
hgs
parents: 21
diff changeset
   502
                        return field8.Size();
hgs
parents: 21
diff changeset
   503
                        }
hgs
parents: 21
diff changeset
   504
                    }
hgs
parents: 21
diff changeset
   505
                }
hgs
parents: 21
diff changeset
   506
            }
hgs
parents: 21
diff changeset
   507
        }
19
hgs
parents:
diff changeset
   508
25
hgs
parents: 21
diff changeset
   509
    return 0;
hgs
parents: 21
diff changeset
   510
    }
19
hgs
parents:
diff changeset
   511
25
hgs
parents: 21
diff changeset
   512
TInt CS60MetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, //in params
hgs
parents: 21
diff changeset
   513
        TInt* outSize, TInt* encodingType) //out params
hgs
parents: 21
diff changeset
   514
    {
hgs
parents: 21
diff changeset
   515
hgs
parents: 21
diff changeset
   516
    TInt retValueSize = 0;
hgs
parents: 21
diff changeset
   517
    *encodingType = CMetadataUtilityItf::EUnknownEncoding;
hgs
parents: 21
diff changeset
   518
hgs
parents: 21
diff changeset
   519
    if (pMetaDataUtility && index < uNumMetadataItems)
hgs
parents: 21
diff changeset
   520
        {
19
hgs
parents:
diff changeset
   521
25
hgs
parents: 21
diff changeset
   522
        TMetaDataFieldId fieldId;
hgs
parents: 21
diff changeset
   523
        TInt err = KErrGeneral;
hgs
parents: 21
diff changeset
   524
        TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId ));
hgs
parents: 21
diff changeset
   525
hgs
parents: 21
diff changeset
   526
        if ((err == KErrNone) && (fieldId != EUnknownMetaDataField))
hgs
parents: 21
diff changeset
   527
            {
hgs
parents: 21
diff changeset
   528
hgs
parents: 21
diff changeset
   529
            const CMetaDataFieldContainer* iContainer = NULL;
hgs
parents: 21
diff changeset
   530
            TRAP(err, iContainer = &pMetaDataUtility->MetaDataFieldsL());
hgs
parents: 21
diff changeset
   531
            if (err == KErrNone)
hgs
parents: 21
diff changeset
   532
                {
hgs
parents: 21
diff changeset
   533
                *encodingType = ValueEncoding(fieldId);
hgs
parents: 21
diff changeset
   534
                if (*encodingType == CMetadataUtilityItf::EUnicodeEncoding)
hgs
parents: 21
diff changeset
   535
                    {
19
hgs
parents:
diff changeset
   536
25
hgs
parents: 21
diff changeset
   537
                    TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   538
                    TPtrC field = iContainer->Field(fieldId);
hgs
parents: 21
diff changeset
   539
                    TAG_TIME_PROFILING_END;
hgs
parents: 21
diff changeset
   540
                    PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   541
                    if (field != KNullDesC)
hgs
parents: 21
diff changeset
   542
                        {
hgs
parents: 21
diff changeset
   543
                        *outSize = CMetadataUtilityItf::ExtractUCS2(field,
hgs
parents: 21
diff changeset
   544
                                data, maxLength);
hgs
parents: 21
diff changeset
   545
                        retValueSize = field.Size() + 2; //actual size
hgs
parents: 21
diff changeset
   546
                        }
hgs
parents: 21
diff changeset
   547
                    }
hgs
parents: 21
diff changeset
   548
                else //Binary
hgs
parents: 21
diff changeset
   549
                    {
hgs
parents: 21
diff changeset
   550
hgs
parents: 21
diff changeset
   551
                    TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   552
                    TPtrC8 field8 = iContainer->Field8(fieldId);
hgs
parents: 21
diff changeset
   553
                    TAG_TIME_PROFILING_END;
hgs
parents: 21
diff changeset
   554
                    PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   555
                    if (field8 != KNullDesC8)
hgs
parents: 21
diff changeset
   556
                        {
hgs
parents: 21
diff changeset
   557
                        *outSize
hgs
parents: 21
diff changeset
   558
                                = (maxLength > field8.Size())
hgs
parents: 21
diff changeset
   559
                                                              ? field8.Size()
hgs
parents: 21
diff changeset
   560
                                                                 : maxLength;
hgs
parents: 21
diff changeset
   561
                        memcpy(data, field8.Ptr(), *outSize);
hgs
parents: 21
diff changeset
   562
                        retValueSize = field8.Size();
hgs
parents: 21
diff changeset
   563
                        }
hgs
parents: 21
diff changeset
   564
                    }
hgs
parents: 21
diff changeset
   565
                }
hgs
parents: 21
diff changeset
   566
            }
hgs
parents: 21
diff changeset
   567
        }
hgs
parents: 21
diff changeset
   568
hgs
parents: 21
diff changeset
   569
    return retValueSize;
hgs
parents: 21
diff changeset
   570
    }
19
hgs
parents:
diff changeset
   571
hgs
parents:
diff changeset
   572
TInt CS60MetadataUtilityItf::Reset()
25
hgs
parents: 21
diff changeset
   573
    {
hgs
parents: 21
diff changeset
   574
    TInt err = KErrNone;
hgs
parents: 21
diff changeset
   575
    if (pMetaDataUtility)
hgs
parents: 21
diff changeset
   576
        {
hgs
parents: 21
diff changeset
   577
        TRAP(err, pMetaDataUtility->ResetL());
hgs
parents: 21
diff changeset
   578
        }
19
hgs
parents:
diff changeset
   579
25
hgs
parents: 21
diff changeset
   580
    return err;
hgs
parents: 21
diff changeset
   581
    }
19
hgs
parents:
diff changeset
   582
25
hgs
parents: 21
diff changeset
   583
CHXMetadataUtilityItf::CHXMetadataUtilityItf() :
hgs
parents: 21
diff changeset
   584
    pHXMetaDataUtility(NULL)
hgs
parents: 21
diff changeset
   585
    {
hgs
parents: 21
diff changeset
   586
    }
19
hgs
parents:
diff changeset
   587
hgs
parents:
diff changeset
   588
void CHXMetadataUtilityItf::ConstructL()
25
hgs
parents: 21
diff changeset
   589
    {
hgs
parents: 21
diff changeset
   590
    TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   591
    pHXMetaDataUtility = CHXMetaDataUtility::NewL();
hgs
parents: 21
diff changeset
   592
    TAG_TIME_PROFILING_END; 
hgs
parents: 21
diff changeset
   593
    PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   594
    }
19
hgs
parents:
diff changeset
   595
hgs
parents:
diff changeset
   596
CHXMetadataUtilityItf* CHXMetadataUtilityItf::New()
25
hgs
parents: 21
diff changeset
   597
    {
hgs
parents: 21
diff changeset
   598
    CHXMetadataUtilityItf* self = new CHXMetadataUtilityItf();
hgs
parents: 21
diff changeset
   599
hgs
parents: 21
diff changeset
   600
    if (self)
hgs
parents: 21
diff changeset
   601
        {
hgs
parents: 21
diff changeset
   602
        TInt err = KErrGeneral;
hgs
parents: 21
diff changeset
   603
        TRAP(err, self->ConstructL());
19
hgs
parents:
diff changeset
   604
25
hgs
parents: 21
diff changeset
   605
        if (err != KErrNone)
hgs
parents: 21
diff changeset
   606
            {
hgs
parents: 21
diff changeset
   607
            delete self;
hgs
parents: 21
diff changeset
   608
            self = NULL;
hgs
parents: 21
diff changeset
   609
            }
hgs
parents: 21
diff changeset
   610
        }
hgs
parents: 21
diff changeset
   611
hgs
parents: 21
diff changeset
   612
    return self;
hgs
parents: 21
diff changeset
   613
    }
hgs
parents: 21
diff changeset
   614
19
hgs
parents:
diff changeset
   615
CHXMetadataUtilityItf::~CHXMetadataUtilityItf()
25
hgs
parents: 21
diff changeset
   616
    {
hgs
parents: 21
diff changeset
   617
    if (pHXMetaDataUtility)
hgs
parents: 21
diff changeset
   618
        {
hgs
parents: 21
diff changeset
   619
        TInt err = KErrGeneral;
19
hgs
parents:
diff changeset
   620
25
hgs
parents: 21
diff changeset
   621
        TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   622
        TRAP(err, pHXMetaDataUtility->ResetL());
hgs
parents: 21
diff changeset
   623
        delete pHXMetaDataUtility;
hgs
parents: 21
diff changeset
   624
        TAG_TIME_PROFILING_END; 
hgs
parents: 21
diff changeset
   625
        PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   626
        }
hgs
parents: 21
diff changeset
   627
hgs
parents: 21
diff changeset
   628
    pHXMetaDataUtility = NULL;
hgs
parents: 21
diff changeset
   629
    }
19
hgs
parents:
diff changeset
   630
hgs
parents:
diff changeset
   631
TInt CHXMetadataUtilityItf::Reset()
25
hgs
parents: 21
diff changeset
   632
    {
hgs
parents: 21
diff changeset
   633
    TInt err = KErrNone;
hgs
parents: 21
diff changeset
   634
    if (pHXMetaDataUtility)
hgs
parents: 21
diff changeset
   635
        {
hgs
parents: 21
diff changeset
   636
        TRAP(err, pHXMetaDataUtility->ResetL());
hgs
parents: 21
diff changeset
   637
        }
19
hgs
parents:
diff changeset
   638
25
hgs
parents: 21
diff changeset
   639
    return err;
hgs
parents: 21
diff changeset
   640
    }
19
hgs
parents:
diff changeset
   641
hgs
parents:
diff changeset
   642
TInt CHXMetadataUtilityItf::ParseSource(TDesC& fileName)
25
hgs
parents: 21
diff changeset
   643
    {
hgs
parents: 21
diff changeset
   644
    TInt err = KErrGeneral;
19
hgs
parents:
diff changeset
   645
25
hgs
parents: 21
diff changeset
   646
    if (pHXMetaDataUtility)
hgs
parents: 21
diff changeset
   647
        {
hgs
parents: 21
diff changeset
   648
        //open with the file handle
hgs
parents: 21
diff changeset
   649
        TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   650
        TRAP(err, pHXMetaDataUtility->OpenFileL(fileName)); 
hgs
parents: 21
diff changeset
   651
        TAG_TIME_PROFILING_END; 
hgs
parents: 21
diff changeset
   652
        PRINT_TO_CONSOLE_TIME_DIFF;
19
hgs
parents:
diff changeset
   653
25
hgs
parents: 21
diff changeset
   654
        if (err == KErrNone)
hgs
parents: 21
diff changeset
   655
            {
hgs
parents: 21
diff changeset
   656
            return pHXMetaDataUtility->GetMetaDataCount(uNumMetadataItems);
hgs
parents: 21
diff changeset
   657
            }
hgs
parents: 21
diff changeset
   658
        }
19
hgs
parents:
diff changeset
   659
25
hgs
parents: 21
diff changeset
   660
    return err;
hgs
parents: 21
diff changeset
   661
    }
19
hgs
parents:
diff changeset
   662
hgs
parents:
diff changeset
   663
TInt CHXMetadataUtilityItf::CalculateNumMetadataItems(TUint* numItems)
25
hgs
parents: 21
diff changeset
   664
    {
hgs
parents: 21
diff changeset
   665
    TInt err = KErrGeneral;
19
hgs
parents:
diff changeset
   666
25
hgs
parents: 21
diff changeset
   667
    if (pHXMetaDataUtility && numItems)
hgs
parents: 21
diff changeset
   668
        {
hgs
parents: 21
diff changeset
   669
        *numItems = uNumMetadataItems;
hgs
parents: 21
diff changeset
   670
        err = KErrNone;
hgs
parents: 21
diff changeset
   671
        }
19
hgs
parents:
diff changeset
   672
25
hgs
parents: 21
diff changeset
   673
    return err;
hgs
parents: 21
diff changeset
   674
    }
19
hgs
parents:
diff changeset
   675
hgs
parents:
diff changeset
   676
char* CHXMetadataUtilityItf::KeyMapping(HXMetaDataKeys::EHXMetaDataId fldID)
25
hgs
parents: 21
diff changeset
   677
    {
hgs
parents: 21
diff changeset
   678
hgs
parents: 21
diff changeset
   679
    switch (fldID)
hgs
parents: 21
diff changeset
   680
        {
hgs
parents: 21
diff changeset
   681
hgs
parents: 21
diff changeset
   682
        case HXMetaDataKeys::EHXTitle:
hgs
parents: 21
diff changeset
   683
            {
hgs
parents: 21
diff changeset
   684
            return "KhronosTitle";
hgs
parents: 21
diff changeset
   685
            }
hgs
parents: 21
diff changeset
   686
        case HXMetaDataKeys::EHXPerformer:
hgs
parents: 21
diff changeset
   687
            {
hgs
parents: 21
diff changeset
   688
            return "KhronosArtist";
hgs
parents: 21
diff changeset
   689
            }
hgs
parents: 21
diff changeset
   690
        case HXMetaDataKeys::EHXDescription:
hgs
parents: 21
diff changeset
   691
            {
hgs
parents: 21
diff changeset
   692
            return "KhronosComment";
hgs
parents: 21
diff changeset
   693
            }
hgs
parents: 21
diff changeset
   694
        case HXMetaDataKeys::EHXGenre:
hgs
parents: 21
diff changeset
   695
            {
hgs
parents: 21
diff changeset
   696
            return "KhronosGenre";
hgs
parents: 21
diff changeset
   697
            }
hgs
parents: 21
diff changeset
   698
        case HXMetaDataKeys::EHXAuthor:
hgs
parents: 21
diff changeset
   699
            {
hgs
parents: 21
diff changeset
   700
            return "Composer"; //Non Standard
hgs
parents: 21
diff changeset
   701
            }
hgs
parents: 21
diff changeset
   702
        case HXMetaDataKeys::EHXCopyright:
hgs
parents: 21
diff changeset
   703
            {
hgs
parents: 21
diff changeset
   704
            return "KhronosCopyright";
hgs
parents: 21
diff changeset
   705
            }
hgs
parents: 21
diff changeset
   706
        case HXMetaDataKeys::EHXContentURI:
hgs
parents: 21
diff changeset
   707
            {
hgs
parents: 21
diff changeset
   708
            return "KhronosContentURL";
hgs
parents: 21
diff changeset
   709
            }
hgs
parents: 21
diff changeset
   710
        case HXMetaDataKeys::EHXDuration:
hgs
parents: 21
diff changeset
   711
            {
hgs
parents: 21
diff changeset
   712
            return "Duration"; //Non Standard
hgs
parents: 21
diff changeset
   713
            }
hgs
parents: 21
diff changeset
   714
        case HXMetaDataKeys::EHXClipBitRate:
hgs
parents: 21
diff changeset
   715
            {
hgs
parents: 21
diff changeset
   716
            return "ClipBitRate"; //non-standard
hgs
parents: 21
diff changeset
   717
            }
hgs
parents: 21
diff changeset
   718
        case HXMetaDataKeys::EHXVideoBitRate:
hgs
parents: 21
diff changeset
   719
            {
hgs
parents: 21
diff changeset
   720
            return "VideoBitRate"; // non-standard
hgs
parents: 21
diff changeset
   721
            }
hgs
parents: 21
diff changeset
   722
        case HXMetaDataKeys::EHXAudioBitRate:
hgs
parents: 21
diff changeset
   723
            {
hgs
parents: 21
diff changeset
   724
            return "AudioBitRate";
hgs
parents: 21
diff changeset
   725
            }
hgs
parents: 21
diff changeset
   726
        case HXMetaDataKeys::EHXCodec:
hgs
parents: 21
diff changeset
   727
            {
hgs
parents: 21
diff changeset
   728
            return "Codec";
hgs
parents: 21
diff changeset
   729
            }
hgs
parents: 21
diff changeset
   730
        case HXMetaDataKeys::EHXFrameSize:
hgs
parents: 21
diff changeset
   731
            {
hgs
parents: 21
diff changeset
   732
            return "Resolution";
hgs
parents: 21
diff changeset
   733
            }
hgs
parents: 21
diff changeset
   734
        case HXMetaDataKeys::EHXFramesPerSecond:
hgs
parents: 21
diff changeset
   735
            {
hgs
parents: 21
diff changeset
   736
            return "FrameRate";
hgs
parents: 21
diff changeset
   737
            }
hgs
parents: 21
diff changeset
   738
        case HXMetaDataKeys::EHXStreamCount:
hgs
parents: 21
diff changeset
   739
            {
hgs
parents: 21
diff changeset
   740
            return "Stream Count";
hgs
parents: 21
diff changeset
   741
            }
hgs
parents: 21
diff changeset
   742
        case HXMetaDataKeys::EHXLiveStream:
hgs
parents: 21
diff changeset
   743
            {
hgs
parents: 21
diff changeset
   744
            return "Live Stream";
hgs
parents: 21
diff changeset
   745
            }
19
hgs
parents:
diff changeset
   746
        case HXMetaDataKeys::EHXSeekable:
25
hgs
parents: 21
diff changeset
   747
            {
hgs
parents: 21
diff changeset
   748
            return "Seekable";
hgs
parents: 21
diff changeset
   749
            }
19
hgs
parents:
diff changeset
   750
        case HXMetaDataKeys::EHXContentType:
25
hgs
parents: 21
diff changeset
   751
            {
hgs
parents: 21
diff changeset
   752
            return "Content Type";
hgs
parents: 21
diff changeset
   753
            }
hgs
parents: 21
diff changeset
   754
        case HXMetaDataKeys::EHXFormat:
hgs
parents: 21
diff changeset
   755
            {
hgs
parents: 21
diff changeset
   756
            return "Format";
hgs
parents: 21
diff changeset
   757
            }
19
hgs
parents:
diff changeset
   758
        case HXMetaDataKeys::EHXQuality:
25
hgs
parents: 21
diff changeset
   759
            {
hgs
parents: 21
diff changeset
   760
            return "Quality";
hgs
parents: 21
diff changeset
   761
            }
19
hgs
parents:
diff changeset
   762
        case HXMetaDataKeys::EHXAbstract:
25
hgs
parents: 21
diff changeset
   763
            {
hgs
parents: 21
diff changeset
   764
            return "Abstract";
hgs
parents: 21
diff changeset
   765
            }
hgs
parents: 21
diff changeset
   766
        case HXMetaDataKeys::EHXMimeType:
hgs
parents: 21
diff changeset
   767
            {
hgs
parents: 21
diff changeset
   768
            return "MimeType";
hgs
parents: 21
diff changeset
   769
            }
hgs
parents: 21
diff changeset
   770
        case HXMetaDataKeys::EHXIconURI:
hgs
parents: 21
diff changeset
   771
            {
hgs
parents: 21
diff changeset
   772
            return "Icon URI";
hgs
parents: 21
diff changeset
   773
            }
19
hgs
parents:
diff changeset
   774
        case HXMetaDataKeys::EHXEPreviewURI:
25
hgs
parents: 21
diff changeset
   775
            {
hgs
parents: 21
diff changeset
   776
            return "Preview URI";
hgs
parents: 21
diff changeset
   777
            }
19
hgs
parents:
diff changeset
   778
        case HXMetaDataKeys::EHXContentID:
25
hgs
parents: 21
diff changeset
   779
            {
hgs
parents: 21
diff changeset
   780
            return "Content ID";
hgs
parents: 21
diff changeset
   781
            }
19
hgs
parents:
diff changeset
   782
        case HXMetaDataKeys::EHXInfoURL:
25
hgs
parents: 21
diff changeset
   783
            {
hgs
parents: 21
diff changeset
   784
            return "Info URL";
hgs
parents: 21
diff changeset
   785
            }
hgs
parents: 21
diff changeset
   786
        default:
hgs
parents: 21
diff changeset
   787
            {
hgs
parents: 21
diff changeset
   788
            }
hgs
parents: 21
diff changeset
   789
        }
19
hgs
parents:
diff changeset
   790
25
hgs
parents: 21
diff changeset
   791
    return "UnSupported";
hgs
parents: 21
diff changeset
   792
    }
19
hgs
parents:
diff changeset
   793
hgs
parents:
diff changeset
   794
TInt CHXMetadataUtilityItf::ValueEncoding(HXMetaDataKeys::EHXMetaDataId fldID)
25
hgs
parents: 21
diff changeset
   795
    {
hgs
parents: 21
diff changeset
   796
    switch (fldID)
hgs
parents: 21
diff changeset
   797
        {
hgs
parents: 21
diff changeset
   798
        default:
hgs
parents: 21
diff changeset
   799
            {
hgs
parents: 21
diff changeset
   800
            return CMetadataUtilityItf::EUnicodeEncoding;
hgs
parents: 21
diff changeset
   801
            }
hgs
parents: 21
diff changeset
   802
        }
hgs
parents: 21
diff changeset
   803
hgs
parents: 21
diff changeset
   804
    }
19
hgs
parents:
diff changeset
   805
char* CHXMetadataUtilityItf::GetKey(TInt index)
25
hgs
parents: 21
diff changeset
   806
    {
19
hgs
parents:
diff changeset
   807
25
hgs
parents: 21
diff changeset
   808
    if (pHXMetaDataUtility && index < uNumMetadataItems)
hgs
parents: 21
diff changeset
   809
        {
hgs
parents: 21
diff changeset
   810
        HXMetaDataKeys::EHXMetaDataId id;
hgs
parents: 21
diff changeset
   811
        HBufC* pDes;
hgs
parents: 21
diff changeset
   812
hgs
parents: 21
diff changeset
   813
        TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   814
        TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes);
hgs
parents: 21
diff changeset
   815
        TAG_TIME_PROFILING_END; 
hgs
parents: 21
diff changeset
   816
        PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   817
hgs
parents: 21
diff changeset
   818
        if (err == KErrNone)
hgs
parents: 21
diff changeset
   819
            {
hgs
parents: 21
diff changeset
   820
            return KeyMapping(id);
hgs
parents: 21
diff changeset
   821
            }
hgs
parents: 21
diff changeset
   822
        }
hgs
parents: 21
diff changeset
   823
    return NULL;
hgs
parents: 21
diff changeset
   824
    }
19
hgs
parents:
diff changeset
   825
hgs
parents:
diff changeset
   826
TInt CHXMetadataUtilityItf::GetValueSize(TInt index)
25
hgs
parents: 21
diff changeset
   827
    {
hgs
parents: 21
diff changeset
   828
    if (pHXMetaDataUtility && index < uNumMetadataItems)
hgs
parents: 21
diff changeset
   829
        {
hgs
parents: 21
diff changeset
   830
        HXMetaDataKeys::EHXMetaDataId id;
hgs
parents: 21
diff changeset
   831
        HBufC* pDes;
hgs
parents: 21
diff changeset
   832
hgs
parents: 21
diff changeset
   833
        TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes);
19
hgs
parents:
diff changeset
   834
25
hgs
parents: 21
diff changeset
   835
        if (err == KErrNone)
hgs
parents: 21
diff changeset
   836
            {
hgs
parents: 21
diff changeset
   837
            if (ValueEncoding(id) == CMetadataUtilityItf::EUnicodeEncoding)
hgs
parents: 21
diff changeset
   838
                {
hgs
parents: 21
diff changeset
   839
                return pDes->Size() + 2; //additional character (two bytes) for null terminator
hgs
parents: 21
diff changeset
   840
                }
hgs
parents: 21
diff changeset
   841
            else //Binary
hgs
parents: 21
diff changeset
   842
                {
hgs
parents: 21
diff changeset
   843
                //no support
hgs
parents: 21
diff changeset
   844
                }
hgs
parents: 21
diff changeset
   845
            }
hgs
parents: 21
diff changeset
   846
        }
19
hgs
parents:
diff changeset
   847
25
hgs
parents: 21
diff changeset
   848
    return 0;
hgs
parents: 21
diff changeset
   849
    }
hgs
parents: 21
diff changeset
   850
hgs
parents: 21
diff changeset
   851
TInt CHXMetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, //in params
hgs
parents: 21
diff changeset
   852
        TInt* outSize, TInt* encodingType) //out params
hgs
parents: 21
diff changeset
   853
    {
hgs
parents: 21
diff changeset
   854
hgs
parents: 21
diff changeset
   855
    TInt retValueSize = 0;
hgs
parents: 21
diff changeset
   856
    *encodingType = CMetadataUtilityItf::EUnknownEncoding;
19
hgs
parents:
diff changeset
   857
25
hgs
parents: 21
diff changeset
   858
    if (pHXMetaDataUtility && index < uNumMetadataItems)
hgs
parents: 21
diff changeset
   859
        {
hgs
parents: 21
diff changeset
   860
        HXMetaDataKeys::EHXMetaDataId id;
hgs
parents: 21
diff changeset
   861
        HBufC* pDes;
hgs
parents: 21
diff changeset
   862
hgs
parents: 21
diff changeset
   863
        TAG_TIME_PROFILING_BEGIN;
hgs
parents: 21
diff changeset
   864
        TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes);
hgs
parents: 21
diff changeset
   865
        TAG_TIME_PROFILING_END; 
hgs
parents: 21
diff changeset
   866
        PRINT_TO_CONSOLE_TIME_DIFF;
hgs
parents: 21
diff changeset
   867
hgs
parents: 21
diff changeset
   868
        *encodingType = ValueEncoding(id);
19
hgs
parents:
diff changeset
   869
25
hgs
parents: 21
diff changeset
   870
        if (err == KErrNone)
hgs
parents: 21
diff changeset
   871
            {
hgs
parents: 21
diff changeset
   872
            if (*encodingType == CMetadataUtilityItf::EUnicodeEncoding)
hgs
parents: 21
diff changeset
   873
                {
hgs
parents: 21
diff changeset
   874
                *outSize = CMetadataUtilityItf::ExtractUCS2(*pDes, data,
hgs
parents: 21
diff changeset
   875
                        maxLength);
hgs
parents: 21
diff changeset
   876
                retValueSize = pDes->Size() + 2; //actual Size	
hgs
parents: 21
diff changeset
   877
                }
hgs
parents: 21
diff changeset
   878
            else //Binary
hgs
parents: 21
diff changeset
   879
                {
hgs
parents: 21
diff changeset
   880
                //no support
hgs
parents: 21
diff changeset
   881
                }
hgs
parents: 21
diff changeset
   882
            }
hgs
parents: 21
diff changeset
   883
        }
19
hgs
parents:
diff changeset
   884
25
hgs
parents: 21
diff changeset
   885
    return retValueSize;
hgs
parents: 21
diff changeset
   886
    }
19
hgs
parents:
diff changeset
   887
25
hgs
parents: 21
diff changeset
   888
extern "C"
hgs
parents: 21
diff changeset
   889
    {
19
hgs
parents:
diff changeset
   890
hgs
parents:
diff changeset
   891
    void* mmf_metadata_utility_init(char* uri)
25
hgs
parents: 21
diff changeset
   892
        {
hgs
parents: 21
diff changeset
   893
        return CMetadataUtilityItf::New(uri);
hgs
parents: 21
diff changeset
   894
        }
19
hgs
parents:
diff changeset
   895
hgs
parents:
diff changeset
   896
    void mmf_metadata_utility_destroy(void* context)
25
hgs
parents: 21
diff changeset
   897
        {
hgs
parents: 21
diff changeset
   898
        delete ((CMetadataUtilityItf*) context);
hgs
parents: 21
diff changeset
   899
        }
hgs
parents: 21
diff changeset
   900
hgs
parents: 21
diff changeset
   901
    XAresult mmf_metadata_utility_parse_source(void* context, char* uri)
hgs
parents: 21
diff changeset
   902
        {
hgs
parents: 21
diff changeset
   903
        TInt err = ((CMetadataUtilityItf*) context)->ParseSource(uri);
hgs
parents: 21
diff changeset
   904
hgs
parents: 21
diff changeset
   905
        if (err == KErrNone)
hgs
parents: 21
diff changeset
   906
            {
hgs
parents: 21
diff changeset
   907
            return XA_RESULT_SUCCESS;
hgs
parents: 21
diff changeset
   908
            }
19
hgs
parents:
diff changeset
   909
25
hgs
parents: 21
diff changeset
   910
        return XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   911
        }
19
hgs
parents:
diff changeset
   912
25
hgs
parents: 21
diff changeset
   913
    XAresult mmf_get_item_count(void* context, XAuint32* itemCount)
hgs
parents: 21
diff changeset
   914
        {
hgs
parents: 21
diff changeset
   915
        if (itemCount)
hgs
parents: 21
diff changeset
   916
            {
hgs
parents: 21
diff changeset
   917
            TInt err =((CMetadataUtilityItf*) (context))->CalculateNumMetadataItems(
hgs
parents: 21
diff changeset
   918
                                    (TUint *) itemCount);
hgs
parents: 21
diff changeset
   919
            if (err == KErrNone)
hgs
parents: 21
diff changeset
   920
                {
hgs
parents: 21
diff changeset
   921
                return XA_RESULT_SUCCESS;
hgs
parents: 21
diff changeset
   922
                }
hgs
parents: 21
diff changeset
   923
            }
hgs
parents: 21
diff changeset
   924
hgs
parents: 21
diff changeset
   925
        return XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   926
        }
19
hgs
parents:
diff changeset
   927
25
hgs
parents: 21
diff changeset
   928
    XAresult mmf_get_key_size(void* context, XAuint32 keyIndex,
hgs
parents: 21
diff changeset
   929
            XAuint32* keySize)
hgs
parents: 21
diff changeset
   930
        {
hgs
parents: 21
diff changeset
   931
        char* key = ((CMetadataUtilityItf*) (context))->GetKey(keyIndex);
hgs
parents: 21
diff changeset
   932
        if (key && keySize)
hgs
parents: 21
diff changeset
   933
            {
hgs
parents: 21
diff changeset
   934
            *keySize = (strlen(key) + sizeof(XAMetadataInfo));
hgs
parents: 21
diff changeset
   935
hgs
parents: 21
diff changeset
   936
            return XA_RESULT_SUCCESS;
hgs
parents: 21
diff changeset
   937
            }
hgs
parents: 21
diff changeset
   938
hgs
parents: 21
diff changeset
   939
        return XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   940
        }
19
hgs
parents:
diff changeset
   941
25
hgs
parents: 21
diff changeset
   942
    XAresult mmf_get_key(void* context, XAuint32 index, XAuint32 keySize,
hgs
parents: 21
diff changeset
   943
            XAMetadataInfo *pKey)
hgs
parents: 21
diff changeset
   944
        {
hgs
parents: 21
diff changeset
   945
        XAresult ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   946
hgs
parents: 21
diff changeset
   947
        TInt keyDataSize = keySize - sizeof(XAMetadataInfo) + 1;
hgs
parents: 21
diff changeset
   948
        char* ascKey = ((CMetadataUtilityItf*) (context))->GetKey(index);
19
hgs
parents:
diff changeset
   949
25
hgs
parents: 21
diff changeset
   950
        if (ascKey && keyDataSize)
hgs
parents: 21
diff changeset
   951
            {
hgs
parents: 21
diff changeset
   952
            TInt ascKeySize = strlen(ascKey);
hgs
parents: 21
diff changeset
   953
            TInt outSize = (ascKeySize >= keyDataSize)
hgs
parents: 21
diff changeset
   954
                                                       ? (keyDataSize - 1)
hgs
parents: 21
diff changeset
   955
                                                          : ascKeySize;
hgs
parents: 21
diff changeset
   956
hgs
parents: 21
diff changeset
   957
            pKey->size = outSize + 1;
hgs
parents: 21
diff changeset
   958
            pKey->encoding = XA_CHARACTERENCODING_ASCII;
hgs
parents: 21
diff changeset
   959
            strcpy((char *) (pKey->langCountry), "en-us");
hgs
parents: 21
diff changeset
   960
            strncpy((char *) (pKey->data), ascKey, outSize);
hgs
parents: 21
diff changeset
   961
            pKey->data[outSize] = '\0';
19
hgs
parents:
diff changeset
   962
25
hgs
parents: 21
diff changeset
   963
            if (ascKeySize >= keyDataSize)
hgs
parents: 21
diff changeset
   964
                {
hgs
parents: 21
diff changeset
   965
                ret = XA_RESULT_BUFFER_INSUFFICIENT;
hgs
parents: 21
diff changeset
   966
                }
hgs
parents: 21
diff changeset
   967
            else
hgs
parents: 21
diff changeset
   968
                {
hgs
parents: 21
diff changeset
   969
                ret = XA_RESULT_SUCCESS;
hgs
parents: 21
diff changeset
   970
                }
hgs
parents: 21
diff changeset
   971
            }
hgs
parents: 21
diff changeset
   972
hgs
parents: 21
diff changeset
   973
        ret = XA_RESULT_SUCCESS;
hgs
parents: 21
diff changeset
   974
        return ret;
hgs
parents: 21
diff changeset
   975
        }
19
hgs
parents:
diff changeset
   976
25
hgs
parents: 21
diff changeset
   977
    XAresult mmf_get_value_size(void* context, XAuint32 index,
hgs
parents: 21
diff changeset
   978
            XAuint32 *pValueSize)
hgs
parents: 21
diff changeset
   979
        {
hgs
parents: 21
diff changeset
   980
        if (pValueSize)
hgs
parents: 21
diff changeset
   981
            {
hgs
parents: 21
diff changeset
   982
            *pValueSize = ((CMetadataUtilityItf*) (context))->GetValueSize(
hgs
parents: 21
diff changeset
   983
                    index) + sizeof(XAMetadataInfo) - 1; 
hgs
parents: 21
diff changeset
   984
            //XAMetadataInfo already includes one byte for Data
19
hgs
parents:
diff changeset
   985
25
hgs
parents: 21
diff changeset
   986
            return XA_RESULT_SUCCESS;
hgs
parents: 21
diff changeset
   987
            }
19
hgs
parents:
diff changeset
   988
25
hgs
parents: 21
diff changeset
   989
        return XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   990
        }
19
hgs
parents:
diff changeset
   991
25
hgs
parents: 21
diff changeset
   992
    XAresult mmf_get_value(void* context, XAuint32 index, XAuint32 valueSize,
hgs
parents: 21
diff changeset
   993
            XAMetadataInfo *pValue)
hgs
parents: 21
diff changeset
   994
        {
hgs
parents: 21
diff changeset
   995
        XAresult ret = XA_RESULT_PARAMETER_INVALID;
hgs
parents: 21
diff changeset
   996
        TInt dataSize = valueSize - sizeof(XAMetadataInfo) + 1;
hgs
parents: 21
diff changeset
   997
        TInt outLen = 0, encodingType = CMetadataUtilityItf::EUnknownEncoding;
19
hgs
parents:
diff changeset
   998
25
hgs
parents: 21
diff changeset
   999
        if (dataSize > 0)
hgs
parents: 21
diff changeset
  1000
            {
19
hgs
parents:
diff changeset
  1001
25
hgs
parents: 21
diff changeset
  1002
            TInt actualDataSize =
hgs
parents: 21
diff changeset
  1003
                    ((CMetadataUtilityItf*) (context))->GetValue(index,
hgs
parents: 21
diff changeset
  1004
                            (char*) pValue->data, dataSize, &outLen,
hgs
parents: 21
diff changeset
  1005
                            &encodingType);
19
hgs
parents:
diff changeset
  1006
25
hgs
parents: 21
diff changeset
  1007
            pValue->size = outLen;
hgs
parents: 21
diff changeset
  1008
            pValue->encoding
hgs
parents: 21
diff changeset
  1009
                    = (encodingType == CMetadataUtilityItf::EUnicodeEncoding) 
hgs
parents: 21
diff changeset
  1010
                    ? XA_CHARACTERENCODING_UTF16LE : XA_CHARACTERENCODING_BINARY;
hgs
parents: 21
diff changeset
  1011
            strcpy((char *) (pValue->langCountry), "en-us");
19
hgs
parents:
diff changeset
  1012
25
hgs
parents: 21
diff changeset
  1013
            if (!actualDataSize)
hgs
parents: 21
diff changeset
  1014
                {
hgs
parents: 21
diff changeset
  1015
                return XA_RESULT_INTERNAL_ERROR;
hgs
parents: 21
diff changeset
  1016
                }
hgs
parents: 21
diff changeset
  1017
            if (actualDataSize > dataSize)
hgs
parents: 21
diff changeset
  1018
                {
hgs
parents: 21
diff changeset
  1019
                ret = XA_RESULT_BUFFER_INSUFFICIENT;
hgs
parents: 21
diff changeset
  1020
                }
hgs
parents: 21
diff changeset
  1021
            else
hgs
parents: 21
diff changeset
  1022
                {
hgs
parents: 21
diff changeset
  1023
                ret = XA_RESULT_SUCCESS;
hgs
parents: 21
diff changeset
  1024
                }
hgs
parents: 21
diff changeset
  1025
            }
hgs
parents: 21
diff changeset
  1026
hgs
parents: 21
diff changeset
  1027
        return ret;
hgs
parents: 21
diff changeset
  1028
        }
hgs
parents: 21
diff changeset
  1029
    }
hgs
parents: 21
diff changeset
  1030