|
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 "xamediarecorderadaptctx.h" |
|
19 #include "xaimageencoderitfadaptation.h" |
|
20 #include "xacapabilitiesmgr.h" |
|
21 |
|
22 |
|
23 /* |
|
24 * XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationGstCtx *bCtx, |
|
25 * XAImageSettings *pSettings ) |
|
26 * @param XAAdaptationGstCtx *ctx - pointer to Media Recorer adaptation context |
|
27 * @param XAImageSettings *pSettings - Settings for encoder |
|
28 * @return XAresult ret - return success value |
|
29 * Description: Sets preferred encoder settings for pipeline. |
|
30 */ |
|
31 XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationGstCtx *bCtx, |
|
32 const XAImageSettings *pSettings ) |
|
33 { |
|
34 XAresult ret = XA_RESULT_SUCCESS; |
|
35 XAMediaRecorderAdaptationCtx* mCtx = NULL; |
|
36 XACapabilities temp; |
|
37 |
|
38 DEBUG_API("->XAImageEncoderAdapt_SetImageSettings"); |
|
39 |
|
40 if( !bCtx || (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) || !pSettings ) |
|
41 { |
|
42 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
43 return XA_RESULT_PARAMETER_INVALID; |
|
44 } |
|
45 |
|
46 mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; |
|
47 if(XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_ENCODER|XACAP_IMAGE), mCtx->imageEncSettings.encoderId, &temp) != XA_RESULT_SUCCESS) |
|
48 { /* no such codec */ |
|
49 return XA_RESULT_FEATURE_UNSUPPORTED; |
|
50 } |
|
51 /*Just copy - image settings are applied in InitiateSnapshot*/ |
|
52 memcpy(&mCtx->imageEncSettings, pSettings, sizeof(XAImageSettings)); |
|
53 |
|
54 DEBUG_API("<-XAImageEncoderAdapt_SetImageSettings"); |
|
55 return ret; |
|
56 } |
|
57 |
|
58 XAresult XAImageEncoderItfAdapt_GetImageSettings( XAAdaptationGstCtx *bCtx, |
|
59 XAImageSettings *pSettings ) |
|
60 { |
|
61 XAMediaRecorderAdaptationCtx* mCtx = NULL; |
|
62 XAresult ret = XA_RESULT_SUCCESS; |
|
63 |
|
64 DEBUG_API("->XAImageEncoderItfAdapt_GetImageSettings"); |
|
65 if( !bCtx || (bCtx->baseObj.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->imageEncSettings), sizeof(XAImageSettings)); |
|
72 DEBUG_API("<-XAImageEncoderItfAdapt_GetImageSettings"); |
|
73 return ret; |
|
74 } |