51 * XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos, |
51 * XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos, |
52 * XAuint32 seekMode) |
52 * XAuint32 seekMode) |
53 * Description: Sets the position of the playback head. |
53 * Description: Sets the position of the playback head. |
54 **/ |
54 **/ |
55 XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos, |
55 XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos, |
56 XAuint32 seekMode) |
56 XAuint32 seekMode) |
57 { |
57 { |
58 XAresult ret = XA_RESULT_SUCCESS; |
58 XAresult ret = XA_RESULT_SUCCESS; |
59 XAmillisecond duration = 0; |
59 XAmillisecond duration = 0; |
60 XASeekItfImpl* impl = GetImpl(self); |
60 XASeekItfImpl* impl = GetImpl(self); |
61 DEBUG_API("->XASeekItfImpl_SetPosition"); |
61 DEBUG_API("->XASeekItfImpl_SetPosition"); |
62 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); |
62 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); |
63 |
63 |
64 if(!impl) |
64 if (!impl) |
65 { |
65 { |
66 /* invalid parameter */ |
66 /* invalid parameter */ |
67 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
67 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
68 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
68 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
69 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
69 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
70 return XA_RESULT_PARAMETER_INVALID; |
70 return XA_RESULT_PARAMETER_INVALID; |
71 } |
71 } |
72 |
72 |
73 |
73 if (impl->adapCtx->fwtype == FWMgrFWMMF) |
74 if(impl->adapCtx->fwtype == FWMgrFWMMF) |
|
75 { |
74 { |
76 /* Get duration of the content */ |
75 /* Get duration of the content */ |
77 if(XAPlayItfAdaptMMF_GetDuration((XAAdaptationBaseCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) |
76 if (XAPlayItfAdaptMMF_GetDuration( |
78 { |
77 (XAAdaptationBaseCtx*) impl->adapCtx, &duration) |
79 /* invalid parameter */ |
78 != XA_RESULT_SUCCESS) |
80 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
79 { |
81 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
80 /* invalid parameter */ |
82 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
81 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
83 return XA_RESULT_PARAMETER_INVALID; |
82 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
84 } |
83 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
85 if(pos > duration) |
84 return XA_RESULT_PARAMETER_INVALID; |
86 { |
85 } |
87 /* invalid parameter */ |
86 if (pos > duration) |
88 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
87 { |
89 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
88 /* invalid parameter */ |
90 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
89 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
91 return XA_RESULT_PARAMETER_INVALID; |
90 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
92 } |
91 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
93 |
92 return XA_RESULT_PARAMETER_INVALID; |
94 if(seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) |
93 } |
|
94 |
|
95 if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) |
95 { |
96 { |
96 /* seek mode unsupported */ |
97 /* seek mode unsupported */ |
97 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
98 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
98 DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); |
99 DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); |
99 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
100 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
100 return XA_RESULT_FEATURE_UNSUPPORTED; |
101 return XA_RESULT_FEATURE_UNSUPPORTED; |
101 } |
102 } |
102 |
103 |
103 ret = XASeekItfAdaptMMF_SetPosition(impl->adapCtx, pos, seekMode); |
104 ret = XASeekItfAdaptMMF_SetPosition(impl->adapCtx, pos, seekMode); |
104 if(ret == XA_RESULT_SUCCESS) |
105 if (ret == XA_RESULT_SUCCESS) |
105 { |
106 { |
106 impl->playbackPosition = pos; |
107 impl->playbackPosition = pos; |
107 impl->seekMode = seekMode; |
108 impl->seekMode = seekMode; |
108 } |
109 } |
109 } |
110 } |
110 else |
111 else |
111 { |
112 { |
112 /* Get duration of the content */ |
113 /* Get duration of the content */ |
113 if(XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) |
114 if (XAPlayItfAdaptGST_GetDuration( |
114 { |
115 (XAAdaptationGstCtx*) impl->adapCtx, &duration) |
115 /* invalid parameter */ |
116 != XA_RESULT_SUCCESS) |
116 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
117 { |
117 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
118 /* invalid parameter */ |
118 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
119 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
119 return XA_RESULT_PARAMETER_INVALID; |
120 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
120 } |
121 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
121 if(pos > duration) |
122 return XA_RESULT_PARAMETER_INVALID; |
122 { |
123 } |
123 /* invalid parameter */ |
124 if (pos > duration) |
124 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
125 { |
125 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
126 /* invalid parameter */ |
126 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
127 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
127 return XA_RESULT_PARAMETER_INVALID; |
128 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
128 } |
129 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
129 |
130 return XA_RESULT_PARAMETER_INVALID; |
130 if(seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) |
131 } |
|
132 |
|
133 if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) |
131 { |
134 { |
132 /* seek mode unsupported */ |
135 /* seek mode unsupported */ |
133 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
136 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
134 DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); |
137 DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); |
135 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
138 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
136 return XA_RESULT_FEATURE_UNSUPPORTED; |
139 return XA_RESULT_FEATURE_UNSUPPORTED; |
137 } |
140 } |
138 |
141 |
139 ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*)impl->adapCtx, pos, seekMode); |
142 ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*) impl->adapCtx, |
140 if(ret == XA_RESULT_SUCCESS) |
143 pos, seekMode); |
|
144 if (ret == XA_RESULT_SUCCESS) |
141 { |
145 { |
142 impl->playbackPosition = pos; |
146 impl->playbackPosition = pos; |
143 impl->seekMode = seekMode; |
147 impl->seekMode = seekMode; |
144 } |
148 } |
145 |
149 |
146 } |
150 } |
147 |
151 |
148 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
152 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
149 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
153 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
150 return ret; |
154 return ret; |
151 } |
155 } |
152 |
156 |
153 /** |
157 /** |
154 * XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable, |
158 * XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable, |
155 * XAmillisecond startPos, XAmillisecond endPos) |
159 * XAmillisecond startPos, XAmillisecond endPos) |
156 * Description: Enables or disables looping and sets the start and end points of looping. |
160 * Description: Enables or disables looping and sets the start and end points of looping. |
157 **/ |
161 **/ |
158 XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable, |
162 XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable, |
159 XAmillisecond startPos, XAmillisecond endPos) |
163 XAmillisecond startPos, XAmillisecond endPos) |
160 { |
164 { |
161 XAresult ret = XA_RESULT_SUCCESS; |
165 XAresult ret = XA_RESULT_SUCCESS; |
162 XAmillisecond duration = 0; |
166 XAmillisecond duration = 0; |
163 XASeekItfImpl* impl = GetImpl(self); |
167 XASeekItfImpl* impl = GetImpl(self); |
164 DEBUG_API_A2("->XASeekItfImpl_SetLoop, startPos:%lu, endPos:%lu", startPos, endPos); |
168 DEBUG_API_A2("->XASeekItfImpl_SetLoop, startPos:%lu, endPos:%lu", startPos, endPos); |
165 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); |
169 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); |
166 |
170 |
167 if(!impl || (startPos > endPos)) |
171 if (!impl || (startPos > endPos)) |
168 { |
172 { |
169 /* invalid parameter */ |
173 /* invalid parameter */ |
170 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
174 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
171 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
175 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
172 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
176 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
173 return XA_RESULT_PARAMETER_INVALID; |
177 return XA_RESULT_PARAMETER_INVALID; |
174 } |
178 } |
175 |
179 |
176 if(impl->adapCtx->fwtype == FWMgrFWMMF) |
180 if (impl->adapCtx->fwtype == FWMgrFWMMF) |
177 { |
181 { |
178 /* Get duration of the content */ |
182 /* Get duration of the content */ |
179 if(XAPlayItfAdaptMMF_GetDuration((XAAdaptationBaseCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) |
183 if (XAPlayItfAdaptMMF_GetDuration( |
|
184 (XAAdaptationBaseCtx*) impl->adapCtx, &duration) |
|
185 != XA_RESULT_SUCCESS) |
180 { |
186 { |
181 /* invalid parameter */ |
187 /* invalid parameter */ |
182 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
188 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
183 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
189 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
184 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
190 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
185 return XA_RESULT_PARAMETER_INVALID; |
191 return XA_RESULT_PARAMETER_INVALID; |
186 } |
192 } |
187 if(endPos > duration && endPos != XA_TIME_UNKNOWN) |
193 if (endPos > duration && endPos != XA_TIME_UNKNOWN) |
188 { |
194 { |
189 /* invalid parameter */ |
195 /* invalid parameter */ |
190 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
196 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
191 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
197 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
192 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
198 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
193 return XA_RESULT_PARAMETER_INVALID; |
199 return XA_RESULT_PARAMETER_INVALID; |
194 } |
200 } |
195 |
201 |
196 ret = XASeekItfAdaptMMF_SetLoop(impl->adapCtx, loopEnable, startPos, endPos); |
202 ret = XASeekItfAdaptMMF_SetLoop(impl->adapCtx, loopEnable, startPos, |
197 if(ret == XA_RESULT_SUCCESS) |
203 endPos); |
|
204 if (ret == XA_RESULT_SUCCESS) |
198 { |
205 { |
199 impl->loopEnable = loopEnable; |
206 impl->loopEnable = loopEnable; |
200 impl->startPos = startPos; |
207 impl->startPos = startPos; |
201 impl->endPos = endPos; |
208 impl->endPos = endPos; |
202 } |
209 } |
203 } |
210 } |
204 else |
211 else |
205 { |
212 { |
206 /* Get duration of the content */ |
213 /* Get duration of the content */ |
207 if(XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) |
214 if (XAPlayItfAdaptGST_GetDuration( |
|
215 (XAAdaptationGstCtx*) impl->adapCtx, &duration) |
|
216 != XA_RESULT_SUCCESS) |
208 { |
217 { |
209 /* invalid parameter */ |
218 /* invalid parameter */ |
210 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
219 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
211 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
220 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
212 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
221 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
213 return XA_RESULT_PARAMETER_INVALID; |
222 return XA_RESULT_PARAMETER_INVALID; |
214 } |
223 } |
215 if(endPos > duration && endPos != XA_TIME_UNKNOWN) |
224 if (endPos > duration && endPos != XA_TIME_UNKNOWN) |
216 { |
225 { |
217 /* invalid parameter */ |
226 /* invalid parameter */ |
218 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
227 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
219 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
228 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
220 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
229 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
221 return XA_RESULT_PARAMETER_INVALID; |
230 return XA_RESULT_PARAMETER_INVALID; |
222 } |
231 } |
223 |
232 |
224 ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*)impl->adapCtx, loopEnable, startPos, endPos); |
233 ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*) impl->adapCtx, |
225 if(ret == XA_RESULT_SUCCESS) |
234 loopEnable, startPos, endPos); |
|
235 if (ret == XA_RESULT_SUCCESS) |
226 { |
236 { |
227 impl->loopEnable = loopEnable; |
237 impl->loopEnable = loopEnable; |
228 impl->startPos = startPos; |
238 impl->startPos = startPos; |
229 impl->endPos = endPos; |
239 impl->endPos = endPos; |
230 } |
240 } |
231 |
241 |
232 } |
242 } |
233 |
243 |
234 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
244 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
235 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
245 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
236 return ret; |
246 return ret; |
237 } |
247 } |
238 |
248 |
239 /** |
249 /** |
240 * XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled, |
250 * XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled, |
241 * XAmillisecond *pStartPos, |
251 * XAmillisecond *pStartPos, |
242 * XAmillisecond *pEndPos) |
252 * XAmillisecond *pEndPos) |
243 * Description: Queries whether looping is enabled or disabled, and retrieves loop points. |
253 * Description: Queries whether looping is enabled or disabled, and retrieves loop points. |
244 **/ |
254 **/ |
245 XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled, |
255 XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled, |
246 XAmillisecond *pStartPos, |
256 XAmillisecond *pStartPos, XAmillisecond *pEndPos) |
247 XAmillisecond *pEndPos) |
257 { |
248 { |
|
249 XAresult ret = XA_RESULT_SUCCESS; |
258 XAresult ret = XA_RESULT_SUCCESS; |
250 |
259 |
251 XASeekItfImpl* impl = GetImpl(self); |
260 XASeekItfImpl* impl = GetImpl(self); |
252 DEBUG_API("->XASeekItfImpl_GetLoop"); |
261 DEBUG_API("->XASeekItfImpl_GetLoop"); |
253 |
262 |
254 if(!impl || !pLoopEnabled || !pStartPos || !pEndPos) |
263 if (!impl || !pLoopEnabled || !pStartPos || !pEndPos) |
255 { |
264 { |
256 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
265 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
257 DEBUG_API("<-XASeekItfImpl_GetLoop"); |
266 DEBUG_API("<-XASeekItfImpl_GetLoop"); |
258 /* invalid parameter */ |
267 /* invalid parameter */ |
259 return XA_RESULT_PARAMETER_INVALID; |
268 return XA_RESULT_PARAMETER_INVALID; |
260 } |
269 } |
261 |
270 |
262 *pLoopEnabled = impl->loopEnable; |
271 *pLoopEnabled = impl->loopEnable; |
263 *pStartPos = impl->startPos; |
272 *pStartPos = impl->startPos; |
264 *pEndPos = impl->endPos; |
273 *pEndPos = impl->endPos; |
265 |
274 |
266 DEBUG_API("<-XASeekItfImpl_GetLoop"); |
275 DEBUG_API("<-XASeekItfImpl_GetLoop"); |
267 return ret; |
276 return ret; |
268 } |
277 } |
269 |
278 |
270 /** |
279 /** |
271 * XASeekItfImpl -specific methods |
280 * XASeekItfImpl -specific methods |
272 **/ |
281 **/ |
273 |
282 |
274 /** |
283 /** |
275 * XASeekItfImpl* XASeekItfImpl_Create() |
284 * XASeekItfImpl* XASeekItfImpl_Create() |
276 * Description: Allocate and initialize SeekItfImpl. |
285 * Description: Allocate and initialize SeekItfImpl. |
277 **/ |
286 **/ |
278 XASeekItfImpl* XASeekItfImpl_Create( XAMediaPlayerImpl* impl ) |
287 XASeekItfImpl* XASeekItfImpl_Create(XAMediaPlayerImpl* impl) |
279 { |
288 { |
280 XASeekItfImpl *self = (XASeekItfImpl*) |
289 XASeekItfImpl *self = (XASeekItfImpl*) calloc(1, sizeof(XASeekItfImpl)); |
281 calloc(1,sizeof(XASeekItfImpl)); |
|
282 DEBUG_API("->XASeekItfImpl_Create"); |
290 DEBUG_API("->XASeekItfImpl_Create"); |
283 if(self) |
291 if (self) |
284 { |
292 { |
285 /* init itf default implementation */ |
293 /* init itf default implementation */ |
286 self->itf.GetLoop = XASeekItfImpl_GetLoop; |
294 self->itf.GetLoop = XASeekItfImpl_GetLoop; |
287 self->itf.SetLoop = XASeekItfImpl_SetLoop; |
295 self->itf.SetLoop = XASeekItfImpl_SetLoop; |
288 self->itf.SetPosition = XASeekItfImpl_SetPosition; |
296 self->itf.SetPosition = XASeekItfImpl_SetPosition; |
289 |
297 |