18 #include <stdio.h> |
18 #include <stdio.h> |
19 #include <stdlib.h> |
19 #include <stdlib.h> |
20 #include <assert.h> |
20 #include <assert.h> |
21 |
21 |
22 #include "xaseekitf.h" |
22 #include "xaseekitf.h" |
23 |
|
24 #include "xaseekitfadaptation.h" |
|
25 #include "xaplayitfadaptation.h" |
|
26 #include "xathreadsafety.h" |
23 #include "xathreadsafety.h" |
27 #include "xaplayitfadaptationmmf.h" |
24 #include "xaplayitfadaptationmmf.h" |
28 #include "xaseekitfadaptationmmf.h" |
25 #include "xaseekitfadaptationmmf.h" |
29 /** |
26 /** |
30 * XASeekItfImpl* GetImpl(XASeekItf self) |
27 * XASeekItfImpl* GetImpl(XASeekItf self) |
106 { |
103 { |
107 impl->playbackPosition = pos; |
104 impl->playbackPosition = pos; |
108 impl->seekMode = seekMode; |
105 impl->seekMode = seekMode; |
109 } |
106 } |
110 } |
107 } |
111 else |
|
112 { |
|
113 /* Get duration of the content */ |
|
114 if (XAPlayItfAdaptGST_GetDuration( |
|
115 (XAAdaptationGstCtx*) impl->adapCtx, &duration) |
|
116 != XA_RESULT_SUCCESS) |
|
117 { |
|
118 /* invalid parameter */ |
|
119 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
|
120 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
121 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
|
122 return XA_RESULT_PARAMETER_INVALID; |
|
123 } |
|
124 if (pos > duration) |
|
125 { |
|
126 /* invalid parameter */ |
|
127 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
|
128 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
129 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
|
130 return XA_RESULT_PARAMETER_INVALID; |
|
131 } |
|
132 |
|
133 if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) |
|
134 { |
|
135 /* seek mode unsupported */ |
|
136 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
|
137 DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); |
|
138 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
|
139 return XA_RESULT_FEATURE_UNSUPPORTED; |
|
140 } |
|
141 |
|
142 ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*) impl->adapCtx, |
|
143 pos, seekMode); |
|
144 if (ret == XA_RESULT_SUCCESS) |
|
145 { |
|
146 impl->playbackPosition = pos; |
|
147 impl->seekMode = seekMode; |
|
148 } |
|
149 |
|
150 } |
|
151 |
108 |
152 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
109 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
153 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
110 DEBUG_API("<-XASeekItfImpl_SetPosition"); |
154 return ret; |
111 return ret; |
155 } |
112 } |
205 { |
162 { |
206 impl->loopEnable = loopEnable; |
163 impl->loopEnable = loopEnable; |
207 impl->startPos = startPos; |
164 impl->startPos = startPos; |
208 impl->endPos = endPos; |
165 impl->endPos = endPos; |
209 } |
166 } |
210 } |
|
211 else |
|
212 { |
|
213 /* Get duration of the content */ |
|
214 if (XAPlayItfAdaptGST_GetDuration( |
|
215 (XAAdaptationGstCtx*) impl->adapCtx, &duration) |
|
216 != XA_RESULT_SUCCESS) |
|
217 { |
|
218 /* invalid parameter */ |
|
219 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
|
220 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
221 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
|
222 return XA_RESULT_PARAMETER_INVALID; |
|
223 } |
|
224 if (endPos > duration && endPos != XA_TIME_UNKNOWN) |
|
225 { |
|
226 /* invalid parameter */ |
|
227 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
|
228 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
229 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
|
230 return XA_RESULT_PARAMETER_INVALID; |
|
231 } |
|
232 |
|
233 ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*) impl->adapCtx, |
|
234 loopEnable, startPos, endPos); |
|
235 if (ret == XA_RESULT_SUCCESS) |
|
236 { |
|
237 impl->loopEnable = loopEnable; |
|
238 impl->startPos = startPos; |
|
239 impl->endPos = endPos; |
|
240 } |
|
241 |
|
242 } |
167 } |
243 |
168 |
244 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
169 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); |
245 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
170 DEBUG_API("<-XASeekItfImpl_SetLoop"); |
246 return ret; |
171 return ret; |