39 XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, |
39 XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, |
40 XADataSink *pVibra, XADataSink *pLEDArray) |
40 XADataSink *pVibra, XADataSink *pLEDArray) |
41 { |
41 { |
42 XAMediaPlayerAdaptationMMFCtx *pSelf = NULL; |
42 XAMediaPlayerAdaptationMMFCtx *pSelf = NULL; |
43 XAuint32 locType = 0; |
43 XAuint32 locType = 0; |
|
44 XADataLocator_IODevice *ioDevice; |
44 XAresult res; |
45 XAresult res; |
45 DEBUG_API("->XAMediaPlayerAdaptMMF_Create"); |
46 DEBUG_API("->XAMediaPlayerAdaptMMF_Create"); |
46 |
47 |
47 pSelf = calloc(1, sizeof(XAMediaPlayerAdaptationMMFCtx)); |
48 pSelf = calloc(1, sizeof(XAMediaPlayerAdaptationMMFCtx)); |
48 if ( pSelf) |
49 if ( pSelf) |
49 { |
50 { |
50 |
51 if ( pDataSrc ) |
51 if( XAAdaptationBaseMMF_Init(&(pSelf->baseObj),XAMediaPlayerAdaptation) |
|
52 != XA_RESULT_SUCCESS ) |
|
53 { |
|
54 DEBUG_ERR("Failed to init base context!!!"); |
|
55 free(pSelf); |
|
56 pSelf = NULL; |
|
57 } |
|
58 else |
|
59 |
|
60 { |
|
61 pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; |
|
62 pSelf->xaSource = pDataSrc; |
|
63 pSelf->xaBankSrc = pBankSrc; |
|
64 pSelf->xaAudioSink = pAudioSnk; |
|
65 pSelf->xaVideoSink = pImageVideoSnk; |
|
66 pSelf->xaLEDArray = pLEDArray; |
|
67 pSelf->xaVibra = pVibra; |
|
68 pSelf->curMirror = XA_VIDEOMIRROR_NONE; |
|
69 pSelf->curRotation = 0; |
|
70 pSelf->isobjsrc = XA_BOOLEAN_FALSE; |
|
71 pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; |
|
72 /*pSelf->waitData = XA_BOOLEAN_FALSE;*/ |
|
73 } |
|
74 |
|
75 |
|
76 if ( pDataSrc ) |
|
77 { |
|
78 locType = *((XAuint32*)(pDataSrc->pLocator)); |
|
79 if ( locType == XA_DATALOCATOR_IODEVICE ) |
|
80 { |
52 { |
81 //XADataLocator_IODevice *ioDevice = (XADataLocator_IODevice*)(pDataSrc->pLocator); |
53 locType = *((XAuint32*)(pDataSrc->pLocator)); |
82 } |
54 if ( locType == XA_DATALOCATOR_IODEVICE ) |
|
55 { |
|
56 ioDevice = (XADataLocator_IODevice*)(pDataSrc->pLocator); |
|
57 if ( ioDevice->deviceType == XA_IODEVICE_RADIO ) |
|
58 { |
|
59 return XAMediaPlayerAdaptMMF_CreateRadio(pSelf, pDataSrc, pBankSrc, pAudioSnk, pImageVideoSnk, pVibra, pLEDArray); |
|
60 } |
|
61 } |
83 } |
62 } |
84 } |
63 if( XAAdaptationBaseMMF_Init(&(pSelf->baseObj),XAMediaPlayerAdaptation) != XA_RESULT_SUCCESS ) |
85 |
64 { |
86 else |
65 DEBUG_ERR("Failed to init base context!!!"); |
87 { |
66 free(pSelf); |
88 DEBUG_ERR("Failed to create XAMediaPlayerAdaptationMMFCtx !!!"); |
67 pSelf = NULL; |
89 return NULL; |
68 } |
90 } |
69 else |
91 if(pSelf) |
70 { |
92 { |
71 pSelf->isForRadio = XA_BOOLEAN_FALSE; |
93 res = mmf_backend_engine_init(&(pSelf->mmfContext)); |
72 pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; |
94 if(!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) |
73 pSelf->xaSource = pDataSrc; |
95 { |
74 pSelf->xaBankSrc = pBankSrc; |
96 /* TODO Check to make sure there is no undeleted MMF objects here*/ |
75 pSelf->xaAudioSink = pAudioSnk; |
97 DEBUG_ERR("Failed to init mmf context!!!"); |
76 pSelf->xaVideoSink = pImageVideoSnk; |
98 free(pSelf); |
77 pSelf->xaLEDArray = pLEDArray; |
99 pSelf = NULL; |
78 pSelf->xaVibra = pVibra; |
100 return NULL; |
79 pSelf->curMirror = XA_VIDEOMIRROR_NONE; |
101 } |
80 pSelf->curRotation = 0; |
|
81 pSelf->isobjsrc = XA_BOOLEAN_FALSE; |
|
82 pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; |
|
83 /*pSelf->waitData = XA_BOOLEAN_FALSE;*/ |
|
84 } |
|
85 } |
|
86 else |
|
87 { |
|
88 DEBUG_ERR("Failed to create XAMediaPlayerAdaptationMMFCtx !!!"); |
|
89 return NULL; |
|
90 } |
|
91 if(pSelf) |
|
92 { |
|
93 res = mmf_backend_engine_init(&(pSelf->mmfContext)); |
|
94 if(!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) |
|
95 { |
|
96 /* TODO Check to make sure there is no undeleted MMF objects here*/ |
|
97 DEBUG_ERR("Failed to init mmf context!!!"); |
|
98 free(pSelf); |
|
99 pSelf = NULL; |
|
100 return NULL; |
|
101 } |
102 res = mmf_set_play_adapt_context(pSelf->mmfContext, &(pSelf->baseObj)); |
102 res = mmf_set_play_adapt_context(pSelf->mmfContext, &(pSelf->baseObj)); |
103 if(pDataSrc) |
103 if(pDataSrc) |
104 { |
104 { |
105 pSelf->mmfMetadataContext = mmf_metadata_utility_init((char *)(( (XADataLocator_URI*)(pDataSrc->pLocator))->URI)); |
105 pSelf->mmfMetadataContext = mmf_metadata_utility_init((char *)(( (XADataLocator_URI*)(pDataSrc->pLocator))->URI)); |
106 if(!pSelf->mmfMetadataContext) |
106 if(!pSelf->mmfMetadataContext) |
118 |
118 |
119 DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); |
119 DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); |
120 return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj); |
120 return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj); |
121 } |
121 } |
122 |
122 |
123 |
123 /* |
|
124 * XAMediaPlayerAdaptationMMFCtx* XAMediaPlayerAdapt_CreateRadio() |
|
125 |
|
126 * @returns XAMediaPlayerAdaptationMMFCtx* - Pointer to created context, NULL if error occurs. |
|
127 */ |
|
128 XAAdaptationBaseCtx* XAMediaPlayerAdaptMMF_CreateRadio(XAMediaPlayerAdaptationMMFCtx *pSelf, XADataSource *pDataSrc, XADataSource *pBankSrc, |
|
129 XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, |
|
130 XADataSink *pVibra, XADataSink *pLEDArray) |
|
131 { |
|
132 XAresult res; |
|
133 DEBUG_API("->XAMediaPlayerAdaptMMF_CreateRadio"); |
|
134 |
|
135 res = XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XARadioAdaptation); |
|
136 if (res != XA_RESULT_SUCCESS) |
|
137 { |
|
138 DEBUG_ERR("Failed to init base context!!!"); |
|
139 free(pSelf); |
|
140 pSelf = NULL; |
|
141 return NULL; |
|
142 } |
|
143 |
|
144 pSelf->isForRadio = XA_BOOLEAN_TRUE; |
|
145 pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; |
|
146 pSelf->xaSource = pDataSrc; |
|
147 pSelf->xaBankSrc = pBankSrc; |
|
148 pSelf->xaAudioSink = pAudioSnk; |
|
149 pSelf->xaVideoSink = pImageVideoSnk; |
|
150 pSelf->xaLEDArray = pLEDArray; |
|
151 pSelf->xaVibra = pVibra; |
|
152 pSelf->curMirror = XA_VIDEOMIRROR_NONE; |
|
153 pSelf->curRotation = 0; |
|
154 pSelf->isobjsrc = XA_BOOLEAN_FALSE; |
|
155 pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; |
|
156 /*pSelf->waitData = XA_BOOLEAN_FALSE;*/ |
|
157 |
|
158 res = mmf_backend_engine_init(&(pSelf->mmfContext)); |
|
159 if(!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) |
|
160 { |
|
161 /* TODO Check to make sure there is no undeleted MMF objects here*/ |
|
162 DEBUG_ERR("Failed to init mmf context!!!"); |
|
163 free(pSelf); |
|
164 pSelf = NULL; |
|
165 return NULL; |
|
166 } |
|
167 DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); |
|
168 return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj); |
|
169 } |
124 |
170 |
125 /* |
171 /* |
126 * XAresult XAMediaPlayerAdaptMMF_PostInit() |
172 * XAresult XAMediaPlayerAdaptMMF_PostInit() |
127 * 2nd phase initialization of Media Player Adaptation Context |
173 * 2nd phase initialization of Media Player Adaptation Context |
128 * @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context |
174 * @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context |
134 XAMediaPlayerAdaptationMMFCtx *pSelf = (XAMediaPlayerAdaptationMMFCtx*)bCtx; |
180 XAMediaPlayerAdaptationMMFCtx *pSelf = (XAMediaPlayerAdaptationMMFCtx*)bCtx; |
135 |
181 |
136 DEBUG_API("->XAMediaPlayerAdaptMMF_PostInit"); |
182 DEBUG_API("->XAMediaPlayerAdaptMMF_PostInit"); |
137 |
183 |
138 XAAdaptationBaseMMF_PostInit(bCtx); |
184 XAAdaptationBaseMMF_PostInit(bCtx); |
|
185 |
|
186 if (pSelf->isForRadio) |
|
187 { |
|
188 DEBUG_API("<-XAMediaPlayerAdaptMMF_PostInit"); |
|
189 return XA_RESULT_SUCCESS; |
|
190 } |
139 |
191 |
140 if(pSelf->mmfContext) |
192 if(pSelf->mmfContext) |
141 { |
193 { |
142 XADataLocator_URI* tempUri = (XADataLocator_URI*)(pSelf->xaSource->pLocator); |
194 XADataLocator_URI* tempUri = (XADataLocator_URI*)(pSelf->xaSource->pLocator); |
143 XADataFormat_MIME* tempFormat = (XADataFormat_MIME*)(pSelf->xaSource->pFormat); |
195 XADataFormat_MIME* tempFormat = (XADataFormat_MIME*)(pSelf->xaSource->pFormat); |