18 #include <string.h> |
18 #include <string.h> |
19 #include <assert.h> |
19 #include <assert.h> |
20 #include "xamediarecorderadaptctxmmf.h" |
20 #include "xamediarecorderadaptctxmmf.h" |
21 #include "xaadaptationmmf.h" |
21 #include "xaadaptationmmf.h" |
22 #include "cmmfbackendengine.h" |
22 #include "cmmfbackendengine.h" |
|
23 #include "xaadptbasectx.h" |
23 //#include "XAMetadataAdaptation.h" |
24 //#include "XAMetadataAdaptation.h" |
24 //#include "XAStaticCapsAdaptation.h" |
25 //#include "XAStaticCapsAdaptation.h" |
25 |
26 |
26 |
27 |
27 #define XA_ADAPTID_UNINITED 0 |
|
28 #ifdef _GSTREAMER_BACKEND_ |
|
29 extern XAboolean cameraRealized; |
28 extern XAboolean cameraRealized; |
30 #endif |
29 |
31 //extern XACameraAdaptationCtx_* cameraCtx; |
30 //extern XACameraAdaptationCtx_* cameraCtx; |
32 |
31 |
33 |
32 |
34 |
33 |
35 /* |
34 /* |
38 * @param XADataSource *pAudioSrc - pointer to OMX-AL audio source |
37 * @param XADataSource *pAudioSrc - pointer to OMX-AL audio source |
39 * @param XADataSource *pImageVideoSrc - pointer image/video source |
38 * @param XADataSource *pImageVideoSrc - pointer image/video source |
40 * @param XADataSink *pDataSnk - pointer to OMX-AL sink |
39 * @param XADataSink *pDataSnk - pointer to OMX-AL sink |
41 * @returns XAMediaRecorderAdaptationMMFCtx* - Pointer to created context, NULL if error occurs. |
40 * @returns XAMediaRecorderAdaptationMMFCtx* - Pointer to created context, NULL if error occurs. |
42 */ |
41 */ |
43 XAAdaptationBaseMMFCtx* XAMediaRecorderAdaptMMF_Create(XADataSource* pAudioSrc, |
42 XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create(XADataSource* pAudioSrc, |
44 XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes) |
43 XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes) |
45 { |
44 { |
46 XAMediaRecorderAdaptationMMFCtx *pSelf = NULL; |
45 XAMediaRecorderAdaptationMMFCtx *pSelf = NULL; |
47 XAuint32 locType = 0; |
46 XAuint32 locType = 0; |
48 XAresult res; |
47 XAresult res; |
49 XADataLocator_IODevice *ioDevice; |
48 XADataLocator_IODevice *ioDevice; |
50 DEBUG_API("->XAMediaRecorderAdaptMMF_Create"); |
49 DEBUG_API("->XAMediaRecorderAdaptMMF_Create"); |
51 |
50 |
52 pSelf = calloc(1, sizeof(XAMediaRecorderAdaptationMMFCtx)); |
51 pSelf = (XAMediaRecorderAdaptationMMFCtx*)calloc(1, sizeof(XAMediaRecorderAdaptationMMFCtx)); |
53 if (pSelf) |
52 if (pSelf) |
54 { |
53 { |
55 if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), |
54 if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), |
56 XAMediaRecorderAdaptationMMF) != XA_RESULT_SUCCESS) |
55 XAMediaRecorderAdaptation) != XA_RESULT_SUCCESS) |
57 { |
56 { |
58 DEBUG_ERR("Failed to init base context!!!"); |
57 DEBUG_ERR("Failed to init base context!!!"); |
59 free(pSelf); |
58 free(pSelf); |
60 pSelf = NULL; |
59 pSelf = NULL; |
61 } |
60 } |
95 if (locType == XA_DATALOCATOR_IODEVICE) |
94 if (locType == XA_DATALOCATOR_IODEVICE) |
96 { |
95 { |
97 ioDevice |
96 ioDevice |
98 = (XADataLocator_IODevice*) (pImageVideoSrc->pLocator); |
97 = (XADataLocator_IODevice*) (pImageVideoSrc->pLocator); |
99 if (ioDevice->deviceType == XA_IODEVICE_CAMERA |
98 if (ioDevice->deviceType == XA_IODEVICE_CAMERA |
100 #ifdef _GSTREAMER_BACKEND_ |
99 |
101 && !cameraRealized |
100 && !cameraRealized |
102 #endif |
101 |
103 ) |
102 ) |
104 { |
103 { |
105 DEBUG_ERR("Preconditions violated - Camera object not realized"); |
104 DEBUG_ERR("Preconditions violated - Camera object not realized"); |
106 XAAdaptationBaseMMF_Free(&pSelf->baseObj); |
105 XAAdaptationBaseMMF_Free(&pSelf->baseObj); |
107 free(pSelf); |
106 free(pSelf); |
121 pSelf = NULL; |
120 pSelf = NULL; |
122 } |
121 } |
123 } |
122 } |
124 |
123 |
125 DEBUG_API("<-XAMediaRecorderAdaptMMF_Create"); |
124 DEBUG_API("<-XAMediaRecorderAdaptMMF_Create"); |
126 return (XAAdaptationBaseMMFCtx*) pSelf; |
125 return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj); |
127 } |
126 } |
128 |
127 |
129 /* |
128 /* |
130 * XAresult XAMediaRecorderAdaptMMF_PostInit() |
129 * XAresult XAMediaRecorderAdaptMMF_PostInit() |
131 * 2nd phase initialization of Media Recorder Adaptation Context |
130 * 2nd phase initialization of Media Recorder Adaptation Context |
132 * @param XAAdaptationBaseCtx* ctx - pointer to Media Recorder adaptation context |
131 * @param XAAdaptationBaseCtx* ctx - pointer to Media Recorder adaptation context |
133 * @return XAresult - Success value |
132 * @return XAresult - Success value |
134 */ |
133 */ |
135 XAresult XAMediaRecorderAdaptMMF_PostInit(XAAdaptationBaseMMFCtx* bCtx) |
134 XAresult XAMediaRecorderAdaptMMF_PostInit(XAAdaptationMMFCtx* bCtx) |
136 { |
135 { |
137 |
136 |
138 XAresult ret = XA_RESULT_SUCCESS; |
137 XAresult ret = XA_RESULT_SUCCESS; |
139 XADataLocator_URI* tempUri; |
138 XADataLocator_URI* tempUri; |
140 XADataFormat_MIME* tempFormat; |
139 XADataFormat_MIME* tempFormat; |
151 DEBUG_API("<-XAMediaRecorderAdapt_PostInit"); |
150 DEBUG_API("<-XAMediaRecorderAdapt_PostInit"); |
152 return ret; |
151 return ret; |
153 } |
152 } |
154 |
153 |
155 /* |
154 /* |
156 * void XAMediaRecorderAdaptMMF_Destroy( XAAdaptationBaseMMFCtx* bCtx ) |
155 * void XAMediaRecorderAdaptMMF_Destroy( XAAdaptationMMFCtx* bCtx ) |
157 * Destroys Media Recorder Adaptation Context |
156 * Destroys Media Recorder Adaptation Context |
158 * @param ctx - Media Recorder Adaptation context to be destroyed |
157 * @param ctx - Media Recorder Adaptation context to be destroyed |
159 */ |
158 */ |
160 void XAMediaRecorderAdaptMMF_Destroy(XAAdaptationBaseMMFCtx* bCtx) |
159 void XAMediaRecorderAdaptMMF_Destroy(XAAdaptationMMFCtx* bCtx) |
161 { |
160 { |
162 XAMediaRecorderAdaptationMMFCtx* ctx = NULL; |
161 XAMediaRecorderAdaptationMMFCtx* ctx = NULL; |
163 |
162 |
164 DEBUG_API("->XAMediaRecorderAdaptMMF_Destroy"); |
163 DEBUG_API("->XAMediaRecorderAdaptMMF_Destroy"); |
165 |
164 |