19
|
1 |
/*
|
25
|
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: AudioEnc Intfc Adaptation for GStreamer
|
|
15 |
*
|
|
16 |
*/
|
19
|
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 |
*/
|
25
|
32 |
XAresult XAAudioEncoderItfAdapt_SetEncoderSettings(XAAdaptationBaseCtx *ctx,
|
|
33 |
XAAudioEncoderSettings *pSettings)
|
|
34 |
{
|
19
|
35 |
XAresult ret = XA_RESULT_SUCCESS;
|
|
36 |
XAMediaRecorderAdaptationCtx* mCtx = NULL;
|
|
37 |
|
|
38 |
DEBUG_API("->XAAudioEncoderItfAdapt_SetEncoderSettings");
|
25
|
39 |
if (!ctx || (ctx->ctxId != XAMediaRecorderAdaptation) || !pSettings)
|
|
40 |
{
|
19
|
41 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
42 |
DEBUG_API("<-XAAudioEncoderItfImpl_SetEncoderSettings");
|
|
43 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
44 |
}
|
19
|
45 |
mCtx = (XAMediaRecorderAdaptationCtx*) ctx;
|
|
46 |
|
25
|
47 |
ret = XAMediaRecorderAdapt_CheckCodec(mCtx, XACAP_AUDIO,
|
|
48 |
pSettings->encoderId);
|
|
49 |
if (ret == XA_RESULT_SUCCESS)
|
|
50 |
{
|
19
|
51 |
/*change of settings - pipeline must be regenerated**/
|
|
52 |
mCtx->encodingchanged = XA_BOOLEAN_TRUE;
|
25
|
53 |
memcpy(&mCtx->audioEncSettings, pSettings,
|
|
54 |
sizeof(XAAudioEncoderSettings));
|
|
55 |
}DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings");
|
19
|
56 |
return ret;
|
25
|
57 |
}
|
19
|
58 |
|
25
|
59 |
XAresult XAAudioEncoderItfAdapt_GetEncoderSettings(XAAdaptationBaseCtx *bCtx,
|
|
60 |
XAAudioEncoderSettings *pSettings)
|
|
61 |
{
|
19
|
62 |
XAMediaRecorderAdaptationCtx* mCtx = NULL;
|
|
63 |
XAresult ret = XA_RESULT_SUCCESS;
|
|
64 |
|
|
65 |
DEBUG_API("->XAAudioEncoderItfAdapt_GetEncoderSettings");
|
25
|
66 |
if (!bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings)
|
|
67 |
{
|
19
|
68 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
|
|
69 |
return XA_RESULT_PARAMETER_INVALID;
|
25
|
70 |
}
|
19
|
71 |
mCtx = (XAMediaRecorderAdaptationCtx*) bCtx;
|
25
|
72 |
memcpy(pSettings, &(mCtx->audioEncSettings),
|
|
73 |
sizeof(XAAudioEncoderSettings));
|
19
|
74 |
DEBUG_API("<-XAAudioEncoderItfAdapt_GetEncoderSettings");
|
|
75 |
return ret;
|
25
|
76 |
}
|