33 * Sets play state to GStreamer. |
33 * Sets play state to GStreamer. |
34 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID |
34 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID |
35 * XAuint32 state - Play state to be set |
35 * XAuint32 state - Play state to be set |
36 * @return XAresult ret - Success value |
36 * @return XAresult ret - Success value |
37 */ |
37 */ |
38 XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state) |
38 XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, |
39 { |
39 XAuint32 state) |
40 XAresult ret = XA_RESULT_SUCCESS; |
40 { |
41 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
41 XAresult ret = XA_RESULT_SUCCESS; |
|
42 XAMediaPlayerAdaptationMMFCtx* mCtx; |
|
43 if (!bCtx) |
|
44 { |
|
45 ret = XA_RESULT_PARAMETER_INVALID; |
|
46 return ret; |
|
47 } |
|
48 |
|
49 mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
|
50 |
42 |
51 |
43 DEBUG_API_A1("->XAPlayItfAdaptMMF_SetPlayState %s",PLAYSTATENAME(state)); |
52 DEBUG_API_A1("->XAPlayItfAdaptMMF_SetPlayState %s",PLAYSTATENAME(state)); |
44 |
53 |
45 /* bCtx and parameter pointer validation happens in the calling function. |
54 /* bCtx and parameter pointer validation happens in the calling function. |
46 * We don't need to repeat it here*/ |
55 * We don't need to repeat it here*/ |
47 switch ( state ) |
56 switch (state) |
48 { |
57 { |
49 case XA_PLAYSTATE_STOPPED: |
58 case XA_PLAYSTATE_STOPPED: |
50 { |
59 { |
51 if ( bCtx->ctxId == XARadioAdaptation ) |
60 if (bCtx->ctxId == XARadioAdaptation) |
52 { |
61 { |
53 mmf_set_player_adapt_context(cmmfradiobackendengine_init(), bCtx); |
62 mmf_set_player_adapt_context(cmmfradiobackendengine_init(), |
54 stop_radio(cmmfradiobackendengine_init()); |
63 bCtx); |
55 } |
64 stop_radio(cmmfradiobackendengine_init()); |
56 else |
65 } |
57 { |
66 else |
58 ret = mmf_playitf_stop_playback(mCtx->mmfContext); |
67 { |
59 } |
68 ret = mmf_playitf_stop_playback(mCtx->mmfContext); |
60 break; |
69 } |
61 } |
70 break; |
|
71 } |
62 case XA_PLAYSTATE_PAUSED: |
72 case XA_PLAYSTATE_PAUSED: |
63 ret = mmf_playitf_pause_playback(mCtx->mmfContext); |
73 ret = mmf_playitf_pause_playback(mCtx->mmfContext); |
64 break; |
74 break; |
65 case XA_PLAYSTATE_PLAYING: |
75 case XA_PLAYSTATE_PLAYING: |
66 { |
76 { |
67 if ( bCtx->ctxId == XARadioAdaptation ) |
77 if (bCtx->ctxId == XARadioAdaptation) |
68 { |
78 { |
69 mmf_set_player_adapt_context(cmmfradiobackendengine_init(), bCtx); |
79 mmf_set_player_adapt_context(cmmfradiobackendengine_init(), |
70 play_radio(cmmfradiobackendengine_init()); |
80 bCtx); |
71 } |
81 play_radio(cmmfradiobackendengine_init()); |
72 else |
82 } |
73 { |
83 else |
74 ret = mmf_playitf_resume_playback(mCtx->mmfContext); |
84 { |
75 } |
85 ret = mmf_playitf_resume_playback(mCtx->mmfContext); |
76 break; |
86 } |
77 } |
87 break; |
|
88 } |
78 default: |
89 default: |
79 ret = XA_RESULT_PARAMETER_INVALID; |
90 ret = XA_RESULT_PARAMETER_INVALID; |
80 break; |
91 break; |
81 } |
92 } |
82 |
93 |
83 DEBUG_API("<-XAPlayItfAdaptMMF_SetPlayState"); |
94 DEBUG_API("<-XAPlayItfAdaptMMF_SetPlayState"); |
84 return ret; |
95 return ret; |
85 } |
96 } |
86 |
97 |
87 /* |
98 /* |
88 * XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 *pState) |
99 * XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 *pState) |
89 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID |
100 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID |
90 * XAuint32 *state - XAmillisecond *pMsec - Pointer where to store play state |
101 * XAuint32 *state - XAmillisecond *pMsec - Pointer where to store play state |
91 * @return XAresult ret - Success value |
102 * @return XAresult ret - Success value |
92 */ |
103 */ |
93 XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 *pState) |
104 XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, |
94 { |
105 XAuint32 *pState) |
95 XAresult ret = XA_RESULT_SUCCESS; |
106 { |
96 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
107 XAresult ret = XA_RESULT_SUCCESS; |
|
108 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
109 if (!bCtx || !pState) |
|
110 { |
|
111 ret = XA_RESULT_PARAMETER_INVALID; |
|
112 return ret; |
|
113 } |
|
114 |
|
115 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
97 |
116 |
98 DEBUG_API("->XAPlayItfAdaptMMF_GetPlayState"); |
117 DEBUG_API("->XAPlayItfAdaptMMF_GetPlayState"); |
99 |
118 |
100 /* If playhead reaches eof, state will transition to paused. |
119 /* If playhead reaches eof, state will transition to paused. |
101 * This object does not have visibility to callback*/ |
120 * This object does not have visibility to callback*/ |
102 ret = mmf_playitf_get_play_state(mCtx->mmfContext, pState); |
121 ret = mmf_playitf_get_play_state(pSelf->mmfContext, pState); |
103 |
122 |
104 DEBUG_API("<-XAPlayItfAdaptMMF_GetPlayState"); |
123 DEBUG_API("<-XAPlayItfAdaptMMF_GetPlayState"); |
105 return ret; |
124 return ret; |
106 |
125 |
107 } |
126 } |
110 * XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) |
129 * XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) |
111 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID |
130 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID |
112 * XAmillisecond *pMsec - Pointer where to store duration of stream. |
131 * XAmillisecond *pMsec - Pointer where to store duration of stream. |
113 * @return XAresult ret - Success value |
132 * @return XAresult ret - Success value |
114 */ |
133 */ |
115 XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) |
134 XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, |
116 { |
135 XAmillisecond *pMsec) |
117 XAresult ret = XA_RESULT_SUCCESS; |
136 { |
118 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
137 XAresult ret = XA_RESULT_SUCCESS; |
|
138 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
139 if (!bCtx || !pMsec) |
|
140 { |
|
141 ret = XA_RESULT_PARAMETER_INVALID; |
|
142 return ret; |
|
143 } |
|
144 |
|
145 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
119 |
146 |
120 DEBUG_API("->XAPlayItfAdaptMMF_GetDuration"); |
147 DEBUG_API("->XAPlayItfAdaptMMF_GetDuration"); |
121 |
148 |
122 ret = mmf_playitf_get_duration(mCtx->mmfContext, pMsec); |
149 ret = mmf_playitf_get_duration(pSelf->mmfContext, pMsec); |
123 |
150 |
124 DEBUG_API("<-XAPlayItfAdaptMMF_GetDuration"); |
151 DEBUG_API("<-XAPlayItfAdaptMMF_GetDuration"); |
125 return ret; |
152 return ret; |
126 } |
153 } |
127 |
154 |
128 /* |
155 /* |
129 * XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) |
156 * XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) |
130 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value |
157 * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value |
131 * XAmillisecond *pMsec - Pointer where to store current position in stream. |
158 * XAmillisecond *pMsec - Pointer where to store current position in stream. |
132 * @return XAresult ret - Success value |
159 * @return XAresult ret - Success value |
133 */ |
160 */ |
134 XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) |
161 XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, |
135 { |
162 XAmillisecond *pMsec) |
136 XAresult ret = XA_RESULT_SUCCESS; |
163 { |
137 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
164 XAresult ret = XA_RESULT_SUCCESS; |
|
165 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
166 if (!bCtx || !pMsec) |
|
167 { |
|
168 ret = XA_RESULT_PARAMETER_INVALID; |
|
169 return ret; |
|
170 } |
|
171 |
|
172 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
138 |
173 |
139 DEBUG_API("->XAPlayItfAdaptMMF_GetPosition"); |
174 DEBUG_API("->XAPlayItfAdaptMMF_GetPosition"); |
140 |
175 |
141 ret = mmf_playitf_get_position(mCtx->mmfContext, pMsec); |
176 ret = mmf_playitf_get_position(pSelf->mmfContext, pMsec); |
142 |
177 |
143 DEBUG_API("<-XAPlayItfAdaptMMF_GetPosition"); |
178 DEBUG_API("<-XAPlayItfAdaptMMF_GetPosition"); |
144 return ret; |
179 return ret; |
145 } |
180 } |
146 |
181 |
147 /* |
182 /* |
148 * XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, xaPlayCallback callback) |
183 * XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, xaPlayCallback callback) |
149 * Description: Sets the playback callback function. |
184 * Description: Sets the playback callback function. |
150 */ |
185 */ |
151 XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, xaPlayCallback callback) |
186 XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, |
152 { |
187 xaPlayCallback callback) |
153 XAresult ret = XA_RESULT_SUCCESS; |
188 { |
154 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
189 XAresult ret = XA_RESULT_SUCCESS; |
|
190 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
191 if (!bCtx) |
|
192 { |
|
193 ret = XA_RESULT_PARAMETER_INVALID; |
|
194 return ret; |
|
195 } |
|
196 |
|
197 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
155 |
198 |
156 DEBUG_API("->XAPlayItfAdaptMMF_RegisterCallback"); |
199 DEBUG_API("->XAPlayItfAdaptMMF_RegisterCallback"); |
157 |
200 |
158 ret = mmf_playitf_register_callback(mCtx->mmfContext, callback); |
201 ret = mmf_playitf_register_callback(pSelf->mmfContext, callback); |
159 |
202 |
160 DEBUG_API("<-XAPlayItfAdaptMMF_RegisterCallback"); |
203 DEBUG_API("<-XAPlayItfAdaptMMF_RegisterCallback"); |
161 return ret; |
204 return ret; |
162 } |
205 } |
163 |
206 |
164 /** |
207 /** |
165 * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) |
208 * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) |
166 * Description: Enables/disables notification of playback events. |
209 * Description: Enables/disables notification of playback events. |
167 **/ |
210 **/ |
168 XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) |
211 XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, |
169 { |
212 XAuint32 eventFlags) |
170 XAresult ret = XA_RESULT_SUCCESS; |
213 { |
171 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
214 XAresult ret = XA_RESULT_SUCCESS; |
|
215 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
216 if (!bCtx) |
|
217 { |
|
218 ret = XA_RESULT_PARAMETER_INVALID; |
|
219 return ret; |
|
220 } |
|
221 |
|
222 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
172 |
223 |
173 DEBUG_API("->XAPlayItfAdaptMMF_SetCallbackEventsMask"); |
224 DEBUG_API("->XAPlayItfAdaptMMF_SetCallbackEventsMask"); |
174 |
225 |
175 ret = mmf_playitf_set_callback_events_mask(mCtx->mmfContext, eventFlags); |
226 ret = mmf_playitf_set_callback_events_mask(pSelf->mmfContext, eventFlags); |
176 |
227 |
177 DEBUG_API("<-XAPlayItfAdaptMMF_SetCallbackEventsMask"); |
228 DEBUG_API("<-XAPlayItfAdaptMMF_SetCallbackEventsMask"); |
178 return ret; |
229 return ret; |
179 } |
230 } |
180 |
231 |
181 /** |
232 /** |
182 * XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) |
233 * XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) |
183 * Description: Sets marker position. |
234 * Description: Sets marker position. |
184 **/ |
235 **/ |
185 XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) |
236 XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, |
186 { |
237 XAmillisecond mSec) |
187 XAresult ret = XA_RESULT_SUCCESS; |
238 { |
188 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
239 XAresult ret = XA_RESULT_SUCCESS; |
|
240 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
241 if (!bCtx) |
|
242 { |
|
243 ret = XA_RESULT_PARAMETER_INVALID; |
|
244 return ret; |
|
245 } |
|
246 |
|
247 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
189 |
248 |
190 DEBUG_API("->XAPlayItfAdaptMMF_SetMarkerPosition"); |
249 DEBUG_API("->XAPlayItfAdaptMMF_SetMarkerPosition"); |
191 |
250 |
192 ret = mmf_playitf_set_marker_position(mCtx->mmfContext, mSec); |
251 ret = mmf_playitf_set_marker_position(pSelf->mmfContext, mSec); |
193 |
252 |
194 DEBUG_API("<-XAPlayItfAdaptMMF_SetMarkerPosition"); |
253 DEBUG_API("<-XAPlayItfAdaptMMF_SetMarkerPosition"); |
195 return ret; |
254 return ret; |
196 } |
255 } |
197 |
256 |
198 /** |
257 /** |
199 * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) |
258 * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) |
200 * Description: Clears marker position. |
259 * Description: Clears marker position. |
201 **/ |
260 **/ |
202 XAresult XAPlayItfAdaptMMF_ClearMarkerPosition(XAAdaptationBaseCtx *bCtx) |
261 XAresult XAPlayItfAdaptMMF_ClearMarkerPosition(XAAdaptationBaseCtx *bCtx) |
203 { |
262 { |
204 XAresult ret = XA_RESULT_SUCCESS; |
263 XAresult ret = XA_RESULT_SUCCESS; |
205 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
264 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
265 if (!bCtx) |
|
266 { |
|
267 ret = XA_RESULT_PARAMETER_INVALID; |
|
268 return ret; |
|
269 } |
|
270 |
|
271 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
206 |
272 |
207 DEBUG_API("->XAPlayItfAdaptMMF_ClearMarkerPosition"); |
273 DEBUG_API("->XAPlayItfAdaptMMF_ClearMarkerPosition"); |
208 |
274 |
209 ret = mmf_playitf_clear_marker_position(mCtx->mmfContext); |
275 ret = mmf_playitf_clear_marker_position(pSelf->mmfContext); |
210 |
276 |
211 DEBUG_API("<-XAPlayItfAdaptMMF_ClearMarkerPosition"); |
277 DEBUG_API("<-XAPlayItfAdaptMMF_ClearMarkerPosition"); |
212 return ret; |
278 return ret; |
213 } |
279 } |
214 |
280 |
215 /** |
281 /** |
216 * XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) |
282 * XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) |
217 * Description: Sets position update period. |
283 * Description: Sets position update period. |
218 **/ |
284 **/ |
219 XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) |
285 XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, |
220 { |
286 XAmillisecond mSec) |
221 XAresult ret = XA_RESULT_SUCCESS; |
287 { |
222 XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
288 XAresult ret = XA_RESULT_SUCCESS; |
|
289 XAMediaPlayerAdaptationMMFCtx* pSelf; |
|
290 if (!bCtx) |
|
291 { |
|
292 ret = XA_RESULT_PARAMETER_INVALID; |
|
293 return ret; |
|
294 } |
|
295 |
|
296 pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; |
223 |
297 |
224 DEBUG_API("->XAPlayItfAdaptMMF_SetPositionUpdatePeriod"); |
298 DEBUG_API("->XAPlayItfAdaptMMF_SetPositionUpdatePeriod"); |
225 |
299 |
226 ret = mmf_playitf_set_position_update_period(mCtx->mmfContext, mSec); |
300 ret = mmf_playitf_set_position_update_period(pSelf->mmfContext, mSec); |
227 |
301 |
228 DEBUG_API("<-XAPlayItfAdaptMMF_SetPositionUpdatePeriod"); |
302 DEBUG_API("<-XAPlayItfAdaptMMF_SetPositionUpdatePeriod"); |
229 return ret; |
303 return ret; |
230 } |
304 } |
231 /* |
305 /* |
232 * XAresult XAPlayItfAdapt_StateChange |
306 * XAresult XAPlayItfAdapt_StateChange |
233 * Handle callback from Radio utility |
307 * Handle callback from Radio utility |
234 */ |
308 */ |
235 void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx, XAboolean playing) |
309 void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx, |
236 { |
310 XAboolean playing) |
237 if (playing) |
311 { |
238 { |
312 if (playing) |
239 XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING,1,0}; |
313 { |
240 XAAdaptationBase_SendAdaptEvents(bCtx, &event ); |
314 XAAdaptEvent event = |
241 } |
315 { |
242 else |
316 XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING, 1, 0 |
243 { |
317 }; |
244 XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADSTALLED,1,0}; |
318 XAAdaptationBase_SendAdaptEvents(bCtx, &event); |
245 XAAdaptationBase_SendAdaptEvents(bCtx, &event ); |
319 } |
246 } |
320 else |
247 |
321 { |
248 } |
322 XAAdaptEvent event = |
|
323 { |
|
324 XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADSTALLED, 1, 0 |
|
325 }; |
|
326 XAAdaptationBase_SendAdaptEvents(bCtx, &event); |
|
327 } |
|
328 |
|
329 } |