|
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 "xavideoencoderitfadaptation.h" |
|
21 #include "xaadaptationgst.h" |
|
22 |
|
23 |
|
24 /* |
|
25 * XAresult XAVideoEncoderITfAdapt_SetVideoSettings( XAAdaptationGstCtx *bCtx, |
|
26 * XAVideoSettings *pSettings ) |
|
27 * @param XAAdaptationGstCtx *ctx - pointer to Media Recorer adaptation context |
|
28 * @param XAVideoSettings *pSettings - Settings for encoder |
|
29 * @return XAresult ret - return success value |
|
30 * Description: Sets preferred encoder settings for pipeline. |
|
31 */ |
|
32 XAresult XAVideoEncoderItfAdapt_SetVideoSettings( XAAdaptationGstCtx *bCtx, |
|
33 XAVideoSettings *pSettings ) |
|
34 { |
|
35 XAMediaRecorderAdaptationCtx* mCtx = NULL; |
|
36 XAresult ret = XA_RESULT_SUCCESS; |
|
37 |
|
38 DEBUG_API("->XAVideoEncoderAdapt_SetVideoSettings"); |
|
39 if( !bCtx || (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) || !pSettings ) |
|
40 { |
|
41 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
42 DEBUG_API("<-XAVideoEncoderAdapt_SetVideoSettings"); |
|
43 return XA_RESULT_PARAMETER_INVALID; |
|
44 } |
|
45 mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; |
|
46 |
|
47 ret = XAMediaRecorderAdapt_CheckCodec(mCtx,XACAP_VIDEO,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->videoEncSettings, pSettings, sizeof(XAVideoSettings)); |
|
53 } |
|
54 DEBUG_API("<-XAVideoEncoderAdapt_SetVideoSettings"); |
|
55 return ret; |
|
56 } |
|
57 |
|
58 /* |
|
59 * XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationGstCtx *bCtx, XAVideoSettings *pSettings ) |
|
60 */ |
|
61 XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationGstCtx *bCtx, |
|
62 XAVideoSettings *pSettings ) |
|
63 { |
|
64 XAMediaRecorderAdaptationCtx* mCtx = NULL; |
|
65 XAresult ret = XA_RESULT_SUCCESS; |
|
66 |
|
67 DEBUG_API("->XAVideoEncoderItfAdapt_GetVideoSettings"); |
|
68 |
|
69 if( !bCtx || (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) || !pSettings ) |
|
70 { |
|
71 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
72 DEBUG_API("<-XAVideoEncoderItfAdapt_GetVideoSettings"); |
|
73 return XA_RESULT_PARAMETER_INVALID; |
|
74 } |
|
75 mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; |
|
76 memcpy(pSettings, &(mCtx->videoEncSettings), sizeof(XAVideoSettings)); |
|
77 DEBUG_API("<-XAVideoEncoderItfAdapt_GetVideoSettings"); |
|
78 return ret; |
|
79 } |