khronosfws/openmax_al/src/adaptation/xaimageencoderitfadaptation.c
changeset 12 5a06f39ad45b
equal deleted inserted replaced
0:71ca22bcf22a 12:5a06f39ad45b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <gst.h>
       
    19 #include "XAMediaRecorderAdaptCtx.h"
       
    20 #include "XAImageEncoderItfAdaptation.h"
       
    21 #include "XAAdaptation.h"
       
    22 #include "XAStaticCapsAdaptation.h"
       
    23 
       
    24 /*
       
    25  * XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationBaseCtx *bCtx,
       
    26  *                                                   XAImageSettings *pSettings )
       
    27  * @param XAAdaptationBaseCtx *ctx - pointer to Media Recorer adaptation context
       
    28  * @param XAImageSettings *pSettings - Settings for encoder
       
    29  * @return XAresult ret - return success value
       
    30  * Description: Sets preferred encoder settings for pipeline.
       
    31  */
       
    32 XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationBaseCtx *bCtx,
       
    33                                                   const XAImageSettings *pSettings )
       
    34 {
       
    35     XAresult ret = XA_RESULT_SUCCESS;
       
    36     XAMediaRecorderAdaptationCtx* mCtx = NULL;
       
    37     XAStaticCapsData temp;
       
    38 
       
    39     DEBUG_API("->XAImageEncoderAdapt_SetImageSettings");
       
    40 
       
    41     if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings )
       
    42     {
       
    43         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
    44         return XA_RESULT_PARAMETER_INVALID;
       
    45     }
       
    46 
       
    47     mCtx = (XAMediaRecorderAdaptationCtx*) bCtx;
       
    48     if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_IMAGE, mCtx->imageEncSettings.encoderId, &temp) != XA_RESULT_SUCCESS)
       
    49     {   /* no such codec */
       
    50         return XA_RESULT_FEATURE_UNSUPPORTED;
       
    51     }
       
    52     /*Just copy - image settings are applied in InitiateSnapshot*/
       
    53     memcpy(&mCtx->imageEncSettings, pSettings, sizeof(XAImageSettings));
       
    54 
       
    55     DEBUG_API("<-XAImageEncoderAdapt_SetImageSettings");
       
    56     return ret;
       
    57 }
       
    58 
       
    59 XAresult XAImageEncoderItfAdapt_GetImageSettings( XAAdaptationBaseCtx *bCtx,
       
    60                                                   XAImageSettings *pSettings )
       
    61 {
       
    62     XAMediaRecorderAdaptationCtx* mCtx = NULL;
       
    63     XAresult ret = XA_RESULT_SUCCESS;
       
    64 
       
    65     DEBUG_API("->XAImageEncoderItfAdapt_GetImageSettings");
       
    66     if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings )
       
    67     {
       
    68         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
       
    69         return XA_RESULT_PARAMETER_INVALID;
       
    70     }
       
    71     mCtx = (XAMediaRecorderAdaptationCtx*) bCtx;
       
    72     memcpy(pSettings, &(mCtx->imageEncSettings), sizeof(XAImageSettings));
       
    73     DEBUG_API("<-XAImageEncoderItfAdapt_GetImageSettings");
       
    74     return ret;
       
    75 }