khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.c
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:
19
hgs
parents:
diff changeset
     1
/*
25
hgs
parents: 19
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents: 19
diff changeset
     3
 * All rights reserved.
hgs
parents: 19
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents: 19
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents: 19
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents: 19
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents: 19
diff changeset
     8
 *
hgs
parents: 19
diff changeset
     9
 * Initial Contributors:
hgs
parents: 19
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents: 19
diff changeset
    11
 *
hgs
parents: 19
diff changeset
    12
 * Contributors:
hgs
parents: 19
diff changeset
    13
 *
hgs
parents: 19
diff changeset
    14
 * Description: MMF capabilities mgr
hgs
parents: 19
diff changeset
    15
 *
hgs
parents: 19
diff changeset
    16
 */
19
hgs
parents:
diff changeset
    17
#include <stdio.h>
hgs
parents:
diff changeset
    18
#include <string.h>
25
hgs
parents: 19
diff changeset
    19
#include "xammfcapabilitiesmgr.h"
19
hgs
parents:
diff changeset
    20
25
hgs
parents: 19
diff changeset
    21
static XAresult XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities(
hgs
parents: 19
diff changeset
    22
        XACapabilities **ppNode);
hgs
parents: 19
diff changeset
    23
static XAresult XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities(
hgs
parents: 19
diff changeset
    24
        XACapabilities **ppNode);
hgs
parents: 19
diff changeset
    25
static XAresult XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities(
hgs
parents: 19
diff changeset
    26
        XACapabilities **ppNode);
19
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
/* XAresult XAMMFCapabilitiesMgr_UpdateCapabilitieList
hgs
parents:
diff changeset
    29
 * Description: Update the capabilities list supported by GStreamer framework.
hgs
parents:
diff changeset
    30
 */
hgs
parents:
diff changeset
    31
XAresult XAMMFCapabilitiesMgr_UpdateCapabilitieList(
25
hgs
parents: 19
diff changeset
    32
        FrameworkMap *frameworkMap, XACapabilities **ppListHead)
19
hgs
parents:
diff changeset
    33
25
hgs
parents: 19
diff changeset
    34
    {
19
hgs
parents:
diff changeset
    35
    XAresult res = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
    36
    XACapabilities *lastNode;
hgs
parents:
diff changeset
    37
    XACapabilities *firstNode;
hgs
parents:
diff changeset
    38
    XACapabilities *newNode = NULL;
hgs
parents:
diff changeset
    39
    FWMgrFwType fwtype = FWMgrFWUknown;
hgs
parents:
diff changeset
    40
    char *uri = NULL;
hgs
parents:
diff changeset
    41
    DEBUG_API("->XAGSTCapabilitiesMgr_UpdateCapabilitieList");
hgs
parents:
diff changeset
    42
25
hgs
parents: 19
diff changeset
    43
    if (!frameworkMap || !ppListHead)
hgs
parents: 19
diff changeset
    44
        {
19
hgs
parents:
diff changeset
    45
        res = XA_RESULT_PARAMETER_INVALID;
hgs
parents:
diff changeset
    46
        return res;
25
hgs
parents: 19
diff changeset
    47
        }
19
hgs
parents:
diff changeset
    48
hgs
parents:
diff changeset
    49
    lastNode = firstNode = *ppListHead;
25
hgs
parents: 19
diff changeset
    50
19
hgs
parents:
diff changeset
    51
    /* traverse and point to the last node in the list */
25
hgs
parents: 19
diff changeset
    52
    while (lastNode && lastNode->next)
hgs
parents: 19
diff changeset
    53
        {
19
hgs
parents:
diff changeset
    54
        lastNode = lastNode->next;
25
hgs
parents: 19
diff changeset
    55
        }
19
hgs
parents:
diff changeset
    56
hgs
parents:
diff changeset
    57
    uri = "file:///c:/test.mp4";
25
hgs
parents: 19
diff changeset
    58
    fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
hgs
parents: 19
diff changeset
    59
hgs
parents: 19
diff changeset
    60
    if (fwtype == FWMgrFWMMF)
hgs
parents: 19
diff changeset
    61
        {
19
hgs
parents:
diff changeset
    62
        /* Add codec capabilities */
hgs
parents:
diff changeset
    63
        newNode = NULL;
hgs
parents:
diff changeset
    64
        res = XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities(&newNode);
hgs
parents:
diff changeset
    65
        if (res != XA_RESULT_SUCCESS)
hgs
parents:
diff changeset
    66
            {
hgs
parents:
diff changeset
    67
            return res;
hgs
parents:
diff changeset
    68
            }
hgs
parents:
diff changeset
    69
        if (lastNode)
25
hgs
parents: 19
diff changeset
    70
            {
19
hgs
parents:
diff changeset
    71
            lastNode->next = newNode;
25
hgs
parents: 19
diff changeset
    72
            }
19
hgs
parents:
diff changeset
    73
        if (newNode)
25
hgs
parents: 19
diff changeset
    74
            { /* if a new node is created move lastNode to the new item */
19
hgs
parents:
diff changeset
    75
            if (!firstNode)
25
hgs
parents: 19
diff changeset
    76
                {
19
hgs
parents:
diff changeset
    77
                firstNode = newNode;
25
hgs
parents: 19
diff changeset
    78
                }
19
hgs
parents:
diff changeset
    79
            lastNode = newNode;
25
hgs
parents: 19
diff changeset
    80
            }
19
hgs
parents:
diff changeset
    81
        }
hgs
parents:
diff changeset
    82
hgs
parents:
diff changeset
    83
    uri = "file:///c:/test.amr";
25
hgs
parents: 19
diff changeset
    84
    fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
hgs
parents: 19
diff changeset
    85
hgs
parents: 19
diff changeset
    86
    if (fwtype == FWMgrFWMMF)
hgs
parents: 19
diff changeset
    87
        {
19
hgs
parents:
diff changeset
    88
        newNode = NULL;
hgs
parents:
diff changeset
    89
        res = XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities(&newNode);
hgs
parents:
diff changeset
    90
        if (res != XA_RESULT_SUCCESS)
hgs
parents:
diff changeset
    91
            {
hgs
parents:
diff changeset
    92
            return res;
hgs
parents:
diff changeset
    93
            }
hgs
parents:
diff changeset
    94
        if (lastNode)
25
hgs
parents: 19
diff changeset
    95
            {
19
hgs
parents:
diff changeset
    96
            lastNode->next = newNode;
25
hgs
parents: 19
diff changeset
    97
            }
19
hgs
parents:
diff changeset
    98
        if (newNode)
25
hgs
parents: 19
diff changeset
    99
            { /* if a new node is created move lastNode to the new item */
19
hgs
parents:
diff changeset
   100
            if (!firstNode)
25
hgs
parents: 19
diff changeset
   101
                {
19
hgs
parents:
diff changeset
   102
                firstNode = newNode;
25
hgs
parents: 19
diff changeset
   103
                }
19
hgs
parents:
diff changeset
   104
            lastNode = newNode;
25
hgs
parents: 19
diff changeset
   105
            }
19
hgs
parents:
diff changeset
   106
        }
hgs
parents:
diff changeset
   107
hgs
parents:
diff changeset
   108
    uri = "file:///c:/test.wav";
25
hgs
parents: 19
diff changeset
   109
    fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder);
hgs
parents: 19
diff changeset
   110
hgs
parents: 19
diff changeset
   111
    if (fwtype == FWMgrFWMMF)
hgs
parents: 19
diff changeset
   112
        {
19
hgs
parents:
diff changeset
   113
        newNode = NULL;
hgs
parents:
diff changeset
   114
        res = XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities(&newNode);
hgs
parents:
diff changeset
   115
        if (res != XA_RESULT_SUCCESS)
hgs
parents:
diff changeset
   116
            {
hgs
parents:
diff changeset
   117
            return res;
hgs
parents:
diff changeset
   118
            }
hgs
parents:
diff changeset
   119
        if (lastNode)
25
hgs
parents: 19
diff changeset
   120
            {
19
hgs
parents:
diff changeset
   121
            lastNode->next = newNode;
25
hgs
parents: 19
diff changeset
   122
            }
19
hgs
parents:
diff changeset
   123
        if (newNode)
25
hgs
parents: 19
diff changeset
   124
            { /* if a new node is created move lastNode to the new item */
19
hgs
parents:
diff changeset
   125
            if (!firstNode)
25
hgs
parents: 19
diff changeset
   126
                {
19
hgs
parents:
diff changeset
   127
                firstNode = newNode;
25
hgs
parents: 19
diff changeset
   128
                }
19
hgs
parents:
diff changeset
   129
            lastNode = newNode;
25
hgs
parents: 19
diff changeset
   130
            }
19
hgs
parents:
diff changeset
   131
        }
hgs
parents:
diff changeset
   132
    /* if empty list, then append first node as the head */
hgs
parents:
diff changeset
   133
    if (!(*ppListHead))
hgs
parents:
diff changeset
   134
        {
hgs
parents:
diff changeset
   135
        *ppListHead = firstNode;
25
hgs
parents: 19
diff changeset
   136
        }DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList");
19
hgs
parents:
diff changeset
   137
    return res;
25
hgs
parents: 19
diff changeset
   138
    }
19
hgs
parents:
diff changeset
   139
25
hgs
parents: 19
diff changeset
   140
XAresult XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities(
hgs
parents: 19
diff changeset
   141
        XACapabilities **ppNode)
hgs
parents: 19
diff changeset
   142
    {
19
hgs
parents:
diff changeset
   143
    XAresult res = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   144
    XACapabilities *newNode = NULL;
hgs
parents:
diff changeset
   145
    XAAudioCodecDescriptor *entries = NULL;
hgs
parents:
diff changeset
   146
25
hgs
parents: 19
diff changeset
   147
    newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
19
hgs
parents:
diff changeset
   148
    if (!newNode)
25
hgs
parents: 19
diff changeset
   149
        {
19
hgs
parents:
diff changeset
   150
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   151
        return res;
25
hgs
parents: 19
diff changeset
   152
        }
19
hgs
parents:
diff changeset
   153
hgs
parents:
diff changeset
   154
    newNode->capsType = AUD_E;
hgs
parents:
diff changeset
   155
    newNode->xaid = XA_AUDIOCODEC_AAC;
hgs
parents:
diff changeset
   156
    newNode->noOfEntries = 1;
hgs
parents:
diff changeset
   157
hgs
parents:
diff changeset
   158
    /* Allocate array */
25
hgs
parents: 19
diff changeset
   159
    entries = (XAAudioCodecDescriptor*) calloc(1,
hgs
parents: 19
diff changeset
   160
            sizeof(XAAudioCodecDescriptor));
19
hgs
parents:
diff changeset
   161
    if (!entries)
25
hgs
parents: 19
diff changeset
   162
        {
19
hgs
parents:
diff changeset
   163
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   164
        XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
hgs
parents:
diff changeset
   165
        return res;
25
hgs
parents: 19
diff changeset
   166
        }
19
hgs
parents:
diff changeset
   167
25
hgs
parents: 19
diff changeset
   168
    newNode->pEntry = (void*) entries;
hgs
parents: 19
diff changeset
   169
19
hgs
parents:
diff changeset
   170
    entries->maxChannels = 2;
hgs
parents:
diff changeset
   171
    entries->minBitsPerSample = 16;
hgs
parents:
diff changeset
   172
    entries->maxBitsPerSample = 16;
25
hgs
parents: 19
diff changeset
   173
    entries->minSampleRate = 8000000; /*milliHz*/
19
hgs
parents:
diff changeset
   174
    entries->maxSampleRate = 48000000;
25
hgs
parents: 19
diff changeset
   175
    entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
19
hgs
parents:
diff changeset
   176
    entries->numSampleRatesSupported = 7;
25
hgs
parents: 19
diff changeset
   177
    entries->pSampleRatesSupported = (XAmilliHertz*) calloc(
hgs
parents: 19
diff changeset
   178
            entries->numSampleRatesSupported, sizeof(XAmilliHertz));
19
hgs
parents:
diff changeset
   179
    if (!entries->pSampleRatesSupported)
25
hgs
parents: 19
diff changeset
   180
        {
19
hgs
parents:
diff changeset
   181
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   182
        XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
hgs
parents:
diff changeset
   183
        return res;
25
hgs
parents: 19
diff changeset
   184
        }
19
hgs
parents:
diff changeset
   185
    /* entries in milliHz */
hgs
parents:
diff changeset
   186
    entries->pSampleRatesSupported[0] = 8000000;
hgs
parents:
diff changeset
   187
    entries->pSampleRatesSupported[1] = 11025000;
hgs
parents:
diff changeset
   188
    entries->pSampleRatesSupported[2] = 16000000;
hgs
parents:
diff changeset
   189
    entries->pSampleRatesSupported[3] = 22050000;
hgs
parents:
diff changeset
   190
    entries->pSampleRatesSupported[4] = 32000000;
hgs
parents:
diff changeset
   191
    entries->pSampleRatesSupported[5] = 44100000;
hgs
parents:
diff changeset
   192
    entries->pSampleRatesSupported[6] = 48000000;
hgs
parents:
diff changeset
   193
hgs
parents:
diff changeset
   194
    entries->minBitRate = 32000;
hgs
parents:
diff changeset
   195
    entries->maxBitRate = 256000;
hgs
parents:
diff changeset
   196
    entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
hgs
parents:
diff changeset
   197
    entries->numBitratesSupported = 8;
25
hgs
parents: 19
diff changeset
   198
    entries->pBitratesSupported = (XAuint32*) calloc(
hgs
parents: 19
diff changeset
   199
            entries->numBitratesSupported, sizeof(XAuint32));
19
hgs
parents:
diff changeset
   200
    if (!entries->pBitratesSupported)
25
hgs
parents: 19
diff changeset
   201
        {
19
hgs
parents:
diff changeset
   202
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   203
        XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
hgs
parents:
diff changeset
   204
        return res;
25
hgs
parents: 19
diff changeset
   205
        }
19
hgs
parents:
diff changeset
   206
    (entries->pBitratesSupported)[0] = 32000;
hgs
parents:
diff changeset
   207
    (entries->pBitratesSupported)[1] = 64000;
hgs
parents:
diff changeset
   208
    (entries->pBitratesSupported)[2] = 96000;
hgs
parents:
diff changeset
   209
    (entries->pBitratesSupported)[3] = 128000;
hgs
parents:
diff changeset
   210
    (entries->pBitratesSupported)[4] = 160000;
hgs
parents:
diff changeset
   211
    (entries->pBitratesSupported)[5] = 192000;
hgs
parents:
diff changeset
   212
    (entries->pBitratesSupported)[6] = 224000;
hgs
parents:
diff changeset
   213
    (entries->pBitratesSupported)[7] = 256000;
hgs
parents:
diff changeset
   214
hgs
parents:
diff changeset
   215
    entries->profileSetting = XA_AUDIOPROFILE_AAC_AAC;
hgs
parents:
diff changeset
   216
    entries->modeSetting = XA_AUDIOMODE_AAC_LC;
hgs
parents:
diff changeset
   217
hgs
parents:
diff changeset
   218
    *ppNode = newNode;
hgs
parents:
diff changeset
   219
    return res;
25
hgs
parents: 19
diff changeset
   220
    }
19
hgs
parents:
diff changeset
   221
25
hgs
parents: 19
diff changeset
   222
XAresult XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities(
hgs
parents: 19
diff changeset
   223
        XACapabilities **ppNode)
hgs
parents: 19
diff changeset
   224
    {
19
hgs
parents:
diff changeset
   225
    XAresult res = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   226
    XACapabilities *newNode = NULL;
hgs
parents:
diff changeset
   227
    XAAudioCodecDescriptor *entries = NULL;
25
hgs
parents: 19
diff changeset
   228
hgs
parents: 19
diff changeset
   229
    newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
19
hgs
parents:
diff changeset
   230
    if (!newNode)
25
hgs
parents: 19
diff changeset
   231
        {
19
hgs
parents:
diff changeset
   232
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   233
        return res;
25
hgs
parents: 19
diff changeset
   234
        }
19
hgs
parents:
diff changeset
   235
hgs
parents:
diff changeset
   236
    newNode->capsType = AUD_E;
hgs
parents:
diff changeset
   237
    newNode->xaid = XA_AUDIOCODEC_AMR;
hgs
parents:
diff changeset
   238
    newNode->noOfEntries = 1;
hgs
parents:
diff changeset
   239
hgs
parents:
diff changeset
   240
    /* Allocate array */
25
hgs
parents: 19
diff changeset
   241
    entries = (XAAudioCodecDescriptor*) calloc(1,
hgs
parents: 19
diff changeset
   242
            sizeof(XAAudioCodecDescriptor));
19
hgs
parents:
diff changeset
   243
    if (!entries)
25
hgs
parents: 19
diff changeset
   244
        {
19
hgs
parents:
diff changeset
   245
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   246
        XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
hgs
parents:
diff changeset
   247
        return res;
25
hgs
parents: 19
diff changeset
   248
        }
19
hgs
parents:
diff changeset
   249
25
hgs
parents: 19
diff changeset
   250
    newNode->pEntry = (void*) entries;
hgs
parents: 19
diff changeset
   251
19
hgs
parents:
diff changeset
   252
    entries->maxChannels = 1;
hgs
parents:
diff changeset
   253
    entries->minBitsPerSample = 8;
hgs
parents:
diff changeset
   254
    entries->maxBitsPerSample = 8;
25
hgs
parents: 19
diff changeset
   255
    entries->minSampleRate = 8000000; /*milliHz*/
19
hgs
parents:
diff changeset
   256
    entries->maxSampleRate = 8000000;
25
hgs
parents: 19
diff changeset
   257
    entries->isFreqRangeContinuous = XA_BOOLEAN_TRUE;
19
hgs
parents:
diff changeset
   258
    entries->numSampleRatesSupported = 1;
25
hgs
parents: 19
diff changeset
   259
    entries->minBitRate = 4750;
hgs
parents: 19
diff changeset
   260
    entries->maxBitRate = 12200;
hgs
parents: 19
diff changeset
   261
    entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
19
hgs
parents:
diff changeset
   262
    entries->numBitratesSupported = 8;
25
hgs
parents: 19
diff changeset
   263
    entries->pBitratesSupported = (XAuint32*) calloc(
hgs
parents: 19
diff changeset
   264
            entries->numBitratesSupported, sizeof(XAuint32));
19
hgs
parents:
diff changeset
   265
    if (!entries->pBitratesSupported)
25
hgs
parents: 19
diff changeset
   266
        {
19
hgs
parents:
diff changeset
   267
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   268
        XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
hgs
parents:
diff changeset
   269
        return res;
25
hgs
parents: 19
diff changeset
   270
        }
19
hgs
parents:
diff changeset
   271
    (entries->pBitratesSupported)[0] = 4750;
hgs
parents:
diff changeset
   272
    (entries->pBitratesSupported)[1] = 5150;
hgs
parents:
diff changeset
   273
    (entries->pBitratesSupported)[2] = 5900;
hgs
parents:
diff changeset
   274
    (entries->pBitratesSupported)[3] = 6700;
hgs
parents:
diff changeset
   275
    (entries->pBitratesSupported)[4] = 7400;
hgs
parents:
diff changeset
   276
    (entries->pBitratesSupported)[5] = 7950;
hgs
parents:
diff changeset
   277
    (entries->pBitratesSupported)[6] = 10200;
hgs
parents:
diff changeset
   278
    (entries->pBitratesSupported)[7] = 12200;
hgs
parents:
diff changeset
   279
hgs
parents:
diff changeset
   280
    entries->profileSetting = XA_AUDIOPROFILE_AMR;
hgs
parents:
diff changeset
   281
    entries->modeSetting = 0;
hgs
parents:
diff changeset
   282
hgs
parents:
diff changeset
   283
    *ppNode = newNode;
hgs
parents:
diff changeset
   284
    return res;
25
hgs
parents: 19
diff changeset
   285
    }
19
hgs
parents:
diff changeset
   286
25
hgs
parents: 19
diff changeset
   287
XAresult XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities(
hgs
parents: 19
diff changeset
   288
        XACapabilities **ppNode)
hgs
parents: 19
diff changeset
   289
    {
19
hgs
parents:
diff changeset
   290
    XAresult res = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
   291
    XACapabilities *newNode = NULL;
hgs
parents:
diff changeset
   292
    XAAudioCodecDescriptor *entries = NULL;
hgs
parents:
diff changeset
   293
25
hgs
parents: 19
diff changeset
   294
    newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities));
19
hgs
parents:
diff changeset
   295
    if (!newNode)
25
hgs
parents: 19
diff changeset
   296
        {
19
hgs
parents:
diff changeset
   297
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   298
        return res;
25
hgs
parents: 19
diff changeset
   299
        }
19
hgs
parents:
diff changeset
   300
hgs
parents:
diff changeset
   301
    newNode->capsType = AUD_E;
hgs
parents:
diff changeset
   302
    newNode->xaid = XA_AUDIOCODEC_PCM;
hgs
parents:
diff changeset
   303
    newNode->noOfEntries = 1;
hgs
parents:
diff changeset
   304
hgs
parents:
diff changeset
   305
    /* Allocate array */
25
hgs
parents: 19
diff changeset
   306
    entries = (XAAudioCodecDescriptor*) calloc(1,
hgs
parents: 19
diff changeset
   307
            sizeof(XAAudioCodecDescriptor));
19
hgs
parents:
diff changeset
   308
    if (!entries)
25
hgs
parents: 19
diff changeset
   309
        {
19
hgs
parents:
diff changeset
   310
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   311
        XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
hgs
parents:
diff changeset
   312
        return res;
25
hgs
parents: 19
diff changeset
   313
        }
19
hgs
parents:
diff changeset
   314
25
hgs
parents: 19
diff changeset
   315
    newNode->pEntry = (void*) entries;
19
hgs
parents:
diff changeset
   316
hgs
parents:
diff changeset
   317
    entries->maxChannels = 2;
hgs
parents:
diff changeset
   318
    entries->minBitsPerSample = 16;
hgs
parents:
diff changeset
   319
    entries->maxBitsPerSample = 16;
25
hgs
parents: 19
diff changeset
   320
    entries->minSampleRate = 8000000; /*milliHz*/
19
hgs
parents:
diff changeset
   321
    entries->maxSampleRate = 96000000;
25
hgs
parents: 19
diff changeset
   322
    entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE;
19
hgs
parents:
diff changeset
   323
    entries->numSampleRatesSupported = 10;
25
hgs
parents: 19
diff changeset
   324
    entries->pSampleRatesSupported = (XAmilliHertz*) calloc(
hgs
parents: 19
diff changeset
   325
            entries->numSampleRatesSupported, sizeof(XAmilliHertz));
19
hgs
parents:
diff changeset
   326
    if (!entries->pSampleRatesSupported)
25
hgs
parents: 19
diff changeset
   327
        {
19
hgs
parents:
diff changeset
   328
        res = XA_RESULT_MEMORY_FAILURE;
hgs
parents:
diff changeset
   329
        XACapabilitiesMgr_DeleteCapabilitieList(&newNode);
hgs
parents:
diff changeset
   330
        return res;
25
hgs
parents: 19
diff changeset
   331
        }
19
hgs
parents:
diff changeset
   332
    /* entries in milliHz */
hgs
parents:
diff changeset
   333
    entries->pSampleRatesSupported[0] = 12000000;
hgs
parents:
diff changeset
   334
    entries->pSampleRatesSupported[1] = 16000000;
hgs
parents:
diff changeset
   335
    entries->pSampleRatesSupported[2] = 22050000;
hgs
parents:
diff changeset
   336
    entries->pSampleRatesSupported[3] = 24000000;
hgs
parents:
diff changeset
   337
    entries->pSampleRatesSupported[4] = 32000000;
hgs
parents:
diff changeset
   338
    entries->pSampleRatesSupported[5] = 44100000;
hgs
parents:
diff changeset
   339
    entries->pSampleRatesSupported[6] = 48000000;
hgs
parents:
diff changeset
   340
    entries->pSampleRatesSupported[7] = 64000000;
hgs
parents:
diff changeset
   341
    entries->pSampleRatesSupported[8] = 88200000;
hgs
parents:
diff changeset
   342
    entries->pSampleRatesSupported[9] = 96000000;
hgs
parents:
diff changeset
   343
hgs
parents:
diff changeset
   344
    entries->minBitRate = 0;
hgs
parents:
diff changeset
   345
    entries->maxBitRate = 0;
hgs
parents:
diff changeset
   346
    entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE;
hgs
parents:
diff changeset
   347
    entries->pBitratesSupported = NULL;
hgs
parents:
diff changeset
   348
    entries->numBitratesSupported = 0;
hgs
parents:
diff changeset
   349
    entries->profileSetting = XA_AUDIOPROFILE_PCM;
hgs
parents:
diff changeset
   350
    entries->modeSetting = 0;
hgs
parents:
diff changeset
   351
hgs
parents:
diff changeset
   352
    *ppNode = newNode;
hgs
parents:
diff changeset
   353
    return res;
25
hgs
parents: 19
diff changeset
   354
    }