19
|
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 |
|
20
|
18 |
#include <gst/gst.h>
|
19
|
19 |
#include "xamediarecorderadaptctx.h"
|
|
20 |
#include "xaaudioencoderitfadaptation.h"
|
|
21 |
#include "xaadaptationgst.h"
|
|
22 |
//#include "XAStaticCapsAdaptation.h"
|
|
23 |
|
|
24 |
/*
|
|
25 |
* XAresult XAAudioEncoderItfAdapt_SetEncoderSettings( XAAdaptationGstCtx *ctx,
|
|
26 |
* XAAudioEncoderSettings *pSettings )
|
|
27 |
* @param XAAdaptationGstCtx *ctx - pointer to Media Recorer adaptation contex
|
|
28 |
* @param XAAudioEncoderSettings *pSettings - Settings to be setted for encoder
|
|
29 |
* @return XAresult ret - return success value
|
|
30 |
* Description: Sets preferred encoder settings for pipeline.
|
|
31 |
*/
|
|
32 |
XAresult XAAudioEncoderItfAdapt_SetEncoderSettings( XAAdaptationBaseCtx *ctx,
|
|
33 |
XAAudioEncoderSettings *pSettings )
|
|
34 |
{
|
|
35 |
XAresult ret = XA_RESULT_SUCCESS;
|
|
36 |
XAMediaRecorderAdaptationCtx* mCtx = NULL;
|
|
37 |
|
|
38 |
DEBUG_API("->XAAudioEncoderItfAdapt_SetEncoderSettings");
|
|
39 |
if( !ctx || (ctx->ctxId != XAMediaRecorderAdaptation) || !pSettings )
|
|
40 |
{
|
|
41 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
42 |
DEBUG_API("<-XAAudioEncoderItfImpl_SetEncoderSettings");
|
|
43 |
return XA_RESULT_PARAMETER_INVALID;
|
|
44 |
}
|
|
45 |
mCtx = (XAMediaRecorderAdaptationCtx*) ctx;
|
|
46 |
|
|
47 |
ret = XAMediaRecorderAdapt_CheckCodec(mCtx,XACAP_AUDIO,pSettings->encoderId);
|
|
48 |
if(ret==XA_RESULT_SUCCESS)
|
|
49 |
{
|
|
50 |
/*change of settings - pipeline must be regenerated**/
|
|
51 |
mCtx->encodingchanged = XA_BOOLEAN_TRUE;
|
|
52 |
memcpy(&mCtx->audioEncSettings, pSettings, sizeof(XAAudioEncoderSettings));
|
|
53 |
}
|
|
54 |
DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings");
|
|
55 |
return ret;
|
|
56 |
}
|
|
57 |
|
|
58 |
XAresult XAAudioEncoderItfAdapt_GetEncoderSettings( XAAdaptationBaseCtx *bCtx,
|
|
59 |
XAAudioEncoderSettings *pSettings )
|
|
60 |
{
|
|
61 |
XAMediaRecorderAdaptationCtx* mCtx = NULL;
|
|
62 |
XAresult ret = XA_RESULT_SUCCESS;
|
|
63 |
|
|
64 |
DEBUG_API("->XAAudioEncoderItfAdapt_GetEncoderSettings");
|
|
65 |
if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings )
|
|
66 |
{
|
|
67 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
68 |
return XA_RESULT_PARAMETER_INVALID;
|
|
69 |
}
|
|
70 |
mCtx = (XAMediaRecorderAdaptationCtx*) bCtx;
|
|
71 |
memcpy(pSettings, &(mCtx->audioEncSettings), sizeof(XAAudioEncoderSettings));
|
|
72 |
DEBUG_API("<-XAAudioEncoderItfAdapt_GetEncoderSettings");
|
|
73 |
return ret;
|
|
74 |
}
|