khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c
author hgs
Fri, 14 May 2010 18:19:45 -0500
changeset 20 b67dd1fc57c5
parent 19 4a629bc82c5e
child 25 6f7ceef7b1d1
permissions -rw-r--r--
201019
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: 
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
20
hgs
parents: 19
diff changeset
    18
#include <gst/gst.h>
19
hgs
parents:
diff changeset
    19
#include "xamediarecorderadaptctx.h"
hgs
parents:
diff changeset
    20
#include "xaaudioencoderitfadaptation.h"
hgs
parents:
diff changeset
    21
#include "xaadaptationgst.h"
hgs
parents:
diff changeset
    22
//#include "XAStaticCapsAdaptation.h"
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
/*
hgs
parents:
diff changeset
    25
 * XAresult XAAudioEncoderItfAdapt_SetEncoderSettings( XAAdaptationGstCtx *ctx,
hgs
parents:
diff changeset
    26
 *                                                     XAAudioEncoderSettings *pSettings )
hgs
parents:
diff changeset
    27
 * @param XAAdaptationGstCtx *ctx - pointer to Media Recorer adaptation contex
hgs
parents:
diff changeset
    28
 * @param XAAudioEncoderSettings *pSettings - Settings to be setted for encoder
hgs
parents:
diff changeset
    29
 * @return XAresult ret - return success value
hgs
parents:
diff changeset
    30
 * Description: Sets preferred encoder settings for pipeline.
hgs
parents:
diff changeset
    31
 */
hgs
parents:
diff changeset
    32
XAresult XAAudioEncoderItfAdapt_SetEncoderSettings( XAAdaptationBaseCtx *ctx,
hgs
parents:
diff changeset
    33
                                                    XAAudioEncoderSettings *pSettings )
hgs
parents:
diff changeset
    34
{
hgs
parents:
diff changeset
    35
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
    36
    XAMediaRecorderAdaptationCtx* mCtx = NULL;
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
    DEBUG_API("->XAAudioEncoderItfAdapt_SetEncoderSettings");
hgs
parents:
diff changeset
    39
    if( !ctx || (ctx->ctxId != XAMediaRecorderAdaptation) || !pSettings )
hgs
parents:
diff changeset
    40
    {
hgs
parents:
diff changeset
    41
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
    42
        DEBUG_API("<-XAAudioEncoderItfImpl_SetEncoderSettings");
hgs
parents:
diff changeset
    43
        return XA_RESULT_PARAMETER_INVALID;
hgs
parents:
diff changeset
    44
    }
hgs
parents:
diff changeset
    45
    mCtx = (XAMediaRecorderAdaptationCtx*) ctx;
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
    ret = XAMediaRecorderAdapt_CheckCodec(mCtx,XACAP_AUDIO,pSettings->encoderId);
hgs
parents:
diff changeset
    48
    if(ret==XA_RESULT_SUCCESS)
hgs
parents:
diff changeset
    49
    {
hgs
parents:
diff changeset
    50
        /*change of settings - pipeline must be regenerated**/
hgs
parents:
diff changeset
    51
        mCtx->encodingchanged = XA_BOOLEAN_TRUE;
hgs
parents:
diff changeset
    52
        memcpy(&mCtx->audioEncSettings, pSettings, sizeof(XAAudioEncoderSettings));
hgs
parents:
diff changeset
    53
    }
hgs
parents:
diff changeset
    54
    DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings");
hgs
parents:
diff changeset
    55
    return ret;
hgs
parents:
diff changeset
    56
}
hgs
parents:
diff changeset
    57
hgs
parents:
diff changeset
    58
XAresult XAAudioEncoderItfAdapt_GetEncoderSettings( XAAdaptationBaseCtx *bCtx,
hgs
parents:
diff changeset
    59
                                                 XAAudioEncoderSettings *pSettings )
hgs
parents:
diff changeset
    60
{
hgs
parents:
diff changeset
    61
    XAMediaRecorderAdaptationCtx* mCtx = NULL;
hgs
parents:
diff changeset
    62
    XAresult ret = XA_RESULT_SUCCESS;
hgs
parents:
diff changeset
    63
hgs
parents:
diff changeset
    64
    DEBUG_API("->XAAudioEncoderItfAdapt_GetEncoderSettings");
hgs
parents:
diff changeset
    65
    if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings )
hgs
parents:
diff changeset
    66
    {
hgs
parents:
diff changeset
    67
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
hgs
parents:
diff changeset
    68
        return XA_RESULT_PARAMETER_INVALID;
hgs
parents:
diff changeset
    69
    }
hgs
parents:
diff changeset
    70
    mCtx = (XAMediaRecorderAdaptationCtx*) bCtx;
hgs
parents:
diff changeset
    71
    memcpy(pSettings, &(mCtx->audioEncSettings), sizeof(XAAudioEncoderSettings));
hgs
parents:
diff changeset
    72
    DEBUG_API("<-XAAudioEncoderItfAdapt_GetEncoderSettings");
hgs
parents:
diff changeset
    73
    return ret;
hgs
parents:
diff changeset
    74
}