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